Procházet zdrojové kódy

优化工艺文件查看功能并支持按分类编码查询

yusheng před 5 měsíci
rodič
revize
dbe1721cd0

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

@@ -217,7 +217,23 @@ export async function newFilePageAPI(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+//获取工艺文件
 
+export async function fileReleaseAPI(data) {
+  const res = await request.post('/fm/file/page', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// export async function craftFiles(data) {
+//   const res = await request.post('/mes/workorder/craftFiles', data);
+
+//   if (res.data.code == 0) {
+//     return res.data.data;
+//   }
+//   return Promise.reject(new Error(res.data.message));
+// }
 //收样
 
 export async function sampleCollection(data) {
@@ -234,7 +250,6 @@ export async function sampleCollection(data) {
 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;

+ 55 - 0
src/components/workList/wokePopup.vue

@@ -0,0 +1,55 @@
+<template>
+  <ele-modal
+    title="工艺文件"
+    :visible.sync="visible"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    :maxable="true"
+    width="80%"
+  >
+    <wokePopupList ref="wokePopupListRef"></wokePopupList>
+    <template slot="footer">
+      <el-button size="mini" @click="handleClose">取 消</el-button>
+      <el-button size="mini" type="primary" @click="handleClose"
+        >确 定</el-button
+      >
+    </template>
+  </ele-modal>
+</template>
+
+<script>
+  import wokePopupList from './wokePopupList.vue';
+
+  export default {
+    components: { wokePopupList },
+    props: {},
+    data() {
+      return {
+        visible: false
+      };
+    },
+
+    watch: {},
+    methods: {
+      open(ids) {
+        this.visible = true;
+        this.$refs.wokePopupListRef.open(ids);
+      },
+
+      openTwo(req) {
+        this.visible = true;
+        this.$nextTick(() => {
+          this.$refs.wokePopupListRef.openTwo(req);
+        });
+      },
+
+      handleClose() {
+        this.visible = false;
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped></style>

+ 120 - 0
src/components/workList/wokePopupList.vue

@@ -0,0 +1,120 @@
+<template>
+  <ele-pro-table ref="fileTable" :columns="jobColumns1" :datasource="workList">
+    <!-- 表头工具栏 -->
+
+    <template v-slot:action="{ row, $index }">
+      <el-link type="primary" @click="browseOpen(row)">详情</el-link>
+    </template>
+  </ele-pro-table>
+</template>
+
+<script>
+  import {
+    newFilePageAPI,
+    fileReleaseAPI
+  } from '@/api/inspectionWork/index.js';
+  import { setFileUrl } from '@/components/addDoc/util.js';
+  export default {
+    components: {},
+    props: {},
+    data() {
+      return {
+        workList: [],
+
+        jobColumns1: [
+          {
+            label: '编码',
+            prop: 'code',
+            width: 180,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'name',
+            label: '文档名称',
+            align: 'center',
+            slot: 'name',
+            showOverflowTooltip: true,
+            minWidth: 200
+          },
+
+          {
+            prop: 'storagePath',
+            label: '文件名称',
+            align: 'center',
+
+            showOverflowTooltip: true,
+            minWidth: 200,
+            formatter: (_row, _column, cellValue) => {
+              return cellValue[0]?.name;
+            }
+          },
+
+          {
+            prop: 'version',
+            label: '版本',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 100
+          },
+
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 260,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true
+          }
+        ]
+      };
+    },
+
+    watch: {},
+    methods: {
+      open(ids) {
+        this.getFilepProcess(ids);
+      },
+
+      openTwo(req) {
+        fileReleaseAPI({
+          fileType: 0,
+          isQueryAll: 1,
+          jobNumber: '',
+          lcyStatus: '3',
+          loginName: '',
+          name: req.productCode,
+          pageNum: 1,
+          size: 10
+        }).then((res) => {
+          console.log(res, '13123131');
+          this.workList = res.list;
+        });
+      },
+      browseOpen(row) {
+        window.open(setFileUrl(row));
+      },
+      async getFilepProcess(ids) {
+        if (!ids.length) {
+          return;
+        }
+        await newFilePageAPI({
+          ids: "'" + ids + "'"
+        }).then((res) => {
+          this.workList = res;
+        });
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped></style>

+ 18 - 18
src/views/inspectionProjectTask/index.vue

@@ -31,11 +31,7 @@
         </template>
         <!-- 操作列 -->
         <template v-slot:action="{ row }">
-          <el-link
-            v-if="row.qualityWorkOrderId"
-            type="primary"
-            :underline="false"
-            @click="craftFiles(row.qualityWorkOrderId)"
+          <el-link type="primary" :underline="false" @click="craftFiles(row)"
             >工艺文件</el-link
           >
           <el-link
@@ -56,6 +52,7 @@
       @reload="reload"
     />
     <fileList ref="fileListRef"></fileList>
+    <wokePopup ref="wokePopupRef"></wokePopup>
   </div>
 </template>
 
@@ -73,12 +70,15 @@
   import dictMixins from '@/mixins/dictMixins';
   import { recordingMethodList } from '@/utils/util.js';
   import { craftFiles } from '@/api/inspectionWork';
+  import wokePopup from '@/components/workList/wokePopup.vue';
+  import { parameterGetByCode } from '@/api/main/index';
 
   export default {
     components: {
       search,
       inspectionProjectReport,
-      fileList
+      fileList,
+      wokePopup
     },
     mixins: [dictMixins, tabMixins],
     data() {
@@ -302,17 +302,17 @@
       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 craftFiles(row) {
+        const res = await parameterGetByCode({
+          code: 'mes_craft_file_by_category_code'
+        });
+        const byCategory = res?.value === '1';
+
+        if (byCategory) {
+          this.$refs.wokePopupRef.openTwo(row);
+        } else{
+          const data =row.qualityWorkOrderId? await craftFiles(row.qualityWorkOrderId):[];
+        this.$refs.wokePopupRef.open(data.map((item) => item.id));
         }
       },
       async sampleCollection(row) {
@@ -336,7 +336,7 @@
         const res = await getById(row.id);
         this.$refs.inspectionProjectReportRef.open(
           {
-            workData: {...res.data,measureUnit:row.sampleMeasureUnit},
+            workData: { ...res.data, measureUnit: row.measureUnit },
             list: res.data.templateList
           },
           type,

+ 19 - 29
src/views/inspectionWork/components/newQualityContentTabs.vue

@@ -603,17 +603,7 @@
       </el-tab-pane>
 
       <el-tab-pane label="工艺文件" name="6">
-        <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>
+        <wokePopupList ref="wokePopupListRef"></wokePopupList>
       </el-tab-pane>
     </el-tabs>
   </el-row>
@@ -621,6 +611,9 @@
 
 <script>
   import inspectionTemplateDialog from '@/views/inspectionTemplate/components/inspectionTemplateDialog.vue';
+  import wokePopupList from '@/components/workList/wokePopupList.vue';
+  import { parameterGetByCode } from '@/api/main/index';
+
   import {
     getDetails,
     getCategoryPackageDisposition
@@ -645,7 +638,8 @@
     mixins: [dictMixins],
 
     components: {
-      inspectionTemplateDialog
+      inspectionTemplateDialog,
+      wokePopupList
     },
     watch: {
       schemeList: {
@@ -853,7 +847,7 @@
             minWidth: 110
           },
 
-                  {
+          {
             prop: 'sampleQuantity',
             label: '样品数',
             showOverflowTooltip: true,
@@ -1397,27 +1391,23 @@
       });
     },
     mounted() {
-      if (this.fileParam.length) {
-        this.fileParamDatasource(this.fileParam);
-      }
+      this.getFileParam();
     },
 
     methods: {
-      //工艺文件表格回显
-      fileParamDatasource(fileParam) {
-        let fileId = fileParam.map((item) => item.id).join(',');
-        newFilePageAPI({
-          // pageNum: 1,
-          // size: 999,
-          // directoryId: null,
-          // lcyStatus: 1,
-          // fileType: 0,
-          // ids: fileId
-          ids: "'" + fileId + "'"
-        }).then((res) => {
-          this.fileTableList = res;
+      async getFileParam() {
+        const res = await parameterGetByCode({
+          code: 'mes_craft_file_by_category_code'
         });
+        const byCategory = res?.value === '1';
+
+        if (byCategory) {
+          this.$refs.wokePopupListRef.openTwo(this.form);
+        } else {
+          this.$refs.wokePopupListRef.open(this.fileParam.map((item) => item.id));
+        }
       },
+
       // 不良类型改变
       badTypeChange(row) {
         row.badTypeName = null;