From b68fe6af98e37409010e16c93f312d825f6276a3 Mon Sep 17 00:00:00 2001 From: wangting <675591594@qq.com> Date: 星期三, 21 六月 2023 15:34:52 +0800 Subject: [PATCH] 附件列表上传、修改 --- Source/UBCS-WEB/src/components/BatchImport/index.vue | 69 ++++++++++++++++++++++++---------- 1 files changed, 48 insertions(+), 21 deletions(-) diff --git a/Source/UBCS-WEB/src/components/BatchImport/index.vue b/Source/UBCS-WEB/src/components/BatchImport/index.vue index f9baddc..3c674f4 100644 --- a/Source/UBCS-WEB/src/components/BatchImport/index.vue +++ b/Source/UBCS-WEB/src/components/BatchImport/index.vue @@ -1,5 +1,11 @@ <template> - <el-dialog :title="title" :visible="visible" append-to-body> + <el-dialog + v-if="dialogVisible" + :title="title" + :visible.sync="dialogVisible" + append-to-body + v-dialogDrag + > <Divider text="瀵煎叆鎻愮ず" left="30px"></Divider> <ul> <li v-for="(item, index) in tipList" :key="index"> @@ -33,19 +39,29 @@ > </el-upload> <template #footer> - <el-button type="primary" size="small" @click="downloadTemplateFun" :loading="downloadLoading" + <el-button + type="primary" + size="small" + @click="downloadTemplateFun" + :loading="downloadLoading" >涓嬭浇瀵煎叆妯℃澘</el-button > - <el-button size="small">鍏抽棴</el-button> + <el-button size="small" @click="visible = false">鍏抽棴</el-button> </template> + <ShowImportData :visible="showVisible" v-if="showVisible"></ShowImportData> </el-dialog> </template> <script> -import { downloadHistoryImportTemplate, downloadErrorFile } from "../../api/batchImport/index"; +import ShowImportData from "./ShowImportData.vue"; +import { + downloadHistoryImportTemplate, + downloadErrorFile, +} from "../../api/batchImport/index"; import { getToken } from "@/util/auth"; export default { - name: "", + name: "BatchImport", + components: { ShowImportData }, props: { visible: { type: Boolean, @@ -57,7 +73,7 @@ }, codeClassifyOid: { type: String, - default: "535FC9B6-FE27-241F-5FCA-ED4DC17CF95B", + default: "", }, type: { type: String, @@ -68,7 +84,8 @@ return { classifyAttr: "id", uploadParams: {}, - downloadLoading: false + downloadLoading: false, + showVisible: false, }; }, computed: { @@ -76,6 +93,14 @@ return { "Blade-Auth": "bearer " + getToken(), }; + }, + dialogVisible: { + get() { + return this.visible; + }, + set(val) { + this.$emit("update:visible", val); + }, }, }, methods: { @@ -109,30 +134,32 @@ }, // 涓嬭浇瀵煎叆妯℃澘 downloadTemplateFun() { - this.downloadLoading = true + this.downloadLoading = true; downloadHistoryImportTemplate({ - codeClassifyOid: "535FC9B6-FE27-241F-5FCA-ED4DC17CF95B", - }).then(res => { - this.downloadLoading = false - console.log(res); - }).catch(() => { - this.downloadLoading = false - }); + codeClassifyOid: this.codeClassifyOid, + }) + .then((res) => { + this.downloadLoading = false; + this.$utilFunc.downloadFileByBlob(res.data, "鍘嗗彶鏁版嵁瀵煎叆妯℃澘.xls"); + }) + .catch(() => { + this.downloadLoading = false; + }); }, onSuccess(res) { if (res.code === 400) { - this.$message.error(`${res.msg}锛岃涓嬭浇閿欒淇℃伅杩涜鏌ョ湅锛乣) + this.$message.error(`${res.msg}锛岃涓嬭浇閿欒淇℃伅杩涜鏌ョ湅锛乣); } - downloadErrorFile({uuid: res.data.fileOid}) - } + downloadErrorFile({ uuid: res.data.fileOid }); + }, }, watch: { visible: { - immediate:true, + immediate: true, handler() { this.getDataByType(); - } - } + }, + }, }, }; </script> -- Gitblit v1.9.3