Ver Fonte

新增工艺文件查看功能并优化收样接口返回处理

yusheng há 6 meses atrás
pai
commit
ef8f37d4c9

+ 16 - 2
src/api/inspectionWork/index.js

@@ -221,9 +221,23 @@ export async function newFilePageAPI(data) {
 //收样
 
 export async function sampleCollection(data) {
-  const res = await request.put(`/qms/quality_work_order/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));
+}
+// 工艺文件
+export async function craftFiles(qualityWorkOrderId) {
+  const res = await request.get(
+    `/qms/quality_work_order/craftFiles/${qualityWorkOrderId}`
+ 
+  );
   if (res.data.code == 0) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
-}
+}

+ 14 - 0
src/views/inspectionProjectRequest/index.vue

@@ -98,6 +98,9 @@
             @click="openTransfer(row)"
             >转派</el-link
           >
+          <el-link v-if="row.qualityWorkOrderId" type="primary" :underline="false" @click="craftFiles(row.qualityWorkOrderId)"
+            >工艺文件</el-link
+          >
           <el-link
             type="danger"
             :underline="false"
@@ -169,6 +172,7 @@
     verificationQualityInspector,
     removeItem
   } from '@/api/inspectionProjectRequest';
+  import { craftFiles } from '@/api/inspectionWork';
   import dictMixins from '@/mixins/dictMixins';
   import { reviewStatus } from '@/enum/dict';
   import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
@@ -509,6 +513,16 @@
           'inspectionProjectRequest'
         );
       },
+      async craftFiles(id) {
+        if (id) {
+          const data = await craftFiles(id);
+          if (data.length) {
+            this.$nextTick(() => {
+              this.$refs.fileListRef.open(data.map((item) => item.id), 'view');
+            });
+          }
+        }
+      },
       async sampleCollection(row) {
         const code = await verificationQualityInspector(row.id);
         if (code == '-1') {

+ 19 - 8
src/views/inspectionProjectTask/index.vue

@@ -31,15 +31,13 @@
         </template>
         <!-- 操作列 -->
         <template v-slot:action="{ row }">
-          <!-- <el-link
+          <el-link
+            v-if="row.qualityWorkOrderId"
             type="primary"
             :underline="false"
-            icon="el-icon-edit"
-            @click="sampleCollection(row)"
-            v-if="row.status == 0"
+            @click="craftFiles(row.qualityWorkOrderId)"
+            >工艺文件</el-link
           >
-            收样
-          </el-link> -->
           <el-link
             type="primary"
             :underline="false"
@@ -57,12 +55,14 @@
       ref="inspectionProjectReportRef"
       @reload="reload"
     />
+    <fileList ref="fileListRef"></fileList>
   </div>
 </template>
 
 <script>
   import search from './components/search.vue';
   import inspectionProjectReport from '@/views/inspectionWork/components/inspectionProjectReport.vue';
+  import fileList from '@/components/addDoc/main.vue';
   import tabMixins from '@/mixins/tableColumnsMixin';
   import {
     getList,
@@ -72,11 +72,13 @@
   } from '@/api/inspectionProjectTask';
   import dictMixins from '@/mixins/dictMixins';
   import { recordingMethodList } from '@/utils/util.js';
+  import { craftFiles } from '@/api/inspectionWork';
 
   export default {
     components: {
       search,
-      inspectionProjectReport
+      inspectionProjectReport,
+      fileList
     },
     mixins: [dictMixins, tabMixins],
     data() {
@@ -300,7 +302,16 @@
       reload(where) {
         this.$refs.table.reload({ page: 1, where: where });
       },
-
+      async craftFiles(id) {
+        if (id) {
+          const data = await craftFiles(id);
+          if (data.length) {
+            this.$nextTick(() => {
+              this.$refs.fileListRef.open(data.map((item) => item.id), 'view');
+            });
+          }
+        }
+      },
       async sampleCollection(row) {
         const code = await verificationQualityInspector(row.id);
         if (code == '-1') {

+ 97 - 0
src/views/inspectionWork/components/fileTableList.vue

@@ -0,0 +1,97 @@
+<template>
+  <div>
+    <ele-pro-table
+      ref="fileTable"
+      :columns="jobColumns1"
+      :datasource="fileTableList"
+      :need-page="false"
+      :immediate="true"
+    >
+      <template v-slot:action="{ row, $index }">
+        <el-link type="primary" @click="fileDetails(row)">预览</el-link>
+      </template>
+    </ele-pro-table>
+  </div>
+</template>
+
+<script>
+  import { newFilePageAPI } from '@/api/inspectionWork';
+  export default {
+    components: {},
+    props: {
+      fileParam: {
+        type: Array
+      }
+    },
+
+    watch: {
+      fileParam: {
+        handler(val) {
+          this.fileParamDatasource(val);
+        },
+        deep: true,
+        immediate: true
+      }
+    },
+
+    data() {
+      return {
+        fileTableList: []
+      };
+    },
+
+    created() {},
+
+    methods: {
+      //工艺文件表格回显
+      fileParamDatasource(fileParam) {
+        let fileId = fileParam.map((item) => item.id).join(',');
+        newFilePageAPI({
+          ids: "'" + fileId + "'"
+        }).then((res) => {
+          this.fileTableList = res;
+        });
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .content_box {
+    width: 100%;
+    margin-top: 12px;
+    max-height: 42vh;
+    overflow-y: scroll;
+  }
+
+  .content_ll_case {
+    display: flex;
+    flex-wrap: wrap;
+    background: #e6f7ff;
+    line-height: 30px;
+  }
+
+  .content_ll {
+    height: 30px;
+    width: 23%;
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+
+    margin: auto;
+
+    .name {
+      color: #000;
+      font-weight: 500;
+      margin-right: 8px;
+    }
+  }
+
+  ::v-deep .el-table--medium .el-table__cell {
+    padding: 4px 0 !important;
+  }
+
+  ::v-deep .el-form-item__content {
+    line-height: 28px !important;
+  }
+</style>

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

@@ -740,7 +740,7 @@
 
         sampleCollection({ id: row.id }).then((res) => {
           this.$message.success('收样成功');
-          this.reload();
+           this.search();
         });
       },
       // 批量关闭