基础管理网点管理等页面导出功能

This commit is contained in:
wuteng 2026-04-01 16:56:01 +08:00
parent d31da35371
commit 0b8c4b597a
8 changed files with 220 additions and 142 deletions

View File

@ -1,7 +1,7 @@
<template>
<div>
<template v-for="(item, index) in options">
<template v-if="values.includes(item.value)">
<template v-if="isValueMatch(item)">
<span
v-if="item.raw.listClass == 'default' || item.raw.listClass == '' || !isNeedListClass"
:key="item.value"
@ -24,8 +24,6 @@
</template>
<script>
import { type } from 'jquery';
export default {
name: "DictTag",
props: {
@ -44,13 +42,33 @@ export default {
}
},
computed: {
/** 与字典 option.value 比对时统一为字符串,避免接口数字与字典字符串不一致 */
values() {
if (this.value !== null && typeof this.value !== 'undefined') {
// return Array.isArray(this.value) ? this.value : [String(this.value)];
return Array.isArray(this.value) ? this.value : this.value?this.value.split(','):[];
} else {
if (this.value === null || this.value === undefined) {
return [];
}
if (Array.isArray(this.value)) {
return this.value.map((v) => String(v));
}
if (typeof this.value === "number" || typeof this.value === "boolean") {
return [String(this.value)];
}
if (typeof this.value === "string") {
if (!this.value) {
return [];
}
return this.value.split(",").map((s) => s.trim()).filter(Boolean);
}
return [String(this.value)];
},
},
methods: {
isValueMatch(item) {
if (!item || this.values.length === 0) {
return false;
}
const opt = String(item.value);
return this.values.some((v) => v === opt);
},
},
};

View File

@ -18,6 +18,7 @@
</search-form>
<xd-table
ref="refTable"
slot="pageContent"
slot-scope="slotProps"
:height="(slotProps.contentHeight-50)+'px'"
@ -70,7 +71,7 @@
v-hasPermi="['emis:emisCountryArea:remove']"
>删除</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-col :span="1.5">
<el-button
type="warning"
plain
@ -79,7 +80,7 @@
@click="handleExport"
v-hasPermi="['emis:emisCountryArea:export']"
>导出</el-button>
</el-col> -->
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
@ -148,6 +149,7 @@ export default {
loading: true,
// 选中数组
ids: [],
selectedRows: [],
// 非单个禁用
single: true,
// 非多个禁用
@ -272,6 +274,7 @@ export default {
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.selectedRows = selection
this.single = selection.length!==1
this.multiple = !selection.length
},
@ -355,48 +358,51 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
// this.download('emis/emisCountryArea/export', {
// ...this.queryParams
// }, `emisCountryArea_${new Date().getTime()}.xlsx`)
const loadingInstance = this.$loading({
text: '正在导出...'
})
var qParam = {...this.queryParams};
qParam.pageNum=1;
qParam.pageSize=5000;
const loadingInstance = this.$loading({
text: '正在导出...'
})
if (this.selectedRows.length > 0) {
this.exportData(this.selectedRows, loadingInstance)
return
}
const qParam = { ...this.queryParams }
qParam.pageNum = 1
qParam.pageSize = 5000
listEmisCountryArea(this.addDateRange(qParam, this.dateTimeRange)).then(response => {
this.downloadLoading = false
listEmisCountryArea(this.addDateRange(qParam, this.dateTimeRange)).then(response => {
if (response.code === 200) {
const curList = response.rows
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['区域序号','区域名称','英文名称','国家编码','国家名称','备注','租户ID','删除标志(0代表存在','创建者','创建时间','更新者','更新时间','创建网点','更新网点',];
const filterVal = ['id','name','nameEn','countryCode','countryName','remark','tenantId','delFlag','createBy','createTime','updateBy','updateTime','createSite','updateSite',];
const data = this.formatJson(filterVal, curList, response.rows)
excel.export_json_to_excel({
header: tHeader,
data,
filename: '国家大区表',
autoWidth: true
})
loadingInstance.close()
})
this.exportData(response.rows, loadingInstance)
return
}
});
loadingInstance.close()
}).catch(() => {
loadingInstance.close()
})
},
formatJson(filterVal, jsonData, resData) {
exportData(selData, loadingInstance) {
const curList = selData || []
import('@/vendor/Export2Excel').then(excel => {
const exportParam = this.$refs.refTable.getExportParam()
const tHeader = exportParam.header
const filterVal = exportParam.filter
const data = this.formatJson(filterVal, curList)
excel.export_json_to_excel({
header: tHeader,
data,
filename: '国家大区表',
autoWidth: true
})
loadingInstance.close()
}).catch(() => {
loadingInstance.close()
})
},
formatJson(filterVal, jsonData) {
let index = 0
return jsonData.map(v => filterVal.map(j => {
if (j === 'index') {
return ++index
}
if (j === 'status') {
var statusStr='xxx'
if(v[j] == 10){
statusStr='xxx'
}
return statusStr;
}
return v[j]
}))
},

View File

@ -50,6 +50,7 @@
</SearchForm>
<XdTable
ref="refTable"
slot="pageContent"
slot-scope="slotProps"
:height="(slotProps.contentHeight)+'px'"
@ -102,7 +103,7 @@
v-hasPermi="['emis:emisDestination:remove']"
>删除</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-col :span="1.5">
<el-button
type="warning"
plain
@ -111,7 +112,7 @@
@click="handleExport"
v-hasPermi="['emis:emisDestination:export']"
>导出</el-button>
</el-col> -->
</el-col>
<el-button style="margin-right: 5px;"
type="primary"
plain
@ -236,6 +237,7 @@ export default {
countryName:null,
// 选中数组
ids: [],
selectedRows: [],
// 非单个禁用
single: true,
// 非多个禁用
@ -354,6 +356,7 @@ export default {
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.selectedRows = selection
this.single = selection.length!==1
this.multiple = !selection.length
},
@ -413,47 +416,53 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
// this.download('emis/emisDestination/export', {
// ...this.queryParams
// }, `emisDestination_${new Date().getTime()}.xlsx`)
const loadingInstance = this.$loading({
text: '正在导出...'
})
var qParam = {...this.queryParams};
qParam.pageNum=1;
qParam.pageSize=5000;
const loadingInstance = this.$loading({
text: '正在导出...'
})
if (this.selectedRows.length > 0) {
this.exportData(this.selectedRows, loadingInstance)
return
}
const qParam = { ...this.queryParams }
qParam.pageNum = 1
qParam.pageSize = 5000
listEmisDestination(this.addDateRange(qParam, this.dateTimeRange)).then(response => {
this.downloadLoading = false
listEmisDestination(this.addDateRange(qParam, this.dateTimeRange)).then(response => {
if (response.code === 200) {
const curList = response.rows
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['序号','目的地编码','目的地名称','英文名称','启用状态','所属国家','所属线路','所属线路名称','服务网点编号','服务网点名称','省','市','区','乡镇','备注','租户ID','删除标志(0代表存在','创建者','创建时间','更新者','更新时间',];
const filterVal = ['id','destCode','destName','destNameEn','status','country','transLineCode','transLine','siteCode','siteName','province','city','county','town','remark','tenantId','delFlag','createBy','createTime','updateBy','updateTime',];
const data = this.formatJson(filterVal, curList, response.rows)
excel.export_json_to_excel({
header: tHeader,
data,
filename: '目的地',
autoWidth: true
})
loadingInstance.close()
})
this.exportData(response.rows, loadingInstance)
return
}
});
loadingInstance.close()
}).catch(() => {
loadingInstance.close()
})
},
formatJson(filterVal, jsonData, resData) {
exportData(selData, loadingInstance) {
const curList = selData || []
import('@/vendor/Export2Excel').then(excel => {
const exportParam = this.$refs.refTable.getExportParam()
const tHeader = exportParam.header
const filterVal = exportParam.filter
const data = this.formatJson(filterVal, curList)
excel.export_json_to_excel({
header: tHeader,
data,
filename: '目的地',
autoWidth: true
})
loadingInstance.close()
}).catch(() => {
loadingInstance.close()
})
},
formatJson(filterVal, jsonData) {
let index = 0
return jsonData.map(v => filterVal.map(j => {
if (j === 'index') {
return ++index
}
if (j === 'status') {
var statusStr='xxx'
if(v[j] == 10){
statusStr='xxx'
}
return statusStr;
if (j === 'status' && (v[j] === 0 || v[j] === 1 || v[j] === '0' || v[j] === '1')) {
return Number(v[j]) === 1 ? '启用' : '停用'
}
return v[j]
}))

View File

@ -46,6 +46,7 @@
:header-cell-style="{ color: '#000', background: '#fff' }"
-->
<xd-table
ref="refTable"
slot="pageContent"
slot-scope="slotProps"
@ -109,6 +110,16 @@
v-hasPermi="['emis:emisRegion:draftSubmitRegion']"
>批量导入</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['emis:emisRegion:export']"
>导出</el-button>
</el-col>
</el-row>
</div>
@ -172,6 +183,7 @@
<script>
import { listEmisRegion, delEmisRegion} from "@/api/emis/emisRegion";
import { selectDictLabel } from "@/utils/custom";
import emisRegionForm from '@/views/emis/emisRegion/emisRegionForm';
import CountryPicker from '@/views/emis/EmisBaseTools/CountryPicker.vue';
import CountryAreaPicker from '@/views/emis/EmisBaseTools/CountryAreaPicker.vue';
@ -198,6 +210,7 @@ export default {
loading: true,
// 选中数组
ids: [],
selectedRows: [],
// 非单个禁用
single: true,
// 非多个禁用
@ -330,6 +343,7 @@ export default {
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.selectedRows = selection
this.single = selection.length!==1
this.multiple = !selection.length
},
@ -386,47 +400,53 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
// this.download('emis/emisRegion/export', {
// ...this.queryParams
// }, `emisRegion_${new Date().getTime()}.xlsx`)
const loadingInstance = this.$loading({
text: '正在导出...'
})
var qParam = {...this.queryParams};
qParam.pageNum=1;
qParam.pageSize=5000;
const loadingInstance = this.$loading({
text: '正在导出...'
})
if (this.selectedRows.length > 0) {
this.exportData(this.selectedRows, loadingInstance)
return
}
const qParam = { ...this.queryParams }
qParam.pageNum = 1
qParam.pageSize = 5000
listEmisRegion(this.addDateRange(qParam, this.dateTimeRange)).then(response => {
this.downloadLoading = false
listEmisRegion(this.addDateRange(qParam, this.dateTimeRange)).then(response => {
if (response.code === 200) {
const curList = response.rows
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['id','代码','区域名称','英文名称','类型','简称','父代码','所属片区id','区域名称','国家代码','国家名称','邮编','显示顺序','备注','租户ID','删除标志(0代表存在','创建者','创建时间','更新者','更新时间','创建网点','更新网点',];
const filterVal = ['id','regionCode','regionName','regionNameEn','regionType','shortName','parentCode','areaId','areaName','countryCode','countryName','zipCode','orderNum','remark','tenantId','delFlag','createBy','createTime','updateBy','updateTime','createSite','updateSite',];
const data = this.formatJson(filterVal, curList, response.rows)
excel.export_json_to_excel({
header: tHeader,
data,
filename: '四级省市区镇表',
autoWidth: true
})
loadingInstance.close()
})
this.exportData(response.rows, loadingInstance)
return
}
});
loadingInstance.close()
}).catch(() => {
loadingInstance.close()
})
},
formatJson(filterVal, jsonData, resData) {
exportData(selData, loadingInstance) {
const curList = selData || []
import('@/vendor/Export2Excel').then(excel => {
const exportParam = this.$refs.refTable.getExportParam()
const tHeader = exportParam.header
const filterVal = exportParam.filter
const data = this.formatJson(filterVal, curList)
excel.export_json_to_excel({
header: tHeader,
data,
filename: '省市区表',
autoWidth: true
})
loadingInstance.close()
}).catch(() => {
loadingInstance.close()
})
},
formatJson(filterVal, jsonData) {
let index = 0
return jsonData.map(v => filterVal.map(j => {
if (j === 'index') {
return ++index
}
if (j === 'status') {
var statusStr='xxx'
if(v[j] == 10){
statusStr='xxx'
}
return statusStr;
if (j === 'regionType') {
return selectDictLabel(this.dict.type.emis_region_level_type, v[j])
}
return v[j]
}))

View File

@ -209,6 +209,7 @@
<script>
import { listEmisRegion, getEmisRegion, delEmisRegion, addEmisRegion, updateEmisRegion } from "@/api/emis/emisRegion";
import { selectDictLabel } from "@/utils/custom";
import emisRegionForm from '@/views/emis/emisRegion/emisRegionForm';
import CountryPicker from '@/views/emis/EmisBaseTools/CountryPicker.vue';
@ -420,6 +421,9 @@ export default {
}
return statusStr;
}
if (j === 'regionType') {
return selectDictLabel(this.dict.type.emis_region_level_type, v[j])
}
return v[j]
}))
},

View File

@ -299,6 +299,7 @@ export default {
loading: true,
// 选中数组
ids: [],
selectedRows: [],
// 非单个禁用
single: true,
// 非多个禁用
@ -494,6 +495,7 @@ export default {
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.selectedRows = selection
this.single = selection.length!==1
this.multiple = !selection.length
},
@ -550,6 +552,10 @@ export default {
const loadingInstance = this.$loading({
text: '正在导出...'
})
if (this.selectedRows.length > 0) {
this.exportData(this.selectedRows, loadingInstance)
return
}
const qParam = { ...this.queryParams }
qParam.pageNum = 1
qParam.pageSize = 5000

View File

@ -47,6 +47,7 @@
<XdTable
ref="refTable"
slot="pageContent"
slot-scope="slotProps"
:height="(slotProps.contentHeight)+'px'"
@ -99,7 +100,7 @@
v-hasPermi="['emis:emisSpecialCalcWeight:remove']"
>删除</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-col :span="1.5">
<el-button
type="warning"
plain
@ -108,7 +109,7 @@
@click="handleExport"
v-hasPermi="['emis:emisSpecialCalcWeight:export']"
>导出</el-button>
</el-col> -->
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
@ -217,6 +218,7 @@ export default {
loading: true,
// 选中数组
ids: [],
selectedRows: [],
// 非单个禁用
single: true,
// 非多个禁用
@ -305,6 +307,7 @@ export default {
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.selectedRows = selection
this.single = selection.length!==1
this.multiple = !selection.length
},
@ -354,47 +357,53 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
// this.download('emis/emisSpecialCalcWeight/export', {
// ...this.queryParams
// }, `emisSpecialCalcWeight_${new Date().getTime()}.xlsx`)
const loadingInstance = this.$loading({
text: '正在导出...'
})
var qParam = {...this.queryParams};
qParam.pageNum=1;
qParam.pageSize=5000;
const loadingInstance = this.$loading({
text: '正在导出...'
})
if (this.selectedRows.length > 0) {
this.exportData(this.selectedRows, loadingInstance)
return
}
const qParam = { ...this.queryParams }
qParam.pageNum = 1
qParam.pageSize = 5000
listEmisSpecialCalcWeight(this.addDateRange(qParam, this.dateTimeRange)).then(response => {
this.downloadLoading = false
listEmisSpecialCalcWeight(this.addDateRange(qParam, this.dateTimeRange)).then(response => {
if (response.code === 200) {
const curList = response.rows
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['序号','产品类型代码','产品类型名称','启用状态','取重方式','起始重量','结束重量','起始时间','结束时间','备注','租户ID','删除标志(0代表存在','创建者','创建时间','更新者','更新时间',];
const filterVal = ['id','prodCode','prodName','status','carryType','beginWeight','endWeight','beginDate','endDate','remark','tenantId','delFlag','createBy','createTime','updateBy','updateTime',];
const data = this.formatJson(filterVal, curList, response.rows)
excel.export_json_to_excel({
header: tHeader,
data,
filename: '特殊取重',
autoWidth: true
})
loadingInstance.close()
})
this.exportData(response.rows, loadingInstance)
return
}
});
loadingInstance.close()
}).catch(() => {
loadingInstance.close()
})
},
formatJson(filterVal, jsonData, resData) {
exportData(selData, loadingInstance) {
const curList = selData || []
import('@/vendor/Export2Excel').then(excel => {
const exportParam = this.$refs.refTable.getExportParam()
const tHeader = exportParam.header
const filterVal = exportParam.filter
const data = this.formatJson(filterVal, curList)
excel.export_json_to_excel({
header: tHeader,
data,
filename: '特殊取重',
autoWidth: true
})
loadingInstance.close()
}).catch(() => {
loadingInstance.close()
})
},
formatJson(filterVal, jsonData) {
let index = 0
return jsonData.map(v => filterVal.map(j => {
if (j === 'index') {
return ++index
}
if (j === 'status') {
var statusStr='xxx'
if(v[j] == 10){
statusStr='xxx'
}
return statusStr;
if (j === 'status' && (v[j] === 0 || v[j] === 1 || v[j] === '0' || v[j] === '1')) {
return Number(v[j]) === 1 ? '启用' : '停用'
}
return v[j]
}))

View File

@ -223,6 +223,7 @@ export default {
loading: true,
// 选中数组
ids: [],
selectedRows: [],
countryName:null,
// 非单个禁用
single: true,
@ -380,6 +381,7 @@ export default {
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.selectedRows = selection
this.single = selection.length!==1
this.multiple = !selection.length
},
@ -443,6 +445,10 @@ export default {
const loadingInstance = this.$loading({
text: '正在导出...'
})
if (this.selectedRows.length > 0) {
this.exportData(this.selectedRows, loadingInstance)
return
}
const qParam = { ...this.queryParams }
qParam.pageNum = 1
qParam.pageSize = 5000