优化导入
This commit is contained in:
parent
c4ff355d1e
commit
c24b7fdfc3
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<slot name="header"></slot>
|
||||
|
||||
<el-dialog v-bind="$attrs" :title="title" v-model="visible" :width="560" destroy-on-close draggable @closed="visible=false">
|
||||
<el-dialog v-bind="$attrs" :title="title" v-model="visible" :width="560" destroy-on-close draggable @closed="closeVisible">
|
||||
<div class="importBody">
|
||||
<el-upload
|
||||
class="upload"
|
||||
@ -26,7 +26,7 @@
|
||||
<div class="el-upload__text">
|
||||
<el-icon class="trueIcon el-icon--upload">
|
||||
<sc-icon-FormXls />
|
||||
<div class="deleteFile" @click="deleteFile"><el-icon class="icon"><el-icon-Close/></el-icon></div>
|
||||
<div class="deleteFile" @click="deleteFile" v-if="!progressTrue"><el-icon class="icon"><el-icon-Close/></el-icon></div>
|
||||
</el-icon>
|
||||
<div class="el-upload__text">{{text}}</div>
|
||||
</div>
|
||||
@ -48,7 +48,7 @@
|
||||
</div>
|
||||
<div class="errText" v-if="errorShow">
|
||||
<div class="deleteErr" @click="errorClick"><el-icon class="icon"><el-icon-Close/></el-icon></div>
|
||||
<el-scrollbar max-height="120px">
|
||||
<el-scrollbar ref="scrollbar" max-height="120px">
|
||||
<div v-for="em in errorList" :key="em">
|
||||
<div :class="em.status==0?'text danger':'text success'" v-html="em.msg"></div>
|
||||
</div>
|
||||
@ -58,8 +58,8 @@
|
||||
</el-upload>
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button @click="visible=false">取 消</el-button>
|
||||
<el-button type="primary" :disabled="!importTrue || progressShow || httpDisabled" @click="save">确定导入</el-button>
|
||||
<el-button @click="closeVisible">取 消</el-button>
|
||||
<el-button type="primary" :disabled="!importTrue || progressTrue || httpDisabled" @click="save">确定导入</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@ -91,6 +91,7 @@ export default {
|
||||
importDis:false,
|
||||
importTrue:false,
|
||||
progressShow:false,
|
||||
progressTrue:false,
|
||||
errorShow:false,
|
||||
importInfo:{},
|
||||
errorList:[],
|
||||
@ -116,13 +117,18 @@ export default {
|
||||
if(this.type == res.data.type){
|
||||
this.importInfo = res.data;
|
||||
this.progressShow = true;
|
||||
this.progressTrue = true;
|
||||
this.importTrue = true;
|
||||
if(res.data.status == 0 || res.data.status == 1){
|
||||
this.errorShow = true;
|
||||
let text = res.data;
|
||||
this.errorList.push(text);
|
||||
|
||||
this.scrollDown();
|
||||
}
|
||||
if(res.data.rate == 100){
|
||||
this.progressShow = false;
|
||||
// this.progressShow = false;
|
||||
this.progressTrue = false;
|
||||
this.$emit('importSuccess');
|
||||
}
|
||||
}
|
||||
@ -153,6 +159,7 @@ export default {
|
||||
this.params = formData;
|
||||
this.importTrue = true;
|
||||
this.importDis = true;
|
||||
this.progressShow = false;
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
@ -161,6 +168,7 @@ export default {
|
||||
this.importTrue = false;
|
||||
setTimeout(()=>{
|
||||
this.importDis = false;
|
||||
this.$emit('importSuccess',{refresh:false});
|
||||
this.errorClick();
|
||||
},100)
|
||||
},
|
||||
@ -168,6 +176,11 @@ export default {
|
||||
this.errorShow= false;
|
||||
this.errorList= []
|
||||
},
|
||||
closeVisible(){
|
||||
this.visible = false;
|
||||
this.progressShow = false;
|
||||
this.importTrue = false;
|
||||
},
|
||||
save(){
|
||||
this.errorClick();
|
||||
this.$emit('parentParams',this.params);
|
||||
@ -179,7 +192,19 @@ export default {
|
||||
// 上传失败
|
||||
handleError(){
|
||||
this.$message.warning('上传失败请重新上传');
|
||||
}
|
||||
},
|
||||
|
||||
scrollDown() {
|
||||
this.$nextTick(() => {
|
||||
const wrap = this.$refs.scrollbar;
|
||||
if(wrap){
|
||||
const e = wrap.$el.querySelector('.el-scrollbar__wrap')
|
||||
if(e){
|
||||
e.scrollTop = e.scrollHeight;
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -237,9 +237,11 @@ export default {
|
||||
this.$message.success('上传成功,开始导入数据');
|
||||
}
|
||||
},
|
||||
importSuccess(){
|
||||
importSuccess(refresh){
|
||||
this.httpDisabled = false;
|
||||
this.$refs.table.refresh()
|
||||
if(!refresh){
|
||||
this.$refs.table.refresh()
|
||||
}
|
||||
},
|
||||
|
||||
//编辑
|
||||
|
||||
@ -178,8 +178,11 @@ export default {
|
||||
this.$message.success('上传成功,开始导入数据');
|
||||
}
|
||||
},
|
||||
importSuccess(){
|
||||
this.$refs.table.refresh()
|
||||
importSuccess(refresh){
|
||||
this.httpDisabled = false;
|
||||
if(!refresh){
|
||||
this.$refs.table.refresh()
|
||||
}
|
||||
},
|
||||
|
||||
//编辑
|
||||
|
||||
@ -223,9 +223,11 @@ export default {
|
||||
this.$message.success('上传成功,开始导入数据');
|
||||
}
|
||||
},
|
||||
importSuccess(){
|
||||
importSuccess(refresh){
|
||||
this.httpDisabled = false;
|
||||
this.$refs.table.refresh()
|
||||
if(!refresh){
|
||||
this.$refs.table.refresh()
|
||||
}
|
||||
},
|
||||
|
||||
//编辑
|
||||
|
||||
@ -179,8 +179,11 @@ export default {
|
||||
this.$message.success('上传成功,开始导入数据');
|
||||
}
|
||||
},
|
||||
importSuccess(){
|
||||
this.$refs.table.refresh()
|
||||
importSuccess(refresh){
|
||||
this.httpDisabled = false;
|
||||
if(!refresh){
|
||||
this.$refs.table.refresh()
|
||||
}
|
||||
},
|
||||
|
||||
//编辑
|
||||
|
||||
@ -282,9 +282,11 @@ export default {
|
||||
this.$message.success('上传成功,开始导入数据');
|
||||
}
|
||||
},
|
||||
importSuccess(){
|
||||
importSuccess(refresh){
|
||||
this.httpDisabled = false;
|
||||
this.$refs.table.refresh()
|
||||
if(!refresh){
|
||||
this.$refs.table.refresh()
|
||||
}
|
||||
},
|
||||
|
||||
//编辑
|
||||
|
||||
@ -178,8 +178,11 @@ export default {
|
||||
this.$message.success('上传成功,开始导入数据');
|
||||
}
|
||||
},
|
||||
importSuccess(){
|
||||
this.$refs.table.refresh()
|
||||
importSuccess(refresh){
|
||||
this.httpDisabled = false;
|
||||
if(!refresh){
|
||||
this.$refs.table.refresh()
|
||||
}
|
||||
},
|
||||
|
||||
//编辑
|
||||
|
||||
@ -178,8 +178,11 @@ export default {
|
||||
this.$message.success('上传成功,开始导入数据');
|
||||
}
|
||||
},
|
||||
importSuccess(){
|
||||
this.$refs.table.refresh()
|
||||
importSuccess(refresh){
|
||||
this.httpDisabled = false;
|
||||
if(!refresh){
|
||||
this.$refs.table.refresh()
|
||||
}
|
||||
},
|
||||
|
||||
//编辑
|
||||
|
||||
@ -114,9 +114,11 @@ export default {
|
||||
this.$message.success('上传成功,开始导入数据');
|
||||
}
|
||||
},
|
||||
importSuccess(){
|
||||
importSuccess(refresh){
|
||||
this.httpDisabled = false;
|
||||
this.$refs.table.refresh()
|
||||
if(!refresh){
|
||||
this.$refs.table.refresh()
|
||||
}
|
||||
},
|
||||
|
||||
//表格选择后回调事件
|
||||
|
||||
@ -131,9 +131,11 @@ export default {
|
||||
this.$message.success('上传成功,开始导入数据');
|
||||
}
|
||||
},
|
||||
importSuccess(){
|
||||
importSuccess(refresh){
|
||||
this.httpDisabled = false;
|
||||
this.$refs.table.refresh()
|
||||
if(!refresh){
|
||||
this.$refs.table.refresh()
|
||||
}
|
||||
},
|
||||
|
||||
//表格选择后回调事件
|
||||
|
||||
@ -109,9 +109,11 @@ export default {
|
||||
this.$message.success('上传成功,开始导入数据');
|
||||
}
|
||||
},
|
||||
importSuccess(){
|
||||
importSuccess(refresh){
|
||||
this.httpDisabled = false;
|
||||
this.$refs.table.refresh()
|
||||
if(!refresh){
|
||||
this.$refs.table.refresh()
|
||||
}
|
||||
},
|
||||
//表格选择后回调事件
|
||||
selectionChange(selection){
|
||||
|
||||
@ -211,9 +211,11 @@ export default {
|
||||
this.$message.success('上传成功,开始导入数据');
|
||||
}
|
||||
},
|
||||
importSuccess(){
|
||||
importSuccess(refresh){
|
||||
this.httpDisabled = false;
|
||||
this.$refs.table.refresh()
|
||||
if(!refresh){
|
||||
this.$refs.table.refresh()
|
||||
}
|
||||
},
|
||||
|
||||
//添加
|
||||
|
||||
@ -285,9 +285,11 @@ export default {
|
||||
this.$message.success('上传成功,开始导入数据');
|
||||
}
|
||||
},
|
||||
importSuccess(){
|
||||
importSuccess(refresh){
|
||||
this.httpDisabled = false;
|
||||
this.$refs.table.refresh()
|
||||
if(!refresh){
|
||||
this.$refs.table.refresh()
|
||||
}
|
||||
},
|
||||
|
||||
//编辑
|
||||
|
||||
@ -247,9 +247,11 @@ export default {
|
||||
this.$message.success('上传成功,开始导入数据');
|
||||
}
|
||||
},
|
||||
importSuccess(){
|
||||
importSuccess(refresh){
|
||||
this.httpDisabled = false;
|
||||
this.$refs.table.refresh()
|
||||
if(!refresh){
|
||||
this.$refs.table.refresh()
|
||||
}
|
||||
},
|
||||
//编辑
|
||||
table_edit(row){
|
||||
|
||||
@ -226,9 +226,11 @@ export default {
|
||||
this.$message.success('上传成功,开始导入数据');
|
||||
}
|
||||
},
|
||||
importSuccess(){
|
||||
importSuccess(refresh){
|
||||
this.httpDisabled = false;
|
||||
this.$refs.table.refresh()
|
||||
if(!refresh){
|
||||
this.$refs.table.refresh()
|
||||
}
|
||||
},
|
||||
|
||||
//编辑
|
||||
|
||||
@ -303,9 +303,11 @@
|
||||
this.$message.success('上传成功,开始导入数据');
|
||||
}
|
||||
},
|
||||
importSuccess(){
|
||||
importSuccess(refresh){
|
||||
this.httpDisabled = false;
|
||||
this.$refs.table.refresh()
|
||||
if(!refresh){
|
||||
this.$refs.table.refresh()
|
||||
}
|
||||
},
|
||||
|
||||
//编辑
|
||||
|
||||
@ -179,8 +179,11 @@ export default {
|
||||
this.$message.success('上传成功,开始导入数据');
|
||||
}
|
||||
},
|
||||
importSuccess(){
|
||||
this.$refs.table.refresh()
|
||||
importSuccess(refresh){
|
||||
this.httpDisabled = false;
|
||||
if(!refresh){
|
||||
this.$refs.table.refresh()
|
||||
}
|
||||
},
|
||||
|
||||
//编辑
|
||||
|
||||
@ -211,13 +211,17 @@ export default {
|
||||
};
|
||||
updateOrAppend(params, 'is_save_repeat', this.importParams.is_save_repeat);
|
||||
|
||||
this.httpDisabled = true;
|
||||
const res = await this.$API.shipment.out.import.post(params);
|
||||
if(res.code == 200){
|
||||
this.$message.success('上传成功,开始导入数据');
|
||||
}
|
||||
},
|
||||
importSuccess(){
|
||||
this.$refs.table.refresh()
|
||||
importSuccess(refresh){
|
||||
this.httpDisabled = false;
|
||||
if(!refresh){
|
||||
this.$refs.table.refresh()
|
||||
}
|
||||
},
|
||||
// 删除
|
||||
batch_del(){
|
||||
|
||||
@ -179,8 +179,11 @@ export default {
|
||||
this.$message.success('上传成功,开始导入数据');
|
||||
}
|
||||
},
|
||||
importSuccess(){
|
||||
this.$refs.table.refresh()
|
||||
importSuccess(refresh){
|
||||
this.httpDisabled = false;
|
||||
if(!refresh){
|
||||
this.$refs.table.refresh()
|
||||
}
|
||||
},
|
||||
|
||||
//编辑
|
||||
|
||||
Loading…
Reference in New Issue
Block a user