yusheng 6 ماه پیش
والد
کامیت
8e67a44bd2

+ 111 - 4
src/views/inspectionWork/components/newQualityContentTabs.vue

@@ -314,6 +314,65 @@
               </el-select>
             </template>
           </el-table-column>
+          <el-table-column
+            label="不良类型"
+            align="center"
+            v-if="form.recordingMethod != 1"
+            prop="badTypeId"
+            width="180"
+          >
+            <template v-slot="{ row, $index }">
+              <el-select
+                v-model="row.badTypeId"
+                placeholder="请选择不良类型"
+                size="small"
+                style="width: 100%"
+                remote
+                filterable
+                :remote-method="getBadTypeList"
+                clearable
+                @change="badTypeChange(row)"
+              >
+                <el-option
+                  v-for="item in badTypeList"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.id"
+                >
+                </el-option>
+              </el-select>
+            </template>
+          </el-table-column>
+
+          <el-table-column
+            label="不良名称"
+            align="center"
+            prop="badNameId"
+            width="180"
+            v-if="form.recordingMethod != 1"
+          >
+            <template v-slot="{ row, $index }">
+              <el-select
+                v-model="row.badNameId"
+                placeholder="请选择不良名称"
+                size="small"
+                style="width: 100%"
+                remote
+                filterable
+                :remote-method="(name) => getBadNameList(name, row.badTypeId)"
+                clearable
+                @change="badNameChange(row)"
+              >
+                <el-option
+                  v-for="item in badNameList"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.id"
+                >
+                </el-option>
+              </el-select>
+            </template>
+          </el-table-column>
           <el-table-column
             label="操作"
             align="center"
@@ -555,7 +614,8 @@
   import { getCodeList } from '@/api/login';
   import { inspectionProjectStatus } from '@/enum/dict.js';
   import dictMixins from '@/mixins/dictMixins';
-
+  import { getList as getBadNameList } from '@/api/unacceptedProduct/unqualifiedName';
+  import { getList as getBadTypeList } from '@/api/unacceptedProduct/unqualifiedType';
   export default {
     mixins: [dictMixins],
 
@@ -595,6 +655,10 @@
     },
     data() {
       return {
+        // 不良品类型列表
+        badTypeList: [],
+        // 不良名称列表
+        badNameList: [],
         inspectionProjectStatus,
         disposeTypeList: {
           1: '返工',
@@ -1128,7 +1192,8 @@
       this.activeNameKK = this.activeName;
       this.reload({ qualityWorkerId: this.ids });
       let direction = this.$getDirection();
-
+      this.getBadTypeList();
+      this.getBadNameList();
       direction.on('keyup', function (e, val) {
         if (e.keyCode == 39) {
           direction.next();
@@ -1145,6 +1210,48 @@
       });
     },
     methods: {
+      // 不良类型改变
+      badTypeChange(row) {
+        row.badTypeName = null;
+        // 赋值badTypeName
+        const badType = this.badTypeList.find(
+          (item) => item.id === row.badTypeId
+        );
+        if (badType) {
+          row.badTypeName = badType.name;
+        }
+        this.getBadNameList('', row.badTypeId);
+      },
+      // 不良名称改变
+      badNameChange(row) {
+        // 赋值badNameName
+        const badItem = this.badNameList.find(
+          (item) => item.id === row.badNameId
+        );
+        if (badItem) {
+          row.badNameName = badItem.name;
+        }
+      },
+      // 查询不良类型
+      async getBadTypeList(name = '') {
+        const res = await getBadTypeList({
+          pageNum: 1,
+          size: 50,
+          name: name
+        });
+        this.badTypeList = res.list;
+      },
+      // 查询不良名称
+      async getBadNameList(name = '', badTypeId = 0) {
+        const res = await getBadNameList({
+          pageNum: 1,
+          size: 50,
+          name: name,
+          badTypeId: badTypeId
+        });
+        console.log('this.badNameList', this.badNameList);
+        this.badNameList = res.list;
+      },
       //合格数量变化设置样品清单 全减并且不拆包才执行
       async setSampleList(val, total) {
         this.$set(this.sampleList[0], 'measureQuantity', val);
@@ -1487,8 +1594,8 @@
         this.$emit('setSchemeList', this.templateList);
         // this.schemeList = this.templateList;
         this.schemePagination.total = this.templateList.length;
-        if(this.form.recordingMethod == 1){
-           this.$emit('setSchemeListChange')
+        if (this.form.recordingMethod == 1) {
+          this.$emit('setSchemeListChange');
         }
       },
       handDel(index) {

+ 14 - 0
src/views/inspectionWork/mixins/detailMixins.js

@@ -662,6 +662,20 @@ export default {
           showOverflowTooltip: true,
           width: 150
         },
+        {
+          prop: 'badTypeName',
+          label: '不良类型',
+          width: '180',
+          align: 'center',
+          show: this.form.recordingMethod != 1
+        },
+        {
+          prop: 'badNameName',
+          label: '不良名称',
+          width: '180',
+          align: 'center',
+          show: this.form.recordingMethod != 1
+        },
         {
           label: '质检状态',
           prop: 'qualityStatus',

+ 8 - 8
src/views/unqualifiedProduct/unqualifiedList/components/create.vue

@@ -138,7 +138,7 @@
         <el-table-column label="工序" align="center" prop="produceTaskName">
         </el-table-column>
 
-        <!-- <el-table-column
+        <el-table-column
           label="不良类型"
           align="center"
           prop="badTypeId"
@@ -149,7 +149,7 @@
               label-width="0px"
               :prop="'poList.' + $index + '.badTypeId'"
               :rules="{
-                required: true,
+                // required: true,
                 message: '请选择不良类型',
                 trigger: 'blur'
               }"
@@ -188,7 +188,7 @@
               label-width="0px"
               :prop="'poList.' + $index + '.badNameId'"
               :rules="{
-                required: true,
+                // required: true,
                 message: '请选择不良名称',
                 trigger: 'blur'
               }"
@@ -227,7 +227,7 @@
               label-width="0px"
               :prop="'poList.' + $index + '.reasonTypeId'"
               :rules="{
-                required: true,
+                // required: true,
                 message: '请选择不良原因类型',
                 trigger: 'blur'
               }"
@@ -253,7 +253,7 @@
               </el-select>
             </el-form-item>
           </template>
-        </el-table-column> -->
+        </el-table-column>
 
         <el-table-column
           label="原因"
@@ -392,9 +392,9 @@
       }
     },
     created() {
-      // this.getBadTypeList();
-      // this.getBadNameList();
-      // this.getReasonTypeList();
+      this.getBadTypeList();
+      this.getBadNameList();
+      this.getReasonTypeList();
     },
     methods: {
       open(row, type) {

+ 18 - 18
src/views/unqualifiedProduct/unqualifiedList/detailList.vue

@@ -529,24 +529,24 @@ export default {
           label: '工序',
           align: 'center'
         },
-        // {
-        //   prop: 'badTypeName',
-        //   label: '不良类型',
-        //   width: '180',
-        //   align: 'center'
-        // },
-        // {
-        //   prop: 'badNameName',
-        //   label: '不良名称',
-        //   width: '180',
-        //   align: 'center'
-        // },
-        // {
-        //   prop: 'reasonTypeName',
-        //   label: '原因类型',
-        //   width: '180',
-        //   align: 'center'
-        // },
+        {
+          prop: 'badTypeName',
+          label: '不良类型',
+          width: '180',
+          align: 'center'
+        },
+        {
+          prop: 'badNameName',
+          label: '不良名称',
+          width: '180',
+          align: 'center'
+        },
+        {
+          prop: 'reasonTypeName',
+          label: '原因类型',
+          width: '180',
+          align: 'center'
+        },
         {
           prop: 'unqualifiedReason',
           label: '原因',