diff --git a/assets/styles/global.less b/assets/styles/global.less index 8e24ee2..cd8a2f1 100644 --- a/assets/styles/global.less +++ b/assets/styles/global.less @@ -120,3 +120,7 @@ background-color: rgba(20, 38, 66, 0.3); } } + +.h100 { + height: 100%; +} diff --git a/components/smallCommon/Curd.vue b/components/smallCommon/Curd.vue index efb8883..c645a0a 100644 --- a/components/smallCommon/Curd.vue +++ b/components/smallCommon/Curd.vue @@ -197,7 +197,6 @@ export default { }, watch: {}, mounted() { - console.log(this.dropdownClassName); this.handleSearch() }, methods: { @@ -295,7 +294,7 @@ export default { searchValues[formItem.key] = values[formItem.key] } } - const {api, noPage, method, renderKey} = this.apiConf.listApi + const {api, noPage, method, renderKey, after} = this.apiConf.listApi const {data} = await this[`$${method}`](api, { ...searchValues, pageSize: this.page.pageSize, @@ -303,12 +302,14 @@ export default { }) if (noPage) { this.page = false - this.cacheData = data - this.tableDataSource = data + this.cacheData = renderKey ? get(data, renderKey) : data + this.tableDataSource = renderKey ? get(data, renderKey) : data + after && after(data) } else { this.page.total = data.total || 0 this.cacheData = renderKey ? get(data, renderKey) : data.items this.tableDataSource = renderKey ? get(data, renderKey) : data.items + after && after(data) } }, async handleOk() { diff --git a/components/smallCommon/Pie2.vue b/components/smallCommon/Pie2.vue new file mode 100644 index 0000000..9bda92b --- /dev/null +++ b/components/smallCommon/Pie2.vue @@ -0,0 +1,47 @@ + + + + + diff --git a/mixins/echarts.mixin.js b/mixins/echarts.mixin.js index f5caa23..1776969 100644 --- a/mixins/echarts.mixin.js +++ b/mixins/echarts.mixin.js @@ -2,6 +2,10 @@ import {groupBy} from 'lodash' export default { props: { + title: { + type: String, + default: '' + }, data: { type: Array, default: () => [] diff --git a/mixins/https.js b/mixins/https.js deleted file mode 100644 index 45915ab..0000000 --- a/mixins/https.js +++ /dev/null @@ -1,205 +0,0 @@ -import * as apis from '@/services/apis' -import { orderBy } from 'lodash' -import moment from "moment"; -import {generateUUID} from "ant-design-vue/lib/vc-select/util"; - -const colors = [ - '#00FEF6', - '#FF9811', - '#FF4D11', - '#529a58', - '#D58FFF', - '#0395F6', - '#d5b11e', - '#03f634', - '#d5391e', - '#f6ce03' -] -export default { - created() { - this.getData() - if (this.timer) { - clearInterval(this.timer) - this.timer = null - } - this.timer = setInterval(() => { - this.getData() - }, 5000) - }, - beforeDestroy() { - if (this.timer) { - clearInterval(this.timer) - this.timer = null - } - }, - data () { - return { - resourcesStatistics: {}, - studentGradStatistics: [], - deviceStatistics: {}, - accessStatistics: {}, - classBrandStatistics: {}, - studentAttendanceStatistics: {}, - studentAttendanceStatisticsPie: [], - leaveStatistics: [], - gradeStatistics: [], - gradeStatisticsData: [], - accessInfo: [], - studentSexStatistics: { - men: { - total: 0, - percent: 0 - }, - women: { - total: 0, - percent: 0 - } - } - } - }, - methods: { - getData () { - this.getResourcesStatistics() - this.getStudentGradStatistics() - this.getStudentSexStatistics() - this.getDeviceStatistics() - this.getAccessStatistics() - this.getClassBrandStatistics() - this.getAccessInfo() - this.getStudentAttendanceStatistics() - this.getGradeStatistics() - this.getLeaveStatistics() - }, - - getPercent (num, total) { - if (num === 0) return 0 - if (total === 0) return 100 - return (num * 100 / total).toFixed(2) - }, - // 获取教育资源 - async getResourcesStatistics () { - const { data } = await apis.getResourcesStatistics() - this.resourcesStatistics = data || {} - }, - // 各年级学生分布信息 - async getStudentGradStatistics () { - const {data} = await apis.getStudentGradStatistics() - - this.studentGradStatistics = (data || []).map((item, index) => { - return { - attr: '年级分布', - name: `${item.gradeIndex}年级`, - value: item.studentNumber, - color: colors[index] - } - }) - - }, - // 性别分布 - async getStudentSexStatistics () { - const { data } = await apis.getStudentSexStatistics() - const total = (data || []).reduce((a, b) => a + b.studentNumber || 0, 0) - const men = (data || []).filter(item => `${item.studentSex}` === '1').reduce((a, b) => a + b.studentNumber || 0, 0) - const women = (data || []).filter(item => `${item.studentSex}` === '2').reduce((a, b) => a + b.studentNumber || 0, 0) - this.studentSexStatistics = { - men: { - total: men, - percent: this.getPercent(men, total) - }, - women: { - total: women, - percent: this.getPercent(women, total) - } - } - }, - // 电子班牌概况 - async getDeviceStatistics () { - const { data } = await apis.getDeviceStatistics() - this.deviceStatistics = data || {} - }, - // 门禁出入人数 - async getAccessStatistics () { - const { data } = await apis.getAccessStatistics() - this.accessStatistics = data || {} - }, - - async getClassBrandStatistics () { - const { data } = await apis.getClassBrandStatistics() - this.classBrandStatistics = data || {} - }, - - - async getAccessInfo () { - const { data } = await apis.getAccessInfo() - this.accessInfo = (data || []).map(item => ({ - ...item, - uuid: generateUUID() - })) - }, - - async getStudentAttendanceStatistics () { - const { data } = await apis.getStudentAttendanceStatistics() - const _data = data || {} - this.studentAttendanceStatistics =_data - this.studentAttendanceStatisticsPie = [ - { - attr: '考勤', - name: '出勤', - value: _data.studentAttendanceNumber || 0, - color: colors[0] - }, - { - attr: '考勤', - name: '迟到', - value: _data.studentAttendanceLaterNumber || 0, - color: colors[1] - }, - { - attr: '考勤', - name: '缺勤', - value: _data.studentAttendanceLossNumber || 0, - color: colors[2] - }, - { - attr: '考勤', - name: '请假', - value: _data.studentAttendanceLeaveNumber || 0, - color: colors[3] - } - ] - }, - - async getGradeStatistics () { - const { data } = await apis.getGradeStatistics() - this.gradeStatisticsData = data || [] - this.getGradeStatisticsPieData() - }, - getGradeStatisticsPieData () { - const item = this.gradeStatisticsData.find(item => `${item && item.gradeIndex}` === `${this.cls}`) || {} - this.gradeStatistics = orderBy((item.classStatisticsList || []).map((item, index) => ({ - attr: '班级', - name: `${item.className }`, - value: item.studentNumber || 0, - color: colors[index] - })), ['name'], ['asc']) - }, - - async getLeaveStatistics () { - const { data } = await apis.getLeaveStatistics() - this.leaveStatistics = (data || []).map(item => { - return [ - { - attr: '事假', - name: moment(item.leaveDate).format('MM/DD'), - value: item.businessLeavee || 0 - }, - { - attr: '病假', - name: moment(item.leaveDate).format('MM/DD'), - value: item.sickLeaveNumber || 0 - } - ] - }).flat(Infinity) - } - } -} diff --git a/pages/cleanTravel/trend.vue b/pages/cleanTravel/trend.vue index 433a38c..c0a47e2 100644 --- a/pages/cleanTravel/trend.vue +++ b/pages/cleanTravel/trend.vue @@ -3,31 +3,44 @@ - 清洁运输+趋势 - - - - - 运输车辆占比 - 运输量占比 - - - - - - - - + + 清洁运输+趋势 + + + + + + + 运输车辆占比 + + + + 运输量占比 + + + + + + + + + + + + + + + @@ -36,16 +49,17 @@