统计明细导出样式修改

dianlixunjian
滕嵩 2024-07-16 16:01:44 +08:00
parent be954fa96c
commit 9a841ebd0a
3 changed files with 119 additions and 76 deletions

View File

@ -2,11 +2,6 @@
<div> <div>
<BasicTable @register="registerTable"> <BasicTable @register="registerTable">
<template #toolbar> <template #toolbar>
<a-select v-model:value="exportType_mingxi" style="width: 300px">
<a-select-option value="1">无人机发现违法行为情况统计明细表</a-select-option>
<a-select-option value="2">土地卫片新增违法占用耕地情况统计表</a-select-option>
<a-select-option value="3">无人机发现违法行为情况统计表</a-select-option>
</a-select>
<PermissionBtn @btnEvent="buttonClick"></PermissionBtn> <PermissionBtn @btnEvent="buttonClick"></PermissionBtn>
</template> </template>
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
@ -119,6 +114,27 @@
</template> </template>
</BasicTable> </BasicTable>
<a-modal v-model:open="open" title="导出表格类型" :footer="null">
<div v-if="showRecordList">
<a-button class="exportbutton" @click="handleExport('chuantou_execl')">
案件信息execl
</a-button>
<a-button class="exportbutton" @click="handleExport('chuantou_shp')">
图斑信息shp
</a-button>
</div>
<div v-else>
<a-button class="exportbutton" @click="handleExport('mingxi_1')">
无人机发现违法行为情况统计明细表
</a-button>
<a-button class="exportbutton" @click="handleExport('mingxi_2')">
土地卫片新增违法占用耕地情况统计表
</a-button>
<a-button class="exportbutton" @click="handleExport('mingxi_3')">
无人机发现违法行为情况统计表
</a-button>
</div>
</a-modal>
<a-modal <a-modal
v-model:open="showRecordList" v-model:open="showRecordList"
width="1710px" width="1710px"
@ -126,15 +142,10 @@
@ok="handleOk" @ok="handleOk"
> >
<template #closeIcon> <template #closeIcon>
<CloseOutlined id="closeIconButton" @click="handleCloseAllRecordList()" /> <CloseOutlined id="closeIconButton" @click="handleCloseAllRecordList" />
<MinusOutlined id="closeIconButton" @click="handleCloseRecordList()" /> <MinusOutlined id="closeIconButton" @click="handleCloseRecordList" />
<!-- <CloudDownloadOutlined id="closeIconButton" @click="exportList()" /> -->
</template> </template>
<template #footer> <template #footer>
<a-select v-model:value="exportType_chuantou" style="width: 120px">
<a-select-option value="1">案件信息</a-select-option>
<a-select-option value="2">图斑信息</a-select-option>
</a-select>
<a-button type="primary" @click="exportList"> <a-button type="primary" @click="exportList">
<template #icon> <template #icon>
<CloudDownloadOutlined /> <CloudDownloadOutlined />
@ -216,7 +227,6 @@
afterFetch: (res) => {}, afterFetch: (res) => {},
}); });
const printOpen = ref<boolean>(false);
const showRecordList = ref<boolean>(false); const showRecordList = ref<boolean>(false);
// //
@ -318,62 +328,67 @@
} }
// 穿 // 穿
function exportList() { function exportList() {
handleExport(currentListQuery.listQuery, 'chuantou'); open.value = true;
} }
// //
const exportType_mingxi = ref('1'); const open = ref<boolean>(false);
const exportType_chuantou = ref('1');
// //
function handleExport(params, exportType) { function handleExport(exportType) {
delete params.limit;
delete params.page;
let url = ''; let url = '';
let fileName = ''; let fileName = '';
if (exportType == 'mingxi') { let params: any = {};
switch (exportType_mingxi.value) {
case '1': switch (exportType) {
// case 'chuantou_execl':
url = VITE_GLOB_API_URL + '/api/DroneCaseInfoSingle/CaseOffenceToExcel'; // 穿-execl
fileName = '无人机发现违法行为情况统计明细表' + new Date().getTime() + '.xls'; url = VITE_GLOB_API_URL + '/api/DroneCaseInfoSingle/ExprotCaseListByType';
break; fileName =
case '2': '案件信息 ' +
// tablist[activeKey.value].countyname +
url = VITE_GLOB_API_URL + '/api/DroneCaseInfoSingle/CaseOffenceSimpleToExcel'; '_' +
fileName = '土地卫片新增违法占用耕地情况统计表' + new Date().getTime() + '.xls'; tablist[activeKey.value].label +
break; '.xls';
case '3': break;
// case 'chuantou_shp':
url = VITE_GLOB_API_URL + '/api/DroneCaseInfoSingle/CaseOffenceToExcel2'; // 穿-shp
fileName = '无人机发现违法行为情况统计表' + new Date().getTime() + '.xls'; url = VITE_GLOB_API_URL + '/api/DroneCaseInfoSingle/ExportShapefile';
break; fileName =
} '图斑信息 ' +
tablist[activeKey.value].countyname +
'_' +
tablist[activeKey.value].label +
'.shp';
break;
case 'mingxi_1':
//
url = VITE_GLOB_API_URL + '/api/DroneCaseInfoSingle/CaseOffenceToExcel';
fileName = '无人机发现违法行为情况统计明细表' + new Date().getTime() + '.xls';
break;
case 'mingxi_2':
//
url = VITE_GLOB_API_URL + '/api/DroneCaseInfoSingle/CaseOffenceSimpleToExcel';
fileName = '土地卫片新增违法占用耕地情况统计表' + new Date().getTime() + '.xls';
break;
case 'mingxi_3':
//
url = VITE_GLOB_API_URL + '/api/DroneCaseInfoSingle/CaseOffenceSimpleToExcel2';
fileName = '无人机发现违法行为情况统计表' + new Date().getTime() + '.xls';
break;
default:
break;
} }
if (exportType == 'chuantou') {
switch (exportType_chuantou.value) { if (['chuantou_execl', 'chuantou_shp'].includes(exportType)) {
case '1': params = currentListQuery.listQuery;
// 穿-execl delete params.limit;
url = VITE_GLOB_API_URL + '/api/DroneCaseInfoSingle/ExprotCaseListByType'; delete params.page;
fileName = } else {
'案件信息 ' + params = {
tablist[activeKey.value].countyname + startTime: dayjs(searchParams.value?.startTime).startOf('month').format('YYYY-MM-DD'),
'_' + endTime: dayjs(searchParams.value?.endTime).endOf('month').format('YYYY-MM-DD'),
tablist[activeKey.value].label + };
'.xls';
break;
case '2':
// 穿-shp
url = VITE_GLOB_API_URL + '/api/DroneCaseInfoSingle/ExportShapefile';
fileName =
'图斑信息 ' +
tablist[activeKey.value].countyname +
'_' +
tablist[activeKey.value].label +
'.shp';
break;
}
} }
axios({ axios({
@ -399,22 +414,26 @@
const buttonClick = async (type) => { const buttonClick = async (type) => {
switch (type) { switch (type) {
case 'btnExport': case 'btnExport':
let params = { open.value = true;
startTime: dayjs(searchParams.value?.startTime).startOf('month').format('YYYY-MM-DD'), break;
endTime: dayjs(searchParams.value?.endTime).endOf('month').format('YYYY-MM-DD'), default:
};
handleExport(params, 'mingxi');
break; break;
} }
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
#closeIconButton { #closeIconButton {
width: 30px; width: 40px;
height: 40px; height: 50px;
line-height: 40px; line-height: 50px;
float: right; float: right;
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
} }
.exportbutton {
width: 510px;
height: 60px;
margin: 5px;
}
</style> </style>

View File

@ -19,6 +19,16 @@
</template> </template>
</template> </template>
</BasicTable> </BasicTable>
<a-modal v-model:open="open" title="导出文件类型" :footer="null">
<div>
<a-button class="exportbutton" @click="handleExport('excel')">
图斑汇总统计报表execl
</a-button>
<a-button class="exportbutton" @click="handleExport('shp')">
图斑汇总统计信息shp
</a-button>
</div>
</a-modal>
<a-modal <a-modal
style="width: 100vw; top: 0px; left: 0px; margin: 0px; padding: 0px" style="width: 100vw; top: 0px; left: 0px; margin: 0px; padding: 0px"
wrap-class-name="full-modal" wrap-class-name="full-modal"
@ -84,19 +94,27 @@
}); });
// //
function handleExport() { function handleExport(exportType) {
let params = { ...searchParams.value }; let params = { ...searchParams.value };
let url = '';
let fileName = '';
if (exportType == 'excel') {
url = VITE_GLOB_API_URL + '/api/DroneCaseInfoSingle/ExportCaseInfoTuBanList';
fileName = '图斑汇总统计报表' + new Date().getTime() + '.xls';
} else if (exportType == 'shp') {
url = VITE_GLOB_API_URL + '/api/DroneCaseInfoSingle/ExportCaseInfoTuBanList';
fileName = '图斑汇总统计信息' + new Date().getTime() + '.shp';
return;
}
axios({ axios({
method: 'post', method: 'post',
url: VITE_GLOB_API_URL + '/api/DroneCaseInfoSingle/ExportCaseInfoTuBanList', url: url,
params: params, params: params,
headers: { headers: {
'X-Token': localStorage.getItem('X-Token'), 'X-Token': localStorage.getItem('X-Token'),
}, },
responseType: 'blob', responseType: 'blob',
}).then((res) => { }).then((res) => {
console.log('excel', res);
let fileName = '图斑汇总统计报表' + new Date().getTime() + '.xls';
const elink = document.createElement('a'); const elink = document.createElement('a');
elink.download = fileName; elink.download = fileName;
elink.style.display = 'none'; elink.style.display = 'none';
@ -108,10 +126,11 @@
}); });
} }
const open = ref<boolean>(false);
function onBtnClicked(domId) { function onBtnClicked(domId) {
switch (domId) { switch (domId) {
case 'btnExport': case 'btnExport':
handleExport(); open.value = true;
break; break;
default: default:
break; break;
@ -165,4 +184,9 @@
flex: 1; flex: 1;
} }
} }
.exportbutton {
width: 510px;
height: 60px;
margin: 5px;
}
</style> </style>

View File

@ -164,8 +164,8 @@ export const searchFormSchema: FormSchema[] = [
colProps: { span: 4 }, colProps: { span: 4 },
componentProps: { componentProps: {
options: [ options: [
{ label: '拆除复耕', value: '拆除复耕' }, { label: '拆除复耕', value: '0' },
{ label: '补办手续', value: '补办手续' }, { label: '补办手续', value: '1' },
], ],
}, },
}, },