695593266@qq.com il y a 11 mois
Parent
commit
f9435040e7

+ 1 - 1
src/enum/dict.js

@@ -14,7 +14,7 @@ export default {
   质检计划类型:'inspection_plan_type',
   工艺参数单位: 'parameter_code',
   计量单位: 'measuring_uint',
-
+  检验方案: 'inspection_scheme',
 };
 
 export const numberList = [

+ 14 - 9
src/views/inspectionPlan/components/new-baseInfo.vue

@@ -244,12 +244,13 @@
             <el-input v-model="form.brandNo" disabled />
           </el-form-item>
         </el-col>
+        <!-- :disabled="quantityShow ? false : true" -->
         <el-col :span="6">
           <el-form-item label="数量:" prop="productNumber">
             <el-input
               type="number"
               v-model="form.productNumber"
-              :disabled="quantityShow ? false : true"
+              disabled
               @input="changeProductNumber"
               @change="changeProductNumber"
             >
@@ -602,7 +603,6 @@
     created() {
       // this.getDictListIqoCode('iqo_code');
       this.getDictListIqoCode('measurement_type');
-      console.log(this.form);
     },
     methods: {
       toggleExpand(val) {
@@ -666,6 +666,7 @@
       planSourceChange(val) {
         if (val) {
           this.addProduct();
+          this.$emit('changeSource');
         }
       },
       addProduct() {
@@ -686,7 +687,7 @@
         }
       },
       //根据类型获取计划来源下拉
-      typeChange(val) {
+      typeChange(val, type) {
         if (val == 1) {
           this.sourceList = [{ label: '采购收货单', value: '1' }];
         } else if (val == 2) {
@@ -701,6 +702,9 @@
             { label: '库存台账', value: '6' }
           ];
         }
+        if (!type) {
+          this.$emit('changeType');
+        }
       },
 
       //主数据根据来源得到产品
@@ -756,9 +760,9 @@
         this.form.batchNo = val.batchNo; //批次号
         console.log('----------------->>111111');
         this.getProductDetails(this.form.productId, this.form.planSource);
-        if (this.form.planSource == '6') {
-          this.$emit('changesStokledgerNumberModal', list, dimension);
-        }
+        // if (this.form.planSource == '6') {
+        this.$emit('changesStokledgerNumberModal', list, dimension, 'type');
+        // }
         // this.$emit('changesStokledgerNumberModal', list, dimension);
         if (this.form.type != 3) {
           this.$emit('getQualityTemplate', val.categoryCode);
@@ -848,10 +852,11 @@
         // *** 新增 批次号,来源单据 字段传递
         console.log(this.categoryInfo.measureType, 'getProductDetails');
         this.form.inspectionStandards = this.categoryInfo.measureType;
+
         this.form.qualityMode = qmsData.checkFormula || 1;
-        if (this.form.qualityMode) {
-          this.changeQualityMode(this.form.qualityMode);
-        }
+        // if (this.form.qualityMode) {
+        //   this.changeQualityMode(this.form.qualityMode, 'Details');
+        // }
         data.category.batchNo = batchNo;
         data.category.id = id;
         data.category.planSourceCode = productionCode;

+ 108 - 26
src/views/inspectionPlan/components/new-edit.vue

@@ -22,6 +22,8 @@
       @changeModel="changeModel"
       @getList="getList"
       @table2="table2"
+      @changeType="changeType"
+      @changeSource="changeSource"
       @getInspectionStandards="getInspectionStandards"
       :packingLists="packingList"
       @getCategoryInfo="getCategoryInfo"
@@ -54,7 +56,8 @@
             :datasource="datasource"
             :needPage="
               btnType == 'add' ||
-              (btnType == 'edit' && !isFormNumber && !isOrder)
+              (btnType == 'edit' && !isPackingList) ||
+              !isSampleList
                 ? false
                 : true
             "
@@ -509,7 +512,10 @@
         isChangeNumber: true,
         isChangeType: true,
         isOnce: true,
-        dimensionType: ''
+        dimensionType: '',
+        isSampleList: true,
+        isPackingList: true,
+        isSchemeList: true
       };
     },
     computed: {
@@ -643,6 +649,7 @@
         return this.schemeList.slice(start, end);
       }
     },
+
     created() {},
     methods: {
       //成品检验类型,计划来源主数据,修改数量生成来源清单
@@ -697,6 +704,7 @@
         // }
         console.log('数据33333');
         this.$refs.table12.setData([]);
+        this.packingList = [];
         this.isOrder = false;
         let nums = Number(num);
         let p = this.productItem;
@@ -731,6 +739,7 @@
         console.log('数据22222');
         console.log(this.isOrder);
         this.$refs.table12.setData(list);
+        this.packingList = list;
 
         // *** 如果检验方式是全量的话 还需要同步样品清单数据
         if (
@@ -745,15 +754,17 @@
       },
 
       //成品类型检验类型,计划来源库存台账, 生成来源清单
-      changesStokledgerNumberModal(val, dimension) {
-        console.log(val, dimension, '获取成品检验订单数据');
+      changesStokledgerNumberModal(val, dimension, type) {
+        console.log(val, dimension, '获取成品检验订单数据', type);
         this.$refs.table12.setData([]);
+        this.packingList = [];
         if (dimension) this.dimensionType = dimension;
         if (dimension == 3) {
           this.$refs.table12.setData(val);
-          if (this.baseForm.qualityMode == '1') {
+          this.packingList = val;
+          if (this.baseForm.qualityMode == '1' || type) {
             this.handleUnpackCase(val);
-          } else if (this.baseForm.qualityMode == '2') {
+          } else if (this.baseForm.qualityMode == '2' || type) {
             this.sampleList = [];
           }
           return;
@@ -789,9 +800,10 @@
         // });
         console.log(list, 'for循环成品检验订单数据');
         this.$refs.table12.setData(list);
-        if (this.baseForm.qualityMode == '1') {
+        this.packingList = list;
+        if (this.baseForm.qualityMode == '1' || type) {
           this.handleUnpackCase(list);
-        } else if (this.baseForm.qualityMode == '2') {
+        } else if (this.baseForm.qualityMode == '2' || type) {
           this.sampleList = [];
         }
       },
@@ -838,15 +850,22 @@
         this.isOnce = false;
       },
       async datasource({ page, limit, where }) {
-        console.log(this.btnType);
-        console.log(this.isScheme, this.isOrder);
-        const res = await getInventoryListByPlanId({
+        // console.log(this.btnType);
+        // console.log(this.isScheme, this.isOrder);
+        // const res = await getInventoryListByPlanId({
+        //   ...where,
+        //   pageNum: page,
+        //   size: limit
+        // });
+        // console.log(res.list);
+        // this.packingList = res.list;
+        // return res;
+
+        return await getInventoryListByPlanId({
           ...where,
           pageNum: page,
           size: limit
         });
-        this.packingList = res.list;
-        return res;
       },
       // 切换质检内容
       handleClick(tab) {
@@ -896,8 +915,6 @@
           qualityMode: row.qualityMode
         };
 
-        console.log('baseInfo:' + this.baseForm);
-
         this.$nextTick(() => {
           if (this.$refs.baseInfoRefs) {
             // 获取人员
@@ -908,13 +925,13 @@
             }
             //根据类型获取计划来源
             if (this.baseForm.type) {
-              this.$refs.baseInfoRefs.typeChange(this.baseForm.type);
+              this.$refs.baseInfoRefs.typeChange(this.baseForm.type, '1111');
+            }
+            if (this.baseForm.productId) {
+              this.$refs.baseInfoRefs.getProductDetails(
+                this.baseForm.productId
+              );
             }
-            // if (this.baseForm.productId) {
-            //   this.$refs.baseInfoRefs.getProductDetails(
-            //     this.baseForm.productId
-            //   );
-            // }
           }
         });
 
@@ -1015,6 +1032,7 @@
       ) {
         console.log('数据1-1-1-1-1');
         this.$refs.table12.setData([]);
+        this.packingList = [];
 
         console.log(999999);
         let res;
@@ -1070,6 +1088,7 @@
           this.packingList = _arr1;
           console.log('数据1010101010');
           this.$refs.table12.setData(_arr1); //赋值
+          this.packingList = _arr1;
           const _arr2 = this.$refs.table12.getData();
           if (_arr2.length > 1) {
             this.baseForm.productNumber = _arr2.length;
@@ -1078,10 +1097,12 @@
           }
           //处理样品清单
           console.log('+++++++++3');
-          await this.handleSampleList();
+          // await this.handleSampleList();
+          await this.updatePackingList(_arr1);
         } else {
           console.log('数据99999');
           this.$refs.table12.setData([]);
+          this.packingList = [];
         }
       },
       async handleSampleList() {
@@ -1114,6 +1135,7 @@
             }
             if (list.length > 0 && list[0].categoryCode) {
               this.$refs.table12.setData(list);
+              this.packingList = list;
               let packList = this.$refs.table12.getData();
               this.getFullInspectionWeight(packList);
             }
@@ -1167,6 +1189,7 @@
             console.log('数据777777');
             if (this.$refs.table12) {
               this.$refs.table12.setData([]);
+              this.packingList = [];
               let nums = Number(this.baseForm.productNumber);
               let p = this.productItem;
               let list = [];
@@ -1186,6 +1209,7 @@
               }
               console.log('数据666666');
               this.$refs.table12.setData(list);
+              this.packingList = list;
               let packList = this.$refs.table12.getData();
               await this.handleUnpackCase(packList);
 
@@ -1273,6 +1297,7 @@
           console.log(list);
           if (list.length > 0 && list[0].categoryCode) {
             this.$refs.table12.setData(list);
+            this.packingList = list;
             let packList = this.$refs.table12.getData();
             this.getFullInspectionWeight(packList);
           }
@@ -1348,7 +1373,7 @@
           for (let i = 0; i < roundedQuantity; i++) {
             data.push({
               ...oldItem,
-              measureQuantity: 1,
+              // measureQuantity: 1,
               weight: this.netWeight || 0
               // weight:
               //   num - index >= 1
@@ -1849,6 +1874,7 @@
       },
       table1() {
         this.$refs.table12.setData([]);
+        this.packingList = [];
         this.schemeList = [];
       },
       table2() {
@@ -1936,6 +1962,8 @@
           this.isChangeType = true;
           this.isOnce = true;
           this.dimensionType = '';
+          this.isPackingList = true;
+          this.isSampleList = true;
         });
       },
 
@@ -1951,12 +1979,40 @@
             this.baseForm.isUnpack = this.isCheck ? 1 : 2;
           }
           this.baseForm.conditionType = this.conditionType;
+          // isSampleList: true,
+          // isPackingList: true,
+
+          console.log(this.isSampleList);
+          console.log(this.isPackingList);
+
+          const qualityListData =
+            this.btnType == 'add'
+              ? this.$refs.table12.getData()
+              : this.btnType == 'edit' &&
+                this.isPackingList &&
+                this.isSampleList
+              ? []
+              : this.$refs.table12.getData();
+          const sampleListData =
+            this.btnType == 'add'
+              ? this.sampleList
+              : this.btnType == 'edit' && this.isSampleList
+              ? []
+              : this.sampleList;
+
+          // let params = {
+          //   ...this.baseForm,
+          //   qualityInventoryList: this.$refs.table12.getData(),
+          //   sampleList: this.sampleList,
+          //   planTemplateList: this.schemeList
+          // };
           let params = {
             ...this.baseForm,
-            qualityInventoryList: this.$refs.table12.getData(),
-            sampleList: this.sampleList,
+            qualityInventoryList: qualityListData,
+            sampleList: sampleListData,
             planTemplateList: this.schemeList
           };
+
           console.log(params, 'params');
 
           if (this.btnType == 'issued' && this.schemeList.length < 1) {
@@ -2057,6 +2113,7 @@
       changeModel(val) {
         console.log('更改检验方式');
         this.baseForm.qualityMode = val;
+        this.isSampleList = false;
         if (this.btnType != 'issued') {
           this.baseForm.sampleNumber = '';
         }
@@ -2069,7 +2126,24 @@
           if (this.$refs.table12 && this.dimensionType) {
             const listData = this.$refs.table12.getData();
             console.log(listData, '成品检验订单数据');
-            this.changesStokledgerNumberModal(listData, this.dimensionType);
+            this.changesStokledgerNumberModal(
+              listData,
+              this.dimensionType,
+              'type'
+            );
+            // if (this.dimensionType == 3) {
+            //   if (this.baseForm.qualityMode == '1') {
+            //     this.handleUnpackCase(val);
+            //   } else if (this.baseForm.qualityMode == '2') {
+            //     this.sampleList = [];
+            //   }
+            // } else {
+            //   if (this.baseForm.qualityMode == '1') {
+            //     this.handleUnpackCase(listData);
+            //   } else if (this.baseForm.qualityMode == '2') {
+            //     this.sampleList = [];
+            //   }
+            // }
           }
           return;
         }
@@ -2082,6 +2156,14 @@
         }
       },
 
+      changeType() {
+        this.isPackingList = false;
+      },
+
+      changeSource() {
+        this.isSampleList = false;
+      },
+
       //确定按钮
       handleExtractFull() {
         this.$refs.ruleForm.validate(async (valid) => {

+ 2 - 1
src/views/inspectionPlan/index.vue

@@ -83,7 +83,7 @@
       </ele-pro-table>
     </el-card>
     <!-- <edit ref="edit" @done="reload"></edit> -->
-    <edit ref="edit"></edit>
+    <edit ref="edit" @done="reload"></edit>
   </div>
 </template>
 <script>
@@ -361,6 +361,7 @@
         this.reload(e);
       },
       openEdit(type, row) {
+        console.log(row);
         this.$refs.edit.open(type, row);
       },
       downloadFile(file) {

+ 2 - 2
vue.config.js

@@ -35,8 +35,8 @@ module.exports = {
         // target: 'http://192.168.1.107:18086',
         // target: 'http://192.168.1.125:18086',
         // target: 'http://192.168.1.144:18086',
-        target: 'http://192.168.1.251:18086',
-        // target: 'http://192.168.1.251:18186',
+        // target: 'http://192.168.1.251:18086',
+        target: 'http://192.168.1.251:18186',
         // target: 'http://124.71.68.31:50001',
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {