From fa4c36d0848b047b853dcea33f1b995a8b9067da Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期五, 19 九月 2025 17:47:42 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
admin/src/components/common/ImportWindow.vue | 70 +++++++++++++++++------------------
1 files changed, 34 insertions(+), 36 deletions(-)
diff --git a/admin/src/components/common/ImportWindow.vue b/admin/src/components/common/ImportWindow.vue
index dda83c8..ed8e4bc 100644
--- a/admin/src/components/common/ImportWindow.vue
+++ b/admin/src/components/common/ImportWindow.vue
@@ -9,33 +9,27 @@
:close-on-press-escape="false"
:show-close="false"
>
- <el-form>
- <el-form-item>
- <el-upload
- drag
- :show-file-list="false"
- action="none"
- accept=".xlsx, .xls"
- :before-upload="handleBeforeUpload"
- >
- <template v-if="form.file == null">
- <i class="el-icon-upload"></i>
- <div class="el-upload__text">灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em></div>
- </template>
- <template v-else>
- <i class="el-icon-files"></i>
- <div class="el-upload__text">{{form.file.name}}<em></em></div>
- </template>
- </el-upload>
- </el-form-item>
- </el-form>
-
+ <el-upload
+ drag
+ :show-file-list="false"
+ action="none"
+ accept=".xlsx"
+ :before-upload="handleBeforeUpload"
+ >
+ <template v-if="form.file == null">
+ <i class="el-icon-upload"></i>
+ <div class="el-upload__text">灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em></div>
+ </template>
+ <template v-else>
+ <i class="el-icon-files"></i>
+ <div class="el-upload__text">{{form.file.name}}<em></em></div>
+ </template>
+ </el-upload>
<div slot="footer" class="import-window__footer">
- <!-- <div class="sync-exists">
+ <div class="sync-exists">
<el-checkbox v-model="form.sync"/><span>鍚屾宸插瓨鍦ㄧ殑鏁版嵁</span>
- </div> -->
+ </div>
<div class="opera">
- <a href=""></a>
<el-button type="text" icon="el-icon-download" @click="downloadTemplate">涓嬭浇妯$増</el-button>
<el-button @click="cancel">{{cancelText}}</el-button>
<el-button type="primary" @click="confirm" :loading="isWorking">{{confirmText}}</el-button>
@@ -46,6 +40,7 @@
<script>
import request from '@/utils/request'
+import { downloadLocalFile } from '@/api/system/common'
export default {
name: 'ImportWindow',
props: {
@@ -58,7 +53,6 @@
type: String,
default: '瀵煎叆'
},
-
// 鍙栨秷鎸夐挳鏂囨
cancelText: {
type: String,
@@ -80,8 +74,7 @@
title: '瀵煎叆鏁版嵁',
form: {
sync: false,
- file: false,
- categoryId: ''
+ file: false
}
}
},
@@ -108,18 +101,19 @@
this.isWorking = true
const param = new FormData()
param.set('file', this.form.file)
+ param.set('sync', this.form.sync)
request.post(this.action, param, {
headers: {
'Content-Type': 'multipart/form-data;charset=UTF-8'
}
})
- .then(() => {
- this.$tip.success('瀵煎叆鎴愬姛')
+ .then(data => {
+ this.$tip.success('瀵煎叆鎴愬姛锛屽叡瀵煎叆' + data + '鏉¤褰�')
this.visible = false
this.$emit('success')
})
.catch(e => {
- // this.$tip.apiFailed(e)
+ this.$tip.apiFailed(e)
})
.finally(() => {
this.isWorking = false
@@ -135,12 +129,16 @@
* 涓嬭浇妯$増
*/
downloadTemplate () {
- const link = document.createElement('a')
- link.setAttribute('download', this.templateName) //涓嬭浇鐨勬枃浠跺悕
- console.log(`${window.location.origin}${process.env.VUE_APP_CONTEXT_PATH}${this.templatePath}`);
- link.href = `${window.location.origin}${process.env.VUE_APP_CONTEXT_PATH}${this.templatePath}` //鏂囦欢url
- link.click()
- // this.$emit('download')
+ downloadLocalFile({
+ path: this.templatePath,
+ name: this.templateName
+ })
+ .then(data => {
+ this.download(data)
+ })
+ .catch(e => {
+ this.$tip.apiFailed(e)
+ })
},
/**
* 鏂囦欢涓婁紶鍓嶅瓨鍌ㄤ笂浼犵殑鏂囦欢
--
Gitblit v1.9.3