修改导出封装组件

This commit is contained in:
龙运模 2024-07-13 22:08:45 +08:00
parent 88193f9c57
commit bb6c776515
7 changed files with 67 additions and 35 deletions

View File

@ -4,19 +4,24 @@
title="" title=""
trigger="click" trigger="click"
content="" content=""
width="280" width="300"
:visible="exportVisible" v-bind="$attrs"
:visible="show"
> >
<template #reference> <template #reference>
<el-button v-bind="$attrs" :size="size" icon="sc-icon-Download" @click="exportClick">下载</el-button> <el-button :size="size" icon="sc-icon-Download" @click="exportClick">下载</el-button>
</template> </template>
<template #default> <template #default>
<div v-for="item in list" :key="item">
<div v-if="list.length>0 && type == item.type">
<div class="exportHeader"> <div class="exportHeader">
<div class="name">{{info.type_desc}}</div> <div class="name">{{item.type_desc}}</div>
<div class="status" v-if="info.status==0">{{info.msg}}</div> <div class="status" v-if="item.status==0">{{item.msg}}</div>
<div class="finish" v-if="info.status==1"><i class="icon"><sc-icon-Finish/></i> 文件生成完成</div> <div class="finish" v-if="item.status==1"><i class="icon"><sc-icon-Finish/></i> 文件生成完成</div>
</div>
<el-progress class="exportPopover" :text-inside="true" :stroke-width="12" :percentage="item.rate" />
</div>
</div> </div>
<el-progress class="exportPopover" :text-inside="true" :stroke-width="12" :percentage="info.rate" />
</template> </template>
</el-popover> </el-popover>
</template> </template>
@ -26,15 +31,15 @@ export default {
name: "index", name: "index",
props:{ props:{
size:{ type: String, default: "small" }, size:{ type: String, default: "small" },
show:{type:Boolean, default: false},
type:{type: String, default: ""}
},
watch:{
}, },
data(){ data(){
return{ return{
exportVisible:false, list:[{},{},{}],
info:{
name:"",
status:"",
rate:0,
}
} }
}, },
mounted() { mounted() {
@ -44,17 +49,27 @@ export default {
methods:{ methods:{
getWsResult(res){ getWsResult(res){
if(res.data && (res.data.type == 6 || res.data.type == 7 || res.data.type == 8)){ if(res.data && (res.data.type == 6 || res.data.type == 7 || res.data.type == 8)){
if(res.data.status == 0){ let item = {
this.exportVisible = true; type:res.data.type,
type_desc:res.data.type_desc,
msg:res.data.msg,
status:res.data.status,
rate:res.data.rate,
} }
this.info = res.data; if(res.data.type == 6){
this.list[0] = item;
}
if(res.data.type == 7){
this.list[1] = item;
}
if(res.data.type == 8){
this.list[2] = item;
}
this.$emit('updateShow',item);
if(res.data.status==1){ if(res.data.status==1){
this.exportVisible = false;
this.info = {};
this.down(res.data); this.down(res.data);
} }
} }
}, },
down(item){ down(item){
const link = document.createElement('a'); const link = document.createElement('a');
@ -65,10 +80,6 @@ export default {
document.body.removeChild(link); document.body.removeChild(link);
}, },
exportClick(){ exportClick(){
if(this.exportVisible){
this.exportVisible = false;
return
}
this.$emit('exportData'); this.$emit('exportData');
}, },
} }
@ -80,8 +91,8 @@ export default {
font-size: 12px; font-size: 12px;
display: flex;align-items: center;justify-content: space-around; display: flex;align-items: center;justify-content: space-around;
margin-bottom: 6px; margin-bottom: 6px;
.name{width: 60%;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;} .name{width: 50%;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;}
.status{width: 40%;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;} .status{width: 50%;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;}
.finish{ .finish{
display: flex;align-items: center;justify-content: flex-end;color: var(--el-color-success); display: flex;align-items: center;justify-content: flex-end;color: var(--el-color-success);
.icon{width: 14px;height: 14px;margin-right: 4px;} .icon{width: 14px;height: 14px;margin-right: 4px;}

View File

@ -96,7 +96,8 @@ export default {
}, },
// //
handleAvatarSuccess(file){ handleAvatarSuccess(file){
this.imageUrl = file.data.base_url+file.data.filename; // file.data.base_url
this.imageUrl = this.oss.host+'/'+file.data.filename;
this.$emit('parentParams',this.imageUrl); this.$emit('parentParams',this.imageUrl);
}, },
// //

View File

@ -101,7 +101,8 @@ export default {
}, },
// //
handleAvatarSuccess(file){ handleAvatarSuccess(file){
let imageUrl = file.data.base_url+file.data.filename; // file.data.base_url
let imageUrl = this.oss.host+'/'+file.data.filename;
this.imageList.push(imageUrl) this.imageList.push(imageUrl)
this.$emit('parentParams',this.imageList); this.$emit('parentParams',this.imageList);
}, },

View File

@ -36,7 +36,7 @@
</div> </div>
</div> </div>
</template> </template>
<div class="passKeyLogin" @click="passKeyLogin">指纹登录</div> <div class="passKeyLogin" @click="passKeyLogin">passKey登录</div>
</div> </div>
<div class="login_adv__bottom"> <div class="login_adv__bottom">
xwcloud.com 版权所有 © 2023 xwcloud.com 版权所有 © 2023

View File

@ -6,7 +6,7 @@
<el-button type="primary" :size="size" plain @click="importFile">批量导入</el-button> <el-button type="primary" :size="size" plain @click="importFile">批量导入</el-button>
</div> </div>
<div class="right-panel"> <div class="right-panel">
<scExport :size="size" @exportData="exportData"></scExport> <scExport :size="size" @exportData="exportData" @updateShow="exportChangeShow" :show="exportShow" type="6"></scExport>
</div> </div>
</el-header> </el-header>
<el-main class="nopadding"> <el-main class="nopadding">
@ -80,6 +80,7 @@ export default {
column: [], column: [],
}, },
selection: [], selection: [],
exportShow:false,
searchShow:false, searchShow:false,
searchList:[ searchList:[
{name:'开通日期',type:'date',code:'activation_date'}, {name:'开通日期',type:'date',code:'activation_date'},
@ -222,6 +223,12 @@ export default {
delete row.$switch_yx; delete row.$switch_yx;
}, 500); }, 500);
}, },
//
exportChangeShow(e){
if(e.type == 6){
this.exportShow = e.status==0?true:false
}
},
async exportData() { async exportData() {
const res = await this.$API.system.company.export.post(this.params); const res = await this.$API.system.company.export.post(this.params);
if(res.code == 200){ if(res.code == 200){

View File

@ -7,7 +7,7 @@
<div class="searchItem searchBtn"> <div class="searchItem searchBtn">
<el-button :size="size" type="primary" icon="el-icon-search" @click="upSearch">查询</el-button> <el-button :size="size" type="primary" icon="el-icon-search" @click="upSearch">查询</el-button>
<el-button :size="size" type="info" icon="el-icon-RefreshRight" @click="reset">重置</el-button> <el-button :size="size" type="info" icon="el-icon-RefreshRight" @click="reset">重置</el-button>
<scExport :size="size" @exportData="exportData"></scExport> <scExport :size="size" @exportData="exportData" @updateShow="exportChangeShow" :show="exportShow" type="8"></scExport>
</div> </div>
</div> </div>
<scTable ref="table" :apiObj="list.apiObj" :column="list.column" stripe :size="size" highlightCurrentRow @row-click="rowClick"> <scTable ref="table" :apiObj="list.apiObj" :column="list.column" stripe :size="size" highlightCurrentRow @row-click="rowClick">
@ -25,7 +25,6 @@
import info from './info' import info from './info'
export default { export default {
name: 'log',
components: { components: {
info, info,
}, },
@ -42,12 +41,13 @@
apiObj: this.$API.system.log.list, apiObj: this.$API.system.log.list,
column:[] column:[]
}, },
exportShow:false,
searchList:[ searchList:[
{name:'操作日期',type:'date',code:'created_at'}, {name:'操作日期',type:'date',code:'created_at'},
{name:'操作功能',type:'multiple',code:'type', data:[], placeholder:"请选择功能",show:true}, {name:'操作功能',type:'multiple',code:'type', data:[], placeholder:"请选择功能",show:true},
{name:'关键字',type:'text',code:['remark','ip','location','creator_name'],keyword:true,show:true}, {name:'关键字',type:'text',code:['remark','ip','location','creator_name'],keyword:true,show:true},
], ],
params: {} params: {},
} }
}, },
methods: { methods: {
@ -72,6 +72,12 @@
}) })
} }
}, },
//
exportChangeShow(e){
if(e.type == 8){
this.exportShow = e.status==0?true:false
}
},
async exportData() { async exportData() {
const res = await this.$API.system.log.export.post(this.params); const res = await this.$API.system.log.export.post(this.params);
if(res.code == 200){ if(res.code == 200){

View File

@ -20,7 +20,7 @@
</div> </div>
<div class="right-panel"> <div class="right-panel">
<div class="right-panel-search"> <div class="right-panel-search">
<scExport :size="size" @exportData="exportData"></scExport> <scExport :size="size" @exportData="exportData" @updateShow="exportChangeShow" :show="exportShow" type="7"></scExport>
</div> </div>
</div> </div>
</el-header> </el-header>
@ -105,7 +105,7 @@
column:[] column:[]
}, },
selection: [], selection: [],
exportShow:false,
searchShow:false, searchShow:false,
searchList:[ searchList:[
{name:'创建日期',type:'date',code:'activation_date'}, {name:'创建日期',type:'date',code:'activation_date'},
@ -278,6 +278,12 @@
delete row.$switch_yx; delete row.$switch_yx;
}, 500); }, 500);
}, },
//
exportChangeShow(e){
if(e.type == 7){
this.exportShow = e.status==0?true:false
}
},
async exportData() { async exportData() {
const res = await this.$API.system.user.export.post(); const res = await this.$API.system.user.export.post();
if(res.code == 200){ if(res.code == 200){