lxf 1 year ago
parent
commit
1d99989652
1 changed files with 40 additions and 0 deletions
  1. 40 0
      src/views/group/purchase/return-goods/index.vue

+ 40 - 0
src/views/group/purchase/return-goods/index.vue

@@ -12,10 +12,25 @@
           text: '发起采购退货',
           action: () => clickInitiateReturn(),
         },
+        {
+          text: '导入采购退货',
+          action: () => clickImport(),
+        },
       ]"
       @get-list="getList"
       @clickReset="clickReset">
     </byTable>
+
+    <el-dialog title="导入采购退货" v-if="openUpload" v-model="openUpload" width="600">
+      <div v-loading="loadingUpload">
+        <el-upload :show-file-list="false" action="##" :http-request="uploadServerLog" :before-upload="handleBeforeUpload">
+          <el-button style="background: #20b2aa; color: #fff; border: 1px solid #20b2aa">上传</el-button>
+        </el-upload>
+        <div style="text-align: center; margin: 10px">
+          <el-button @click="openUpload = false" size="large">关 闭</el-button>
+        </div>
+      </div>
+    </el-dialog>
   </el-card>
 </template>
 
@@ -197,6 +212,31 @@ const clickChange = (item) => {
     },
   });
 };
+const openUpload = ref(false);
+const loadingUpload = ref(false);
+const clickImport = () => {
+  loadingUpload.value = false;
+  openUpload.value = true;
+};
+const handleBeforeUpload = () => {
+  loadingUpload.value = true;
+};
+const uploadServerLog = (params) => {
+  let file = params.file;
+  let formData = new FormData();
+  formData.append("file", file);
+  proxy.postUploadFile("/purchaseReturn/purchaseReturnImport", formData).then(
+    () => {
+      ElMessage({ message: "导入成功", type: "success" });
+      openUpload.value = false;
+      getList();
+    },
+    (err) => {
+      console.log(err);
+      loadingUpload.value = false;
+    }
+  );
+};
 </script>
 
 <style lang="scss" scoped></style>