|
@@ -4,16 +4,20 @@
|
|
|
<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-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 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-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>
|
|
@@ -33,8 +37,13 @@
|
|
|
:data-source="chartsData"
|
|
|
:columns="columns"
|
|
|
tableLayout="auto"
|
|
|
- :scroll="{x: 1, y: BaseTool.Constant.scrollY }"
|
|
|
+ :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>
|
|
@@ -44,6 +53,7 @@
|
|
|
</div>
|
|
|
</a-card>
|
|
|
<print-in-repair-report-mttr ref="basePrintModal" @ok="handleOk"/>
|
|
|
+ <detail-repair-report ref="detailModal" @ok="handleOk"/>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -51,12 +61,14 @@
|
|
|
import { getMonthReportMttr, exportMonthReportMttr } from '@/api/report/application-form'
|
|
|
import { Chart } from '@antv/g2'
|
|
|
import PrintInRepairReportMttr from '@/views/dashboard/modules/PrintInRepairReportMttr'
|
|
|
+import DetailRepairReport from '@/views/dashboard/modules/DetailRepairReport'
|
|
|
|
|
|
export default {
|
|
|
name: 'Analysis',
|
|
|
components: {
|
|
|
PrintInRepairReportMttr,
|
|
|
- Chart
|
|
|
+ Chart,
|
|
|
+ DetailRepairReport
|
|
|
},
|
|
|
props: {
|
|
|
title: {
|
|
@@ -69,7 +81,6 @@ export default {
|
|
|
loading: false,
|
|
|
serverData: [],
|
|
|
queryParam: {
|
|
|
- year: 2021
|
|
|
},
|
|
|
years: [],
|
|
|
visible: true,
|
|
@@ -96,20 +107,29 @@ export default {
|
|
|
title: '平均修复时间(小时)',
|
|
|
width: 120,
|
|
|
dataIndex: 'mttr'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ key: 'action',
|
|
|
+ width: '200px',
|
|
|
+ align: 'center',
|
|
|
+ scopedSlots: { customRender: 'action' }
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
},
|
|
|
created () {
|
|
|
- this.initSelectYear()
|
|
|
+ // this.initSelectYear()
|
|
|
},
|
|
|
mounted () {
|
|
|
- this.changeYear(this.queryParam.year)
|
|
|
+ // this.changeYear(this.queryParam.year)
|
|
|
},
|
|
|
methods: {
|
|
|
initSelectYear () {
|
|
|
- var myDate = new Date()
|
|
|
- this.queryParam.year = myDate.getFullYear()// 获取当前年
|
|
|
+ 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) + '年' })
|
|
@@ -117,6 +137,25 @@ export default {
|
|
|
},
|
|
|
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
|
|
|
+ }
|
|
|
getMonthReportMttr(this.queryParam)
|
|
|
.then(res => {
|
|
|
this.chartsData = res.data
|
|
@@ -143,6 +182,9 @@ export default {
|
|
|
this.chart.legend({
|
|
|
position: 'bottom'
|
|
|
})
|
|
|
+ this.chart.option('scrollbar', {
|
|
|
+ type: 'horizontal'
|
|
|
+ })
|
|
|
this.chart.render()
|
|
|
},
|
|
|
doExport () {
|
|
@@ -156,7 +198,11 @@ export default {
|
|
|
handlePrint (record) {
|
|
|
const modal = this.$refs.basePrintModal
|
|
|
this.visible = false
|
|
|
- modal.base({ year: this.queryParam.year, title: this.title, data: this.chartsData })
|
|
|
+ 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
|