From b9b031348b72b9997f44f790a613dcf00766fae0 Mon Sep 17 00:00:00 2001
From: yuxc <653031404@qq.com>
Date: 星期一, 19 六月 2023 17:53:00 +0800
Subject: [PATCH] 1、查询返回的数据类型错误。
---
Source/UBCS-WEB/src/components/BatchImport/index.vue | 172 ++++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 120 insertions(+), 52 deletions(-)
diff --git a/Source/UBCS-WEB/src/components/BatchImport/index.vue b/Source/UBCS-WEB/src/components/BatchImport/index.vue
index cb6d21f..a5bacf6 100644
--- a/Source/UBCS-WEB/src/components/BatchImport/index.vue
+++ b/Source/UBCS-WEB/src/components/BatchImport/index.vue
@@ -1,85 +1,153 @@
<template>
- <el-dialog :title="title" :visible="visible" append-to-body>
- <Divider text="瀵煎叆鎻愮ず" left="30px"></Divider>
- <ul>
- <li v-for="(item, index) in tipInfo" :key="index">
- {{ item }}
- </li>
- </ul>
- <div class="radio_box">
- <span>鍒嗙被鐨勮矾寰勪娇鐢ㄧ殑灞炴��:</span>
- <el-radio-group v-model="classifyAttr">
- <el-radio label="id">鍒嗙被缂栧彿</el-radio>
- <el-radio label="name">鍒嗙被鍚嶇О</el-radio>
- </el-radio-group>
- </div>
- <Divider text="excel鏂囦欢锛岄�夋嫨鏂囦欢鍚庝細鑷姩涓婁紶" left="30px"></Divider>
- <el-upload
- class="upload"
- :accept="accept"
- :action="action"
- :before-upload="beforeUpload"
- :on-exceed="handleExceed"
- >
- <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 size="small">鍏抽棴</el-button>
- </template>
- </el-dialog>
+ <div>
+ <el-dialog :title="title" :visible="visible" append-to-body>
+ <Divider text="瀵煎叆鎻愮ず" left="30px"></Divider>
+ <ul>
+ <li v-for="(item, index) in tipList" :key="index">
+ {{ item }}
+ </li>
+ </ul>
+ <div class="radio_box">
+ <span>鍒嗙被鐨勮矾寰勪娇鐢ㄧ殑灞炴��:</span>
+ <el-radio-group v-model="classifyAttr">
+ <el-radio label="id">鍒嗙被缂栧彿</el-radio>
+ <el-radio label="name">鍒嗙被鍚嶇О</el-radio>
+ </el-radio-group>
+ </div>
+ <Divider text="excel鏂囦欢锛岄�夋嫨鏂囦欢鍚庝細鑷姩涓婁紶" left="30px"></Divider>
+ <el-upload
+ class="upload"
+ :accept="accept"
+ :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-upload>
+ <template #footer>
+ <el-button
+ type="primary"
+ size="small"
+ @click="downloadTemplateFun"
+ :loading="downloadLoading"
+ >涓嬭浇瀵煎叆妯℃澘</el-button
+ >
+ <el-button size="small" @click="visible = false">鍏抽棴</el-button>
+ </template>
+ </el-dialog>
+ <ShowImportData :visible="showVisible" v-if="showVisible"></ShowImportData>
+ </div>
</template>
<script>
-import { downloadTemplate } 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: {
- 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,
+ showVisible: 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.9.3