增加用户导入
This commit is contained in:
parent
a3a626292e
commit
e85f113865
@ -350,6 +350,20 @@ export default {
|
|||||||
return await http.post(this.url, params);
|
return await http.post(this.url, params);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
template:{
|
||||||
|
url: `${config.API_URL}/user.import.template`,
|
||||||
|
name: "用户资料导入模版",
|
||||||
|
post: async function (params) {
|
||||||
|
return await http.get(this.url,params,{responseType: 'arraybuffer'});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
import:{
|
||||||
|
url: `${config.API_URL}/user.import`,
|
||||||
|
name: "用户资料导入",
|
||||||
|
post: async function (params) {
|
||||||
|
return await http.post(this.url,params,{'Content-Type': 'multipart/form-data'});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
generateRegistration:{
|
generateRegistration:{
|
||||||
url: `${config.API_URL}/generate.registration.challenge`,
|
url: `${config.API_URL}/generate.registration.challenge`,
|
||||||
|
|||||||
@ -44,7 +44,7 @@
|
|||||||
<el-progress class="exportPopover" :text-inside="true" :stroke-width="12" :percentage="importInfo.rate" />
|
<el-progress class="exportPopover" :text-inside="true" :stroke-width="12" :percentage="importInfo.rate" />
|
||||||
</div>
|
</div>
|
||||||
<div class="errText" v-if="errorShow">
|
<div class="errText" v-if="errorShow">
|
||||||
<div class="deleteErr" @click="errorShow=false"><el-icon class="icon"><el-icon-Close/></el-icon></div>
|
<div class="deleteErr" @click="errorClick"><el-icon class="icon"><el-icon-Close/></el-icon></div>
|
||||||
<el-scrollbar max-height="120px">
|
<el-scrollbar max-height="120px">
|
||||||
<p v-for="item in errorList" :key="item">{{item.msg}}</p>
|
<p v-for="item in errorList" :key="item">{{item.msg}}</p>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
@ -66,11 +66,11 @@ export default {
|
|||||||
props:{
|
props:{
|
||||||
size:{type:String, default:'small'},
|
size:{type:String, default:'small'},
|
||||||
title:{type:String, default: ""},
|
title:{type:String, default: ""},
|
||||||
text:{type:String, default: ""}
|
|
||||||
},
|
},
|
||||||
data(){
|
data(){
|
||||||
return{
|
return{
|
||||||
visible: false,
|
visible: false,
|
||||||
|
text:"",
|
||||||
|
|
||||||
oss:{
|
oss:{
|
||||||
host:''
|
host:''
|
||||||
@ -100,7 +100,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
getWsResult(res){
|
getWsResult(res){
|
||||||
if(res.data && (res.data.type == 5)){
|
if(res.data && (res.data.type == 4 || res.data.type == 5)){
|
||||||
this.importInfo = res.data;
|
this.importInfo = res.data;
|
||||||
this.progressShow = true;
|
this.progressShow = true;
|
||||||
if(res.data.status == 0){
|
if(res.data.status == 0){
|
||||||
@ -125,6 +125,7 @@ export default {
|
|||||||
this.$message.warning(`只能选择的excel文件类型`);
|
this.$message.warning(`只能选择的excel文件类型`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
this.text = file.name;
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
async uploadFile({ file }) {
|
async uploadFile({ file }) {
|
||||||
@ -145,9 +146,15 @@ export default {
|
|||||||
this.importTrue = false;
|
this.importTrue = false;
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
this.importDis = false;
|
this.importDis = false;
|
||||||
|
this.errorClick();
|
||||||
},100)
|
},100)
|
||||||
},
|
},
|
||||||
|
errorClick(){
|
||||||
|
this.errorShow= false;
|
||||||
|
this.errorList= []
|
||||||
|
},
|
||||||
save(){
|
save(){
|
||||||
|
this.errorClick();
|
||||||
this.$emit('parentParams',this.params);
|
this.$emit('parentParams',this.params);
|
||||||
},
|
},
|
||||||
// 上传成功
|
// 上传成功
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<el-header>
|
<el-header>
|
||||||
<div class="left-panel">
|
<div class="left-panel">
|
||||||
<el-button type="primary" :size="size" icon="el-icon-plus" @click="add">新增公司</el-button>
|
<el-button type="primary" :size="size" icon="el-icon-plus" @click="add">新增公司</el-button>
|
||||||
<scImport :size="size" title="批量导入公司组织" text="公司表单" @parentParams="importUpload" @importSuccess="importSuccess">
|
<scImport :size="size" title="批量导入公司组织" @parentParams="importUpload" @importSuccess="importSuccess">
|
||||||
<div @click="importTemplate">下载导入模版</div>
|
<div @click="importTemplate">下载导入模版</div>
|
||||||
</scImport>
|
</scImport>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -17,6 +17,9 @@
|
|||||||
<el-button type="danger" plain :size="size" icon="el-icon-delete" :disabled="selection.length==0" @click="batch_del"></el-button>
|
<el-button type="danger" plain :size="size" icon="el-icon-delete" :disabled="selection.length==0" @click="batch_del"></el-button>
|
||||||
<el-button type="primary" plain :size="size" :disabled="selection.length==0" @click="role">分配角色</el-button>
|
<el-button type="primary" plain :size="size" :disabled="selection.length==0" @click="role">分配角色</el-button>
|
||||||
<el-button type="primary" plain :size="size" :disabled="selection.length==0" @click="rePwd">密码重置</el-button>
|
<el-button type="primary" plain :size="size" :disabled="selection.length==0" @click="rePwd">密码重置</el-button>
|
||||||
|
<scImport :size="size" title="批量导入用户" @parentParams="importUpload" @importSuccess="importSuccess">
|
||||||
|
<div @click="importTemplate">下载导入模版</div>
|
||||||
|
</scImport>
|
||||||
</div>
|
</div>
|
||||||
<div class="right-panel">
|
<div class="right-panel">
|
||||||
<div class="right-panel-search">
|
<div class="right-panel-search">
|
||||||
@ -180,6 +183,31 @@
|
|||||||
this.$refs.saveDialog.open()
|
this.$refs.saveDialog.open()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 批量导入
|
||||||
|
async importTemplate() {
|
||||||
|
const res = await this.$API.system.user.template.post();
|
||||||
|
const blob = new Blob([res]);
|
||||||
|
const text = new Date().getTime();
|
||||||
|
const eLink = document.createElement('a');
|
||||||
|
eLink.download = "用户导入模版_"+text+'.xlsx';
|
||||||
|
eLink.style.display = 'none';
|
||||||
|
eLink.href = URL.createObjectURL(blob);
|
||||||
|
document.body.appendChild(eLink);
|
||||||
|
eLink.click();
|
||||||
|
URL.revokeObjectURL(eLink.href);
|
||||||
|
document.body.removeChild(eLink);
|
||||||
|
},
|
||||||
|
async importUpload(params) {
|
||||||
|
const res = await this.$API.system.user.import.post(params);
|
||||||
|
if(res.code == 200){
|
||||||
|
this.$message.success('上传成功,开始导入数据');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
importSuccess(){
|
||||||
|
this.$refs.table.refresh()
|
||||||
|
},
|
||||||
|
|
||||||
//编辑
|
//编辑
|
||||||
table_edit(row){
|
table_edit(row){
|
||||||
this.dialog.save = true
|
this.dialog.save = true
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user