From 7a29d8642c4b168d3861340b8f8bff28ba7d3af3 Mon Sep 17 00:00:00 2001 From: wangting <675591594@qq.com> Date: 星期一, 15 四月 2024 10:33:50 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/ProjectWeb/src/components/PLT-basic-component/Upload-files.vue | 67 +++++++++++++++++---------------- 1 files changed, 35 insertions(+), 32 deletions(-) diff --git a/Source/ProjectWeb/src/components/PLT-basic-component/Upload-files.vue b/Source/ProjectWeb/src/components/PLT-basic-component/Upload-files.vue index 9e19065..35b1b6d 100644 --- a/Source/ProjectWeb/src/components/PLT-basic-component/Upload-files.vue +++ b/Source/ProjectWeb/src/components/PLT-basic-component/Upload-files.vue @@ -1,10 +1,10 @@ <template> <el-dialog - title="涓婁紶鏂囦欢" :visible.sync="dialogVisible" append-to-body + title="涓婁紶鏂囦欢" > - <Divider text="瀵煎叆鎻愮ず" left="30px"></Divider> + <Divider left="30px" text="瀵煎叆鎻愮ず"></Divider> <ul> <li> 1.绾㈣壊瀛椾綋琛ㄧず蹇呰緭椤� @@ -13,26 +13,27 @@ 2.姣忔浠呰兘鏈�澶氬鍏�10000鏉℃暟鎹� </li> </ul> - <Divider text="excel鏂囦欢锛岄�夋嫨鏂囦欢鍚庝細鑷姩涓婁紶" left="30px"></Divider> + <Divider left="30px" text="excel鏂囦欢锛岄�夋嫨鏂囦欢鍚庝細鑷姩涓婁紶"></Divider> <el-upload + :before-upload="beforeUpload" + :headers="uploadHeaders" + :on-change="uploadChange" + :on-error="onError" + :on-success="onSuccess" + :show-file-list="false" accept=".xlsx, .xls" action="/api/ubcs-code/codeClassify/importClassify" - :on-success="onSuccess" - :on-error="onError" - :headers="uploadHeaders" - :show-file-list="false" - :before-upload="beforeUpload" - :on-change="uploadChange" class="upload-demo"> - <el-button size="small" type="primary" style="margin: 15px 35px">娴忚鏂囦欢</el-button> + <el-button size="small" style="margin: 15px 35px" type="primary">娴忚鏂囦欢</el-button> </el-upload> <template #footer> <el-button - type="primary" - size="small" - @click="downloadTemplateFun" :loading="downloadLoading" - >涓嬭浇瀵煎叆妯℃澘</el-button + size="small" + type="primary" + @click="downloadTemplateFun" + >涓嬭浇瀵煎叆妯℃澘 + </el-button > <el-button size="small" @click="dialogVisible = false">鍏抽棴</el-button> </template> @@ -43,6 +44,7 @@ // import {downloadErrorFile,downloadBatchImportApplyTemplate} from '@/api/template/templateAttr' import {getToken} from "@/util/auth"; import func from "@/util/func"; + export default { name: "Upload-files", props: { @@ -55,21 +57,21 @@ default: "", }, }, - data(){ - return{ - flga:true, + data() { + return { + flga: true, pageLoading: null, downloadLoading: false, } }, - watch:{ - visible:{ - handler(newval,oldval){ + watch: { + visible: { + handler(newval, oldval) { // console.log('newval',newval) } } }, - computed:{ + computed: { uploadHeaders() { return { "Blade-Auth": "bearer " + getToken(), @@ -84,7 +86,7 @@ }, }, }, - methods:{ + methods: { //鏂囦欢涓婁紶鍓� async beforeUpload(file) { const fileType = file.name.split(".").pop(); @@ -102,37 +104,37 @@ return true; }, // 鏂囦欢涓婁紶鎴愬姛 - onSuccess(resbonse){ + onSuccess(resbonse) { if (Object.keys(resbonse.data).length === 0) { - this.$message.success( "涓婁紶鎴愬姛锛�"); + this.$message.success("涓婁紶鎴愬姛锛�"); this.dialogVisible = false; return; } if (resbonse.data.fileOid) { const fileName = resbonse.data.filePath.split("/").pop(); this.$message.error("璇蜂笅杞介敊璇俊鎭枃浠惰繘琛屾煡鐪嬶紒"); - downloadErrorFile({ uuid: resbonse.data.fileOid }).then((res) => { + downloadErrorFile({uuid: resbonse.data.fileOid}).then((res) => { func.downloadFileByBlobHandler(res); }); } }, //鐐瑰嚮涓嬭浇妯℃澘 - downloadTemplateFun(){ + downloadTemplateFun() { this.downloadLoading = true; - downloadBatchImportApplyTemplate({codeClassifyOid: this.codeClassifyOid}).then(res=>{ - this.$utilFunc.downloadFileByBlob(res.data, "妯℃澘鏂囦欢.xls"); + downloadBatchImportApplyTemplate({codeClassifyOid: this.codeClassifyOid}).then(res => { + this.$utilFunc.downloadFileByBlob(res.data, "妯℃澘鏂囦欢.xls"); this.downloadLoading = false; - }).catch((res)=>{ + }).catch((res) => { this.$message.warning(res) this.downloadLoading = false; }) }, //鏂囦欢涓婁紶澶辫触 - onError(res){ + onError(res) { this.pageLoading.close(); }, //鏂囦欢鐘舵�佹敼鍙� - uploadChange(file){ + uploadChange(file) { if (file.status === "success" || file.status === "error") { this.pageLoading.close(); } @@ -141,12 +143,13 @@ } </script> -<style scoped lang="scss"> +<style lang="scss" scoped> ul { color: rgb(188, 188, 188); margin: 20px 0 20px 0; padding: 0 0 0 30px; list-style: none; + li { margin-bottom: 5px; font-size: 13px; -- Gitblit v1.9.3