Просмотр исходного кода

生产备料:待备料页面列表整改

lxf 1 год назад
Родитель
Сommit
f19a58f0d6
2 измененных файлов с 134 добавлено и 123 удалено
  1. 1 1
      src/components/byTable/index.vue
  2. 133 122
      src/views/production/operation/batching/index.vue

+ 1 - 1
src/components/byTable/index.vue

@@ -8,7 +8,7 @@
           v-model="pagination[item.prop]"
           :placeholder="'请选择' + item.label"
           :multiple="item.multiple"
-          clearable
+          :clearable="!item.clearable"
           @change="searchFn">
           <template v-if="item.dictKey">
             <el-option v-for="itemDict in useUserStore().allDict[item.dictKey]" :key="itemDict.dictKey" :label="itemDict.dictValue" :value="itemDict.dictKey" />

+ 133 - 122
src/views/production/operation/batching/index.vue

@@ -4,6 +4,7 @@
       <el-tabs v-model="activeName" type="card" @tab-change="changeActiveName">
         <el-tab-pane label="待备料" name="first">
           <byTable
+            :hideTable="true"
             :hidePagination="true"
             :source="sourceList.data"
             :pagination="sourceList.pagination"
@@ -20,26 +21,46 @@
                 text: '打印备料单',
                 action: () => outExcel(),
               },
-              {
-                text: '快捷出库',
-                action: () => clickQuickDelivery(),
-              },
+              // {
+              //   text: '快捷出库',
+              //   action: () => clickQuickDelivery(),
+              // },
             ]"
             @get-list="getList"
             @clickReset="clickReset">
-            <template #blueprint="{ item }">
-              <div>
-                <img
-                  v-if="item.blueprint"
-                  style="margin-top: 3px; width: 40px; height: 40px; cursor: pointer; object-fit: contain; vertical-align: middle"
-                  v-lazy="item.blueprint"
-                  @click="openFile(item.blueprint)" />
-              </div>
-            </template>
-            <template #size="{ item }">
-              <div>{{ item.length }} * {{ item.width }} * {{ item.height }}</div>
-            </template>
           </byTable>
+
+          <table class="table-class" border="0" cellpadding="0" cellspacing="0">
+            <tr>
+              <th style="width: 48px">
+                <el-checkbox v-model="checkAll" :indeterminate="isIndeterminate" @change="handleCheckAllChange"> </el-checkbox>
+              </th>
+              <th style="width: 200px">BOM品号</th>
+              <th style="min-width: 320px">BOM品名</th>
+              <th style="width: 200px">SKU品号</th>
+              <th style="width: 120px; text-align: center">数量小计</th>
+              <th style="width: 140px; text-align: center">数量总计</th>
+            </tr>
+            <tbody v-for="(item, index) in sourceList.data" :key="index">
+              <tr v-for="(itemSKU, indexSKU) in item.skuInfoList" :key="indexSKU">
+                <td v-if="indexSKU === 0" :rowspan="item.skuInfoList.length">
+                  <el-checkbox
+                    v-model="item.isCheck"
+                    :data-a="isCheck"
+                    @change="
+                      (val) => {
+                        return changeCheck(val, item, index);
+                      }
+                    "></el-checkbox>
+                </td>
+                <td v-if="indexSKU === 0" :rowspan="item.skuInfoList.length">{{ item.bomSpecCode }}</td>
+                <td v-if="indexSKU === 0" :rowspan="item.skuInfoList.length">{{ item.bomSpecName }}</td>
+                <td>{{ itemSKU.skuSpecCode }}</td>
+                <td style="text-align: center">{{ itemSKU.quantity }}</td>
+                <td v-if="indexSKU === 0" :rowspan="item.skuInfoList.length" style="text-align: center">{{ item.totalQuantity }}</td>
+              </tr>
+            </tbody>
+          </table>
         </el-tab-pane>
         <el-tab-pane label="已备料" name="second">
           <byTable
@@ -47,7 +68,7 @@
             :pagination="sourceListTwo.pagination"
             :config="configTwo"
             :loading="loading"
-            :searchConfig="searchConfig"
+            :searchConfig="searchConfigTwo"
             highlight-current-row
             @get-list="getListTwo"
             @clickReset="clickResetTwo">
@@ -60,9 +81,6 @@
                   @click="openFile(item.blueprint)" />
               </div>
             </template>
-            <template #size="{ item }">
-              <div>{{ item.length }} * {{ item.width }} * {{ item.height }}</div>
-            </template>
           </byTable>
         </el-tab-pane>
       </el-tabs>
@@ -85,14 +103,14 @@
               <td style="width: 10%; text-align: center">数量总计</td>
             </tr>
           </thead>
-          <tbody v-for="(item, index) in printBomList" :key="index">
-            <tr v-for="(itemSKU, indexSKU) in item.SKUList" :key="indexSKU">
-              <td :rowspan="item.SKUList.length" v-if="indexSKU === 0" style="text-align: center">{{ index + 1 }}</td>
-              <td :rowspan="item.SKUList.length" v-if="indexSKU === 0">{{ item.bomSpecCode }}</td>
-              <td :rowspan="item.SKUList.length" v-if="indexSKU === 0">{{ item.bomSpecName }}</td>
+          <tbody v-for="(item, index) in selectData" :key="index">
+            <tr v-for="(itemSKU, indexSKU) in item.skuInfoList" :key="indexSKU">
+              <td :rowspan="item.skuInfoList.length" v-if="indexSKU === 0" style="text-align: center">{{ index + 1 }}</td>
+              <td :rowspan="item.skuInfoList.length" v-if="indexSKU === 0">{{ item.bomSpecCode }}</td>
+              <td :rowspan="item.skuInfoList.length" v-if="indexSKU === 0">{{ item.bomSpecName }}</td>
               <td>{{ itemSKU.skuSpecCode }}</td>
               <td style="text-align: center">{{ itemSKU.quantity }}</td>
-              <td :rowspan="item.SKUList.length" v-if="indexSKU === 0" style="text-align: center">{{ item.quantity }}</td>
+              <td :rowspan="item.skuInfoList.length" v-if="indexSKU === 0" style="text-align: center">{{ item.totalQuantity }}</td>
             </tr>
           </tbody>
         </table>
@@ -121,15 +139,13 @@ const departmentList = ref([{ dictKey: "0", dictValue: "胜德体育" }]);
 const sourceList = ref({
   data: [],
   pagination: {
-    orderCode: "",
-    orderWlnCode: "",
     bomSpecCode: "",
     bomSpecName: "",
     skuSpecCode: "",
     skuSpecName: "",
     departmentId: "",
     warehouseName: "",
-    width: "",
+    departmentId: "1689164627162529793",
   },
 });
 const sourceListTwo = ref({
@@ -155,6 +171,37 @@ const searchConfig = computed(() => {
   return [
     {
       type: "input",
+      prop: "bomSpecCode",
+      label: "BOM品号",
+    },
+    {
+      type: "input",
+      prop: "bomSpecName",
+      label: "BOM品名",
+    },
+    {
+      type: "input",
+      prop: "skuSpecCode",
+      label: "SKU品号",
+    },
+    {
+      type: "input",
+      prop: "skuSpecName",
+      label: "SKU品名",
+    },
+    {
+      type: "select",
+      prop: "departmentId",
+      data: departmentList.value,
+      label: "事业部",
+      clearable: true,
+    },
+  ];
+});
+const searchConfigTwo = computed(() => {
+  return [
+    {
+      type: "input",
       prop: "orderCode",
       label: "订单号",
     },
@@ -206,80 +253,30 @@ const config = computed(() => {
     },
     {
       attrs: {
-        label: "设计图",
-        slot: "blueprint",
-        width: 80,
-      },
-    },
-    {
-      attrs: {
-        label: "事业部",
-        prop: "departmentName",
-        width: 120,
-      },
-    },
-    {
-      attrs: {
         label: "BOM品号",
         prop: "bomSpecCode",
-        width: 160,
+        width: 200,
       },
     },
     {
       attrs: {
         label: "BOM品名",
         prop: "bomSpecName",
-        "min-width": 280,
+        "min-width": 320,
       },
     },
     {
       attrs: {
         label: "SKU品号",
         prop: "skuSpecCode",
-        width: 160,
-      },
-    },
-    {
-      attrs: {
-        label: "SKU品名",
-        prop: "skuSpecName",
-        "min-width": 200,
-      },
-    },
-    {
-      attrs: {
-        label: "尺寸(长宽高,cm)",
-        slot: "size",
-        width: 160,
+        width: 180,
       },
     },
     {
       attrs: {
         label: "数量",
         prop: "quantity",
-        width: 100,
-      },
-    },
-    {
-      attrs: {
-        label: "投产时间",
-        prop: "createTime",
-        width: 160,
-        align: "center",
-      },
-    },
-    {
-      attrs: {
-        label: "订单号",
-        prop: "orderCode",
-        width: 170,
-      },
-    },
-    {
-      attrs: {
-        label: "万里牛单号",
-        prop: "orderWlnCode",
-        width: 150,
+        width: 120,
       },
     },
   ];
@@ -366,8 +363,16 @@ const configTwo = computed(() => {
     },
   ];
 });
-const getList = async (req) => {
-  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+const getList = async (req, status) => {
+  if (status) {
+    sourceList.value.pagination = {
+      pageNum: sourceList.value.pagination.pageNum,
+      pageSize: sourceList.value.pagination.pageSize,
+      departmentId: "1689164627162529793",
+    };
+  } else {
+    sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  }
   loading.value = true;
   proxy.post("/stockPreparation/uncompletedList", sourceList.value.pagination).then((res) => {
     selectData.value = [];
@@ -376,7 +381,7 @@ const getList = async (req) => {
         res.map((item) => {
           return {
             ...item,
-            isCheck: true,
+            isCheck: false,
           };
         })
       );
@@ -390,7 +395,7 @@ const getList = async (req) => {
 };
 getList();
 const clickReset = () => {
-  getList("");
+  getList("", true);
 };
 const getListTwo = async (req, status) => {
   if (status) {
@@ -442,40 +447,10 @@ const selectRow = (data) => {
 const openFile = (path) => {
   window.open(path);
 };
-const printBomList = ref([]);
 const openPrint = ref(false);
 const printTime = ref("");
 const outExcel = () => {
   if (selectData.value && selectData.value.length > 0) {
-    let printList = [];
-    let bomSpecList = Array.from(new Set(selectData.value.map((item) => item.bomSpecId)));
-    for (let i = 0; i < bomSpecList.length; i++) {
-      let list = selectData.value.filter((item) => item.bomSpecId === bomSpecList[i]);
-      let skuSpecList = Array.from(new Set(list.map((item) => item.skuSpecId)));
-      let sum = 0;
-      let SKUList = [];
-      for (let j = 0; j < skuSpecList.length; j++) {
-        let sumSKU = 0;
-        let listTwo = list.filter((item) => item.skuSpecId === skuSpecList[j]);
-        for (let y = 0; y < listTwo.length; y++) {
-          if (listTwo[y].quantity) {
-            sumSKU = Number(parseFloat(Number(sumSKU) + Number(listTwo[y].quantity)).toFixed(0));
-          }
-        }
-        SKUList.push({
-          skuSpecCode: listTwo[0].skuSpecCode,
-          quantity: sumSKU,
-        });
-        sum = Number(parseFloat(Number(sum) + Number(sumSKU)).toFixed(0));
-      }
-      printList.push({
-        bomSpecCode: list[0].bomSpecCode,
-        bomSpecName: list[0].bomSpecName,
-        quantity: sum,
-        SKUList: SKUList,
-      });
-    }
-    printBomList.value = printList;
     printTime.value = moment().format("yyyy-MM-DD HH:mm:ss");
     openPrint.value = true;
   } else {
@@ -490,11 +465,6 @@ const printObj = ref({
 });
 const openQuick = ref(false);
 const clickQuickDelivery = () => {
-  // if (selectData.value && selectData.value.length > 0) {
-  //   openQuick.value = true;
-  // } else {
-  //   return ElMessage("请勾选需要快捷出库的数据");
-  // }
   if (sourceList.value.data && sourceList.value.data.length > 0) {
     openQuick.value = true;
   } else {
@@ -507,6 +477,26 @@ const clickCancel = (status) => {
     getList();
   }
 };
+const checkAll = ref(false);
+const isIndeterminate = ref(false);
+const handleCheckAllChange = (val) => {
+  sourceList.value.data = sourceList.value.data.map((item) => {
+    return {
+      ...item,
+      isCheck: val,
+    };
+  });
+  selectData.value = sourceList.value.data.filter((item) => item.isCheck);
+  isIndeterminate.value = false;
+};
+const isCheck = ref(false);
+const changeCheck = () => {
+  isCheck.value = !isCheck.value;
+  selectData.value = sourceList.value.data.filter((item) => item.isCheck);
+  const checkedCount = selectData.value.length;
+  checkAll.value = checkedCount === sourceList.value.data.length;
+  isIndeterminate.value = checkedCount > 0 && checkedCount < sourceList.value.data.length;
+};
 </script>
 
 <style lang="scss" scoped>
@@ -535,4 +525,25 @@ const clickCancel = (status) => {
   margin-top: 10px !important;
   margin-bottom: 10px !important;
 }
+.table-class {
+  width: 100%;
+  font-size: 14px;
+  border: 1px solid #eeeeee;
+}
+.table-class th {
+  height: 35px;
+  line-height: 35px;
+  padding: 0 12px;
+  text-align: left;
+  background-color: #eeeeee !important;
+  border-right: 1px solid #eeeeee;
+}
+.table-class td {
+  height: 35px;
+  line-height: 35px;
+  padding: 8px 12px;
+  text-align: left;
+  border-bottom: 1px solid #eeeeee;
+  border-right: 1px solid #eeeeee;
+}
 </style>