cz 1 سال پیش
والد
کامیت
facf267598
2فایلهای تغییر یافته به همراه51 افزوده شده و 13 حذف شده
  1. 1 0
      public/index.html
  2. 50 13
      src/views/processApproval/components/WdlyPurchase.vue

+ 1 - 0
public/index.html

@@ -33,6 +33,7 @@
         })(window, document, "https://g.alicdn.com/woodpeckerx/jssdk??wpkReporter.js", "__wpk");
       }
     </script>
+    <script type="text/javascript" src="https://unpkg.com/@dcloudio/uni-webview-js@0.0.3/index.js"></script>
   </head>
   <header>
     

+ 50 - 13
src/views/processApproval/components/WdlyPurchase.vue

@@ -13,6 +13,21 @@
           :rules="rules"
           ref="formDom1"
         >
+          <template #file>
+            <div
+              v-if="formData.data.fileList && formData.data.fileList.length > 0"
+            >
+              <div
+                v-for="(item, index) in formData.data.fileList"
+                :key="index"
+                class="fileItem"
+                @click="handleOpenFile(item)"
+              >
+                {{ item.name }}
+              </div>
+            </div>
+            <div v-else>暂无附件</div>
+          </template>
         </testForm>
       </div>
       <div class="common-process-card" v-show="active == 1">
@@ -69,6 +84,7 @@ const tabsChange = () => {
 const formData = reactive({
   data: {
     purchaseDetailList: [],
+    fileList: [],
   },
 });
 const formDom1 = ref(null);
@@ -303,6 +319,11 @@ const formConfig = reactive([
     itemType: "textarea",
     readonly: true,
   },
+  {
+    type: "slot",
+    label: "附件",
+    slotName: "file",
+  },
 ]);
 const formConfigOne = reactive([
   {
@@ -435,6 +456,7 @@ onMounted(() => {
       for (const key in jsonData) {
         formData.data[key] = jsonData[key];
       }
+
       if (formData.data.supplyId && formData.data.supplyName) {
         proxy
           .post("/supplierInfo/page", {
@@ -472,18 +494,33 @@ onMounted(() => {
       formDom2.value.formDataListShowLabelOne();
     });
 
-  // proxy.post("/fileInfo/getList", { businessIdList: [val] }).then((fileObj) => {
-  //   formData.data.fileList = fileObj[val] || [];
-  //   if (formData.data.fileList && formData.data.fileList.length > 0) {
-  //     fileList.value = formData.data.fileList.map((item) => {
-  //       return {
-  //         raw: item,
-  //         name: item.fileName,
-  //         url: item.fileUrl,
-  //       };
-  //     });
-  //   }
-  // });
+  proxy.post("/fileInfo/getList", { businessIdList: [val] }).then((fileObj) => {
+    formData.data.fileList = fileObj.data[val] || [];
+    if (formData.data.fileList && formData.data.fileList.length > 0) {
+      formData.data.fileList = formData.data.fileList.map((item) => {
+        return {
+          raw: item,
+          name: item.fileName,
+          url: item.fileUrl,
+        };
+      });
+    }
+  });
 });
+
+const handleOpenFile = (item) => {
+  uni.postMessage({
+    data: {
+      url: item.url,
+      name: item.name,
+    },
+  });
+};
 </script>
-<style lang="scss" scoped></style>
+<style lang="scss" scoped>
+.fileItem {
+  cursor: pointer;
+  margin-bottom: 5px;
+  color: #409eff;
+}
+</style>