|
@@ -52,22 +52,24 @@
|
|
|
|
|
|
</div>
|
|
|
<div class="fr">
|
|
|
- <!-- <el-upload
|
|
|
+ <el-button size="small" @click="handleDownload" v-if="checkBtnRole('download')">下载导入模板</el-button>
|
|
|
+
|
|
|
+ <el-upload
|
|
|
class="import-btn"
|
|
|
- style="height: 0; width: 0; overflow: hidden;"
|
|
|
- :action="baseURL + 'student/import'"
|
|
|
+ v-if="checkBtnRole('import')"
|
|
|
+ action=""
|
|
|
:http-request="handleImport"
|
|
|
:file-list="importFileList"
|
|
|
- v-if="checkBtnRole('import')"
|
|
|
+ :show-file-list="false"
|
|
|
>
|
|
|
+ <!-- v-if="checkBtnRole('import')" -->
|
|
|
<el-button size="small" type="primary" :loading="importLoading">{{ importLoading ? '导入中...' : '导入' }}</el-button>
|
|
|
</el-upload>
|
|
|
-
|
|
|
+<!--
|
|
|
<el-button size="small" type="primary" @click="handleExport">导出</el-button>
|
|
|
|
|
|
<el-button size="small" type="primary" :loading="importLoading" @click="clickImport">{{ importLoading ? '导入中...' : '导入' }}</el-button>
|
|
|
-
|
|
|
- <el-button size="small" @click="handleDownload" v-if="checkBtnRole('download')">下载导入模板</el-button> -->
|
|
|
+-->
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
@@ -230,7 +232,8 @@
|
|
|
<script>
|
|
|
import {getStockListStock, getDepartmentList, getAccountList, addAccount, editAccount, deleteAccount, getAccountDetail, getRoleList, getMerchantList, changeAccountStatus, resetPassword } from '@/api/setting'
|
|
|
import { getDealerList } from '@/api/common'
|
|
|
-import { findElem, downloadFiles, handleImport } from '@/utils/util'
|
|
|
+import { findElem, downloadFiles, handleImportTwo } from '@/utils/util'
|
|
|
+
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
@@ -718,7 +721,7 @@ export default {
|
|
|
|
|
|
// 下载导入模版
|
|
|
handleDownload() {
|
|
|
- downloadFiles('wechat/enterprise/download');
|
|
|
+ downloadFiles('/admin/user/download');
|
|
|
},
|
|
|
|
|
|
clickImport() {
|
|
@@ -731,18 +734,27 @@ export default {
|
|
|
|
|
|
// 导入
|
|
|
async handleImport(param) {
|
|
|
+ console.log(param);
|
|
|
this.importLoading = true;
|
|
|
const file = param.file;
|
|
|
const formData = new FormData();
|
|
|
formData.append("file", file);
|
|
|
- formData.append("mainDepartmentId", this.selectDepartment.websitId);
|
|
|
- let result = await handleImport('wechat/enterprise/import', formData);
|
|
|
+
|
|
|
+ let result = await handleImportTwo('/admin/user/importUser', formData);
|
|
|
this.importLoading = false;
|
|
|
this.importFileList = [];
|
|
|
- if(result.code == 200) {
|
|
|
+ // console.log(result,999);
|
|
|
+
|
|
|
+ if(result) {
|
|
|
this.$alert(result.message, '导入成功', {
|
|
|
confirmButtonText: '确定'
|
|
|
});
|
|
|
+ let blob = new Blob([result],{type: 'application/vnd.ms-excel,charset=utf-8'})
|
|
|
+ let urll = window.URL.createObjectURL(blob)
|
|
|
+ let link = document.createElement('a')
|
|
|
+ link.download = '导入失败数据.xlsx'
|
|
|
+ link.href = urll
|
|
|
+ link.click()
|
|
|
this.getList();
|
|
|
}else {
|
|
|
this.$alert(result.message, '导入失败', {
|
|
@@ -756,6 +768,10 @@ export default {
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
+.import-btn {
|
|
|
+ display: inline-block;
|
|
|
+ margin-left: 10px;
|
|
|
+}
|
|
|
.app-container {
|
|
|
display: flex;
|
|
|
.tree-container {
|