|
@@ -1,136 +1,222 @@
|
|
|
<template>
|
|
|
<div class="page-header-index-wide">
|
|
|
- <a-row :gutter="24">
|
|
|
- <a-col :sm="24" :md="12" :xl="6" :style="{ marginBottom: '24px' }">
|
|
|
- <chart-card :loading="loading" title="本月任务总数" total="¥126,560">
|
|
|
- <a-tooltip title="指标说明" slot="action">
|
|
|
- <a-icon type="info-circle-o" />
|
|
|
- </a-tooltip>
|
|
|
- <div>
|
|
|
- </div>
|
|
|
- </chart-card>
|
|
|
- </a-col>
|
|
|
- <a-col :sm="24" :md="12" :xl="6" :style="{ marginBottom: '24px' }">
|
|
|
- <chart-card :loading="loading" title="本月完成数" :total="8846 | NumberFormat">
|
|
|
- <a-tooltip title="指标说明" slot="action">
|
|
|
- <a-icon type="info-circle-o" />
|
|
|
- </a-tooltip>
|
|
|
- </chart-card>
|
|
|
- </a-col>
|
|
|
- <a-col :sm="24" :md="12" :xl="6" :style="{ marginBottom: '24px' }">
|
|
|
- <chart-card :loading="loading" title="本月未完成数" :total="6560 | NumberFormat">
|
|
|
- <a-tooltip title="指标说明" slot="action">
|
|
|
- <a-icon type="info-circle-o" />
|
|
|
- </a-tooltip>
|
|
|
- </chart-card>
|
|
|
- </a-col>
|
|
|
- <a-col :sm="24" :md="12" :xl="6" :style="{ marginBottom: '24px' }">
|
|
|
- <chart-card :loading="loading" title="本月完成率" total="78%">
|
|
|
- <a-tooltip title="指标说明" slot="action">
|
|
|
- <a-icon type="info-circle-o" />
|
|
|
- </a-tooltip>
|
|
|
- </chart-card>
|
|
|
- </a-col>
|
|
|
- </a-row>
|
|
|
-
|
|
|
- <a-card :loading="loading" :bordered="false" :body-style="{padding: '0'}">
|
|
|
+ <a-card title="保养任务月统计报表" :loading="loading" v-show="visible" :bordered="false" :body-style="{padding: '0'}">
|
|
|
<div class="salesCard">
|
|
|
<a-tabs default-active-key="1" size="large" :tab-bar-style="{marginBottom: '24px', paddingLeft: '16px'}">
|
|
|
<div class="extra-wrapper" slot="tabBarExtraContent">
|
|
|
- <div class="extra-item">
|
|
|
- <a>9月</a>
|
|
|
- </div>
|
|
|
- <a-range-picker :style="{width: '256px'}" />
|
|
|
+ <a-button type="primary" icon="printer" @click="handlePrint()">打印</a-button>
|
|
|
+ <a-button style="margin-left: 8px" type="primary" @click="doExport()">导出</a-button>
|
|
|
+ <a-select style="margin-left: 8px" @change="changeYear" v-model="queryParam.year" placeholder="请选择">
|
|
|
+ <a-select-option
|
|
|
+ v-for="item in years"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value">{{ item.label }}
|
|
|
+ </a-select-option>
|
|
|
+ </a-select>
|
|
|
</div>
|
|
|
- <a-tab-pane loading="true" tab="月统计" key="1">
|
|
|
+ <a-tab-pane loading="true" tab="图形统计" key="1">
|
|
|
+ <a-row>
|
|
|
+ <a-col :xl="24" :lg="24" :md="24" :sm="24" :xs="24">
|
|
|
+ <div style="padding: 10px">
|
|
|
+ <div id="container"></div>
|
|
|
+ </div>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-tab-pane>
|
|
|
+ <a-tab-pane loading="true" tab="表格统计" key="2">
|
|
|
<a-row>
|
|
|
<a-col :xl="24" :lg="24" :md="24" :sm="24" :xs="24">
|
|
|
- <g2-chart></g2-chart>
|
|
|
+ <div style="padding: 10px">
|
|
|
+ <a-table
|
|
|
+ bordered
|
|
|
+ :data-source="chartsData"
|
|
|
+ :columns="columns"
|
|
|
+ tableLayout="auto"
|
|
|
+ :scroll="{x: 1, y: BaseTool.Constant.scrollY }"
|
|
|
+ rowKey="month">
|
|
|
+ </a-table>
|
|
|
+ </div>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
</a-tab-pane>
|
|
|
</a-tabs>
|
|
|
</div>
|
|
|
</a-card>
|
|
|
+ <print-in-check-job-report ref="basePrintModal" @ok="handleOk"/>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import moment from 'moment'
|
|
|
-import { ChartCard, G2Chart } from '@/components'
|
|
|
+import { getMonthReport, exportMonthReport } from '@/api/report/check-job'
|
|
|
+import { Chart } from '@antv/g2'
|
|
|
+import PrintInCheckJobReport from '@/views/dashboard/modules/PrintInCheckJobReport'
|
|
|
|
|
|
export default {
|
|
|
name: 'Analysis',
|
|
|
components: {
|
|
|
- ChartCard,
|
|
|
- G2Chart
|
|
|
+ PrintInCheckJobReport,
|
|
|
+ Chart
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
- loading: true,
|
|
|
- serverData: []
|
|
|
+ loading: false,
|
|
|
+ serverData: [],
|
|
|
+ queryParam: {
|
|
|
+ year: 2021
|
|
|
+ },
|
|
|
+ years: [],
|
|
|
+ visible: true,
|
|
|
+ chart: null, // 创建一个chart变量
|
|
|
+ chartsData: [],
|
|
|
+ // 表头
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ title: '月份',
|
|
|
+ width: 180,
|
|
|
+ dataIndex: 'month'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '数量',
|
|
|
+ width: 120,
|
|
|
+ dataIndex: 'totalNum'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '完成数量',
|
|
|
+ width: 120,
|
|
|
+ dataIndex: 'totalFinishNum'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '未完成数量',
|
|
|
+ width: 120,
|
|
|
+ dataIndex: 'totalWaitNum'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '完成率',
|
|
|
+ width: 120,
|
|
|
+ dataIndex: 'finishRate'
|
|
|
+ }
|
|
|
+ ]
|
|
|
}
|
|
|
},
|
|
|
created () {
|
|
|
- setTimeout(() => {
|
|
|
- this.loading = !this.loading
|
|
|
- }, 1000)
|
|
|
+ this.initSelectYear()
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ this.changeYear(this.queryParam.year)
|
|
|
},
|
|
|
methods: {
|
|
|
- getData () {
|
|
|
- this.serverData =
|
|
|
- [{ 'mzkId': 112, 'strftime': '2017-01-11', 'value': 9275501 }, // 测试数据,根据自己需求自己设置数据
|
|
|
- { 'mzkId': 112, 'strftime': '2017-01-12', 'value': 9281904 },
|
|
|
- { 'mzkId': 112, 'strftime': '2017-01-13', 'value': 9290777 },
|
|
|
- { 'mzkId': 112, 'strftime': '2017-01-14', 'value': 9297913 },
|
|
|
- { 'mzkId': 112, 'strftime': '2017-01-15', 'value': 9306918 },
|
|
|
- { 'mzkId': 112, 'strftime': '2017-01-16', 'value': 9315641 }]
|
|
|
+ initSelectYear () {
|
|
|
+ var myDate = new Date()
|
|
|
+ this.queryParam.year = myDate.getFullYear()// 获取当前年
|
|
|
+ this.years = []
|
|
|
+ for (let i = 0; i < 5; i++) {
|
|
|
+ this.years.push({ value: (this.queryParam.year - i), label: (this.queryParam.year - i) + '年' })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ changeYear (value) {
|
|
|
+ this.queryParam.year = value
|
|
|
+ getMonthReport(this.queryParam)
|
|
|
+ .then(res => {
|
|
|
+ this.chartsData = res.data
|
|
|
+
|
|
|
+ // 需要将数据分组:总数,完成数
|
|
|
+ const groupData = []
|
|
|
+ this.chartsData.forEach(function (data) {
|
|
|
+ groupData.push({ name: '总数', month: data.month, num: data.totalNum })
|
|
|
+ groupData.push({ name: '完成数', month: data.month, num: data.totalFinishNum })
|
|
|
+ })
|
|
|
+ this.getCharts('container', groupData)// 调用统计图
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getCharts (id, data) {
|
|
|
+ this.chart && this.chart.destroy()// 防止点击搜索按钮新增一个
|
|
|
+ this.chart = new Chart({
|
|
|
+ container: 'container',
|
|
|
+ autoFit: true,
|
|
|
+ height: 400
|
|
|
+ })
|
|
|
+ this.chart.data(data)
|
|
|
+ this.chart.scale('num', {
|
|
|
+ nice: true
|
|
|
+ })
|
|
|
+ this.chart.tooltip({
|
|
|
+ showMarkers: false,
|
|
|
+ shared: true
|
|
|
+ })
|
|
|
+ this.chart.interval().position('month*num').color('name').adjust([
|
|
|
+ {
|
|
|
+ type: 'dodge',
|
|
|
+ marginRatio: 0
|
|
|
+ }
|
|
|
+ ])
|
|
|
+ this.chart.interaction('active-region')
|
|
|
+ this.chart.legend({
|
|
|
+ position: 'bottom'
|
|
|
+ })
|
|
|
+ this.chart.render()
|
|
|
+ },
|
|
|
+ doExport () {
|
|
|
+ const parameter = {
|
|
|
+ ...this.queryParam
|
|
|
+ }
|
|
|
+ exportMonthReport(parameter).then(file => {
|
|
|
+ this.BaseTool.UPLOAD.downLoadExportExcel(file)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handlePrint (record) {
|
|
|
+ const modal = this.$refs.basePrintModal
|
|
|
+ this.visible = false
|
|
|
+ modal.base({ year: this.queryParam.year, data: this.chartsData })
|
|
|
+ },
|
|
|
+ handleOk () {
|
|
|
+ this.visible = true
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
- .extra-wrapper {
|
|
|
- line-height: 55px;
|
|
|
- padding-right: 24px;
|
|
|
+.extra-wrapper {
|
|
|
+ line-height: 55px;
|
|
|
+ padding-right: 24px;
|
|
|
|
|
|
- .extra-item {
|
|
|
- display: inline-block;
|
|
|
- margin-right: 24px;
|
|
|
+ .extra-item {
|
|
|
+ display: inline-block;
|
|
|
+ margin-right: 24px;
|
|
|
|
|
|
- a {
|
|
|
- margin-left: 24px;
|
|
|
- }
|
|
|
+ a {
|
|
|
+ margin-left: 24px;
|
|
|
}
|
|
|
}
|
|
|
+}
|
|
|
|
|
|
- .antd-pro-pages-dashboard-analysis-twoColLayout {
|
|
|
- position: relative;
|
|
|
- display: flex;
|
|
|
- display: block;
|
|
|
- flex-flow: row wrap;
|
|
|
- }
|
|
|
+.antd-pro-pages-dashboard-analysis-twoColLayout {
|
|
|
+ position: relative;
|
|
|
+ display: flex;
|
|
|
+ display: block;
|
|
|
+ flex-flow: row wrap;
|
|
|
+}
|
|
|
|
|
|
- .antd-pro-pages-dashboard-analysis-salesCard {
|
|
|
- height: calc(100% - 24px);
|
|
|
- /deep/ .ant-card-head {
|
|
|
- position: relative;
|
|
|
- }
|
|
|
+.antd-pro-pages-dashboard-analysis-salesCard {
|
|
|
+ height: calc(100% - 24px);
|
|
|
+ /deep/ .ant-card-head {
|
|
|
+ position: relative;
|
|
|
}
|
|
|
+}
|
|
|
|
|
|
- .dashboard-analysis-iconGroup {
|
|
|
- i {
|
|
|
- margin-left: 16px;
|
|
|
- color: rgba(0,0,0,.45);
|
|
|
- cursor: pointer;
|
|
|
- transition: color .32s;
|
|
|
- color: black;
|
|
|
- }
|
|
|
- }
|
|
|
- .analysis-salesTypeRadio {
|
|
|
- position: absolute;
|
|
|
- right: 54px;
|
|
|
- bottom: 12px;
|
|
|
+.dashboard-analysis-iconGroup {
|
|
|
+ i {
|
|
|
+ margin-left: 16px;
|
|
|
+ color: rgba(0,0,0,.45);
|
|
|
+ cursor: pointer;
|
|
|
+ transition: color .32s;
|
|
|
+ color: black;
|
|
|
}
|
|
|
+}
|
|
|
+.analysis-salesTypeRadio {
|
|
|
+ position: absolute;
|
|
|
+ right: 54px;
|
|
|
+ bottom: 12px;
|
|
|
+}
|
|
|
</style>
|