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

新增样品清单列表qualitySampleTemplateList初始化

yijing 1 год назад
Родитель
Сommit
61e18f9169

+ 17 - 13
src/views/inspectionWork/components/sampleListDialog.vue

@@ -7,7 +7,7 @@
             <el-table-column type="expand">
                 <template slot-scope="props">
                     <div style="padding: 10px;">
-                        <el-table :data="props.row.qualitySampleTemplateList" border >
+                        <el-table :data="props.row.qualitySampleTemplateList" border>
                             <el-table-column label="质检方案编码" prop="qualitySchemeTemplateCode" align="center">
                             </el-table-column>
                             <el-table-column label="质检方案名称" prop="qualitySchemeTemplateName"
@@ -41,12 +41,14 @@
             </el-table-column>
             <template v-for="column in tableColumns">
                 <el-table-column :label="column.label" :prop="column.prop" :fixed="column.fixed"
-                    :show-overflow-tooltip="true" :width="column.width" :align="column.align" :formatter="column.formatter">
+                    :show-overflow-tooltip="true" :width="column.width" :align="column.align"
+                    :formatter="column.formatter">
                 </el-table-column>
             </template>
             <el-table-column label="操作" align="center" width="80">
                 <template slot-scope="scope">
-                    <el-link :underline="false" type="primary" @click="handleDispose(scope.$index, scope.row, 'dispose')">
+                    <el-link :underline="false" type="primary"
+                        @click="handleDispose(scope.$index, scope.row, 'dispose')">
                         处置
                     </el-link>
                 </template>
@@ -101,12 +103,13 @@ export default {
                 { label: '重量', prop: 'weight', align: 'center' },
                 { label: '重量单位', prop: 'weightUnit', align: 'center' },
                 { label: '仓库', prop: 'warehouseName', align: 'center', },
-                { label: '质检结果', prop: 'qualityResults', align: 'center',formatter: (row, column) => {
-                    if(row.qualityResults){
-                        return row.qualityResults==1?'合格':row.qualityResults==2?'不合格':row.qualityResults==3?'让步接收':'';
+                {
+                    label: '质检结果', prop: 'qualityResults', align: 'center', formatter: (row, column) => {
+                        if (row.qualityResults) {
+                            return row.qualityResults == 1 ? '合格' : row.qualityResults == 2 ? '不合格' : row.qualityResults == 3 ? '让步接收' : '';
+                        }
                     }
-                } 
-            },
+                },
                 // { label: '货区', prop: 'areaName', align: 'center', },
                 // { label: '货架', prop: 'goodsShelfName', align: 'center', },
                 // { label: '货位', prop: 'goodsAllocationName', align: 'center', },
@@ -134,10 +137,11 @@ export default {
 
     created() { },
     methods: {
-        async openDia(index, row, type, list,isStatus) {
-          this.tableData = [];
+        async openDia(index, row, type, list, isStatus) {
+            this.tableData = [];
             this.rowIndex = index
             this.type = type;
+            console.log(list, 'lklllllllllllllllllkkkkkkkkkkkkkkkkkkkkk');
             this.tableData = list;
 
             this.visible = true;
@@ -149,9 +153,9 @@ export default {
             this.visible = false;
             this.$emit('handleConfirm', this.tableData, this.rowIndex);
         },
-      handleDispose(index, row, type) {
-      this.$emit('handleDispose', index, row, type);
-    },
+        handleDispose(index, row, type) {
+            this.$emit('handleDispose', index, row, type);
+        },
     }
 };
 </script>

+ 12 - 3
src/views/inspectionWork/edit.vue

@@ -134,6 +134,7 @@ export default {
           }
         }
         this.getProSamList(this.packingList)
+
       } else {
         this.sampleList = [];
       }
@@ -148,6 +149,13 @@ export default {
           const count = oldItem.measureQuantity;
           const newMeasureQuantity = oldItem.measureQuantity / count;
           const newWeight = parseFloat((oldItem.weight / count).toFixed(2))
+
+          console.log(typeof (oldItem.qualitySampleTemplateList), 'ssssss')
+
+          if (oldItem.qualitySampleTemplateList == undefined || oldItem.qualitySampleTemplateList == null) {
+            oldItem.qualitySampleTemplateList = JSON.parse(JSON.stringify(this.schemeList))
+          }
+          console.log(oldItem, 'oldItem')
           console.log(count, newMeasureQuantity, newWeight)
           delete oldItem.id;
 
@@ -158,13 +166,13 @@ export default {
             }
             delete item.id;
           });
-          oldItem.qualitySampleTemplateList = JSON.parse(JSON.stringify(this.schemeList));
+
           for (let i = 0; i < count; i++) {
             ProductSampleList.push({
               ...oldItem,
               measureQuantity: newMeasureQuantity,
               weight: newWeight,
-              qualitySampleTemplateList:JSON.parse(JSON.stringify(this.schemeList))
+              // qualitySampleTemplateList: JSON.parse(JSON.stringify(this.schemeList))
             });
           }
         });
@@ -335,7 +343,8 @@ export default {
           ...item
         }
       })
-      console.log(addStatus, '样品清单')
+      console.log(addStatus, '样品清单12123123')
+
       if (addStatus.length > 0) {
         this.getProSamList(addStatus)
       } else {