Browse Source

解决报工页面仓库回显问题

hezhanp 7 tháng trước cách đây
mục cha
commit
e01c21faac

+ 22 - 24
src/views/salesServiceManagement/components/sparePartsList.vue

@@ -614,32 +614,30 @@ export default {
       return this.form.tableList;
     },
     async setTableValue(val) {
-      const tableList = JSON.parse(JSON.stringify(val));
-      for (let i = 0; i < tableList.length; i++) {
-        const item = tableList[i];
-        // if (!item.feeType) {
-        //   item.feeType = '1';
-        // }
-
-        item.feeType = (item.feeType || '1').toString();
-        item.categoryCode = item.categoryCode || item.code;
-        item.categoryName = item.categoryName || item.name;
-        if (item.typeId == 2) {
-          const warehouseList = await getIdWarehouseList({
-            categoryId: item.categoryId
-          });
-          item.warehouseList = warehouseList;
-          if (item.warehouseId) {
-            item.warehouseNum = await getWarehouseOutStock({
-              warehouseId: item.warehouseId,
-              code: item.categoryCode
-            });
-          }
+  const tableList = JSON.parse(JSON.stringify(val));
+  for (let i = 0; i < tableList.length; i++) {
+    const item = tableList[i];
+    item.feeType = (item.feeType || '1').toString();
+    item.categoryCode = item.categoryCode || item.code;
+    item.categoryName = item.categoryName || item.name;
+    if (item.typeId == 2) {
+      const warehouseList = await getIdWarehouseList({ categoryId: item.categoryId });
+      item.warehouseList = warehouseList;
+      if (item.warehouseId) {
+        const matchedWarehouse = warehouseList.find(wh => wh.warehouseId === item.warehouseId);
+        if (matchedWarehouse) {
+          item.warehouseName = matchedWarehouse.warehouseName; // 同步仓库名
         }
+        item.warehouseNum = await getWarehouseOutStock({
+          warehouseId: item.warehouseId,
+          code: item.categoryCode
+        });
       }
-      this.$set(this.form, 'tableList', tableList);
-      this.calculatePrice();
-    },
+    }
+  }
+  this.$set(this.form, 'tableList', tableList);
+  this.calculatePrice();
+},
     totalCountChange(index, data, name) {
       data[name] = data[name].replace(/[^\d]/g, '').replace(/^0+/, '') || '0';
       let row = this.form.tableList[index];

+ 9 - 3
src/views/salesServiceManagement/workOrder/index.vue

@@ -550,7 +550,13 @@ export default {
     },
     /* 表格数据源 */
     datasource({ page, limit, where, order }) {
-      return getSalesWorkOrder({ pageNum: page, size: limit, ...where });
+      let isDispatch = '1';
+      return getSalesWorkOrder({
+        pageNum: page,
+        size: limit,
+        ...where,
+        isDispatch
+      });
     },
     /* 刷新表格 */
     reload(where) {
@@ -615,7 +621,7 @@ export default {
     },
     //验收
     async checkAndAccept(accepterStatus) {
-      console.log(accepterStatus)
+      console.log(accepterStatus);
       if (!this.form.accepterUserId) {
         this.$message.warning('请选择验收人!');
         return;
@@ -675,7 +681,7 @@ export default {
         this.carByTemplate = this.defaultTemplateList.find(
           (item) => item?.code === 'carBy'
         );
-        console.log(this.carByTemplate)
+        console.log(this.carByTemplate);
         if (this.carByTemplate && this.carByTemplate.formJson?.makingJson) {
           this.formSchema = JSON.parse(this.carByTemplate.formJson.makingJson);
           this.formSchema.config.dataSource &&