Browse Source

修改bug

PC-202503171525\Administrator 1 năm trước cách đây
mục cha
commit
641be9eefb

+ 1 - 1
src/views/inspectionWork/components/sampleListDialog.vue

@@ -140,7 +140,7 @@ export default {
             //     this.tableDataUpdate(list);
             //   }
             // }
-            this.tableData.push(row);
+            this.tableData = list;
 
             this.visible = true;
         },

+ 39 - 62
src/views/inspectionWork/edit.vue

@@ -2,14 +2,14 @@
   <div class="ele-body">
     <el-card shadow="never">
       <header-title title="基本信息">
-        <el-button @click="cancel">返回</el-button>
-        <el-button type="primary" @click="save" :loading="loading">保存</el-button>
-        <el-button type="primary" @click="handleReporting" :loading="loading">报工完成</el-button>
+        <el-button @click="cancel" >返回</el-button>
+        <el-button type="primary" @click="save" :loading="loading" v-if="type != 'detail'">保存</el-button>
+        <el-button type="primary" @click="handleReporting" :loading="loading" v-if="type != 'detail'">报工完成</el-button>
       </header-title>
       <base-info ref="baseInfoRefs" v-if="form" :form="form" :btnType="type"></base-info>
       <el-row>
         <header-title title="质检内容">
-          <el-button type="primary" :loading="loading" @click="batchQuality(null,null,'report')">批量质检</el-button>
+          <el-button type="primary" :loading="loading" v-if="type != 'detail'" @click="batchQuality(null,null,'report')">批量质检</el-button>
         </header-title>
         <el-tabs v-model="activeName" @tab-click="handleClick">
           <el-tab-pane label="来源清单" name="1"></el-tab-pane>
@@ -87,7 +87,7 @@
               </el-select>
             </template>
           </el-table-column>
-          <el-table-column label="操作" align="center" width="120" fixed="right">
+          <el-table-column label="操作" align="center" width="120" fixed="right" v-if="type != 'detail'">
             <template slot-scope="scope">
               <el-link :type="scope.row.isValid ? 'primary' : 'danger'" :underline="false"
                 @click="handleDetail(scope.$index, scope.row, 'report')">
@@ -229,8 +229,8 @@ export default {
         { label: '物料代号', prop: 'materielDesignation', align: 'center' },
         { label: '客户代号', prop: 'clientCode', align: 'center' },
         { label: '刻码', prop: 'engrave', align: 'center' },
-        // { label: '重量', prop: 'weight', align: 'center' },
-        // { label: '重量单位', prop: 'weightUnit', align: 'center' },
+        { label: '重量', prop: 'weight', align: 'center' },
+        { label: '重量单位', prop: 'weightUnit', align: 'center' },
         { label: '仓库', prop: 'warehouseName', align: 'center' },
         { label: '货区', prop: 'areaName', align: 'center' },
         { label: '货架', prop: 'goodsShelfName', align: 'center' },
@@ -395,11 +395,19 @@ export default {
           return false;
         }
         this.loading = true;
-        save(this.form)
+        let URL =
+          this.type == 'add' ? save : this.type == 'edit' ? update : '';
+        let params = {
+          ...this.form,
+          sampleList: this.sampleList,
+          planTemplateList: this.schemeList,
+          qualityInventoryList: this.packingList
+        }
+        URL(params)
           .then((msg) => {
             this.loading = false;
             this.$message.success(msg);
-            this.handleClose();
+            this.cancel();
             this.$emit('done');
           })
           .catch((e) => {
@@ -431,22 +439,14 @@ export default {
       this.$router.go(-1);
     },
     handleDetail(index, row, type) {
-      if (row.isStatus == undefined) {
-        row.isStatus = true;
-      }else {
-        row.isStatus = false;
-      }
+      debugger
       if (!this.sampleList[index] || !this.schemeList) {
         return;
       }
-
-      const selectedData = this.sampleList[index];
-      const mergedData = [{
-        ...selectedData,
-        children: [...this.schemeList]
-      }];
-      console.log(index, row, type, mergedData, 'index, row, type, mergedData')
-      this.$refs.detailRef.openDia(index, row, type, mergedData,null);
+      const selectedData = [];
+      selectedData.push(this.sampleList[index])
+      console.log(index, row, type, selectedData, 'index, row, type, mergedData')
+      this.$refs.detailRef.openDia(index, row, type, selectedData,null);
     },
     // 报工
     handleReporting(index, row) {
@@ -466,7 +466,7 @@ export default {
           .then((msg) => {
             this.loading = false;
             this.$message.success(msg);
-            this.handleClose();
+            this.cancel();
             this.$emit('done');
           })
           .catch((e) => {
@@ -489,51 +489,28 @@ export default {
           }
         }
       }
-
-      // 处理数据
-      const hasInvalidItem = list.some(item =>
-        item.qualitySampleTemplateList.some(child => child.qualityResults === 2)
-      );
-      console.log('是否有不合格数据', hasInvalidItem)
-
-      for (const item of list) {
-        const filteredData = item.qualitySampleTemplateList.filter((item) =>
-          item.qualityResults == 2
-        );
-        console.log(filteredData, '不合格数据')
-        if (filteredData.length > -1) {
-          this.form.noQualifiedNumber = filteredData.length;
-          this.form.qualifiedNumber = this.form.total - filteredData.length;
-        }
-      }
       console.log(list, 'listlistlistlist')
-
-      const processedList = list.map(item => {
-        item.qualityResults = hasInvalidItem ? 2 : 1;
-        item.qualityStatus = 1;
-        // item.qualitySampleTemplateList = item.children;
-        item.isValid = !hasInvalidItem
-        // delete item.children;
-        return {
-          ...item,
+      list.forEach((item) => {
+        if (item.qualitySampleTemplateList.some(child => child.qualityResults === 2)) {
+          item.isValid = false;
+          item.qualityResults = 2;
+        }else{
+          item.isValid = true;
+          item.qualityResults = 1;
         }
-      });
-      this.$set(this.sampleList, index, processedList[0]);
-
-      console.log(this.sampleList, processedList, '222表')
-
-      // this.SampleListbyReportList = processedList;
+        item.qualityStatus = 1;
+      })
+      if (index != null){
+        this.$set(this.sampleList, index, list[0]);
+      }else{
+        this.$set(this.sampleList, null, list);
+      }
+      console.log(this.sampleList,  '222表')
 
     },
     // 批量质检
     batchQuality(index, row,type){
-      if (!this.isStatus){
-        this.isStatus = false;
-      }
-      this.sampleList.forEach((item) => {
-        item.children=this.schemeList;
-      });
-      this.$refs.detailRef.openDia(null, null,type, this.sampleList, this.isStatus)
+      this.$refs.detailRef.openDia(null, null,type, this.sampleList, null)
     }
   }
 };

+ 18 - 14
src/views/inspectionWork/index.vue

@@ -4,11 +4,11 @@
       <search ref="search" @search="search"></search>
       <ele-pro-table ref="table" :columns="columns" :datasource="datasource">
         <!-- 表头工具栏 -->
-        <template v-slot:toolbar>
-          <el-button size="small" type="primary" icon="el-icon-plus" class="ele-btn-icon" @click="openEdit('add')">
-            添加
-          </el-button>
-        </template>
+<!--        <template v-slot:toolbar>-->
+<!--          <el-button size="small" type="primary" icon="el-icon-plus" class="ele-btn-icon" @click="openEdit('add')">-->
+<!--            添加-->
+<!--          </el-button>-->
+<!--        </template>-->
 
         <template v-slot:code="{ row }">
           <el-link type="primary" :underline="false" @click="openEdit('detail', row)">
@@ -219,6 +219,12 @@ export default {
           slot: 'accessory',
           showOverflowTooltip: true
         },
+        {
+          label: '创建时间',
+          prop: 'createTime',
+          align: 'center',
+          width: 160
+        },
         {
           prop: 'status',
           label: '状态',
@@ -226,14 +232,8 @@ export default {
           width: 80,
           formatter: (row, column, cellValue) => {
             return cellValue == 0 ? '未报工' : cellValue == 1 ? '已报工' : '';
-          }
-        },
-
-        {
-          label: '创建时间',
-          prop: 'createTime',
-          align: 'center',
-          width: 160
+          },
+          fixed: 'right'
         },
         {
           columnKey: 'action',
@@ -267,12 +267,16 @@ export default {
       });
     },
     openEdit(type, row) {
+      let id = '';
+      if (type != 'add') {
+        id = row.id;
+      }
       // this.$refs.edit.open(type, row);
       this.$router.push({
         path: '/inspectionWork/edit',
         query: {
           type: type,
-          id: row.id || ''
+          id: id || ''
         }
       });
     },

+ 8 - 1
src/views/samplemanagement/index.vue

@@ -81,7 +81,14 @@ export default {
             this.$refs.table.reload({ page: 1, where });
         },
         processingMethod(type, row) {
-            this.$refs.edit.open(type, row)
+          this.$router.push({
+            path: '/samplemanagement/components/edit',
+            query: {
+              type: type,
+              qualityWorkOrderId: row.qualityWorkOrderId || ''
+            }
+          });
+            // this.$refs.edit.open(type, row)
         },
     }
 };