Browse Source

导出弹窗功能暂存封装

noToken
安虹睿 1 year ago
parent
commit
f2303ae134
  1. 89
      PC/InterFace.Dash/src/components/exportDrop/index.vue
  2. 3
      PC/InterFace.Dash/src/mixins/LoadingMixins.js
  3. 73
      PC/InterFace.Dash/src/mixins/TableHeaderMixins.js
  4. 4
      PC/InterFace.Dash/src/utils/utils.js
  5. 6
      PC/InterFace.Dash/src/views/interfaceBoard/AsnMstr.vue

89
PC/InterFace.Dash/src/components/exportDrop/index.vue

@ -0,0 +1,89 @@
<template>
<div>
<el-dialog
title="导出"
:visible.sync="show"
:append-to-body="true"
:modal-append-to-body="false"
width="800px"
:show-close="true"
@close="close"
>
<div class="formItem">
<span class="title">是否显示明细</span>
<el-radio-group v-model="form.isDetail" >
<el-radio :label="true"></el-radio>
<el-radio :label="false"></el-radio>
</el-radio-group>
</div>
<div class="formItem">
<span class="title">是否冗余主表数据</span>
<el-radio-group v-model="form.isRedundance" >
<el-radio :label="true"></el-radio>
<el-radio :label="false"></el-radio>
</el-radio-group>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="submit('page')">本页导出</el-button>
<el-button
:spinner="'el-icon-loading'"
type="primary"
@click="submit('all')"
>全部导出</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'exportDrop',
props: {
//
isDetail:{
type: Boolean,
default: true,
},
//
isRedundance:{
type: Boolean,
default: true,
},
},
data () {
return {
show:true,
form:{
isDetail:null,
isRedundance:null,
}
}
},
mounted () {
this.form={
isDetail:this.isDetail,
isRedundance:this.isRedundance,
}
},
methods: {
close() {
this.show = false
this.$emit("closeDialog")
},
submit(type){
this.$emit("exportDropSubmit",type,this.form)
}
}
}
</script>
<style lang="scss" scoped>
.formItem{
padding-bottom: 15px;
display: flex;
.title{
width: 180px;
text-align: right;
padding-right: 10px;
}
}
</style>

3
PC/InterFace.Dash/src/mixins/LoadingMixins.js

@ -18,7 +18,8 @@ export const LoadingMixins = {
screenDialog: false, //筛选 screenDialog: false, //筛选
AddNewDialog: false, //选择数据弹出框 AddNewDialog: false, //选择数据弹出框
scanningDialog: false, //扫描 scanningDialog: false, //扫描
importDialog: false, //导出 importDialog: false, //导入
exportDialog: false, //导出
handleFromDialog: false, //执行生成 handleFromDialog: false, //执行生成
}, },
} }

73
PC/InterFace.Dash/src/mixins/TableHeaderMixins.js

@ -30,6 +30,32 @@ export const TableHeaderMixins = {
} }
}, },
methods: { methods: {
// 关闭导出弹窗
closeExportDrop(){
this.displayDialog.exportDialog = false
},
// 导出功能
exportDropSubmit(type,form){
const name = this.$route.meta.title
let _params = {
isRedundance:Boolean(form.isRedundance),
isDetailExport:Boolean(form.isDetail),
userId:JSON.parse(localStorage.getItem("currentUserInfo")).id
}
let _exportUrl = this.URLOption_export ? this.URLOption_export : this.URLOption_base;
let _special = this.URLOption_export ? true : false
let _data = JSON.parse(JSON.stringify(this.PageListParams))
// 全部导出处理
if(type && type == 'all'){ _data.MaxResultCount = this.totalCount}
this.closeExportDrop()
this.Loading.appMainLoading = true
postExport(_params,_data, _exportUrl, _special).then(res => {
this.blob(res, name)//使用前端导出名称
this.Loading.appMainLoading = false
}).catch(err => {
this.Loading.appMainLoading = false
})
},
// 点击常用按钮 // 点击常用按钮
topbutton(val,item) { topbutton(val,item) {
// 更新 // 更新
@ -63,52 +89,7 @@ export const TableHeaderMixins = {
// } // }
// 导出 // 导出
else if (val == 'export') { else if (val == 'export') {
const name = this.$route.meta.title this.displayDialog.exportDialog = true
let _params = {
isRedundance:Boolean(item.isRedundance),
isDetailExport:Boolean(item.isDetailExport),
userId:JSON.parse(localStorage.getItem("currentUserInfo")).id
}
let _exportUrl = this.URLOption_export ? this.URLOption_export : this.URLOption_base;
let _special = this.URLOption_export ? true : false
this.$confirm('您将进行导出操作, 是否继续?', '提示', {
confirmButtonText: '本页导出',
cancelButtonText: '全部导出',
distinguishCancelAndClose: true,
closeOnClickModal: false,
closeOnPressEscape: false,
type: 'warning'
}).then(() => {
// 本页导出
this.Loading.appMainLoading = true
// this.PageListParams.company = window.SITE_CONFIG['company']
// this.PageListParams.function = name
//自定义导出url
// this.PageListParams.route = item.url ? item.url : this.URLOption_base + '/export';
postExport(_params,this.PageListParams, _exportUrl, _special).then(res => {
this.blob(res, name)//使用前端导出名称
this.Loading.appMainLoading = false
}).catch(err => {
this.Loading.appMainLoading = false
})
}).catch((action) => {
if (action === 'cancel') {
// 全部导出
this.Loading.appMainLoading = true
let params = JSON.parse(JSON.stringify(this.PageListParams))
params.MaxResultCount = this.totalCount
this.Loading.appMainLoading = true
// params.company = window.SITE_CONFIG['company']
// params.route = this.URLOption_base + '/export'
// params.function = name
postExport(_params,params, _exportUrl, _special).then(res => {
this.blob(res, name)//使用前端导出名称
this.Loading.appMainLoading = false
}).catch(err => {
this.Loading.appMainLoading = false
})
}
});
} }
// 导入 // 导入
else if (val == 'import') { else if (val == 'import') {

4
PC/InterFace.Dash/src/utils/utils.js

@ -54,7 +54,8 @@ import currenDrawer from "@/components/commonTabel-drawer"; //抽屉
import currenButton from "@/components/currenButton" //按钮 import currenButton from "@/components/currenButton" //按钮
import currenTable from "@/components/currenTable" //table import currenTable from "@/components/currenTable" //table
import tablePagination from "@/components/tablePagination"; //第一视图集成 import tablePagination from "@/components/tablePagination"; //第一视图集成
import importFile from "@/components/importFile" //导出 import importFile from "@/components/importFile" //导入
import exportDrop from "@/components/exportDrop" //导出
import pagination from "@/components/Pagination" //分页器 import pagination from "@/components/Pagination" //分页器
import conditionFilters from "@/components/conditionFilters" //高级筛选 import conditionFilters from "@/components/conditionFilters" //高级筛选
import searchPage from '@/components/searchPage' //autocomplete拉取数据探弹窗 import searchPage from '@/components/searchPage' //autocomplete拉取数据探弹窗
@ -108,6 +109,7 @@ Vue.component('currenButton', currenButton)
Vue.component('currenTable', currenTable) Vue.component('currenTable', currenTable)
Vue.component('tablePagination', tablePagination) Vue.component('tablePagination', tablePagination)
Vue.component('importFile', importFile) Vue.component('importFile', importFile)
Vue.component('exportDrop', exportDrop)
Vue.component('pagination', pagination) Vue.component('pagination', pagination)
Vue.component('conditionFilters', conditionFilters) Vue.component('conditionFilters', conditionFilters)
Vue.component('searchPage', searchPage) Vue.component('searchPage', searchPage)

6
PC/InterFace.Dash/src/views/interfaceBoard/AsnMstr.vue

@ -50,6 +50,12 @@
:parentColumns="apiColumns_Table" :parentColumns="apiColumns_Table"
@closeDialog="changeFilterForDetailShow" @closeDialog="changeFilterForDetailShow"
></filterForDetailPage> ></filterForDetailPage>
<!-- 导出弹窗 -->
<exportDrop
v-if="displayDialog.exportDialog"
@closeDialog="closeExportDrop"
@exportDropSubmit="exportDropSubmit"
></exportDrop>
</div> </div>
</template> </template>
<script> <script>

Loading…
Cancel
Save