Browse Source

申购单详情增加显示附件

lxf 1 year ago
parent
commit
a8e486cc61
1 changed files with 40 additions and 0 deletions
  1. 40 0
      src/components/process/subscribe.vue

+ 40 - 0
src/components/process/subscribe.vue

@@ -37,6 +37,13 @@
           </el-table>
         </div>
       </template>
+      <template #file>
+        <div style="width: 100%">
+          <div v-for="(item, index) in fileList" :key="index">
+            <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="onPreviewFile(item.url)">{{ item.url }}</a>
+          </div>
+        </div>
+      </template>
     </byForm>
 
     <el-dialog title="选择物料" v-if="openMateriel" v-model="openMateriel" width="90%">
@@ -128,6 +135,20 @@ const formConfig = computed(() => {
       type: "slot",
       slotName: "materiel",
     },
+    route.query && route.query.processType == "20"
+      ? {
+          type: "title",
+          title: "附件",
+          label: "",
+        }
+      : {},
+    route.query && route.query.processType == "20"
+      ? {
+          type: "slot",
+          slotName: "file",
+          label: "附件",
+        }
+      : {},
   ];
 });
 const rules = ref({
@@ -184,18 +205,37 @@ const handleSubmit = async (flag) => {
 const getFormData = () => {
   return proxy.deepClone(formData.data);
 };
+const fileList = ref([]);
 watch(
   () => props.queryData,
   (newValue) => {
     formOption.disabled = judgeStatus();
     if (props.queryData && ["10", "20", "30", "40"].includes(route.query.processType)) {
       formData.data = proxy.deepClone(newValue);
+      if (route.query.processType == "20" && formData.data.id) {
+        proxy.post("/fileInfo/getList", { businessIdList: [formData.data.id] }).then((fileObj) => {
+          if (fileObj[formData.data.id] && fileObj[formData.data.id].length > 0) {
+            fileList.value = fileObj[formData.data.id].map((item) => {
+              return {
+                raw: item,
+                name: item.fileName,
+                url: item.fileUrl,
+              };
+            });
+          } else {
+            fileList.value = [];
+          }
+        });
+      }
     }
   },
   {
     deep: true,
   }
 );
+const onPreviewFile = (path) => {
+  window.open(path, "_blank");
+};
 onMounted(() => {
   if (route.query.subscribeStatus) {
     if (subscribeStore().subscribe.list && subscribeStore().subscribe.list.length > 0) {