From ccacbf4793426115572501f651dade60d1d1bc1f Mon Sep 17 00:00:00 2001 From: xuhuajiao <13476289682@163.com> Date: Fri, 29 May 2026 14:18:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A1=A3=E6=A1=88=E7=BB=9F=E8=AE=A1=E5=AF=BC?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/index.js | 26 ++++++ .../borrowingStatistics/index.vue | 40 ++++++++-- .../dataStatistics/index.vue | 40 ++++++++-- .../roomCollectionStatistics/index.vue | 46 +++++++++-- .../usageCountStatistics/index.vue | 62 ++++++++++++-- .../utilizeRegistrationStatistics/index.vue | 80 ++++++++++++++++--- 6 files changed, 253 insertions(+), 41 deletions(-) diff --git a/src/utils/index.js b/src/utils/index.js index 5046e72..a00066f 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -1,6 +1,7 @@ /** * Created by PanJiaChen on 16/11/18. */ +import { getToken } from '@/utils/auth' /** * Parse the time to string @@ -474,3 +475,28 @@ export function saveByteArray(fileName, byte) { link.download = fileName link.click() } + +export function exportFileToken(url, fileName) { + const link = document.createElement('a') + link.style.display = 'none' + + const xhr = new XMLHttpRequest() + xhr.open('GET', url, true) + xhr.setRequestHeader('Authorization', getToken()) + xhr.responseType = 'blob' + + xhr.onload = function() { + if (xhr.status === 200) { + const blob = new Blob([xhr.response], { type: xhr.getResponseHeader('Content-Type') }) + const url = window.URL.createObjectURL(blob) + link.href = url + link.setAttribute('download', fileName || 'export.xlsx') + document.body.appendChild(link) + link.click() + document.body.removeChild(link) + window.URL.revokeObjectURL(url) + } + } + + xhr.send() +} diff --git a/src/views/archivesStatistics/borrowingStatistics/index.vue b/src/views/archivesStatistics/borrowingStatistics/index.vue index 8819af8..f3591d3 100644 --- a/src/views/archivesStatistics/borrowingStatistics/index.vue +++ b/src/views/archivesStatistics/borrowingStatistics/index.vue @@ -33,14 +33,18 @@ 查询 重置 - + 导出 - - - + + + + + @@ -54,7 +58,7 @@ import { FetchFondsAll } from '@/api/system/fonds' import { FetchBorrowdStatistics, FetchArchivedAllYear } from '@/api/statistics/statistics' import qs from 'qs' -import { exportFile } from '@/utils/index' +import { exportFileToken, getCurrentTime } from '@/utils/index' import { mapGetters } from 'vuex' export default { @@ -66,7 +70,8 @@ export default { fondsIds: [], yearsOptions: [], years: [], - loading: false + loading: false, + exportLoading: false } }, computed: { @@ -78,6 +83,12 @@ export default { this.getBorrowdStatistics() }, methods: { + tableRowClassName({ row, rowIndex }) { + if (rowIndex === this.allData.length - 1 && row.year === '全年累计总量') { + return 'summary-row' + } + return '' + }, getSummaries(param) { const { columns, data } = param const sums = [] @@ -126,15 +137,23 @@ export default { }) }, doExport() { + this.exportLoading = true this.$confirm('此操作将导出当前统计数据' + '你是否还要继续?', '提示', { confirmButtonText: '继续', cancelButtonText: '取消', type: 'warning', dangerouslyUseHTMLString: true }).then(() => { - exportFile(this.baseApi + '/api/control/exportBusinessFlow?' + qs.stringify({}, { indices: false })) + const params = { + fondsIds: this.fondsIds, + years: this.years + } + exportFileToken(this.baseApi + '/api/control/exportBorrowdStatistics?' + qs.stringify(params, { indices: false }), '借阅统计' + getCurrentTime() + '.xlsx').then(() => { + this.exportLoading = false + }) }).catch(() => { console.log('取消') + this.exportLoading = false }) } } @@ -156,5 +175,12 @@ export default { ::v-deep .el-table__empty-block{ border-bottom: 1px solid #e4e7ed; } + ::v-deep .summary-row { + background-color: #f5f7fa !important; + td{ + border-top: 1px solid #dfe6ec !important; + border-bottom: 1px solid #dfe6ec !important; + } + } } diff --git a/src/views/archivesStatistics/dataStatistics/index.vue b/src/views/archivesStatistics/dataStatistics/index.vue index 70d1ed8..7b3480b 100644 --- a/src/views/archivesStatistics/dataStatistics/index.vue +++ b/src/views/archivesStatistics/dataStatistics/index.vue @@ -33,14 +33,18 @@ 查询 重置 - + 导出 - - - + + + + + @@ -55,7 +59,7 @@ import { FetchFondsAll } from '@/api/system/fonds' import { FetchTotalStatistics, FetchArchivedAllYear } from '@/api/statistics/statistics' import qs from 'qs' -import { exportFile } from '@/utils/index' +import { exportFileToken, getCurrentTime } from '@/utils/index' import { mapGetters } from 'vuex' export default { @@ -67,7 +71,8 @@ export default { fondsIds: [], yearsOptions: [], years: [], - loading: false + loading: false, + exportLoading: false } }, computed: { @@ -81,6 +86,12 @@ export default { this.getTotalStatistics() }, methods: { + tableRowClassName({ row, rowIndex }) { + if (rowIndex === this.allData.length - 1 && row.categoryName === '合计(全库总量)') { + return 'summary-row' + } + return '' + }, getSummaries(param) { const { columns, data } = param const sums = [] @@ -147,15 +158,23 @@ export default { }) }, doExport() { + this.exportLoading = true this.$confirm('此操作将导出当前统计数据' + '你是否还要继续?', '提示', { confirmButtonText: '继续', cancelButtonText: '取消', type: 'warning', dangerouslyUseHTMLString: true }).then(() => { - exportFile(this.baseApi + '/api/control/exportBusinessFlow?' + qs.stringify({}, { indices: false })) + const params = { + fondsIds: this.fondsIds, + years: this.years + } + exportFileToken(this.baseApi + '/api/control/exportTotalStatistics?' + qs.stringify(params, { indices: false }), '总量统计' + getCurrentTime() + '.xlsx').then(() => { + this.exportLoading = false + }) }).catch(() => { console.log('取消') + this.exportLoading = false }) } } @@ -177,5 +196,12 @@ export default { ::v-deep .el-table__empty-block{ border-bottom: 1px solid #e4e7ed; } + ::v-deep .summary-row { + background-color: #f5f7fa !important; + td{ + border-top: 1px solid #dfe6ec !important; + border-bottom: 1px solid #dfe6ec !important; + } + } } diff --git a/src/views/archivesStatistics/roomCollectionStatistics/index.vue b/src/views/archivesStatistics/roomCollectionStatistics/index.vue index 0f40fa1..ddd2015 100644 --- a/src/views/archivesStatistics/roomCollectionStatistics/index.vue +++ b/src/views/archivesStatistics/roomCollectionStatistics/index.vue @@ -33,16 +33,24 @@ 查询 重置 - + 导出 - - - + + + + + - + + + @@ -55,7 +63,7 @@ import { FetchFondsAll } from '@/api/system/fonds' import { FetchRoomCollectionStatistics, FetchArchivedAllYear } from '@/api/statistics/statistics' import qs from 'qs' -import { exportFile } from '@/utils/index' +import { exportFileToken, getCurrentTime } from '@/utils/index' import { mapGetters } from 'vuex' export default { @@ -67,7 +75,8 @@ export default { fondsIds: [], yearsOptions: [], years: [], - loading: false + loading: false, + exportLoading: false } }, computed: { @@ -98,6 +107,12 @@ export default { this.getRoomCollectionStatistics() }, methods: { + tableRowClassName({ row, rowIndex }) { + if (rowIndex === this.displayData.length - 1 && row.categoryName === '该年度全类型合计') { + return 'summary-row' + } + return '' + }, getSummaries(param) { const { columns, data } = param const sums = [] @@ -160,15 +175,23 @@ export default { }) }, doExport() { + this.exportLoading = true this.$confirm('此操作将导出当前统计数据' + '你是否还要继续?', '提示', { confirmButtonText: '继续', cancelButtonText: '取消', type: 'warning', dangerouslyUseHTMLString: true }).then(() => { - exportFile(this.baseApi + '/api/control/exportBusinessFlow?' + qs.stringify({}, { indices: false })) + const params = { + fondsIds: this.fondsIds, + years: this.years + } + exportFileToken(this.baseApi + '/api/control/exportRoomCollectionStatistics?' + qs.stringify(params, { indices: false }), '室藏统计' + getCurrentTime() + '.xlsx').then(() => { + this.exportLoading = false + }) }).catch(() => { console.log('取消') + this.exportLoading = false }) } } @@ -190,5 +213,12 @@ export default { ::v-deep .el-table__empty-block{ border-bottom: 1px solid #e4e7ed; } + ::v-deep .summary-row { + background-color: #f5f7fa !important; + td{ + border-top: 1px solid #dfe6ec !important; + border-bottom: 1px solid #dfe6ec !important; + } + } } diff --git a/src/views/archivesStatistics/usageCountStatistics/index.vue b/src/views/archivesStatistics/usageCountStatistics/index.vue index e6b1687..bd56751 100644 --- a/src/views/archivesStatistics/usageCountStatistics/index.vue +++ b/src/views/archivesStatistics/usageCountStatistics/index.vue @@ -34,15 +34,19 @@ 查询 重置 - + 导出
- - + + + + @@ -74,7 +78,7 @@ import { FetchFondsAll } from '@/api/system/fonds' import { FetchBorrowdCountStatisticsList, FetchArchivedAllYear } from '@/api/statistics/statistics' import qs from 'qs' -import { exportFile } from '@/utils/index' +import { exportFileToken, getCurrentTime } from '@/utils/index' import { mapGetters } from 'vuex' export default { @@ -92,13 +96,34 @@ export default { page: 0, size: 10, total: 0 - } + }, + totalStatistics: null, + exportLoading: false } }, computed: { ...mapGetters([ 'baseApi' - ]) + ]), + displayData() { + const data = [...this.allData] + if (this.totalStatistics) { + data.push({ + archiveNo: '-', + maintitle: '全库合计', + categoryName: '-', + archiveYear: '-', + retention: '-', + entityBorrowCount: this.totalStatistics.totalEntityBorrowCount, + electronicBorrowCount: this.totalStatistics.totalElectronicBorrowCount, + viewCount: this.totalStatistics.totalViewCount, + downloadCount: this.totalStatistics.totalDownloadCount, + printCount: this.totalStatistics.totalPrintCount, + isSummary: true + }) + } + return data + } }, mounted() { this.getFondsDatas() @@ -138,6 +163,7 @@ export default { console.log(res) this.allData = res.records this.page.total = res.total + this.totalStatistics = res.totalStatistics this.loading = false }) }, @@ -151,16 +177,31 @@ export default { this.page.size = 10 this.getBorrowdCountStatisticsList() }, + tableRowClassName({ row }) { + if (row.isSummary) { + return 'summary-row' + } + return '' + }, doExport() { + this.exportLoading = true this.$confirm('此操作将导出当前统计数据' + '你是否还要继续?', '提示', { confirmButtonText: '继续', cancelButtonText: '取消', type: 'warning', dangerouslyUseHTMLString: true }).then(() => { - exportFile(this.baseApi + '/api/control/exportBusinessFlow?' + qs.stringify({}, { indices: false })) + const params = { + fondsIds: this.fondsIds, + years: this.years, + search: this.search + } + exportFileToken(this.baseApi + '/api/control/exportBorrowdCountStatisticsList?' + qs.stringify(params, { indices: false }), '利用次数统计' + getCurrentTime() + '.xlsx').then(() => { + this.exportLoading = false + }) }).catch(() => { console.log('取消') + this.exportLoading = false }) } } @@ -179,6 +220,13 @@ export default { ::v-deep .el-table__footer{ font-size: 14px; } + ::v-deep .summary-row { + background-color: #f5f7fa !important; + td{ + border-top: 1px solid #dfe6ec !important; + border-bottom: 1px solid #dfe6ec !important; + } + } // ::v-deep .el-table__body{ // border-bottom: 1px solid #e4e7ed; // } diff --git a/src/views/archivesStatistics/utilizeRegistrationStatistics/index.vue b/src/views/archivesStatistics/utilizeRegistrationStatistics/index.vue index 23ef0b1..e3d8cc0 100644 --- a/src/views/archivesStatistics/utilizeRegistrationStatistics/index.vue +++ b/src/views/archivesStatistics/utilizeRegistrationStatistics/index.vue @@ -53,7 +53,7 @@ 查询 重置
- + 导出 @@ -61,15 +61,23 @@
- - + + + + - - - - - + + + + + + + + + { this.allData = res.records this.page.total = res.total + this.totalStatistics = res.totalStatistics this.loading = false }) }, + tableRowClassName({ row }) { + if (row.isSummary) { + return 'summary-row' + } + return '' + }, handleSizeChange(size) { this.page.size = size this.page.page = 0 @@ -225,15 +262,27 @@ export default { this.getBorrowdRegisterStatisticsList() }, doExport() { + this.exportLoading = true this.$confirm('此操作将导出当前统计数据' + '你是否还要继续?', '提示', { confirmButtonText: '继续', cancelButtonText: '取消', type: 'warning', dangerouslyUseHTMLString: true }).then(() => { - exportFile(this.baseApi + '/api/control/exportBusinessFlow?' + qs.stringify({}, { indices: false })) + const params = { + fondsIds: this.fondsIds, + startTime: this.blurryTime ? this.blurryTime[0] : null, + endTime: this.blurryTime ? this.blurryTime[1] : null, + search: this.query.search || null, + borrowReason: this.query.borrowReason || null, + deptId: this.deptId || null + } + exportFileToken(this.baseApi + '/api/control/exportBorrowdRegisterStatisticsList?' + qs.stringify(params, { indices: false }), '利用登记统计' + getCurrentTime() + '.xlsx').then(() => { + this.exportLoading = false + }) }).catch(() => { console.log('取消') + this.exportLoading = false }) } } @@ -252,6 +301,13 @@ export default { ::v-deep .el-table__footer{ font-size: 14px; } + ::v-deep .summary-row { + background-color: #f5f7fa !important; + td{ + border-top: 1px solid #dfe6ec !important; + border-bottom: 1px solid #dfe6ec !important; + } + } // ::v-deep .el-table__body, // ::v-deep .el-table__body-wrapper{ // border-bottom: 1px solid #e4e7ed;