Przeglądaj źródła

不良品列表相关改动

lucw 7 miesięcy temu
rodzic
commit
cd393036c3

+ 2 - 1
src/api/unacceptedProduct/index.js

@@ -54,12 +54,13 @@ export async function dispose(data) {
 }
 // 删除
 export async function deleteUnacceptedProduct(data) {
-  const res = await request.delete('/qms/unqualifiedproducts/delete' + data);
+  const res = await request.delete('/qms/unqualifiedproducts/delete', { data });
   if (res.data.code == 0) {
     return res.data.message;
   }
   return Promise.reject(new Error(res.data.message));
 }
+
 // 删除详情
 export async function deleteUnacceptedProductDetail(data) {
   const res = await request.delete('/qms/unqualifiedproductsdetail/delete', {

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

@@ -423,7 +423,7 @@
       },
       handleClose() {
         this.$emit('close', false);
-       
+
       },
       handleConfirm() {
         this.$refs.form1.validate((valid) => {

+ 18 - 12
src/views/unqualifiedProduct/unqualifiedList/components/EquipmentDialog.vue

@@ -122,18 +122,7 @@ export default {
   computed: {
     columns() {
       let columnsVersion = this.columnsVersion;
-      return [
-        {
-          width: 45,
-          type: 'selection',
-          columnKey: 'selection',
-          align: 'center',
-          reserveSelection: true,
-          show: this.type == 1,
-          selectable: (row, index) => {
-            return !this.disabledCode.includes(row.code);
-          }
-        },
+      const list = [
         {
           columnKey: 'index',
           label: '序号',
@@ -179,6 +168,22 @@ export default {
           minWidth: 110
         }
       ];
+
+      if(this.type == 1){
+        list.unshift({
+          width: 45,
+          type: 'selection',
+          columnKey: 'selection',
+          align: 'center',
+          reserveSelection: true,
+          show: this.type == 1,
+          selectable: (row, index) => {
+            return !this.disabledCode.includes(row.code);
+          }
+        });
+      }
+
+      return list;
     }
   },
 
@@ -214,6 +219,7 @@ export default {
       this.$refs.equiTable.clearSelection();
     },
     reset() {
+      this.searchKey = '';
       this.code = null;
       this.reload();
     },

+ 241 - 12
src/views/unqualifiedProduct/unqualifiedList/components/create.vue

@@ -120,13 +120,12 @@
               <el-input
                 v-model.number="scope.row.unqualifiedQuantity"
                 size="small"
-                oninput="value=value.replace(/[^\d]/g,'')"
                 style="width: 100%"
                 placeholder="输入数量"
+                @input="
+                  scope.row.measureQuantity = scope.row.unqualifiedQuantity
+                "
               ></el-input>
-              <!--   @input="
-                  inputNumber(scope.$index, scope.row.unqualifiedQuantity)
-                " -->
             </el-form-item>
           </template>
         </el-table-column>
@@ -139,7 +138,129 @@
         <el-table-column label="工序" align="center" prop="produceTaskName">
         </el-table-column>
 
-        <el-table-column label="原因" align="center" prop="unqualifiedReason">
+        <el-table-column
+          label="不良类型"
+          align="center"
+          prop="badTypeId"
+          width="180"
+        >
+          <template v-slot="{ row, $index }">
+            <el-form-item
+              label-width="0px"
+              :prop="'poList.' + $index + '.badTypeId'"
+              :rules="{
+                required: true,
+                message: '请选择不良类型',
+                trigger: 'blur'
+              }"
+            >
+              <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>
+            </el-form-item>
+          </template>
+        </el-table-column>
+
+        <el-table-column
+          label="不良名称"
+          align="center"
+          prop="badNameId"
+          width="180"
+        >
+          <template v-slot="{ row, $index }">
+            <el-form-item
+              label-width="0px"
+              :prop="'poList.' + $index + '.badNameId'"
+              :rules="{
+                required: true,
+                message: '请选择不良名称',
+                trigger: 'blur'
+              }"
+            >
+              <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>
+            </el-form-item>
+          </template>
+        </el-table-column>
+
+        <el-table-column
+          label="原因类型"
+          align="center"
+          prop="reasonTypeId"
+          width="180"
+        >
+          <template v-slot="{ row, $index }">
+            <el-form-item
+              label-width="0px"
+              :prop="'poList.' + $index + '.reasonTypeId'"
+              :rules="{
+                required: true,
+                message: '请选择不良原因类型',
+                trigger: 'blur'
+              }"
+            >
+              <el-select
+                v-model="row.reasonTypeId"
+                placeholder="请选择原因类型"
+                size="small"
+                style="width: 100%"
+                remote
+                filterable
+                :remote-method="getReasonTypeList"
+                clearable
+                @change="reasonTypeChange(row)"
+              >
+                <el-option
+                  v-for="item in reasonTypeList"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.id"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </template>
+        </el-table-column>
+
+        <el-table-column
+          label="原因"
+          align="center"
+          prop="unqualifiedReason"
+          width="180"
+        >
           <template slot-scope="scope">
             <el-form-item
               label-width="0px"
@@ -183,7 +304,7 @@
     </template>
 
     <!-- 选择产品 -->
-    <EquipmentDialog ref="equipmentRefs" @choose="confirmChoose" :type="1">
+    <EquipmentDialog ref="equipmentRefs" @choose="confirmChoose">
     </EquipmentDialog>
     <ProductionVersion
       ref="versionRefs"
@@ -203,6 +324,10 @@
     deleteUnacceptedProductDetail,
     getById
   } from '@/api/unacceptedProduct/index';
+  import { getList as getBadNameList } from '@/api/unacceptedProduct/unqualifiedName';
+  import { getList as getBadTypeList } from '@/api/unacceptedProduct/unqualifiedType';
+  import { getList as getReasonTypeList } from '@/api/unacceptedProduct/reasonType';
+
   export default {
     components: {
       EquipmentDialog,
@@ -240,7 +365,8 @@
           measureQuantity: '',
           measureUnit: '',
           weight: '',
-          weightUnit: ''
+          weightUnit: '',
+          qualityType:""
         },
         // 表单验证规则
         rules: {
@@ -249,7 +375,13 @@
           ]
         },
 
-        title: '创建'
+        title: '创建',
+        // 不良品类型列表
+        badTypeList: [],
+        // 不良名称列表
+        badNameList: [],
+        // 原因类型列表
+        reasonTypeList: []
       };
     },
 
@@ -259,7 +391,11 @@
         return this.$store.state.theme.styleResponsive;
       }
     },
-    created() {},
+    created() {
+      this.getBadTypeList();
+      this.getBadNameList();
+      this.getReasonTypeList();
+    },
     methods: {
       open(row, type) {
         this.visible = true;
@@ -477,7 +613,23 @@
         let list = [];
         list = data.map((item, index) => {
           if (item.productCode) {
-            return item;
+            return {
+              // 不良品类型
+              badTypeId: null,
+              // 不良类型名称
+              badTypeName: null,
+              // 不良品名称id
+              badNameId: null,
+              // 不良品名称
+              badNameName: null,
+              // 原因类型id
+              reasonTypeId: null,
+              // 原因类型名称
+              reasonTypeName: null,
+              // 原因
+              unqualifiedReason: '',
+              ...item
+            };
           } else {
             return {
               categoryCode: item.code,
@@ -489,7 +641,6 @@
               modelType: item.modelType,
               engrave: '',
               unqualifiedQuantity: '',
-              unqualifiedReason: '',
               produceRoutingId: '',
               produceRoutingName: '',
               produceTaskId: '',
@@ -497,7 +648,21 @@
               measureQuantity: '',
               measureUnit: item.measuringUnit,
               weight: item.netWeight,
-              weightUnit: item.weightUnit
+              weightUnit: item.weightUnit,
+              // 不良品类型
+              badTypeId: null,
+              // 不良类型名称
+              badTypeName: null,
+              // 不良品名称id
+              badNameId: null,
+              // 不良品名称
+              badNameName: null,
+              // 原因类型id
+              reasonTypeId: null,
+              // 原因类型名称
+              reasonTypeName: null,
+              // 原因
+              unqualifiedReason: ''
             };
           }
         });
@@ -526,6 +691,70 @@
           this.form.unqualifiedQuantity +=
             Number(item.unqualifiedQuantity) || 0;
         });
+      },
+      // 查询不良类型
+      async getBadTypeList(name = '') {
+        const res = await getBadTypeList({
+          pageNum: 1,
+          size: 50,
+          name: name
+        });
+        console.log('this.badTypeList', this.badTypeList);
+        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 getReasonTypeList(name = '') {
+        const res = await getReasonTypeList({
+          pageNum: 1,
+          size: 50,
+          name: name
+        });
+        console.log('this.reasonTypeList', this.reasonTypeList);
+        this.reasonTypeList = res.list;
+      },
+      // 不良类型改变
+      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;
+        }
+      },
+      // 原因类型改变
+      reasonTypeChange(row) {
+        row.reasonTypeName = null;
+        // 赋值reasonTypeName
+        const reasonType = this.reasonTypeList.find(
+          (item) => item.id === row.reasonTypeId
+        );
+        if (reasonType) {
+          row.reasonTypeName = reasonType.name;
+        }
       }
     },
     watch: {

+ 22 - 0
src/views/unqualifiedProduct/unqualifiedList/detailList.vue

@@ -393,6 +393,9 @@ export default {
       if (this.$route.query.qualityType == 1) {
         return this.allList.filter((item) => [5, 10].includes(item.value));
       }
+      if (this.$route.query.qualityType == 2) {
+        return this.allList.filter((item) => item.value !== 8);
+      }
       if (
         this.$route.query.qualityType == 2 ||
         this.$route.query.qualityType == 3
@@ -526,9 +529,28 @@ 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: 'unqualifiedReason',
           label: '原因',
+          width: '180',
           align: 'center'
         },
         {

+ 7 - 3
src/views/unqualifiedProduct/unqualifiedList/index.vue

@@ -74,8 +74,7 @@ import OrderSearch from './components/order-search.vue';
 import dictMixins from '@/mixins/dictMixins';
 import { unacceptedProductStatus } from '@/utils/util';
 import Create from './components/create';
-
-import { getList } from '@/api/unacceptedProduct/index';
+import { getList,deleteUnacceptedProduct } from '@/api/unacceptedProduct/index';
 import tabMixins from '@/mixins/tableColumnsMixin';
 export default {
   components: {
@@ -303,8 +302,13 @@ export default {
     open(row) {
       this.$refs.create.open(row ? JSON.parse(JSON.stringify(row)) : '');
     },
+    reload() {
+      this.$nextTick(() => {
+        this.$refs.table.reload();
+      });
+    },
     remove(row) {
-      deleteUnacceptedProduct(row.id).then((res) => {
+      deleteUnacceptedProduct([row.id]).then((res) => {
         this.$message.success('删除' + res);
         this.reload();
       });

+ 1 - 1
src/views/unqualifiedProduct/unqualifiedList/unqualifiedName/components/edit.vue

@@ -69,7 +69,7 @@
       <el-button
         type="primary"
         @click="save()"
-        v-loading="loading"
+        :loading="loading"
         v-if="title != '详情'"
         >保存</el-button
       >

+ 1 - 0
vue.config.js

@@ -39,6 +39,7 @@ module.exports = {
         // target: 'http://192.168.1.251:18186',
         // target: 'http://124.71.68.31:50001',
         target: 'http://192.168.1.251:18086',
+        // target: 'http://192.168.1.3:18086', // 付丽
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {
           '^/api': ''