소스 검색

优化API函数格式并新增工单详情接口,修复质检报告模板显示问题,新增一键合格功能

yusheng 4 달 전
부모
커밋
35bbd3f80b

+ 24 - 13
src/api/aps/index.js

@@ -1,6 +1,5 @@
 import request from '@/utils/request';
 
-
 // 选择工艺路线
 export async function routeList(params) {
   const res = await request.get('/main/producerouting/page', { params });
@@ -9,11 +8,12 @@ export async function routeList(params) {
   }
 }
 
-
-
 // 工序
 export async function getProduceTaskList(params) {
-  const res = await request.post('/main/producerouting/taskinstance/page',params);
+  const res = await request.post(
+    '/main/producerouting/taskinstance/page',
+    params
+  );
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -28,7 +28,7 @@ export async function producetask(params) {
 /**
  * 生产计划
  */
- export async function getPlanList (data) {
+export async function getPlanList(data) {
   const res = await request.post('/aps/productionplan/page', data);
   if (res.data.code == 0) {
     return res.data.data;
@@ -39,7 +39,7 @@ export async function producetask(params) {
 /**
  * 生产订单
  */
- export async function workOrder(params) {
+export async function workOrder(params) {
   const res = await request.post('/aps/workorder/page', params);
   if (res.data.code == 0) {
     return res.data.data;
@@ -50,7 +50,7 @@ export async function producetask(params) {
 /**
  * 生产工单
  */
- export async function produceOrder (params) {
+export async function produceOrder(params) {
   const res = await request.post('/mes/workorder/page', params);
   if (res.data.code == 0) {
     return res.data.data;
@@ -60,7 +60,7 @@ export async function producetask(params) {
 /**
  * 入库申请
  */
-export async function warehousing (data) {
+export async function warehousing(data) {
   const res = await request.get('/mes/applystorage/page', {
     params: data
   });
@@ -108,7 +108,7 @@ export async function temporaryPlanSave(data) {
 }
 
 // 生成编码
-export async function getCode (code) {
+export async function getCode(code) {
   const res = await request.get(`/main/codemanage/getCode/` + code, {});
   if (res.data.code == 0) {
     return res.data.data;
@@ -127,14 +127,25 @@ export async function getFactoryarea(params) {
   return Promise.reject(new Error(res.data.message));
 }
 
-
 /**
  * 修改处置状态
  */
- export async function updateDisposalStatus (data) {
-  const res = await request.post('/qms/qmsreturnrepairwork/updateDisposalStatus', data);
+export async function updateDisposalStatus(data) {
+  const res = await request.post(
+    '/qms/qmsreturnrepairwork/updateDisposalStatus',
+    data
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 工单详情
+export async function getWorkorderById(id) {
+  const res = await request.get(`/mes/workorder/getById/${id}`);
   if (res.data.code == 0) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
-}
+}

+ 7 - 7
src/components/selectReleaseRules/search.vue

@@ -31,13 +31,13 @@
             type: 'input',
             placeholder: '规则名称'
           },
-          {
-            label: '记录规则分类:',
-            value: 'classify',
-            type: 'select',
-            placeholder: '记录规则分类',
-            planList: this.typeList
-          }
+          // {
+          //   label: '记录规则分类:',
+          //   value: 'classify',
+          //   type: 'select',
+          //   placeholder: '记录规则分类',
+          //   planList: this.typeList
+          // }
           //,
           // {
           //   label: '状态:',

+ 4 - 2
src/components/selectReleaseRules/select-release-rules.vue

@@ -60,7 +60,8 @@
       multiple: {
         type: Boolean,
         default: false
-      }
+      },
+      classify: ''
     },
     computed: {
       columns() {
@@ -310,7 +311,8 @@
           enable: 1,
           ...where,
           reportWorkType: this.reportWorkType,
-          produceTaskId: this.produceTaskId
+          produceTaskId: this.produceTaskId,
+          classify: this.classify
         });
       },
       /* 刷新表格 */

+ 1 - 1
src/mixins/dictMixins.js

@@ -8,7 +8,7 @@ export default {
     };
   },
   computed: {
-    ...mapGetters(['getDictValue', 'dict', 'getDict','getDictName','getDictList'])
+    ...mapGetters(['getDictValue', 'dict', 'getDict','getDictName','getDictCode','getDictList'])
   },
   methods: {
     ...mapActions('dict', ['requestDict'])

+ 6 - 2
src/store/getters.js

@@ -13,8 +13,6 @@ export default {
     ) || {},
   // 根据字典enumName  和 dictCode 获取字典 值(名称
   getDictValue: (state) => (enumName, dictCode) => {
-
-
     const obj = (state.dict[dictEnum[enumName]] || []).find((item) => {
       return item.dictCode === dictCode;
     });
@@ -24,6 +22,12 @@ export default {
   getDictName: (state) => (enumName, dictCode) => {
     const arr = state.dict[dictEnum[enumName]] || [];
     return arr.find((item) => item.dictCode === dictCode)?.dictValue || '';
+  },
+  getDictCode: (state) => (enumName, dictValue) => {
+    const obj = (state.dict[dictEnum[enumName]] || []).find((item) => {
+      return item.dictValue == dictValue;
+    });
+    return obj && obj.dictCode;
   }
   // getDictList: (state) => (enumName) => {
   //   if (!state.dict[dictEnum[enumName]].length) return [];

+ 3 - 3
src/views/inspectionWork/components/experimentReport.vue

@@ -20,17 +20,17 @@
       <el-row>
         <el-col :span="8">
           <el-form-item label="质检项:" prop="inspectionName">
-            {{ tableData[0].inspectionName }}</el-form-item
+            {{ tableData[0]?.inspectionName }}</el-form-item
           >
         </el-col>
         <el-col :span="8">
           <el-form-item label="编码:" prop="inspectionCode">
-            {{ tableData[0].inspectionCode }}
+            {{ tableData[0]?.inspectionCode }}
           </el-form-item>
         </el-col>
         <el-col :span="8">
           <el-form-item label="批次号:" prop="batchNo">
-            {{ tableData[0].batchNo }}
+            {{ tableData[0]?.batchNo }}
           </el-form-item>
         </el-col></el-row
       >

+ 61 - 30
src/views/inspectionWork/components/inspectionProjectReport.vue

@@ -74,7 +74,25 @@
       :datasource="tableData"
     >
       <template v-slot:toolbar>
-        当前质检剩余样品数:{{ getSampleQuantityCount }}{{ form.measureUnit }}
+        <div
+          style="
+            display: flex;
+            justify-content: space-between;
+            align-items: center;
+          "
+        >
+          <span>
+            当前质检剩余样品数:{{ getSampleQuantityCount
+            }}{{ form.measureUnit }}</span
+          >
+          <el-button
+            type="primary"
+            @click="handleOneKeyQualified"
+            style="margin-right: 10px"
+          >
+            一键合格
+          </el-button>
+        </div>
       </template>
       <template v-slot:qualityStandardType="{ row }">
         {{ getDictValue('质检标准类型', row.qualityStandardType) }}
@@ -269,6 +287,7 @@
         tableData: [],
         rowIndex: [],
         curretNum: 0,
+        qms_qualityResultContent: 1,
         workColumns: [
           {
             minWidth: 150,
@@ -503,7 +522,27 @@
           }
         ],
 
-        tableColumns: [
+        qualityResultsList: [
+          {
+            value: 1,
+            label: '合格'
+          },
+          {
+            value: 2,
+            label: '不合格'
+          },
+          {
+            value: 3,
+            label: '让步接收'
+          }
+        ],
+        sList: [], //质检工具筛选
+        pageName: ''
+      };
+    },
+    computed: {
+      tableColumns() {
+        return [
           {
             width: 45,
             type: 'index',
@@ -582,7 +621,7 @@
             prop: 'qualityResultContent',
             align: 'center',
             slot: 'qualityResultContent',
-            headerSlot: 'isRequired',
+            headerSlot: this.qms_qualityResultContent == 1 ? 'isRequired' : '',
             label: '质检内容',
             showOverflowTooltip: true
           },
@@ -644,7 +683,7 @@
           },
 
           {
-            minWidth: 100,
+            minWidth: 130,
             prop: 'qualityResults',
             slot: 'qualityResults',
             align: 'center',
@@ -684,26 +723,8 @@
             showOverflowTooltip: true,
             fixed: 'right'
           }
-        ],
-        qualityResultsList: [
-          {
-            value: 1,
-            label: '合格'
-          },
-          {
-            value: 2,
-            label: '不合格'
-          },
-          {
-            value: 3,
-            label: '让步接收'
-          }
-        ],
-        sList: [], //质检工具筛选
-        pageName: ''
-      };
-    },
-    computed: {
+        ];
+      },
       getSampleQuantityCount() {
         return (
           (this.form.sampleQuantity * 100 -
@@ -720,6 +741,11 @@
       this.requestDict('质检计划类型');
       this.requestDict('取样类型');
       this.requestDict('质检标准类型');
+      parameterGetByCode({
+        code: 'qms_qualityResultContent'
+      }).then((res) => {
+        this.qms_qualityResultContent = res?.value;
+      });
     },
     methods: {
       async craftFiles(row) {
@@ -820,6 +846,11 @@
 
         this.visible = true;
       },
+      handleOneKeyQualified() {
+        this.tableData.forEach((item, index) => {
+          this.$set(this.tableData[index],'qualityResults',1)
+        });
+      },
       formSampleQuantityChange() {
         if (this.form.sampleQuantity < 0) {
           this.form.sampleQuantity = 0;
@@ -858,21 +889,21 @@
       },
       handleConfirm() {
         let isHandleConfirm = false;
+
+        if (!this.form.sampleQuantity) {
+          return this.$message.error('样品数不能为空!');
+        }
         this.tableData.forEach((item, index) => {
+          item.status = 1;
           if (!item.qualityResultContent) {
             isHandleConfirm = true;
-          } else {
-            item.status = 1;
           }
         });
-        if (!this.form.sampleQuantity) {
-          return this.$message.error('样品数不能为空!');
-        }
         if (!this.pageName) {
           this.$emit('success', { data: this.form, tableData: this.tableData });
           this.visible = false;
         } else {
-          if (isHandleConfirm) {
+          if (isHandleConfirm && this.qms_qualityResultContent == 1) {
             return this.$message.error('质检内容不能为空!');
           }
           let api =

+ 48 - 0
src/views/inspectionWork/components/mesWorkOrder.vue

@@ -0,0 +1,48 @@
+<template>
+  <ele-modal
+    custom-class="ele-dialog-form long-dialog-form"
+    :visible.sync="visible"
+    title="生产工单"
+    :close-on-click-modal="false"
+    width="60%"
+    :maxable="true"
+    append-to-body
+  >
+    <el-form ref="certificateForm" :model="form" class="certificate_form">
+    </el-form>
+    <div slot="footer" class="footer">
+      <el-button @click="visible = fasle">返回</el-button>
+    </div>
+  </ele-modal>
+</template>
+
+<script>
+  import { getWorkorderById } from '@/api/aps/index.js';
+  export default {
+    data() {
+      return {
+        form: {},
+        visible: false
+      };
+    },
+
+    mounted() {},
+    methods: {
+      open(id) {
+        getWorkorderById(id).then(res=>{
+          console.log(res);
+        });
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .certificate_form {
+    min-height: 500px;
+
+    :deep(.el-form-item) {
+      margin: 16px 0;
+    }
+  }
+</style>

+ 66 - 32
src/views/inspectionWork/index.vue

@@ -43,9 +43,17 @@
         </template>
 
         <template v-slot:sourceCode="{ row }">
-          <div>{{
-            row.qualityPlanCode ? row.qualityPlanCode : row.workOrderCode
-          }}</div>
+          <div>
+            <el-link
+              type="primary"
+              :underline="false"
+              @click="openWorkDetails(row)"
+            >
+              {{
+                row.qualityPlanCode ? row.qualityPlanCode : row.workOrderCode
+              }}</el-link
+            >
+          </div>
         </template>
 
         <template v-slot:files="scope">
@@ -176,11 +184,12 @@
                 @click.native="generateReportApproval(row, item)"
                 >{{ item.name
                 }}{{
-                  '('+
+                  '(' +
                   item.versionSymbol +
                   item.bigVersion +
                   item.versionMark +
-                  item.smallVersion+')'
+                  item.smallVersion +
+                  ')'
                 }}</el-dropdown-item
               >
             </el-dropdown-menu>
@@ -230,8 +239,8 @@
         <template v-slot:templateList="{ row }">
           <div style="width: 250px; max-height: 60px; overflow: auto">
             <el-tag
-              v-for="item in row.templateList"
-              :key="item.inspectionName"
+              v-for="(item, index) in row.templateList"
+              :key="item.inspectionName + index"
               :type="
                 inspectionProjectStatus.find(
                   (ProjectStatus) => ProjectStatus.value == item.status
@@ -293,6 +302,7 @@
       :item="currentItem"
       @reload="search"
     ></component>
+    <mesWorkOrder ref="mesWorkOrderRef"></mesWorkOrder>
   </div>
 </template>
 <script>
@@ -301,6 +311,7 @@
   import addSample from '@/views/sample/sampleRecord/components/addSample.vue';
   import jimureportBrowse from '@/components/jimureport/browseModal.vue';
   import Transfer from './components/transfer.vue';
+  import mesWorkOrder from './components/mesWorkOrder.vue';
   import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
   import inspectionProjectTaskSend from '@/views/inspectionProjectTask/components/inspectionProjectTaskSend.vue';
   import {
@@ -313,6 +324,8 @@
     sampleCollection,
     checkByQualityWorkOrderId
   } from '@/api/inspectionWork';
+  // import { getWorkorderById } from '@/api/inspectionWork';
+
   import { queryTodo } from '@/api/bpm/task';
   import dictMixins from '@/mixins/dictMixins';
   import { getFile } from '@/api/system/file';
@@ -337,7 +350,8 @@
       addSample,
       inspectionProjectTaskSend,
       inspection_report1,
-      inspection_report2
+      inspection_report2,
+      mesWorkOrder
     },
     data() {
       return {
@@ -458,6 +472,20 @@
             width: 120,
             showOverflowTooltip: true
           },
+          {
+            prop: 'inspectionTeamName',
+            label: '送检班组',
+            align: 'center',
+            width: 120,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'createUserName',
+            label: '送检人',
+            align: 'center',
+            width: 120,
+            showOverflowTooltip: true
+          },
           {
             prop: 'specification',
             label: '规格',
@@ -590,8 +618,8 @@
         },
         processSubmitDialogFlag: false,
         rowData: {},
-        typeList: [], //类型列表
-        qualityMode: [], //取样类型
+        // typeList: [], //类型列表
+        // qualityMode: [], //取样类型
         // 状态(0未报工;1已报工;2已关闭;3待取样)
         statusList: [
           {
@@ -627,8 +655,8 @@
       this.requestDict('取样类型');
       this.getCode();
       this.getReportTemplateList();
-      this.getTnspectionPlanType();
-      this.getQualityMethodCode();
+      // this.getTnspectionPlanType();
+      // this.getQualityMethodCode();
     },
     computed: {
       seekList() {
@@ -897,6 +925,12 @@
           query: { id, path: '/inspectionWork', name: '工单' }
         });
       },
+      openWorkDetails(row) {
+        if (row.qualityPlanCode) {
+        } else {
+          this.$refs.mesWorkOrderRef.open(row);
+        }
+      },
       downloadFile(file) {
         getFile({ objectName: file.storePath }, file.name);
       },
@@ -927,26 +961,26 @@
         await closeWork(row);
         this.done();
       },
-      async getTnspectionPlanType() {
-        let res = await getByCode('inspection_plan_type');
-        if (res?.code == 0) {
-          let list = res.data.map((item) => {
-            let key = Object.keys(item)[0];
-            return { value: key, label: item[key] };
-          });
-          this.typeList = list;
-        }
-      },
-      async getQualityMethodCode() {
-        let res = await getByCode('quality_method_code');
-        if (res?.code == 0) {
-          let list = res.data.map((item) => {
-            let key = Object.keys(item)[0];
-            return { value: key, label: item[key] };
-          });
-          this.qualityMode = list;
-        }
-      },
+      // async getTnspectionPlanType() {
+      //   let res = await getByCode('inspection_plan_type');
+      //   if (res?.code == 0) {
+      //     let list = res.data.map((item) => {
+      //       let key = Object.keys(item)[0];
+      //       return { value: key, label: item[key] };
+      //     });
+      //     this.typeList = list;
+      //   }
+      // },
+      // async getQualityMethodCode() {
+      //   let res = await getByCode('quality_method_code');
+      //   if (res?.code == 0) {
+      //     let list = res.data.map((item) => {
+      //       let key = Object.keys(item)[0];
+      //       return { value: key, label: item[key] };
+      //     });
+      //     this.qualityMode = list;
+      //   }
+      // },
       async openTransfer(id) {
         const code = await verificationQualityInspector(id);
         if (code == '-1') {

+ 5 - 1
src/views/recordComponents/plan.vue

@@ -365,7 +365,11 @@
         this.reload(where);
       },
       openEdit(type, row = null) {
-        this.$refs.programRulesDialogRef.open(type, row);
+        this.$refs.programRulesDialogRef.open(
+          type,
+          row,
+          this.getDictCode('记录规则类型', '蒸汽质量检查记录')
+        );
       },
       async deleteRow(id) {
         await recordrulesplanDelete([id]);

+ 6 - 3
src/views/recordComponents/programRulesDialog.vue

@@ -577,6 +577,7 @@
     <selectReleaseRules
       ref="selectReleaseRulesRef"
       @chooseRules="chooseRules"
+      :classify="classify"
     ></selectReleaseRules>
 
     <selectWorkshop
@@ -655,7 +656,6 @@
     productLineName: ''
   };
   export default {
-
     mixins: [dictMixins, tableColumnsMixin],
     components: {
       deptSelect,
@@ -667,6 +667,8 @@
     data() {
       return {
         visible: false,
+        classify: '',
+
         title: '新增记录计划配置',
         activeIndex: 0,
         addForm: JSON.parse(JSON.stringify(formBaseData)),
@@ -905,7 +907,8 @@
     },
     methods: {
       // 外部调用,打开弹窗
-      async open(type, data) {
+      async open(type, data,classify) {
+        this.classify=classify;
         console.log('type data', type, data);
         this.type = type;
         await this.getAllTeamList();
@@ -987,7 +990,7 @@
               }
 
               const body = this.formMateBody();
-              body.planType = 5
+              body.planType = 5;
 
               if (this.type == 'dispatch') {
                 await recordrulesplanManualDispatchOrder(body);