Explorar el Código

任务报工节目新增工艺文件和设备的按钮,质检报工新增收样按钮

695593266@qq.com hace 5 meses
padre
commit
c8dac6b67d

+ 13 - 0
src/api/inspectionWork/index.js

@@ -162,3 +162,16 @@ export async function checkByQualityWorkOrderId(qualityWorkOrderId) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+//收样
+
+export async function sampleCollection(data) {
+  const res = await request.put(
+    `/qms/quality_work_order/sampleCollection`,
+    data
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 1 - 1
src/views/outsourcing/components/release.vue

@@ -173,7 +173,7 @@
         this.form.id = this.rowObj.id;
         this.form['type'] = this.rowObj['type'];
         release(this.form).then((res) => {
-          this.$emit('refreshs');
+          this.$emit('releaseRefresh');
           this.close();
         });
       }

+ 42 - 17
src/views/produce/components/footBtn.vue

@@ -20,7 +20,7 @@
     props: {
       //
       type: {
-        type: String | Number,
+        type: [String, Number],
         default: ''
       },
       singleReportInspection: {},
@@ -295,6 +295,18 @@
             type: 'bom',
             bjColor: '#BB5500',
             isShow: 'mes:workorder:bom'
+          },
+          {
+            name: '工艺文件',
+            type: 'work',
+            bjColor: '#2f3033',
+            isShow: 'mes:workorder:bomfile'
+          },
+          {
+            name: '设备',
+            type: 'device',
+            bjColor: '#008866',
+            isShow: 'mes:workorder:device'
           }
         ],
         disableObj: {
@@ -314,7 +326,8 @@
             buts: ['报工'],
             msg: '请先完成产后检查'
           }
-        }
+        },
+        localType: ''
       };
     },
     computed: {
@@ -369,22 +382,15 @@
       },
       type: {
         handler(v) {
-          if (this.activeName == '0') {
-            if (v == '2' || v == '3' || v == '6') {
-              let btnList2 = this.btnList2.filter((item) => {
-                if (v != 6) {
-                }
-              });
+          this.updateBtnList(v);
+        },
+        immediate: true,
+        deep: true
+      },
 
-              this.$set(this, 'btnList', this.btnList2);
-            } else if (v == '5') {
-              this.$set(this, 'btnList', this.btnList3);
-            } else {
-              this.$set(this, 'btnList', this.btnList1);
-            }
-          } else if (this.activeName == '1') {
-            this.$set(this, 'btnList', this.taskList);
-          }
+      activeName: {
+        handler(v) {
+          this.updateBtnList('');
         },
         immediate: true,
         deep: true
@@ -424,6 +430,25 @@
           return;
         }
         this.$emit('footBtn', item.type);
+      },
+
+      updateBtnList(v) {
+        if (this.activeName == '0') {
+          if (v == '2' || v == '3' || v == '6') {
+            let btnList2 = this.btnList2.filter((item) => {
+              if (v != 6) {
+              }
+            });
+
+            this.$set(this, 'btnList', this.btnList2);
+          } else if (v == '5') {
+            this.$set(this, 'btnList', this.btnList3);
+          } else {
+            this.$set(this, 'btnList', this.btnList1);
+          }
+        } else if (this.activeName == '1') {
+          this.$set(this, 'btnList', this.taskList);
+        }
       }
     }
   };

+ 1 - 1
src/views/produce/components/taskWorkList.vue

@@ -360,7 +360,7 @@
           {
             columnKey: 'action',
             label: '操作',
-            width: 120,
+            width: 140,
             align: 'center',
             resizable: false,
             fixed: 'right',

+ 33 - 2
src/views/produce/components/workPlan/index.vue

@@ -88,7 +88,7 @@
           </template>
           <!-- 操作列 -->
           <template v-slot:action="{ row }">
-            <el-link
+            <!-- <el-link
               type="primary"
               :underline="false"
               @click="addSampleOpen(row)"
@@ -96,11 +96,29 @@
                 ![1, 2].includes(row.status) && row.sampleQuantity < row.total
               "
               >请样</el-link
+            > -->
+            <el-link
+              type="primary"
+              :underline="false"
+              @click="addSampleOpen(row)"
+              v-if="
+                ![1, 2].includes(row.status) &&
+                row.sampleQuantity < row.total &&
+                row.isPendingSample != 1
+              "
+              >请样</el-link
             >
             <el-link
               type="primary"
               :underline="false"
-              v-if="row.status == 0"
+              @click="sampleCollection(row)"
+              v-if="![1, 2].includes(row.status) && row.isPendingSample == 1"
+              >收样</el-link
+            >
+            <el-link
+              type="primary"
+              :underline="false"
+              v-if="row.status == 0 && row.isPendingSample != 1"
               @click="openEdit('edit', row)"
               >报工</el-link
             >
@@ -240,6 +258,7 @@
     updateCertificateNumber,
     verificationQualityInspector,
     closeWork,
+    sampleCollection,
     checkByQualityWorkOrderId
   } from '@/api/inspectionWork';
   import dictMixins from '@/mixins/dictMixins';
@@ -695,6 +714,18 @@
         this.addOpen = false;
       },
 
+      async sampleCollection(row) {
+        const code = await verificationQualityInspector(row.id);
+        if (code == '-1') {
+          return;
+        }
+
+        sampleCollection({ id: row.id }).then((res) => {
+          this.$message.success('收样成功');
+          this.done();
+        });
+      },
+
       isEmptyObject(obj) {
         return Object.keys(obj).length === 0;
       },

+ 86 - 52
src/views/produce/index.vue

@@ -1883,34 +1883,65 @@
 
       /* ================== work ================== */
       async handleWork() {
-        if (this.activeName != '0') return;
-        if (
-          !this.checkWorkOrder({
-            min: 1,
-            max: 1,
-            msg: { max: '工艺文件只能选择一个工单!' }
-          })
-        )
-          return;
+        const req =
+          this.activeName === '0'
+            ? this.getWorkOrderForWork()
+            : this.getTaskForWork();
 
-        const res = await parameterGetByCode({
-          code: 'mes_craft_file_by_category_code'
+        if (!req) return;
+
+        await this.openWorkFile(req);
+      },
+
+      getWorkOrderForWork() {
+        const valid = this.checkWorkOrder({
+          min: 1,
+          max: 1,
+          msg: { max: '工艺文件只能选择一个工单!' }
         });
 
-        const req = {
+        if (!valid) return null;
+
+        const row = this.workData?.list?.[0];
+        if (!row) return null;
+
+        return {
           taskId: this.taskObj.id,
           workOrderId: this.workListIds[0],
-          productCode: this.workData.list[0].productCode
+          productCode: row.productCode
+        };
+      },
+
+      getTaskForWork() {
+        if (!this.taskData) {
+          this.$message.warning('请选择一条任务单');
+          return null;
+        }
+
+        return {
+          taskId: this.taskObj.id,
+          workOrderId: this.taskData.workOrderId,
+          productCode: this.taskData.productCode
         };
+      },
+
+      async openWorkFile(req) {
+        const res = await parameterGetByCode({
+          code: 'mes_craft_file_by_category_code'
+        });
 
-        res.value === '1'
-          ? this.$refs.wokePopupRef.openTwo(req)
-          : this.$refs.wokePopupRef.open(req);
+        const byCategory = res?.value === '1';
+
+        if (byCategory) {
+          this.$refs.wokePopupRef.openTwo(req);
+        } else {
+          this.$refs.wokePopupRef.open(req);
+        }
       },
 
       /* ================== device ================== */
       handleDevice() {
-        if (this.activeName != '0') return;
+        // if (this.activeName != '0') return;
         if (!this.taskObj.id) {
           return this.$message.warning('请选择工序');
         }
@@ -1918,45 +1949,48 @@
       },
 
       /* ================== bom ================== */
+
       handleBom() {
-        if (this.activeName == '0') {
-          if (
-            !this.checkWorkOrder({
-              min: 1,
-              max: 1,
-              msg: { max: '查看BOM详情只能选择一个工单!' }
-            })
-          )
-            return;
+        const isWorkOrder = this.activeName === '0';
 
-          const row = this.workData.list[0];
-          this.$refs.bomDrawer.open({
-            categoryId: row.categoryId,
-            categoryName: row.bomCategoryName,
-            code: row.code,
-            versions: row.bomCategoryVersions,
-            rootPathIdParent: row.categoryLevelPathIdParent || '',
-            isProduct: true,
-            bomType: Number(row.bomType),
-            isTemp: 0
-          });
-        } else if (this.activeName == '1') {
-          if (!this.taskData) {
-            return this.$message.warning('请选择一条任务单');
-          }
+        const row = isWorkOrder ? this.getWorkOrderRow() : this.getTaskRow();
 
-          const row = this.taskData;
-          this.$refs.bomDrawer.open({
-            categoryId: row.categoryId,
-            categoryName: row.bomCategoryName,
-            code: row.code ? row.code : '',
-            versions: row.bomCategoryVersions,
-            rootPathIdParent: row.categoryLevelPathIdParent || '',
-            isProduct: true,
-            bomType: Number(row.bomType),
-            isTemp: 0
-          });
+        if (!row) return;
+
+        this.openBomDrawer(row);
+      },
+
+      getWorkOrderRow() {
+        const valid = this.checkWorkOrder({
+          min: 1,
+          max: 1,
+          msg: { max: '查看BOM详情只能选择一个工单!' }
+        });
+
+        if (!valid) return null;
+
+        return this.workData?.list?.[0] || null;
+      },
+
+      getTaskRow() {
+        if (!this.taskData) {
+          this.$message.warning('请选择一条任务单');
+          return null;
         }
+        return this.taskData;
+      },
+
+      openBomDrawer(row) {
+        this.$refs.bomDrawer.open({
+          categoryId: row.categoryId,
+          categoryName: row.bomCategoryName,
+          code: row.code || '',
+          versions: row.bomCategoryVersions,
+          rootPathIdParent: row.categoryLevelPathIdParent || '',
+          isProduct: true,
+          bomType: Number(row.bomType),
+          isTemp: 0
+        });
       },
 
       /* ================== Outsourcing ================== */