From 1a3807e155537be25c5bc0440778ff1f83fe08cb Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期一, 19 六月 2023 14:51:39 +0800
Subject: [PATCH] Merge branch 'master' of http://dev.vci-tech.com:1065/r/ubcs
---
Source/UBCS-WEB/src/components/BatchImport/index.vue | 103 +++++++++++++++++++++++++++++++++++++++------------
1 files changed, 78 insertions(+), 25 deletions(-)
diff --git a/Source/UBCS-WEB/src/components/BatchImport/index.vue b/Source/UBCS-WEB/src/components/BatchImport/index.vue
index cb6d21f..f9baddc 100644
--- a/Source/UBCS-WEB/src/components/BatchImport/index.vue
+++ b/Source/UBCS-WEB/src/components/BatchImport/index.vue
@@ -2,7 +2,7 @@
<el-dialog :title="title" :visible="visible" append-to-body>
<Divider text="瀵煎叆鎻愮ず" left="30px"></Divider>
<ul>
- <li v-for="(item, index) in tipInfo" :key="index">
+ <li v-for="(item, index) in tipList" :key="index">
{{ item }}
</li>
</ul>
@@ -20,66 +20,119 @@
:action="action"
:before-upload="beforeUpload"
:on-exceed="handleExceed"
+ :headers="uploadHeaders"
+ :on-success="onSuccess"
+ :show-file-list="false"
+ :data="{
+ codeClassifyOid: this.codeClassifyOid,
+ classifyAttr: this.classifyAttr,
+ }"
>
- <el-button size="small" type="primary"><i class="el-icon-upload"></i> 鐐瑰嚮涓婁紶</el-button>
+ <el-button size="small" type="primary"
+ ><i class="el-icon-upload"></i> 鐐瑰嚮涓婁紶</el-button
+ >
</el-upload>
<template #footer>
- <el-button type="primary" size="small" @click="downloadTemplateFun">涓嬭浇瀵煎叆妯℃澘</el-button>
+ <el-button type="primary" size="small" @click="downloadTemplateFun" :loading="downloadLoading"
+ >涓嬭浇瀵煎叆妯℃澘</el-button
+ >
<el-button size="small">鍏抽棴</el-button>
</template>
</el-dialog>
</template>
<script>
-import { downloadTemplate } from '../../api/batchImport/index'
+import { downloadHistoryImportTemplate, downloadErrorFile } from "../../api/batchImport/index";
+import { getToken } from "@/util/auth";
export default {
name: "",
props: {
- title: {
- type: String,
- default: "鎵归噺鐢宠缂栫爜",
- },
- tipInfo: {
- type: Array,
- default: () => [],
- },
visible: {
type: Boolean,
default: false,
},
accept: {
type: String,
- default: '.xlsx, .xls'
+ default: ".xlsx, .xls",
},
codeClassifyOid: {
type: String,
- default: ''
+ default: "535FC9B6-FE27-241F-5FCA-ED4DC17CF95B",
},
- downloadTemplateFun: {
- type: Function
- }
+ type: {
+ type: String,
+ default: "",
+ },
},
data() {
return {
- classType: "classCode",
+ classifyAttr: "id",
+ uploadParams: {},
+ downloadLoading: false
};
},
computed: {
- action() {
- console.log(process, 'process');
- return '/api/ubcs-code/mdmEngineController/mdmEngineController/batchTopImportCode'
- }
+ uploadHeaders() {
+ return {
+ "Blade-Auth": "bearer " + getToken(),
+ };
+ },
},
methods: {
+ getDataByType() {
+ if (this.type === "historyImport") {
+ this.title = "鍘嗗彶鏁版嵁瀵煎叆";
+ this.tipList = [
+ "1.鏍囬甯︿簲瑙掓槦鐨勮〃绀哄叧閿睘鎬э紝甯︽槦鍙疯〃绀哄繀杈撻」",
+ "2.浼佷笟缂栫爜锛岄泦鍥㈢爜鍜岀姸鎬侀兘闇�瑕佸鍏�",
+ "3.姣忔浠呰兘鏈�澶氬鍏�10000鏉℃暟鎹紝濡傛灉鍑洪敊浼氳繑鍥為敊璇殑鏁版嵁鍜屽師鍥狅紝浣嗘槸姝g‘鐨勬暟鎹細淇濆瓨",
+ "4.鍒嗙被鐨勮矾寰勯渶瑕佺敤#鍒嗛殧銆備粎濉啓褰撳墠閫夌殑鍒嗙被鏍戜笂鐨勪笅绾у垎绫荤殑璺緞锛屽鏋滃綋鍓嶅垎绫诲凡缁忔槸鍙跺瓙鑺傜偣锛屽垯涓嶅~鍐�",
+ ];
+ this.action =
+ "/api/ubcs-code/mdmEngineController/batchImportHistoryData";
+ } else if (this.type === "codeApply") {
+ this.title = "鎵归噺缂栫爜鐢宠";
+ this.tipList = [
+ "1.鏍囬甯︿簲瑙掓槦鐨勮〃绀哄叧閿睘鎬э紝甯︽槦鍙疯〃绀哄繀杈撻」",
+ "2.鍒嗙被鐨勮矾寰勯渶瑕佺敤#鍒嗛殧銆備粠褰撳墠閫夋嫨鍒嗙被鑺傜偣鐨勪笅绾у紑濮嬪~鍐欙紝鐩村埌鏈�鏈熬鑺傜偣锛屽 浜у搧#涓绘満浜у搧#涓绘満浜у搧",
+ ];
+ }
+ },
beforeUpload(file) {
- const fileType = file.name.split('.').pop()
- if (fileType !== 'xlsx' && fileType !== 'xls') {
+ const fileType = file.name.split(".").pop();
+ if (fileType !== "xlsx" && fileType !== "xls") {
// 涓婁紶鏍煎紡涓嶇鍚堣姹傦紝鎻愮ず閿欒淇℃伅骞跺彇娑堜笂浼�
- this.$message.error('鍙厑璁镐笂浼爔lsx銆亁ls鏍煎紡鐨勬枃浠�');
+ this.$message.error("鍙厑璁镐笂浼爔lsx銆亁ls鏍煎紡鐨勬枃浠�");
return false;
}
return true;
},
+ // 涓嬭浇瀵煎叆妯℃澘
+ downloadTemplateFun() {
+ this.downloadLoading = true
+ downloadHistoryImportTemplate({
+ codeClassifyOid: "535FC9B6-FE27-241F-5FCA-ED4DC17CF95B",
+ }).then(res => {
+ this.downloadLoading = false
+ console.log(res);
+ }).catch(() => {
+ this.downloadLoading = false
+ });
+ },
+ onSuccess(res) {
+ if (res.code === 400) {
+ this.$message.error(`${res.msg}锛岃涓嬭浇閿欒淇℃伅杩涜鏌ョ湅锛乣)
+ }
+ downloadErrorFile({uuid: res.data.fileOid})
+ }
+ },
+ watch: {
+ visible: {
+ immediate:true,
+ handler() {
+ this.getDataByType();
+ }
+ }
},
};
</script>
--
Gitblit v1.10.0