15 changed files with 1222 additions and 518 deletions
-
1.env.development
-
1.env.production
-
2package.json
-
1public/static/config.js
-
58src/api/system/documentArchives.js
-
44src/views/archivesMIOD/miodLibrary/index.vue
-
159src/views/archivesMIOD/miodLibrary/module/detail.vue
-
2src/views/archivesMIOD/miodSearch/index.vue
-
282src/views/archivesMIOD/miodSearch/module/resultList.vue
-
117src/views/archivesMIOD/miodStatistics/index copy.vue
-
8src/views/archivesMIOD/miodStatistics/index.vue
-
412src/views/archivesMIOD/miodStatistics/miodTable copy.vue
-
380src/views/archivesMIOD/miodStatistics/miodTable.vue
-
154src/views/components/BindingTagDlg.vue
-
119src/views/system/borrowerManage/index.vue
@ -1,117 +0,0 @@ |
|||||
<template> |
|
||||
<div class="app-container"> |
|
||||
<div style="height: calc(100vh - 140px); overflow-y: scroll; background: #fff; padding: 20px;"> |
|
||||
<!-- 第一个表格 --> |
|
||||
<el-table :data="tableData1" border> |
|
||||
<el-table-column prop="year" label="年份" width="60" align="center" /> |
|
||||
<el-table-column prop="jsdw" label="局属单位" width="80" align="center" /> |
|
||||
<el-table-column prop="wuqiTa" label="武其他" width="80" align="center" /> |
|
||||
<el-table-column prop="wuZhengBan" label="武政办" width="80" align="center" /> |
|
||||
<el-table-column prop="zhengFuJiLiao" label="政府纪要" width="80" align="center" /> |
|
||||
<el-table-column prop="zhongYangZhong" label="中央中央" width="80" align="center" /> |
|
||||
<el-table-column prop="total" label="合计" width="60" align="center" /> |
|
||||
</el-table> |
|
||||
|
|
||||
<!-- 第二个表格 --> |
|
||||
<el-table :data="tableData2" border class="mt-10"> |
|
||||
<el-table-column prop="year" label="年份" width="60" align="center" /> |
|
||||
<el-table-column prop="公开" label="公开" width="80" align="center" /> |
|
||||
<el-table-column prop="限制" label="限制" width="80" align="center" /> |
|
||||
<el-table-column prop="秘密" label="秘密" width="80" align="center" /> |
|
||||
<el-table-column prop="机密" label="机密" width="80" align="center" /> |
|
||||
<el-table-column prop="绝密" label="绝密" width="80" align="center" /> |
|
||||
<el-table-column prop="total" label="合计" width="60" align="center" /> |
|
||||
</el-table> |
|
||||
|
|
||||
<!-- 第三个表格 --> |
|
||||
<el-table :data="tableData3" border class="mt-10"> |
|
||||
<el-table-column prop="year" label="年份" width="60" align="center" /> |
|
||||
<el-table-column prop="pingJi" label="平急" width="80" align="center" /> |
|
||||
<el-table-column prop="jiaJi" label="加急" width="80" align="center" /> |
|
||||
<el-table-column prop="teJi" label="特急" width="80" align="center" /> |
|
||||
<el-table-column prop="teTi" label="特提" width="80" align="center" /> |
|
||||
<el-table-column prop="total" label="合计" width="60" align="center" /> |
|
||||
</el-table> |
|
||||
</div> |
|
||||
</div> |
|
||||
</template> |
|
||||
|
|
||||
<script> |
|
||||
|
|
||||
export default { |
|
||||
name: 'MiodStatistics', |
|
||||
components: { |
|
||||
}, |
|
||||
data() { |
|
||||
return { |
|
||||
tableData1: [ |
|
||||
{ year: '2020', jsdw: 1, wuqiTa: 1, wuZhengBan: 1, zhengFuJiLiao: 1, zhongYangZhong: 1, total: 5 }, |
|
||||
{ year: '2021', jsdw: 1, wuqiTa: 1, wuZhengBan: 1, zhengFuJiLiao: 1, zhongYangZhong: 1, total: 5 }, |
|
||||
{ year: '2022', jsdw: 1, wuqiTa: 1, wuZhengBan: 1, zhengFuJiLiao: 1, zhongYangZhong: 1, total: 5 }, |
|
||||
{ year: '2023', jsdw: 1, wuqiTa: 1, wuZhengBan: 1, zhengFuJiLiao: 1, zhongYangZhong: 1, total: 5 }, |
|
||||
{ year: '2024', jsdw: 1, wuqiTa: 1, wuZhengBan: 1, zhengFuJiLiao: 1, zhongYangZhong: 1, total: 5 }, |
|
||||
{ year: '2025', jsdw: 1, wuqiTa: 1, wuZhengBan: 1, zhengFuJiLiao: 1, zhongYangZhong: 1, total: 5 }, |
|
||||
{ year: '合计', jsdw: 6, wuqiTa: 6, wuZhengBan: 6, zhengFuJiLiao: 6, zhongYangZhong: 6, total: 30 } |
|
||||
], |
|
||||
tableData2: [ |
|
||||
{ year: '2020', 公开: 1, 限制: 1, 秘密: 1, 机密: 1, 绝密: 1, total: 5 }, |
|
||||
{ year: '2021', 公开: 1, 限制: 1, 秘密: 1, 机密: 1, 绝密: 1, total: 5 }, |
|
||||
{ year: '2022', 公开: 1, 限制: 1, 秘密: 1, 机密: 1, 绝密: 1, total: 5 }, |
|
||||
{ year: '2023', 公开: 1, 限制: 1, 秘密: 1, 机密: 1, 绝密: 1, total: 5 }, |
|
||||
{ year: '2024', 公开: 1, 限制: 1, 秘密: 1, 机密: 1, 绝密: 1, total: 5 }, |
|
||||
{ year: '2025', 公开: 1, 限制: 1, 秘密: 1, 机密: 1, 绝密: 1, total: 5 }, |
|
||||
{ year: '合计', 公开: 6, 限制: 6, 秘密: 6, 机密: 6, 绝密: 6, total: 30 } |
|
||||
], |
|
||||
tableData3: [ |
|
||||
{ year: '2020', pingJi: 1, jiaJi: 1, teJi: 1, teTi: 2, total: 5 }, |
|
||||
{ year: '2021', pingJi: 1, jiaJi: 1, teJi: 1, teTi: 2, total: 5 }, |
|
||||
{ year: '2022', pingJi: 1, jiaJi: 1, teJi: 1, teTi: 2, total: 5 }, |
|
||||
{ year: '2023', pingJi: 1, jiaJi: 1, teJi: 1, teTi: 2, total: 5 }, |
|
||||
{ year: '2024', pingJi: 1, jiaJi: 1, teJi: 1, teTi: 2, total: 5 }, |
|
||||
{ year: '2025', pingJi: 1, jiaJi: 1, teJi: 1, teTi: 2, total: 5 }, |
|
||||
{ year: '合计', pingJi: 6, jiaJi: 6, teJi: 6, teTi: 12, total: 30 } |
|
||||
] |
|
||||
} |
|
||||
}, |
|
||||
methods: { |
|
||||
} |
|
||||
} |
|
||||
</script> |
|
||||
|
|
||||
<style lang="scss" scoped> |
|
||||
.mt-10 { |
|
||||
margin-top: 18px; |
|
||||
} |
|
||||
// ::v-deep .el-table{ |
|
||||
// width: auto !important; |
|
||||
// } |
|
||||
// ::v-deep .el-table .cell{ |
|
||||
// padding: 0 !important; |
|
||||
// margin-left: -2px !important; |
|
||||
// margin-top: -2px !important; |
|
||||
// } |
|
||||
// ::v-deep .el-table tr .el-table__cell{ |
|
||||
// height: 28px !important; |
|
||||
// } |
|
||||
::v-deep .el-table__header-wrapper { |
|
||||
background-color: transparent !important; |
|
||||
} |
|
||||
::v-deep .el-table::before, .el-table--group::after, |
|
||||
::v-deep .el-table--border::after{ |
|
||||
background-color: transparent !important; |
|
||||
} |
|
||||
// ::v-deep .el-table .el-table__body-wrapper td.el-table__cell, |
|
||||
// ::v-deep .el-table .el-table__fixed-right td.el-table__cell { |
|
||||
// padding: 0 !important; |
|
||||
// border-left: 1px solid #000; |
|
||||
// border-bottom: 1px solid #000; |
|
||||
// border-right: 1px solid #000; |
|
||||
// } |
|
||||
// ::v-deep.el-table .el-table__header-wrapper th.el-table__cell, |
|
||||
// ::v-deep.el-table .el-table__header th.el-table__cell{ |
|
||||
// border: 1px solid #000; |
|
||||
// } |
|
||||
::v-deep .el-table--group, .el-table--border{ |
|
||||
border: none !important; |
|
||||
} |
|
||||
</style> |
|
@ -0,0 +1,412 @@ |
|||||
|
<template> |
||||
|
<div style="height: calc(100vh - 234px); margin-top: 20px; padding-bottom: 20px; overflow-y: scroll;"> |
||||
|
<el-button :loading="exportLoading" style="padding: 7px 10px; position: absolute; right: 6px; top: -6px;" @click="handleExport"> |
||||
|
<i class="iconfont icon-daochu" /> |
||||
|
导出 |
||||
|
</el-button> |
||||
|
<div> |
||||
|
<!-- 第一个表格 --> |
||||
|
<div v-if="activeIndex===0" class="table-content"> |
||||
|
<div class="table-right-date">截止到:{{ nowDate }}</div> |
||||
|
<el-table ref="table" :data="tableData1" border :cell-style="tableCellStyle"> |
||||
|
<el-table-column prop="year" label="年份" width="60" align="center" /> |
||||
|
<el-table-column prop="中共中央" label="中共中央" width="80" align="center" /> |
||||
|
<el-table-column prop="国务院" label="国务院" width="80" align="center" /> |
||||
|
<el-table-column prop="省交通厅" label="省交通厅" width="80" align="center" /> |
||||
|
<el-table-column prop="省委" label="省委" width="80" align="center" /> |
||||
|
<el-table-column prop="市委" label="市委" width="80" align="center" /> |
||||
|
<el-table-column prop="省政府" label="省政府" width="80" align="center" /> |
||||
|
<el-table-column prop="市政府" label="市政府" width="80" align="center" /> |
||||
|
<el-table-column prop="省市领导批示件" label="省市领导批示件" width="120" align="center" /> |
||||
|
<el-table-column prop="综合" label="综合" width="80" align="center" /> |
||||
|
<el-table-column prop="total" label="合计" width="60" align="center" /> |
||||
|
</el-table> |
||||
|
</div> |
||||
|
<!-- 第二个表格 --> |
||||
|
<!-- 默认显示当前年份 --> |
||||
|
<div v-if="activeIndex===1" class="table-content"> |
||||
|
<div class="table-right-date">选择年份: |
||||
|
<el-select v-model="yearValue" placeholder="请选择" style="width: 90px;"> |
||||
|
<el-option |
||||
|
v-for="item in yearsOptions" |
||||
|
:key="item.id" |
||||
|
:label="item.label" |
||||
|
:value="item.id" |
||||
|
/> |
||||
|
</el-select> |
||||
|
</div> |
||||
|
<el-table ref="table" :data="tableData2" border :cell-style="tableCellStyle"> |
||||
|
<el-table-column prop="month" label="月份" width="60" align="center" /> |
||||
|
<el-table-column prop="ZB" label="中共中央" width="80" align="center" /> |
||||
|
<el-table-column prop="GB" label="国务院" width="80" align="center" /> |
||||
|
<el-table-column prop="ST" label="省交通厅" width="80" align="center" /> |
||||
|
<el-table-column prop="EB" label="省委" width="80" align="center" /> |
||||
|
<el-table-column prop="SW" label="市委" width="80" align="center" /> |
||||
|
<el-table-column prop="EZ" label="省政府" width="80" align="center" /> |
||||
|
<el-table-column prop="WZ" label="市政府" width="80" align="center" /> |
||||
|
<el-table-column prop="PS" label="省市领导批示件" width="120" align="center" /> |
||||
|
<el-table-column prop="ZH" label="综合" width="80" align="center" /> |
||||
|
<el-table-column prop="total" label="合计" width="60" align="center" /> |
||||
|
</el-table> |
||||
|
</div> |
||||
|
|
||||
|
<!-- 第三个表格 --> |
||||
|
<!-- 默认是起止时间以当天时间为准给近1个月的数据 --> |
||||
|
<div v-if="activeIndex===2" class="table-content"> |
||||
|
<div class="table-right-date">自定义起止时间: |
||||
|
<el-date-picker |
||||
|
v-model="customYear" |
||||
|
type="datetimerange" |
||||
|
range-separator="至" |
||||
|
start-placeholder="开始日期" |
||||
|
end-placeholder="结束日期" |
||||
|
/> |
||||
|
</div> |
||||
|
<el-table ref="table" :data="tableData3" border :cell-style="tableCellStyle"> |
||||
|
<el-table-column prop="name" label="借阅者" width="100" align="center" /> |
||||
|
<el-table-column prop="ZB" label="中共中央" width="80" align="center" /> |
||||
|
<el-table-column prop="GB" label="国务院" width="80" align="center" /> |
||||
|
<el-table-column prop="ST" label="省交通厅" width="80" align="center" /> |
||||
|
<el-table-column prop="EB" label="省委" width="80" align="center" /> |
||||
|
<el-table-column prop="SW" label="市委" width="80" align="center" /> |
||||
|
<el-table-column prop="EZ" label="省政府" width="80" align="center" /> |
||||
|
<el-table-column prop="WZ" label="市政府" width="80" align="center" /> |
||||
|
<el-table-column prop="PS" label="省市领导批示件" width="120" align="center" /> |
||||
|
<el-table-column prop="ZH" label="综合" width="80" align="center" /> |
||||
|
<el-table-column prop="total" label="合计" width="60" align="center" /> |
||||
|
</el-table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import CRUD, { presenter, crud } from '@crud/crud' |
||||
|
import { getCurrentTime } from '@/utils/index' |
||||
|
import { FetchAnnualStatistics } from '@/api/system/documentArchives' |
||||
|
import * as XLSX from 'xlsx' |
||||
|
import { saveAs } from 'file-saver' // 简化文件保存 |
||||
|
|
||||
|
export default { |
||||
|
name: 'MiodTable', |
||||
|
components: { }, |
||||
|
mixins: [presenter(), crud()], |
||||
|
cruds() { |
||||
|
return CRUD({ |
||||
|
url: 'api/archivesUtilize/initborrowLog', |
||||
|
title: '公文统计', |
||||
|
optShow: { |
||||
|
add: false, |
||||
|
edit: false, |
||||
|
del: false, |
||||
|
download: false, |
||||
|
reset: false, |
||||
|
group: false |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
props: { |
||||
|
activeIndex: { |
||||
|
type: Number, |
||||
|
default: 0 |
||||
|
}, |
||||
|
isUserCenter: { |
||||
|
type: Boolean, |
||||
|
default: false |
||||
|
} |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
exportLoading: false, |
||||
|
nowDate: getCurrentTime(), |
||||
|
yearValue: 2025, |
||||
|
yearsOptions: [], |
||||
|
customYear: this.calculateDefaultRange(), |
||||
|
tableData1: [], |
||||
|
tableData2: [ |
||||
|
{ month: '1月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 }, |
||||
|
{ month: '2月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 }, |
||||
|
{ month: '3月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 }, |
||||
|
{ month: '4月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 }, |
||||
|
{ month: '5月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 }, |
||||
|
{ month: '6月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 }, |
||||
|
{ month: '7月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 }, |
||||
|
{ month: '8月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 }, |
||||
|
{ month: '9月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 }, |
||||
|
{ month: '10月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 }, |
||||
|
{ month: '11月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 }, |
||||
|
{ month: '12月', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 } |
||||
|
], |
||||
|
tableData3: [ |
||||
|
{ name: '张三', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 }, |
||||
|
{ name: '李四', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 }, |
||||
|
{ name: '王五', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 }, |
||||
|
{ name: '办公室', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 }, |
||||
|
{ name: '档案室', ZB: 1, GB: 1, ST: 1, EB: 1, SW: 1, EZ: 1, WZ: 1, PS: 1, ZH: 1, total: 9 } |
||||
|
], |
||||
|
originalData: [] |
||||
|
} |
||||
|
}, |
||||
|
watch: { |
||||
|
activeIndex: function(newValue, oldValue) { |
||||
|
this.crud.toQuery() |
||||
|
} |
||||
|
}, |
||||
|
created() { |
||||
|
this.generateYearsData() |
||||
|
}, |
||||
|
mounted() { |
||||
|
this.getAnnualStatistics() |
||||
|
}, |
||||
|
methods: { |
||||
|
getAnnualStatistics() { |
||||
|
FetchAnnualStatistics().then((res) => { |
||||
|
console.log('res', res) |
||||
|
this.originalData = res |
||||
|
this.formatTableData() |
||||
|
}).catch(err => { |
||||
|
console.log(err) |
||||
|
}) |
||||
|
}, |
||||
|
// 格式化表格数据 |
||||
|
formatTableData() { |
||||
|
const formattedData = [] |
||||
|
|
||||
|
// 提取年份并排序(转为数字后倒序) |
||||
|
const sortedYears = Object.keys(this.originalData) |
||||
|
.filter(year => year !== '合计') // 排除原始数据中的合计行 |
||||
|
.sort((a, b) => parseInt(b) - parseInt(a)) // 按年份倒序排列 |
||||
|
|
||||
|
// 按排序后的年份顺序处理数据 |
||||
|
sortedYears.forEach(year => { |
||||
|
const values = this.originalData[year] |
||||
|
formattedData.push({ |
||||
|
year, |
||||
|
中共中央: values['中共中央'], |
||||
|
国务院: values['国务院'], |
||||
|
省交通厅: values['省交通厅'], |
||||
|
省委: values['省委'], |
||||
|
市委: values['市委'], |
||||
|
省政府: values['省政府'], |
||||
|
市政府: values['市政府'], |
||||
|
省市领导批示件: values['省市领导批示件'], |
||||
|
综合: values['综合'], |
||||
|
total: values['合计'] |
||||
|
}) |
||||
|
}) |
||||
|
|
||||
|
// 直接使用原始数据中的合计行(如果存在) |
||||
|
if (this.originalData['合计']) { |
||||
|
const totalRow = this.originalData['合计'] |
||||
|
formattedData.push({ |
||||
|
year: '合计', |
||||
|
中共中央: totalRow['中共中央'], |
||||
|
国务院: totalRow['国务院'], |
||||
|
省交通厅: totalRow['省交通厅'], |
||||
|
省委: totalRow['省委'], |
||||
|
市委: totalRow['市委'], |
||||
|
省政府: totalRow['省政府'], |
||||
|
市政府: totalRow['市政府'], |
||||
|
省市领导批示件: totalRow['省市领导批示件'], |
||||
|
综合: totalRow['综合'], |
||||
|
total: totalRow['合计'] |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
this.tableData1 = formattedData |
||||
|
console.log('tableData1', this.tableData1) |
||||
|
}, |
||||
|
async handleExport() { |
||||
|
this.exportLoading = true |
||||
|
try { |
||||
|
let exportData = [] |
||||
|
let sheetName = '' |
||||
|
|
||||
|
// 根据 activeIndex 确定导出的数据和表名 |
||||
|
switch (this.activeIndex) { |
||||
|
case 0: |
||||
|
exportData = this.tableData1.map(item => ({ |
||||
|
年份: item.year, |
||||
|
中共中央: item['中共中央'], |
||||
|
国务院: item['国务院'], |
||||
|
省交通厅: item['省交通厅'], |
||||
|
省委: item['省委'], |
||||
|
市委: item['市委'], |
||||
|
省政府: item['省政府'], |
||||
|
市政府: item['市政府'], |
||||
|
省市领导批示件: item['省市领导批示件'], |
||||
|
综合: item['综合'], |
||||
|
合计: item.total |
||||
|
})) |
||||
|
sheetName = '馆藏年度统计' |
||||
|
break |
||||
|
case 1: |
||||
|
exportData = this.tableData2.map(item => ({ |
||||
|
月份: item.month, |
||||
|
中共中央: item.ZB, |
||||
|
国务院: item.GB, |
||||
|
省交通厅: item.ST, |
||||
|
省委: item.EB, |
||||
|
市委: item.SW, |
||||
|
省政府: item.EZ, |
||||
|
市政府: item.WZ, |
||||
|
省市领导批示件: item.PS, |
||||
|
综合: item.ZH, |
||||
|
合计: item.total |
||||
|
})) |
||||
|
sheetName = '馆藏月度统计' |
||||
|
break |
||||
|
case 2: |
||||
|
exportData = this.tableData3.map(item => ({ |
||||
|
借阅者: item.name, |
||||
|
中共中央: item.ZB, |
||||
|
国务院: item.GB, |
||||
|
省交通厅: item.ST, |
||||
|
省委: item.EB, |
||||
|
市委: item.SW, |
||||
|
省政府: item.EZ, |
||||
|
市政府: item.WZ, |
||||
|
省市领导批示件: item.PS, |
||||
|
综合: item.ZH, |
||||
|
合计: item.total |
||||
|
})) |
||||
|
sheetName = '传阅统计' |
||||
|
break |
||||
|
default: |
||||
|
break |
||||
|
} |
||||
|
|
||||
|
// 生成工作簿 |
||||
|
const workbook = XLSX.utils.book_new() |
||||
|
const sheet = XLSX.utils.json_to_sheet(exportData) |
||||
|
XLSX.utils.book_append_sheet(workbook, sheet, sheetName) |
||||
|
|
||||
|
// 关键:使用 buffer 格式 |
||||
|
const wbout = XLSX.write(workbook, { |
||||
|
bookType: 'xlsx', |
||||
|
type: 'array', |
||||
|
cellDates: true |
||||
|
}) |
||||
|
|
||||
|
// 创建 Blob |
||||
|
const blob = new Blob([wbout], { |
||||
|
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' |
||||
|
}) |
||||
|
saveAs(blob, `${sheetName}_${new Date().getTime()}.xlsx`) |
||||
|
} catch (error) { |
||||
|
console.error('导出错误:', error) |
||||
|
this.$message.error('导出失败,请检查数据格式!') |
||||
|
} finally { |
||||
|
this.exportLoading = false |
||||
|
} |
||||
|
}, |
||||
|
tableCellStyle({ row, column, rowIndex, columnIndex }) { |
||||
|
// 最后一列设置背景色为 lightblue |
||||
|
if (columnIndex === this.$refs.table.columns.length - 1) { |
||||
|
return 'background-color: #f5f7fa;border-top: 1px solid #dfe6ec;border-bottom: 1px solid #dfe6ec;' |
||||
|
} |
||||
|
return '' |
||||
|
}, |
||||
|
generateYearsData() { |
||||
|
const currentYear = new Date().getFullYear() // 获取当前年份 |
||||
|
const startYear = 2007 // 起始年份 |
||||
|
|
||||
|
const years = [] |
||||
|
for (let year = currentYear; year >= startYear; year--) { |
||||
|
years.push({ |
||||
|
id: year, |
||||
|
label: year |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
this.yearsOptions = years |
||||
|
}, |
||||
|
// 计算默认时间范围的方法 |
||||
|
calculateDefaultRange() { |
||||
|
const now = new Date() // 获取当前时间 |
||||
|
const oneMonthAgo = new Date() // 创建一个月前的时间对象 |
||||
|
oneMonthAgo.setMonth(now.getMonth() - 1) // 月份减 1(当前月的第一天向前推一个月) |
||||
|
|
||||
|
// 处理日期边界:若当前是月初,需取上个月的同一天(避免跨月错误) |
||||
|
if (now.getDate() < oneMonthAgo.getDate()) { |
||||
|
oneMonthAgo.setDate(1) // 若上月天数不足,设为上月第一天 |
||||
|
} |
||||
|
|
||||
|
// 转换为 ISO 格式字符串(需与组件的时间格式匹配,默认支持 'YYYY-MM-DD HH:mm:ss') |
||||
|
const start = this.formatDate(oneMonthAgo) |
||||
|
const end = this.formatDate(now) // 结束时间为当前日期 |
||||
|
|
||||
|
return [start, end] |
||||
|
}, |
||||
|
formatDate(date) { |
||||
|
const year = date.getFullYear() |
||||
|
const month = String(date.getMonth() + 1).padStart(2, '0') // 月份补零 |
||||
|
const day = String(date.getDate()).padStart(2, '0') // 日期补零 |
||||
|
const hours = String(date.getHours()).padStart(2, '0') // 小时补零(可选) |
||||
|
const minutes = String(date.getMinutes()).padStart(2, '0') // 分钟补零(可选) |
||||
|
const seconds = String(date.getSeconds()).padStart(2, '0') // 秒补零(可选) |
||||
|
// 若不需要时分秒,可省略后面部分,格式为 'YYYY-MM-DD' |
||||
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}` |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
.table-content { |
||||
|
box-sizing: border-box; |
||||
|
display: inline-block; |
||||
|
border: 1px solid #dfe6ec; |
||||
|
border-bottom: none; |
||||
|
border-right: none; |
||||
|
font-size: 14px; |
||||
|
.table-right-date{ |
||||
|
line-height: 40px; |
||||
|
text-align: right; |
||||
|
padding: 5px 10px; |
||||
|
font-weight: bold; |
||||
|
color: #0c0e1e; |
||||
|
border-bottom: 1px solid #dfe6ec; |
||||
|
border-right: 1px solid #dfe6ec; |
||||
|
} |
||||
|
} |
||||
|
// ::v-deep .el-table{ |
||||
|
// width: auto !important; |
||||
|
// } |
||||
|
// ::v-deep .el-table .cell{ |
||||
|
// padding: 0 !important; |
||||
|
// margin-left: -2px !important; |
||||
|
// margin-top: -2px !important; |
||||
|
// } |
||||
|
// ::v-deep .el-table tr .el-table__cell{ |
||||
|
// height: 28px !important; |
||||
|
// } |
||||
|
::v-deep .el-table__header-wrapper { |
||||
|
background-color: transparent !important; |
||||
|
} |
||||
|
::v-deep .el-table::before, .el-table--group::after, |
||||
|
::v-deep .el-table--border::after{ |
||||
|
background-color: transparent !important; |
||||
|
} |
||||
|
// ::v-deep .el-table .el-table__body-wrapper td.el-table__cell, |
||||
|
// ::v-deep .el-table .el-table__fixed-right td.el-table__cell { |
||||
|
// padding: 0 !important; |
||||
|
// border-left: 1px solid #000; |
||||
|
// border-bottom: 1px solid #000; |
||||
|
// border-right: 1px solid #000; |
||||
|
// } |
||||
|
// ::v-deep.el-table .el-table__header-wrapper th.el-table__cell, |
||||
|
// ::v-deep.el-table .el-table__header th.el-table__cell{ |
||||
|
// border: 1px solid #000; |
||||
|
// } |
||||
|
::v-deep .el-table--group, .el-table--border{ |
||||
|
border: none !important; |
||||
|
} |
||||
|
|
||||
|
/* 在 style 中 */ |
||||
|
::v-deep .el-table .el-table__body tr:last-child td { |
||||
|
background-color: #f5f7fa !important; |
||||
|
border-top: 1px solid #dfe6ec !important; |
||||
|
border-bottom: 1px solid #dfe6ec !important; |
||||
|
} |
||||
|
</style> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue