Просмотр исходного кода

修改检验明细-供应商附件和检验详情的附件

乐菲 6 дней назад
Родитель
Сommit
eefc06b77b

+ 1 - 16
src/views/bulletinBoard/components/queryNew.vue

@@ -763,21 +763,6 @@ export default {
       this.getList();
     },
 
-    // AllConditionReset() {
-    //   /* 0. 先让表格进入“空壳”状态 */
-    //   this.filterAlive = false;
-    //   const tmp = this.queryData; // 暂存
-    //   this.queryData = []; // 强制清空
-    //   this.$nextTick(() => {
-    //     /* 1. 再一次性把列塞回去,配合新的 filterKey */
-    //     this.filterKey++;
-    //     this.queryData = tmp;
-    //     /* 2. 再等 DOM 重建完成再拉数据 */
-    //     this.$nextTick(() => {
-    //       this.getList();
-    //     });
-    //   });
-    // },
     AllConditionReset() {
       /* 0. 先让表格进入“空壳”状态 */
       this.filterAlive = false;
@@ -985,7 +970,7 @@ export default {
       await this.getQueryData();
     },
     handleRefresh() {
-      // 注释掉原来的刷新页面代码,改为初始化所有条件
+      // 初始化所有条件
       location.reload(true);
 
       // 初始化所有条件

+ 1 - 96
src/views/mes/queryManage/queryNew.vue

@@ -742,21 +742,6 @@ export default {
       this.getList();
     },
 
-    // AllConditionReset() {
-    //   /* 0. 先让表格进入“空壳”状态 */
-    //   this.filterAlive = false;
-    //   const tmp = this.queryData; // 暂存
-    //   this.queryData = []; // 强制清空
-    //   this.$nextTick(() => {
-    //     /* 1. 再一次性把列塞回去,配合新的 filterKey */
-    //     this.filterKey++;
-    //     this.queryData = tmp;
-    //     /* 2. 再等 DOM 重建完成再拉数据 */
-    //     this.$nextTick(() => {
-    //       this.getList();
-    //     });
-    //   });
-    // },
     AllConditionReset() {
       /* 0. 先让表格进入“空壳”状态 */
       this.filterAlive = false;
@@ -793,86 +778,6 @@ export default {
       this.getList();
     },
 
-    // async Export() {
-    //   try {
-    //     await this.$confirm("确定导出当前页?", "提示", { type: "warning" });
-    //     setTimeout(() => {
-    //       const xlsxParam = { raw: true };
-    //       const tables = document.getElementById("table_excel");
-    //       const table_book = XLSX.utils.table_to_book(tables, xlsxParam);
-    //       const tableWrite = XLSX.write(table_book, {
-    //         bookType: "xlsx",
-    //         bookSST: true,
-    //         type: "array",
-    //       });
-    //       saveAs(
-    //         new Blob([tableWrite], { type: "application/octet-stream" }),
-    //         `${this.title}.xlsx`
-    //       );
-    //     }, 1000);
-    //   } catch (error) {
-    //     // 忽略取消操作的错误
-    //     if (error !== "cancel") {
-    //       console.error("导出失败:", error);
-    //       this.$message.error("导出失败");
-    //     }
-    //   }
-    // },
-
-    // async Export() {
-    //   try {
-    //     await this.$confirm("确定导出当前页?", "提示", { type: "warning" });
-
-    //     /* 0. 没有数据直接 return */
-    //     if (!this.list || !this.list.length) {
-    //       this.$message.warning("当前无数据可导出");
-    //       return;
-    //     }
-
-    //     /* 1. 拿“要显示的列” => 用户没隐藏的列 */
-    //     const columns = this.queryData.filter((col) => !col.ifHide);
-
-    //     /* 2. 组装表头(中文列名) */
-    //     const header = columns.map((col) => col.columnComment);
-
-    //     /* 3. 组装数据行(与渲染顺序一致) */
-    //     const data = this.list.map((row) =>
-    //       columns.map((col) => {
-    //         const val = row[col.columnComment];
-    //         /* 字典、日期等你想二次格式化可以在这里处理 */
-    //         // if (this.isDict(col.columnComment)) {
-    //         //   return this.getDictLabel(val, col.dictType); // 已有公共方法就复用
-    //         // }
-    //         if (this.isDateTime(col.columnComment)) {
-    //           return this.formatToDateTime(val);
-    //         }
-    //         return val ?? ""; // 空值给空串,避免 undefined 进 Sheet
-    //       })
-    //     );
-
-    //     /* 4. JSON → Sheet → Workbook */
-    //     const ws = XLSX.utils.aoa_to_sheet([header, ...data]);
-    //     const wb = XLSX.utils.book_new();
-    //     XLSX.utils.book_append_sheet(wb, ws, "Sheet1");
-
-    //     /* 5. 写二进制 + 下载 */
-    //     const wbout = XLSX.write(wb, {
-    //       bookType: "xlsx",
-    //       bookSST: true,
-    //       type: "array",
-    //     });
-    //     saveAs(
-    //       new Blob([wbout], { type: "application/octet-stream" }),
-    //       `${this.title}.xlsx`
-    //     );
-    //   } catch (error) {
-    //     if (error !== "cancel") {
-    //       console.error("导出失败:", error);
-    //       this.$message.error("导出失败");
-    //     }
-    //   }
-    // },
-
     async Export() {
       try {
         await this.$confirm("确定导出当前页?", "提示", { type: "warning" });
@@ -1046,7 +951,7 @@ export default {
       await this.getQueryData();
     },
     handleRefresh() {
-      // 注释掉原来的刷新页面代码,改为初始化所有条件
+      // 初始化所有条件
       location.reload(true);
 
       // 初始化所有条件

+ 27 - 1
src/views/wms/quality/iqcInspection/components/InspectDetail.vue

@@ -443,6 +443,17 @@
               />
             </template>
           </el-table-column>
+          <el-table-column label="附件" align="center" width="70">
+            <template slot-scope="scope">
+              <el-button
+                type="text"
+                icon="el-icon-paperclip"
+                size="mini"
+                @click="openRowFile(scope.row)"
+                >查看</el-button
+              >
+            </template>
+          </el-table-column>
         </el-table>
 
         <!-- 表尾 -->
@@ -835,7 +846,15 @@ export default {
           const { id } = cur;
           const item = valueList.find((i) => i.id === id) || {};
           const { maxValue, minValue, standValue, badId } = item;
-          const data = { ...{ maxValue, minValue, standValue, badId }, ...cur };
+          const data = {
+            ...{
+              maxValue,
+              minValue,
+              standValue,
+              badId,
+            },
+            ...cur,
+          };
           if (data.tool === "拉力机") {
             this.handleQualified(data);
           }
@@ -1421,6 +1440,13 @@ export default {
         this.$refs.quadraticElement.open = true;
       }
     },
+    // 直接利用行内 filesList 打开附件弹窗
+    openRowFile(row) {
+      // 把行内附件列表传给弹窗
+      this.$refs.inspectFileUpload.fileList = row.filesList || [];
+      this.$refs.inspectFileUpload.isUploadShow = 9; // 9=仅查看
+      this.$refs.inspectFileUpload.visible = true;
+    },
   },
 };
 </script>

+ 53 - 46
src/views/wms/quality/iqcInspection/components/InspectFileUpload.vue

@@ -16,25 +16,25 @@
         :loading="ensureLoading"
         :disabled="isUploadShow !== -1"
         @click="handelConfirm"
-      >确定</el-button>
+        >确定</el-button
+      >
     </div>
-
   </el-dialog>
 </template>
 
 <script>
-import FileUpload from '@/components/FileUpload/index.vue'
-import { createFileUpload } from '@/api/wms/quality/iqcInspectionExecute'
+import FileUpload from "@/components/FileUpload/index.vue";
+import { createFileUpload } from "@/api/wms/quality/iqcInspectionExecute";
 
 export default {
   components: {
-    FileUpload
+    FileUpload,
   },
   props: {
     processNo: {
       type: String,
-      default: ''
-    }
+      default: "",
+    },
   },
   data() {
     return {
@@ -45,63 +45,70 @@ export default {
       wmsMaterialItemResultId: undefined,
       // 文件列表
       fileList: [],
-      form: {
-      },
-      isUploadShow: '',
+      form: {},
+      isUploadShow: "",
       selectRows: [],
-      rules: {
-      },
-      visible: false
-    }
+      rules: {},
+      visible: false,
+    };
   },
   methods: {
+    // onOpen() {
+    //   this.$nextTick(() => {
+    //     this.$refs.fileUpload.isUploadShow = this.isUploadShow
+    //     this.$refs.fileUpload.fileList = this.fileList
+    //   })
+    // },
     onOpen() {
       this.$nextTick(() => {
-        this.$refs.fileUpload.isUploadShow = this.isUploadShow
-        this.$refs.fileUpload.fileList = this.fileList
-      })
+        // 如果外部已经把 fileList 传进来,就不再调接口
+        if (this.fileList && this.fileList.length) {
+          this.$refs.fileUpload.fileList = this.fileList;
+          this.$refs.fileUpload.isUploadShow = this.isUploadShow;
+          return;
+        }
+        // 否则保持原有逻辑(兼容旧场景)
+        this.$refs.fileUpload.isUploadShow = this.isUploadShow;
+        this.$refs.fileUpload.fileList = this.fileList;
+      });
     },
     close() {
-      this.reset()
-      this.visible = false
+      this.reset();
+      this.visible = false;
     },
     reset() {
       this.form = {
         id: undefined,
         inspectionItemId: undefined,
-        inspectionNo: undefined
-      }
-      this.resetForm('form')
+        inspectionNo: undefined,
+      };
+      this.resetForm("form");
     },
     handelConfirm() {
-      this.fileList = this.$refs.fileUpload.fileList
-      const idList = this.fileList.map(item => {
-        const { url, id } = item
-        return url.fileId === undefined ? id : url.fileId
-      })
+      this.fileList = this.$refs.fileUpload.fileList;
+      const idList = this.fileList.map((item) => {
+        const { url, id } = item;
+        return url.fileId === undefined ? id : url.fileId;
+      });
       const params = {
         wmsIncomingReceiptInspectionId: this.wmsIncomingReceiptInspectionId,
         wmsMaterialItemResultId: this.wmsMaterialItemResultId,
         fileIds: idList,
-        processNo: this.processNo || null
-      }
-      createFileUpload(params).then(res => {
-        this.$modal.msgSuccess('上传成功!')
-        this.visible = false
-        this.fileList = []
-        this.$refs.fileUpload.fileList = res.data
-        this.$emit('uploadComplete')
-      })
-    },
-    queryDetails() {
-
+        processNo: this.processNo || null,
+      };
+      createFileUpload(params).then((res) => {
+        this.$modal.msgSuccess("上传成功!");
+        this.visible = false;
+        this.fileList = [];
+        this.$refs.fileUpload.fileList = res.data;
+        this.$emit("uploadComplete");
+      });
     },
+    queryDetails() {},
     badCodeChange(v) {
-      console.log(v)
-    }
-  }
-}
-
+      console.log(v);
+    },
+  },
+};
 </script>
-  <style>
-  </style>
+<style></style>