From 424ec3037c0f56a761121c60678e68c7ed1bc559 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期二, 19 三月 2024 21:06:24 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
Source/UBCS-WEB/src/components/Theme/ThemeImport.vue | 153 ++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 139 insertions(+), 14 deletions(-)
diff --git a/Source/UBCS-WEB/src/components/Theme/ThemeImport.vue b/Source/UBCS-WEB/src/components/Theme/ThemeImport.vue
index 70caaaa..ab91a1c 100644
--- a/Source/UBCS-WEB/src/components/Theme/ThemeImport.vue
+++ b/Source/UBCS-WEB/src/components/Theme/ThemeImport.vue
@@ -1,33 +1,158 @@
<template>
<el-dialog
- title="涓婚搴撳鍏�"
+ title="涓婚搴撳垎绫诲鍏�"
:visible.sync="dialogVisible"
append-to-body
- v-dialogDrag
- ></el-dialog>
+ >
+ <Divider text="瀵煎叆鎻愮ず" left="30px"></Divider>
+ <ul>
+ <li>
+ 1.绾㈣壊瀛椾綋琛ㄧず蹇呰緭椤�
+ </li>
+ <li>
+ 2.鍒嗙被鐨勮矾寰勯渶瑕佺敤#鍒嗛殧
+ </li>
+ <li>
+ 3.姣忔浠呰兘鏈�澶氬鍏�10000鏉℃暟鎹�
+ </li>
+ </ul>
+ <Divider text="excel鏂囦欢锛岄�夋嫨鏂囦欢鍚庝細鑷姩涓婁紶" left="30px"></Divider>
+ <el-upload
+ 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-upload>
+ <template #footer>
+ <el-button
+ type="primary"
+ size="small"
+ @click="downloadTemplateFun"
+ :loading="downloadLoading"
+ >涓嬭浇瀵煎叆妯℃澘</el-button
+ >
+ <el-button size="small" @click="dialogVisible = false">鍏抽棴</el-button>
+ </template>
+ </el-dialog>
</template>
<script>
+import {downloadErrorFile,downloadBatchImportApplyTemplate} from '@/api/template/templateAttr'
+import {getToken} from "@/util/auth";
+import func from "@/util/func";
export default {
name: "ThemeImport",
- props:{
- dialogVisible: {
- get() {
- return this.dialogVisible;
- },
- set(val) {
- this.$emit("update:dialogVisible", val);
- },
+ props: {
+ visible: {
+ type: Boolean,
+ default: false,
+ },
+ codeClassifyOid: {
+ type: String,
+ default: "",
},
},
data(){
return{
-
+ flga:true,
+ pageLoading: null,
+ downloadLoading: false,
+ }
+ },
+ watch:{
+ visible:{
+ handler(newval,oldval){
+ // console.log('newval',newval)
+ }
+ }
+ },
+ computed:{
+ uploadHeaders() {
+ return {
+ "Blade-Auth": "bearer " + getToken(),
+ };
+ },
+ dialogVisible: {
+ get() {
+ return this.visible;
+ },
+ set(val) {
+ this.$emit("update:visible", val);
+ },
+ },
+ },
+ methods:{
+ //鏂囦欢涓婁紶鍓�
+ async beforeUpload(file) {
+ const fileType = file.name.split(".").pop();
+ if (fileType !== "xlsx" && fileType !== "xls") {
+ // 涓婁紶鏍煎紡涓嶇鍚堣姹傦紝鎻愮ず閿欒淇℃伅骞跺彇娑堜笂浼�
+ this.$message.error("鍙厑璁镐笂浼爔lsx銆亁ls鏍煎紡鐨勬枃浠�");
+ return Promise.reject(false);
+ }
+ this.pageLoading = this.$loading({
+ lock: true,
+ text: "鏂囦欢涓婁紶涓�",
+ spinner: "el-icon-loading",
+ background: "rgba(0, 0, 0, 0.7)",
+ });
+ return true;
+ },
+ // 鏂囦欢涓婁紶鎴愬姛
+ onSuccess(resbonse){
+ if (Object.keys(resbonse.data).length === 0) {
+ 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) => {
+ func.downloadFileByBlobHandler(res);
+ });
+ }
+ },
+ //鐐瑰嚮涓嬭浇妯℃澘
+ downloadTemplateFun(){
+ this.downloadLoading = true;
+ downloadBatchImportApplyTemplate({codeClassifyOid: this.codeClassifyOid}).then(res=>{
+ this.$utilFunc.downloadFileByBlob(res.data, "涓婚搴撳垎绫绘ā鏉�.xls");
+ this.downloadLoading = false;
+ }).catch((res)=>{
+ this.$message.warning(res)
+ this.downloadLoading = false;
+ })
+ },
+ //鏂囦欢涓婁紶澶辫触
+ onError(res){
+ this.pageLoading.close();
+ },
+ //鏂囦欢鐘舵�佹敼鍙�
+ uploadChange(file){
+ if (file.status === "success" || file.status === "error") {
+ this.pageLoading.close();
+ }
}
}
}
</script>
-<style scoped>
-
+<style scoped lang="scss">
+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;
+ }
+}
</style>
--
Gitblit v1.9.3