修改导出封装组件

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

View File

@ -96,7 +96,8 @@ export default {
},
//
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);
},
//

View File

@ -101,7 +101,8 @@ export default {
},
//
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.$emit('parentParams',this.imageList);
},

View File

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

View File

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

View File

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

View File

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