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

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> <template>
<div> <div>
<template v-for="(item, index) in options"> <template v-for="(item, index) in options">
<template v-if="values.includes(item.value)"> <template v-if="isValueMatch(item)">
<span <span
v-if="item.raw.listClass == 'default' || item.raw.listClass == '' || !isNeedListClass" v-if="item.raw.listClass == 'default' || item.raw.listClass == '' || !isNeedListClass"
:key="item.value" :key="item.value"
@ -24,8 +24,6 @@
</template> </template>
<script> <script>
import { type } from 'jquery';
export default { export default {
name: "DictTag", name: "DictTag",
props: { props: {
@ -44,13 +42,33 @@ export default {
} }
}, },
computed: { computed: {
/** 与字典 option.value 比对时统一为字符串,避免接口数字与字典字符串不一致 */
values() { values() {
if (this.value !== null && typeof this.value !== 'undefined') { if (this.value === null || 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 {
return []; 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> </search-form>
<xd-table <xd-table
ref="refTable"
slot="pageContent" slot="pageContent"
slot-scope="slotProps" slot-scope="slotProps"
:height="(slotProps.contentHeight-50)+'px'" :height="(slotProps.contentHeight-50)+'px'"
@ -70,7 +71,7 @@
v-hasPermi="['emis:emisCountryArea:remove']" v-hasPermi="['emis:emisCountryArea:remove']"
>删除</el-button> >删除</el-button>
</el-col> </el-col>
<!-- <el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
plain plain
@ -79,7 +80,7 @@
@click="handleExport" @click="handleExport"
v-hasPermi="['emis:emisCountryArea:export']" v-hasPermi="['emis:emisCountryArea:export']"
>导出</el-button> >导出</el-button>
</el-col> --> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
@ -148,6 +149,7 @@ export default {
loading: true, loading: true,
// 选中数组 // 选中数组
ids: [], ids: [],
selectedRows: [],
// 非单个禁用 // 非单个禁用
single: true, single: true,
// 非多个禁用 // 非多个禁用
@ -272,6 +274,7 @@ export default {
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id) this.ids = selection.map(item => item.id)
this.selectedRows = selection
this.single = selection.length!==1 this.single = selection.length!==1
this.multiple = !selection.length this.multiple = !selection.length
}, },
@ -355,48 +358,51 @@ export default {
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
// this.download('emis/emisCountryArea/export', { const loadingInstance = this.$loading({
// ...this.queryParams text: '正在导出...'
// }, `emisCountryArea_${new Date().getTime()}.xlsx`) })
const loadingInstance = this.$loading({ if (this.selectedRows.length > 0) {
text: '正在导出...' this.exportData(this.selectedRows, loadingInstance)
}) return
var qParam = {...this.queryParams}; }
qParam.pageNum=1; const qParam = { ...this.queryParams }
qParam.pageSize=5000; qParam.pageNum = 1
qParam.pageSize = 5000
listEmisCountryArea(this.addDateRange(qParam, this.dateTimeRange)).then(response => { listEmisCountryArea(this.addDateRange(qParam, this.dateTimeRange)).then(response => {
this.downloadLoading = false
if (response.code === 200) { if (response.code === 200) {
const curList = response.rows this.exportData(response.rows, loadingInstance)
import('@/vendor/Export2Excel').then(excel => { return
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()
})
} }
}); 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 let index = 0
return jsonData.map(v => filterVal.map(j => { return jsonData.map(v => filterVal.map(j => {
if (j === 'index') { if (j === 'index') {
return ++index return ++index
} }
if (j === 'status') {
var statusStr='xxx'
if(v[j] == 10){
statusStr='xxx'
}
return statusStr;
}
return v[j] return v[j]
})) }))
}, },

View File

@ -50,6 +50,7 @@
</SearchForm> </SearchForm>
<XdTable <XdTable
ref="refTable"
slot="pageContent" slot="pageContent"
slot-scope="slotProps" slot-scope="slotProps"
:height="(slotProps.contentHeight)+'px'" :height="(slotProps.contentHeight)+'px'"
@ -102,7 +103,7 @@
v-hasPermi="['emis:emisDestination:remove']" v-hasPermi="['emis:emisDestination:remove']"
>删除</el-button> >删除</el-button>
</el-col> </el-col>
<!-- <el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
plain plain
@ -111,7 +112,7 @@
@click="handleExport" @click="handleExport"
v-hasPermi="['emis:emisDestination:export']" v-hasPermi="['emis:emisDestination:export']"
>导出</el-button> >导出</el-button>
</el-col> --> </el-col>
<el-button style="margin-right: 5px;" <el-button style="margin-right: 5px;"
type="primary" type="primary"
plain plain
@ -236,6 +237,7 @@ export default {
countryName:null, countryName:null,
// 选中数组 // 选中数组
ids: [], ids: [],
selectedRows: [],
// 非单个禁用 // 非单个禁用
single: true, single: true,
// 非多个禁用 // 非多个禁用
@ -354,6 +356,7 @@ export default {
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id) this.ids = selection.map(item => item.id)
this.selectedRows = selection
this.single = selection.length!==1 this.single = selection.length!==1
this.multiple = !selection.length this.multiple = !selection.length
}, },
@ -413,47 +416,53 @@ export default {
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
// this.download('emis/emisDestination/export', { const loadingInstance = this.$loading({
// ...this.queryParams text: '正在导出...'
// }, `emisDestination_${new Date().getTime()}.xlsx`) })
const loadingInstance = this.$loading({ if (this.selectedRows.length > 0) {
text: '正在导出...' this.exportData(this.selectedRows, loadingInstance)
}) return
var qParam = {...this.queryParams}; }
qParam.pageNum=1; const qParam = { ...this.queryParams }
qParam.pageSize=5000; qParam.pageNum = 1
qParam.pageSize = 5000
listEmisDestination(this.addDateRange(qParam, this.dateTimeRange)).then(response => { listEmisDestination(this.addDateRange(qParam, this.dateTimeRange)).then(response => {
this.downloadLoading = false
if (response.code === 200) { if (response.code === 200) {
const curList = response.rows this.exportData(response.rows, loadingInstance)
import('@/vendor/Export2Excel').then(excel => { return
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()
})
} }
}); 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 let index = 0
return jsonData.map(v => filterVal.map(j => { return jsonData.map(v => filterVal.map(j => {
if (j === 'index') { if (j === 'index') {
return ++index return ++index
} }
if (j === 'status') { if (j === 'status' && (v[j] === 0 || v[j] === 1 || v[j] === '0' || v[j] === '1')) {
var statusStr='xxx' return Number(v[j]) === 1 ? '启用' : '停用'
if(v[j] == 10){
statusStr='xxx'
}
return statusStr;
} }
return v[j] return v[j]
})) }))

View File

@ -46,6 +46,7 @@
:header-cell-style="{ color: '#000', background: '#fff' }" :header-cell-style="{ color: '#000', background: '#fff' }"
--> -->
<xd-table <xd-table
ref="refTable"
slot="pageContent" slot="pageContent"
slot-scope="slotProps" slot-scope="slotProps"
@ -109,6 +110,16 @@
v-hasPermi="['emis:emisRegion:draftSubmitRegion']" v-hasPermi="['emis:emisRegion:draftSubmitRegion']"
>批量导入</el-button> >批量导入</el-button>
</el-col> </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> </el-row>
</div> </div>
@ -172,6 +183,7 @@
<script> <script>
import { listEmisRegion, delEmisRegion} from "@/api/emis/emisRegion"; import { listEmisRegion, delEmisRegion} from "@/api/emis/emisRegion";
import { selectDictLabel } from "@/utils/custom";
import emisRegionForm from '@/views/emis/emisRegion/emisRegionForm'; import emisRegionForm from '@/views/emis/emisRegion/emisRegionForm';
import CountryPicker from '@/views/emis/EmisBaseTools/CountryPicker.vue'; import CountryPicker from '@/views/emis/EmisBaseTools/CountryPicker.vue';
import CountryAreaPicker from '@/views/emis/EmisBaseTools/CountryAreaPicker.vue'; import CountryAreaPicker from '@/views/emis/EmisBaseTools/CountryAreaPicker.vue';
@ -198,6 +210,7 @@ export default {
loading: true, loading: true,
// 选中数组 // 选中数组
ids: [], ids: [],
selectedRows: [],
// 非单个禁用 // 非单个禁用
single: true, single: true,
// 非多个禁用 // 非多个禁用
@ -330,6 +343,7 @@ export default {
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id) this.ids = selection.map(item => item.id)
this.selectedRows = selection
this.single = selection.length!==1 this.single = selection.length!==1
this.multiple = !selection.length this.multiple = !selection.length
}, },
@ -386,47 +400,53 @@ export default {
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
// this.download('emis/emisRegion/export', { const loadingInstance = this.$loading({
// ...this.queryParams text: '正在导出...'
// }, `emisRegion_${new Date().getTime()}.xlsx`) })
const loadingInstance = this.$loading({ if (this.selectedRows.length > 0) {
text: '正在导出...' this.exportData(this.selectedRows, loadingInstance)
}) return
var qParam = {...this.queryParams}; }
qParam.pageNum=1; const qParam = { ...this.queryParams }
qParam.pageSize=5000; qParam.pageNum = 1
qParam.pageSize = 5000
listEmisRegion(this.addDateRange(qParam, this.dateTimeRange)).then(response => { listEmisRegion(this.addDateRange(qParam, this.dateTimeRange)).then(response => {
this.downloadLoading = false
if (response.code === 200) { if (response.code === 200) {
const curList = response.rows this.exportData(response.rows, loadingInstance)
import('@/vendor/Export2Excel').then(excel => { return
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()
})
} }
}); 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 let index = 0
return jsonData.map(v => filterVal.map(j => { return jsonData.map(v => filterVal.map(j => {
if (j === 'index') { if (j === 'index') {
return ++index return ++index
} }
if (j === 'status') { if (j === 'regionType') {
var statusStr='xxx' return selectDictLabel(this.dict.type.emis_region_level_type, v[j])
if(v[j] == 10){
statusStr='xxx'
}
return statusStr;
} }
return v[j] return v[j]
})) }))

View File

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

View File

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

View File

@ -47,6 +47,7 @@
<XdTable <XdTable
ref="refTable"
slot="pageContent" slot="pageContent"
slot-scope="slotProps" slot-scope="slotProps"
:height="(slotProps.contentHeight)+'px'" :height="(slotProps.contentHeight)+'px'"
@ -99,7 +100,7 @@
v-hasPermi="['emis:emisSpecialCalcWeight:remove']" v-hasPermi="['emis:emisSpecialCalcWeight:remove']"
>删除</el-button> >删除</el-button>
</el-col> </el-col>
<!-- <el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
plain plain
@ -108,7 +109,7 @@
@click="handleExport" @click="handleExport"
v-hasPermi="['emis:emisSpecialCalcWeight:export']" v-hasPermi="['emis:emisSpecialCalcWeight:export']"
>导出</el-button> >导出</el-button>
</el-col> --> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
@ -217,6 +218,7 @@ export default {
loading: true, loading: true,
// 选中数组 // 选中数组
ids: [], ids: [],
selectedRows: [],
// 非单个禁用 // 非单个禁用
single: true, single: true,
// 非多个禁用 // 非多个禁用
@ -305,6 +307,7 @@ export default {
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id) this.ids = selection.map(item => item.id)
this.selectedRows = selection
this.single = selection.length!==1 this.single = selection.length!==1
this.multiple = !selection.length this.multiple = !selection.length
}, },
@ -354,47 +357,53 @@ export default {
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
// this.download('emis/emisSpecialCalcWeight/export', { const loadingInstance = this.$loading({
// ...this.queryParams text: '正在导出...'
// }, `emisSpecialCalcWeight_${new Date().getTime()}.xlsx`) })
const loadingInstance = this.$loading({ if (this.selectedRows.length > 0) {
text: '正在导出...' this.exportData(this.selectedRows, loadingInstance)
}) return
var qParam = {...this.queryParams}; }
qParam.pageNum=1; const qParam = { ...this.queryParams }
qParam.pageSize=5000; qParam.pageNum = 1
qParam.pageSize = 5000
listEmisSpecialCalcWeight(this.addDateRange(qParam, this.dateTimeRange)).then(response => { listEmisSpecialCalcWeight(this.addDateRange(qParam, this.dateTimeRange)).then(response => {
this.downloadLoading = false
if (response.code === 200) { if (response.code === 200) {
const curList = response.rows this.exportData(response.rows, loadingInstance)
import('@/vendor/Export2Excel').then(excel => { return
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()
})
} }
}); 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 let index = 0
return jsonData.map(v => filterVal.map(j => { return jsonData.map(v => filterVal.map(j => {
if (j === 'index') { if (j === 'index') {
return ++index return ++index
} }
if (j === 'status') { if (j === 'status' && (v[j] === 0 || v[j] === 1 || v[j] === '0' || v[j] === '1')) {
var statusStr='xxx' return Number(v[j]) === 1 ? '启用' : '停用'
if(v[j] == 10){
statusStr='xxx'
}
return statusStr;
} }
return v[j] return v[j]
})) }))

View File

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