|
@@ -0,0 +1,257 @@
|
|
|
+<template>
|
|
|
+ <div class="page-header-index-wide">
|
|
|
+ <a-card :title="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">
|
|
|
+
|
|
|
+ <!-- <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>-->
|
|
|
+ <a-month-picker style="margin-left: 8px" v-model="queryParam.startMonth" placeholder="开始月份" @change="onStartChange" />
|
|
|
+ <a-month-picker style="margin-left: 8px" v-model="queryParam.endMonth" placeholder="结束月份" @change="onEndChange" />
|
|
|
+ <a-button style="margin-left: 8px" type="default" @click="getData()">查询</a-button>
|
|
|
+ <a-button style="margin-left: 8px" type="primary" icon="printer" @click="handlePrint()">打印</a-button>
|
|
|
+ <a-button style="margin-left: 8px" type="primary" @click="doExport()">导出</a-button>
|
|
|
+ </div>
|
|
|
+ <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">
|
|
|
+ <div style="padding: 10px">
|
|
|
+ <a-table
|
|
|
+ bordered
|
|
|
+ :data-source="chartsData"
|
|
|
+ :columns="columns"
|
|
|
+ tableLayout="auto"
|
|
|
+ :scroll="{x: 1000, y: BaseTool.Constant.scrollY }"
|
|
|
+ rowKey="month">
|
|
|
+ <span slot="action" slot-scope="record">
|
|
|
+ <template>
|
|
|
+ <a @click="handleView(record)">查看明细</a>
|
|
|
+ </template>
|
|
|
+ </span>
|
|
|
+ </a-table>
|
|
|
+ </div>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-tab-pane>
|
|
|
+ </a-tabs>
|
|
|
+ </div>
|
|
|
+ </a-card>
|
|
|
+ <print-in-repair-report-fee ref="basePrintModal" @ok="handleOk"/>
|
|
|
+ <detail-repair-report-fee ref="detailModal" @ok="handleOk"/>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { getMonthReportFee, exportMonthReportFee } from '@/api/report/repair-fee'
|
|
|
+import { Chart } from '@antv/g2'
|
|
|
+import PrintInRepairReportFee from '@/views/dashboard/modules/PrintInRepairReportFee'
|
|
|
+import DetailRepairReportFee from '@/views/dashboard/modules/DetailRepairReportFee'
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'RepairReportFee',
|
|
|
+ components: {
|
|
|
+ PrintInRepairReportFee,
|
|
|
+ Chart,
|
|
|
+ DetailRepairReportFee
|
|
|
+ },
|
|
|
+ props: {
|
|
|
+ title: {
|
|
|
+ type: String,
|
|
|
+ default: '费用月统计报表'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ loading: false,
|
|
|
+ serverData: [],
|
|
|
+ queryParam: {
|
|
|
+ },
|
|
|
+ years: [],
|
|
|
+ visible: true,
|
|
|
+ chart: null, // 创建一个chart变量
|
|
|
+ chartsData: [],
|
|
|
+ // 表头
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ title: '月份',
|
|
|
+ width: 180,
|
|
|
+ dataIndex: 'month'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '月费用次数',
|
|
|
+ width: 120,
|
|
|
+ dataIndex: 'num'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '总费用',
|
|
|
+ width: 120,
|
|
|
+ dataIndex: 'totalFee'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '平均费用',
|
|
|
+ width: 120,
|
|
|
+ dataIndex: 'meanFee'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ key: 'action',
|
|
|
+ width: '200px',
|
|
|
+ align: 'center',
|
|
|
+ scopedSlots: { customRender: 'action' }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created () {
|
|
|
+ // this.initSelectYear()
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ // this.changeYear(this.queryParam.year)
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ initSelectYear () {
|
|
|
+ const myDate = new Date()
|
|
|
+ // this.queryParam.year = myDate.getFullYear()// 获取当前年
|
|
|
+ this.queryParam.startMonth = myDate.getFullYear() + '-01-01'
|
|
|
+ this.queryParam.endMonth = myDate.getFullYear() + '-12-01'
|
|
|
+ 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
|
|
|
+ this.getData()
|
|
|
+ },
|
|
|
+ onStartChange (date, dateString) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.queryParam.startMonth = this.BaseTool.Date.formatter(dateString + '-01', this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onEndChange (date, dateString) {
|
|
|
+ this.queryParam.endMonth = this.BaseTool.Date.formatter(dateString + '-01', this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
|
|
|
+ },
|
|
|
+ getData () {
|
|
|
+ if (this.queryParam.startMonth == null) {
|
|
|
+ this.$message.error('请选择起始月份')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.queryParam.endMonth == null) {
|
|
|
+ this.$message.error('请选择结束月份')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ getMonthReportFee(this.queryParam)
|
|
|
+ .then(res => {
|
|
|
+ this.chartsData = res.data
|
|
|
+ this.getCharts('container', this.chartsData)// 调用统计图
|
|
|
+ })
|
|
|
+ },
|
|
|
+ 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('总费用', {
|
|
|
+ nice: true
|
|
|
+ })
|
|
|
+ this.chart.tooltip({
|
|
|
+ showMarkers: true,
|
|
|
+ shared: true
|
|
|
+ })
|
|
|
+ this.chart.interval().position('month*totalFee')
|
|
|
+ this.chart.interaction('active-region')
|
|
|
+ this.chart.legend({
|
|
|
+ position: 'bottom'
|
|
|
+ })
|
|
|
+ this.chart.option('scrollbar', {
|
|
|
+ type: 'horizontal'
|
|
|
+ })
|
|
|
+ this.chart.render()
|
|
|
+ },
|
|
|
+ doExport () {
|
|
|
+ const parameter = {
|
|
|
+ ...this.queryParam
|
|
|
+ }
|
|
|
+ exportMonthReportFee(parameter).then(file => {
|
|
|
+ this.BaseTool.UPLOAD.downLoadExportExcel(file)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handlePrint (record) {
|
|
|
+ const modal = this.$refs.basePrintModal
|
|
|
+ this.visible = false
|
|
|
+ modal.base({ startMonth: this.queryParam.startMonth, endMonth: this.queryParam.endMonth, title: this.title, data: this.chartsData })
|
|
|
+ },
|
|
|
+ handleView (record) {
|
|
|
+ const modal = this.$refs.detailModal
|
|
|
+ modal.base(record)
|
|
|
+ },
|
|
|
+ handleOk () {
|
|
|
+ this.visible = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped>
|
|
|
+ .extra-wrapper {
|
|
|
+ line-height: 55px;
|
|
|
+ padding-right: 24px;
|
|
|
+
|
|
|
+ .extra-item {
|
|
|
+ display: inline-block;
|
|
|
+ margin-right: 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-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;
|
|
|
+ }
|
|
|
+</style>
|