diff --git a/src/api/archivesManage/lendManage.js b/src/api/archivesManage/lendManage.js index 6e4f5a1..6f2e1d6 100644 --- a/src/api/archivesManage/lendManage.js +++ b/src/api/archivesManage/lendManage.js @@ -187,5 +187,14 @@ export function edit(data) { }) } +// 待办事项 +export function FetchWaitBorrower(parameter) { + return request({ + url: 'api/borrow/waitBorrower', + method: 'get', + params: parameter + }) +} + export default { add, edit, del } diff --git a/src/api/archivesManage/statistics.js b/src/api/archivesManage/statistics.js index 75f40b4..8ec9a5e 100644 --- a/src/api/archivesManage/statistics.js +++ b/src/api/archivesManage/statistics.js @@ -55,6 +55,13 @@ export function FetchStorageStatistics(parameter) { } // 档案检索排名 +export function FetchInitArchivesSearchRanking(parameter) { + return request({ + url: 'api/archives/initArchivesSearchRanking', + method: 'get', + params: parameter + }) +} // 档案实际情况 export function FetchInitAddArchivesStatistics(parameter) { diff --git a/src/views/archivesManage/lendManage/mixins/lending.js b/src/views/archivesManage/lendManage/mixins/lending.js index 1dd984f..da0021e 100644 --- a/src/views/archivesManage/lendManage/mixins/lending.js +++ b/src/views/archivesManage/lendManage/mixins/lending.js @@ -85,7 +85,7 @@ export const lendingCrud = { case 4: return 'cell-lend has-return' default: - return 'cell-lend no-lend ' + return 'cell-lend no-lend' } }, // 获取部门list diff --git a/src/views/components/echarts/catePie.vue b/src/views/components/echarts/catePie.vue index 23581d7..249bb91 100644 --- a/src/views/components/echarts/catePie.vue +++ b/src/views/components/echarts/catePie.vue @@ -32,6 +32,17 @@ export default { chart: null } }, + watch: { + 'cateData': { + handler(val) { + setTimeout(() => { + this.drawChart() + }, 100) + }, + immediate: true, + deep: true + } + }, mounted() { this.drawChart() }, @@ -93,7 +104,6 @@ export default { } ] } - option && this.chart.setOption(option) } } diff --git a/src/views/components/echarts/lendAcross.vue b/src/views/components/echarts/lendAcross.vue index 778b0cd..1c1a415 100644 --- a/src/views/components/echarts/lendAcross.vue +++ b/src/views/components/echarts/lendAcross.vue @@ -31,16 +31,25 @@ export default { chart: null } }, + watch: { + 'lendData': { + handler(val) { + setTimeout(() => { + this.drawChart() + }, 100) + }, + immediate: true, + deep: true + } + }, mounted() { this.drawChart() }, beforeDestroy() { - }, methods: { drawChart() { const chartDom = document.getElementById('mainlend') - this.chart = echarts.init(chartDom) let option = null option = { @@ -79,7 +88,7 @@ export default { axisTick: { show: false }, - data: ['异常档案', '在库档案', '已借档案', '待借档案', '逾期档案'] + data: ['异常档案', '逾期档案', '待借档案', '已借档案', '在库档案'] }, series: [ { @@ -112,11 +121,11 @@ export default { // } color: function(params) { var colorList = [ + ['#FF77AA', '#E6236D'], ['#FF7A7D', '#FF3438'], - ['#5FA2E2', '#1C54EE'], - ['#84DFC0', '#0D9D81'], ['#FBCE9B', '#FF801E'], - ['#FF7A7D', '#FF3438'] + ['#84DFC0', '#0D9D81'], + ['#5FA2E2', '#1C54EE'] ] var colorItem = colorList[params.dataIndex] return new echarts.graphic.LinearGradient(0, 0, 1, 0, [{ @@ -130,13 +139,11 @@ export default { ], false) } } - }, data: this.lendData // 从下到上的数据 } ] } - option && this.chart.setOption(option) } diff --git a/src/views/components/echarts/typePie.vue b/src/views/components/echarts/typePie.vue index bf0f13b..2319e1a 100644 --- a/src/views/components/echarts/typePie.vue +++ b/src/views/components/echarts/typePie.vue @@ -10,7 +10,6 @@ import resize from '@/views/dashboard/mixins/resize' export default { name: 'TypePie', mixins: [resize], - props: { typeData: { type: Array, @@ -33,6 +32,17 @@ export default { chart: null } }, + watch: { + 'typeData': { + handler(val) { + setTimeout(() => { + this.drawChart() + }, 100) + }, + immediate: true, + deep: true + } + }, mounted() { this.drawChart() }, @@ -43,8 +53,8 @@ export default { let option = null option = { tooltip: { - trigger: 'item' - // formatter: "{a}
{b} : {c} ({d}%)" + trigger: 'item', + formatter: '{a}
{b} : {c} ({d}%)' }, legend: { @@ -86,13 +96,7 @@ export default { show: false } }, - data: [ - { value: this.typeData[0], name: '文书档案', itemStyle: { color: '#0FBED9' }}, - { value: this.typeData[1], name: '科技档案', itemStyle: { color: '#F65163' }}, - { value: this.typeData[2], name: '会计档案', itemStyle: { color: '#FF8447' }}, - { value: this.typeData[3], name: '实物档案', itemStyle: { color: '#76AF50' }}, - { value: this.typeData[4], name: '基建档案', itemStyle: { color: '#8378E8' }} - ] + data: this.typeData } ] } diff --git a/src/views/system/archiveStatistics/index.vue b/src/views/system/archiveStatistics/index.vue index e7ef5e4..49db828 100644 --- a/src/views/system/archiveStatistics/index.vue +++ b/src/views/system/archiveStatistics/index.vue @@ -21,12 +21,15 @@

档案类别

+
-
@@ -38,6 +41,13 @@

档案类型

+
@@ -53,8 +63,17 @@

出入库管理情况

+
- +
@@ -65,8 +84,15 @@

档案检索排名

+
- +
@@ -81,8 +107,16 @@

档案实际情况

+
- +
@@ -98,14 +132,229 @@ import typePie from '@/views/components/echarts/typePie.vue' import BarEcharts from './module/barEcharts.vue' import AcrossBar from './module/acrossBar.vue' import LineEchart from './module/lineEchart.vue' +import { FetchInitBorrowerNumStatistics, FetchInitArchivesTypeNum, FetchInitArchivesTypeStatistics, FetchStorageStatistics, FetchInitArchivesSearchRanking, FetchInitAddArchivesStatistics } from '@/api/archivesManage/statistics' export default { components: { lendAcross, catePie, typePie, BarEcharts, AcrossBar, LineEchart }, data() { return { - value1: '', - lendData: [100, 18203, 23489, 29034, 104970], - cateData: [1000, 700], - typeData: [1110, 2000, 800, 600, 900] + cateDate: '', + typeDate: '', + inOutStorageDate: '', + arcSearchDate: '', + arcAddDate: '', + pickerOptions: { + disabledDate(time) { + return time.getTime() > Date.now() - 8.64e6 + } + }, + lendData: [], + cateData: [], + typeData: [], + storageData: { + storageMonths: [], + inStorageData: [], + outStorageData: [] + }, + searchAcrivesData: { + searchName: [], + searchValue: [] + }, + addArcivesData: { + addArcivesMonth: [], + addArcivesNum: [] + } + } + }, + mounted() { + this.getBorrowerNumSta() + this.getArchivesTypeNum() + this.getArchivesTypeStatistics() + this.getStorageStatistics() + this.getArchivesSearchRanking() + this.getAddArchivesStatistics() + }, + methods: { + // 档案借阅统计 + getBorrowerNumSta() { + FetchInitBorrowerNumStatistics().then(res => { + if (res) { + delete res.total + // 固定排序 '在库档案', '已借档案', '待借档案', '逾期档案', '异常档案' + const borrowerArr = [] + for (const i in res) { + const obj = {} + obj.name = i + obj.value = res[i] + if (i === 'inStorage') { + obj.sequence = 1 + } else if (i === 'borrow') { + obj.sequence = 2 + } else if (i === 'waitBorrow') { + obj.sequence = 3 + } else if (i === 'overdue') { + obj.sequence = 4 + } else if (i === 'abnormal') { + obj.sequence = 5 + } + borrowerArr.push(obj) + } + this.arrSortByKey(borrowerArr, 'sequence', false) + borrowerArr.forEach(item => { + this.lendData.push(item.value) + }) + } + }) + }, + // 档案类别 - 年选择 + handleCateDate() { + console.log(this.cateDate) + this.getArchivesTypeNum() + }, + // 档案类别 + getArchivesTypeNum() { + let params + if (this.cateDate) { + params = { + 'type': this.cateDate + } + } else { + params = { + 'type': 1 + } + } + FetchInitArchivesTypeNum(params).then(res => { + if (res) { + for (const i in res) { + this.cateData.push(res[i]) + } + } + }) + }, + // 档案类型 - 月选择 + handleTypeDate() { + console.log(this.typeDate) + this.getArchivesTypeStatistics() + }, + // 档案类型 + getArchivesTypeStatistics() { + let params + if (this.typeDate) { + params = { + 'type': this.typeDate + } + } else { + params = { + 'type': 1 + } + } + FetchInitArchivesTypeStatistics(params).then(res => { + if (res) { + res.map(item => { + const obj = {} + obj.name = item.archivesType + obj.value = item.archivesNum + this.typeData.push(obj) + }) + } + }) + }, + // 档案类别 - 年选择 + handleStorageDate() { + console.log(this.inOutStorageDate) + this.getStorageStatistics() + }, + // 出入库管理情况 + getStorageStatistics() { + let params + let year + if (this.inOutStorageDate) { + params = { + 'type': this.inOutStorageDate + } + year = this.arcAddDate + } else { + params = { + 'type': 1 + } + year = new Date().getFullYear() + } + FetchStorageStatistics(params).then(res => { + if (res) { + this.storageData.storageMonths = [] + res.months.forEach(item => { + this.storageData.storageMonths.push(year + '/' + item) + }) + this.storageData.inStorageData = res.inStorage + this.storageData.outStorageData = res.outStorage + } + }) + }, + handleSearchDate() { + console.log(this.arcSearchDate) + this.getArchivesSearchRanking() + }, + // 档案检索排名 + getArchivesSearchRanking() { + let params + if (this.arcSearchDate) { + params = { + 'type': this.arcSearchDate + } + } else { + params = { + 'type': 1 + } + } + FetchInitArchivesSearchRanking(params).then(res => { + if (res) { + this.arrSortByKey(res, 'num', true) + this.searchAcrivesData.searchName = res.map(item => item.cnName) + this.searchAcrivesData.searchValue = res.map(item => item.num) + } + }) + }, + handleArcAddSta() { + console.log(this.arcAddDate) + this.getAddArchivesStatistics() + }, + // 档案检索排名 + getAddArchivesStatistics() { + let params + let year + if (this.arcAddDate) { + params = { + 'type': this.arcAddDate + } + year = this.arcAddDate + } else { + params = { + 'type': 1 + } + year = new Date().getFullYear() + } + FetchInitAddArchivesStatistics(params).then(res => { + if (res) { + this.addArcivesData.addArcivesMonth = [] + res.months.forEach(item => { + this.addArcivesData.addArcivesMonth.push(year + '/' + item) + }) + this.addArcivesData.addArcivesNum = res.nums + } + }) + }, + // array: 需要进行排序的数组 + // key: 根据某个属性进行排序 + // order: 升序/降序 true:升序 false:降序 + arrSortByKey(array, property, order) { + return array.sort(function(a, b) { + const value1 = a[property] + const value2 = b[property] + if (order) { // 升序 + return value1 - value2 + } else { // 降序 + return value2 - value1 + } + }) } } } @@ -114,26 +363,32 @@ export default {