wsx 11 месяцев назад
Родитель
Сommit
8d39c0e785

+ 49 - 5
src/views/inspectionWork/components/newQualityContentTabs.vue

@@ -1,5 +1,10 @@
 <template>
   <el-row>
+    <!-- 选择质检方案 -->
+    <inspectionTemplateDialog
+      ref="inspectionTemplateRef"
+      @choose="inspectionTemplateSuccess"
+    ></inspectionTemplateDialog>
     <header-title title="质检内容">
       <el-button
         type="primary"
@@ -17,7 +22,7 @@
       >
     </header-title>
 
-    <el-tabs v-model="activeName" @tab-click="handleClick">
+    <el-tabs v-model="activeNameKK" @tab-click="handleClick">
       <!--  -->
       <el-tab-pane label="来源清单" name="1">
         <ele-pro-table
@@ -337,6 +342,14 @@
       </el-tab-pane>
       <!--  -->
       <el-tab-pane label="质检方案" name="3">
+        <el-button
+          v-if="showBtn"
+          @click="addInspectionTemplate"
+          type="primary"
+          style="margin-top: 5px"
+          >选择质检方案</el-button
+        >
+
         <el-table
           :data="paginatedSchemeList"
           tooltip-effect="dark"
@@ -408,6 +421,7 @@
 </template>
 
 <script>
+  import inspectionTemplateDialog from '@/views/inspectionTemplate/components/inspectionTemplateDialog.vue';
   import {
     save,
     update,
@@ -418,6 +432,19 @@
     queryQualityInventory
   } from '@/api/inspectionWork';
   export default {
+    components: {
+      inspectionTemplateDialog
+    },
+    watch: {
+      schemeList: {
+        handler(newVal, oldVal) {
+          console.log('213123131');
+          this.templateList = newVal;
+          // console.log(newVal, 'schemeList');
+        },
+        deep: true
+      }
+    },
     props: {
       type: String,
       packingList: Array,
@@ -431,7 +458,9 @@
     },
     data() {
       return {
-        activeName: this.activeName,
+        templateList: [],
+        planTemplateList: [],
+        activeNameKK: '',
         samplePagination: { currentPage: 1, pageSize: 10 },
         schemePagination: { currentPage: 1, pageSize: 10 },
 
@@ -562,6 +591,9 @@
     },
 
     computed: {
+      showBtn() {
+        return this.$route.query.qualityType == 2;
+      },
       tableColumns1() {
         let arr = [
           // (this.btnType !== 'issued' || this.baseForm.qualityMode === 2)
@@ -671,10 +703,13 @@
         const { currentPage, pageSize } = this.schemePagination;
         const start = (currentPage - 1) * pageSize;
         const end = start + pageSize;
-        return this.schemeList?.slice(start, end);
+
+        return this.templateList?.slice(start, end);
+        // return this.schemeList?.slice(start, end);
       }
     },
     created() {
+      this.activeNameKK = this.activeName;
       this.reload({ qualityWorkerId: this.ids });
       let direction = this.$getDirection();
 
@@ -864,10 +899,10 @@
 
       handleClick(tab) {
         console.log(tab, 'tab');
-        this.activeName = tab.name;
+        this.activeNameKK = tab.name;
       },
       tabsChange(val) {
-        this.activeName = val;
+        this.activeNameKK = val;
       },
       tabsConditionType(val) {
         this.conditionType = val;
@@ -902,6 +937,15 @@
 
       selectQualityResultsChange() {
         this.$emit('countQualityResults');
+      },
+      addInspectionTemplate() {
+        this.$refs.inspectionTemplateRef.open(2);
+      },
+      inspectionTemplateSuccess(select) {
+        // planTemplateList
+        console.log(select);
+        this.templateList.push(...select);
+        // this.schemePagination.total = this.templateList.length;
       }
     }
   };

+ 181 - 28
src/views/inspectionWork/components/sampleDisposeDialog.vue

@@ -10,7 +10,112 @@
     :maxable="true"
   >
     <el-form ref="form1" :model="formData" :rules="rules" label-width="120px">
-      <el-row>
+      <el-form-item label="处置方式:" prop="disposeType">
+        <el-select
+          v-model="formData.disposeType"
+          placeholder="请选择"
+          style="width: 100%"
+        >
+          <el-option
+            v-for="item in disposeList"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value"
+          >
+          </el-option>
+        </el-select>
+      </el-form-item>
+
+      <template v-if="formData.disposeType == 6">
+        <el-row>
+          <el-col :span="24">
+            <el-form-item label="留样日期:" prop="sampleDate" align="center">
+              <el-date-picker
+                class="w100"
+                v-model="formData.sampleDate"
+                type="date"
+                value-format="yyyy-MM-dd"
+                placeholder="请输入"
+              ></el-date-picker>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6"> </el-col>
+        </el-row>
+        <el-row style="margin-top: 12px">
+          <el-col :span="24">
+            <el-form-item
+              label="留样条件:"
+              prop="sampleCondition"
+              align="center"
+            >
+              <el-input
+                v-model="formData.sampleCondition"
+                placeholder="请输入"
+                style="width: 100%"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row style="margin-top: 12px">
+          <el-col :span="24">
+            <el-form-item
+              label="生产商/受托生产:"
+              prop="producerManufacturer"
+              align="center"
+            >
+              <el-input
+                v-model="formData.producerManufacturer"
+                placeholder="请输入"
+                style="width: 100%"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row style="margin-top: 12px">
+          <el-col :span="24">
+            <el-form-item label="留样地点:" prop="samplePlace" align="center">
+              <el-input
+                type="textarea"
+                v-model="formData.samplePlace"
+                placeholder="请输入"
+                style="width: 100%"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row style="margin-top: 12px">
+          <el-col :span="24">
+            <el-form-item label="留样备注:" prop="sampleRemark" align="center">
+              <el-input
+                type="textarea"
+                v-model="formData.sampleRemark"
+                placeholder="请输入"
+                style="width: 100%"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+
+        <el-row style="margin-top: 12px">
+          <el-col :span="24"> </el-col>
+        </el-row>
+      </template>
+
+      <template v-if="this.formData.disposeType !== 8">
+        <el-form-item label="入库仓库:" prop="depotId" align="center">
+          <el-select style="width: 100%" v-model="formData.depotId">
+            <el-option
+              v-for="item in warehouseList"
+              :key="item.id"
+              :value="item.id"
+              :label="item.name"
+              @click.native="chooseWarehouse(item)"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </template>
+
+      <!-- <el-row>
         <el-col :span="6">
           <el-form-item label="处置方式" prop="disposalStatus" align="center">
             <el-select
@@ -141,7 +246,7 @@
             ></el-input>
           </el-form-item>
         </el-col>
-      </el-row>
+      </el-row> -->
     </el-form>
     <template v-slot:footer>
       <el-button @click="handleClose">取消</el-button>
@@ -151,42 +256,53 @@
 </template>
 
 <script>
-  import { warehouseList } from '@/api/inspectionWork';
+  // import { warehouseList } from '@/api/inspectionWork';
+
+  import { getWarehouseList } from '@/api/samplemanagement';
 
   export default {
     components: {},
     data() {
       return {
+        allList: [
+          { value: 1, label: '返工' },
+          { value: 2, label: '返修' },
+          { value: 3, label: '报废' },
+          { value: 4, label: '降级使用' },
+          { value: 5, label: '让步接收' },
+          { value: 6, label: '留样' },
+          { value: 7, label: '消耗' },
+          { value: 8, label: '回用/归批' },
+          { value: 9, label: '转试销' },
+          { value: 10, label: '退货' }
+        ],
         title: '',
         visible: false,
         rowIndex: 0,
         type: '',
         formData: {
-          disposalStatus: '',
+          disposeType: '',
           sampleDate: '',
-          disposeTime: '',
           sampleCondition: '',
           producerManufacturer: '',
           samplePlace: '',
-          sampleRemark: ''
+          sampleRemark: '',
+          depotId: '',
+          depotName: ''
         },
         qualityType: '',
         warehouseList: [],
         // 表单验证规则
         rules: {
-          disposeTime: [
-            {
-              required: true,
-              message: '请选择处置时间',
-              trigger: 'blur'
-            }
-          ],
-          disposalStatus: [
+          disposeType: [
             {
               required: true,
               message: '请选择处置方式',
               trigger: 'blur'
             }
+          ],
+          depotId: [
+            { required: true, message: '请选择仓库', trigger: 'change' }
           ]
         },
         disposalStatusList: [
@@ -239,10 +355,27 @@
         ]
       };
     },
-    computed: {},
+    computed: {
+      disposeList() {
+        if (this.$route.query.qualityType == 1) {
+          return this.allList.filter((item) => [5, 10].includes(item.value));
+        }
+        if (
+          this.$route.query.qualityType == 2 ||
+          this.$route.query.qualityType == 3
+        ) {
+          return this.allList.filter(
+            (item) => item.value !== 8 && item.value !== 10
+          );
+        } else {
+          return this.allList;
+        }
+      }
+    },
 
-    created() {
-      this.getWarehouseList();
+    async created() {
+      // this.getWarehouseList();
+      this.warehouseList = await getWarehouseList();
     },
     methods: {
       handleWarehouseChange(val) {
@@ -252,24 +385,25 @@
           }
         });
       },
-      async getWarehouseList() {
-        let res = await warehouseList({});
-        this.warehouseList = res.map((item) => {
-          item.disposeWarehouseName = item.name;
-          item.disposeWarehouseId = item.id;
-          return {
-            ...item
-          };
-        });
-      },
+      // async getWarehouseList() {
+      //   let res = await warehouseList({});
+      //   this.warehouseList = res.map((item) => {
+      //     item.disposeWarehouseName = item.name;
+      //     item.disposeWarehouseId = item.id;
+      //     return {
+      //       ...item
+      //     };
+      //   });
+      // },
       async openDispose(index, row, type, qualityType) {
-        this.visible = true;
         if (index != null) {
           this.formData = JSON.parse(JSON.stringify(row));
         } else {
           this.formData = {};
         }
+        console.log(this.formData);
 
+        this.visible = true;
         this.rowIndex = index;
         this.type = type;
         this.qualityType = qualityType;
@@ -285,6 +419,25 @@
             this.visible = false;
           }
         });
+      },
+      chooseWarehouse(item) {
+        console.log(item);
+        this.formData.depotId = item.id;
+        this.formData.depotName = item.name;
+      }
+    },
+    watch: {
+      'formData.disposeType': {
+        handler(newVal, oldVal) {
+          this.formData.sampleCondition = '';
+          this.formData.sampleDate = '';
+          this.formData.samplePlace = '';
+          this.formData.sampleRemark = '';
+          this.formData.producerManufacturer = '';
+          this.formData.depotId = '';
+          this.formData.depotName = '';
+        },
+        // immediate: true
       }
     }
   };

+ 1 - 1
src/views/inspectionWork/edit.vue

@@ -903,7 +903,6 @@
 
           console.log(this.form.qualityTimeStart, this.form.qualityTimeEnd);
 
-          
           // if (this.form.qualityMode == 1) {
           //   this.form.qualityResults = '';
           // }
@@ -916,6 +915,7 @@
             qualityInventoryList: this.inventoryList
           };
           console.log(params, 'params');
+          return;
           exeReportWork(params)
             .then((msg) => {
               this.loading = false;