修改了统计页面

This commit is contained in:
chenze 2024-08-26 10:41:44 +08:00
parent 1d995f67e2
commit a9597e8c8b
3 changed files with 67 additions and 98 deletions

View File

@ -91,10 +91,6 @@ export default {
title: '维修单号', title: '维修单号',
dataIndex: 'sn' dataIndex: 'sn'
}, },
{
title: '报修名称',
dataIndex: 'repairName'
},
{ {
title: '所属分类', title: '所属分类',
dataIndex: 'typeName' dataIndex: 'typeName'
@ -168,7 +164,7 @@ export default {
}) })
} else { } else {
let datas = { let datas = {
'menu': 7, 'role': 7,
'type': 'all', 'type': 'all',
'sn': this.queryParam.sn, 'sn': this.queryParam.sn,
'name': this.queryParam.name, 'name': this.queryParam.name,

View File

@ -11,60 +11,7 @@
<a-form-item style="display:none"> <a-form-item style="display:none">
<a-input v-decorator="['id']" /> <a-input v-decorator="['id']" />
</a-form-item> </a-form-item>
<a-row>
<a-col :span="10">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="工单名称">
<a-input placeholder="工单名称"
v-decorator="['repairName', {rules: [{ required: true, message: '请输入工单名称' }]}]" />
</a-form-item>
</a-col>
<a-col :span="10">
<a-form-item label="故障时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-date-picker
format="YYYY-MM-DD HH:mm:ss"
valueFormat="YYYY-MM-DD HH:mm:ss"
v-decorator="['repairTime',{rules: [{ required: true, message: '选择报修时间'}]}]"
:show-time="{ defaultValue: moment('00:00:00', 'HH:mm:ss') }"
type="date"
placeholder="选择报修时间"
style="width: 100%;"
/>
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :span="10">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="故障等级">
<a-select v-decorator="['repairLevel',{rules: [{ required: true, message: '请选择故障等级'}]}]"
placeholder="请选择故障等级">
<a-select-option value="一级">
一级
</a-select-option>
<a-select-option value="二级">
二级
</a-select-option>
<a-select-option value="三级">
三级
</a-select-option>
<a-select-option value="四级">
四级
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="10">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="故障类型">
<a-select v-decorator="['failureTypeId', {rules: [{ required: true, message: '请选择所属设备' }]}]"
>
<a-select-option v-for="item in failureTypeList" :key="item.id">{{ item.name }}</a-select-option>
</a-select>
</a-form-item>
</a-col>
</a-row>
<a-row> <a-row>
<a-col :span="10"> <a-col :span="10">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="所属分类"> <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="所属分类">
@ -125,14 +72,21 @@
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="10"> <a-col :span="10">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="门牌号"> <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="门牌号(地点)">
<a-input placeholder="门牌号" <a-input placeholder="门牌号"
v-decorator="['room', {rules: [{ required: true, message: '请输入门牌号' }]}]" /> v-decorator="['room', {rules: [{ required: true, message: '请输入门牌号' }]}]" />
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
<a-row> <a-row>
<a-col :span="10">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="故障类型">
<a-select v-decorator="['failureTypeId', {rules: [{ required: true, message: '请选择所属设备' }]}]"
>
<a-select-option v-for="item in failureTypeList" :key="item.id">{{ item.name }}</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="10"> <a-col :span="10">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="报修内容"> <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="报修内容">
<a-textarea placeholder="报修内容" v-decorator="['explain']" /> <a-textarea placeholder="报修内容" v-decorator="['explain']" />

View File

@ -31,11 +31,9 @@
<div class="headView"> <div class="headView">
<div class="titleView">工单统计</div> <div class="titleView">工单统计</div>
<div class="typeView"> <div class="typeView">
<div :class="type=='month' ? 'activity' : ''" class="type " @click="repairCount">本月</div> <a-range-picker @change="onChange" />
<div :class="type=='year' ? 'activity' : ''" class="type" @click="getYearCount">本年</div>
</div> </div>
</div> </div>
<div class="contentView"> <div class="contentView">
<div class="itemView"> <div class="itemView">
<div class="label">维修工单</div> <div class="label">维修工单</div>
@ -219,6 +217,7 @@
<script> <script>
import * as echarts from 'echarts' import * as echarts from 'echarts'
import { import {
repairAdminStats, repairAdminStats,
repairStats, repairStats,
@ -305,7 +304,9 @@ export default {
} }
], ],
// Promise // Promise
loadData: [] loadData: [],
startTime: '',
endTime: ''
} }
}, },
mounted () { mounted () {
@ -315,9 +316,35 @@ export default {
this.deviceStats() this.deviceStats()
this.faultStats() this.faultStats()
this.selectFailureStats() this.selectFailureStats()
}, },
methods: { methods: {
onChange (value, dateString) {
this.startTime = dateString[0]
this.endTime = dateString[1]
repairStats({ startDate: this.startTime, endDate: this.endTime }).then(res => {
console.log(res.currentMonth.wc)
this.repairStatsCount = res.currentMonth.stats
this.finishCount = res.currentMonth.wc
this.timeout = res.currentMonth.timeout
this.pj = res.currentMonth.pj
this.createEchartCake('echart1', {
bottom: 10,
left: 'right',
orient: 'vertical'
}, this.finishCount)
this.createEchartCake('echart2', {
bottom: 10,
left: 'right',
orient: 'vertical'
}, this.timeout)
this.createEchartCake('echart3', {
bottom: 10,
left: 'right',
orient: 'vertical'
}, this.pj)
})
},
// 使openChange // 使openChange
openChange (open) { openChange (open) {
this.floor.open = open this.floor.open = open
@ -467,13 +494,21 @@ export default {
}, this.selectFaultStatsCount) }, this.selectFaultStatsCount)
}) })
}, },
getYearCount () { repairCount () {
this.type = 'year' var now = new Date() //
repairStats().then(res => { var nowYear = now.getFullYear() //
this.repairStatsCount = res.currentYear.stats var nowMonth = now.getMonth() // 0~11
this.finishCount = res.currentYear.wc let date = this.formatDate(new Date())
this.timeout = res.currentYear.timeout console.log(date)
this.pj = res.currentYear.pj let lastDay = new Date(nowYear, nowMonth + 1, 0)
let endDate = this.formatDate(lastDay)
console.log()
repairStats({ startDate: date, endDate: endDate, type: 'repair' }).then(res => {
this.repairStatsCount = res.data.stats
})
repairStats({ startDate: date, endDate: endDate, type: 'end' }).then(res => {
this.finishCount = res.data.wc
this.timeout = res.data.timeout
this.createEchartCake('echart1', { this.createEchartCake('echart1', {
bottom: 10, bottom: 10,
left: 'right', left: 'right',
@ -490,26 +525,9 @@ export default {
orient: 'vertical' orient: 'vertical'
}, this.pj) }, this.pj)
}) })
}, repairStats({ startDate: date, endDate: endDate, type: 'eval' }).then(res => {
repairCount () { this.pj = res.data.pj
repairStats().then(res => {
this.type = 'month'
console.log(res.currentMonth.wc)
this.repairStatsCount = res.currentMonth.stats
this.finishCount = res.currentMonth.wc
this.timeout = res.currentMonth.timeout
this.pj = res.currentMonth.pj
this.createEchartCake('echart1', {
bottom: 10,
left: 'right',
orient: 'vertical'
}, this.finishCount)
this.createEchartCake('echart2', {
bottom: 10,
left: 'right',
orient: 'vertical'
}, this.timeout)
this.createEchartCake('echart3', { this.createEchartCake('echart3', {
bottom: 10, bottom: 10,
left: 'right', left: 'right',
@ -524,12 +542,13 @@ export default {
this.createEchartLine('echart4', res.data) this.createEchartLine('echart4', res.data)
}) })
}, },
formatDate () { formatDate (date) {
let date = new Date() let year = date.getFullYear() // (4)
let myyear = date.getFullYear() let month = date.getMonth() + 1 // (0-11,01)
let mymonth = date.getMonth() + 1 let strDate = date.getDate() // (1-31)
mymonth < 10 ? mymonth = '0' + mymonth : mymonth if (month < 10) month = `0${month}` // 0
return `${myyear}-${mymonth}` if (strDate < 10) strDate = `0${strDate}` // 0
return `${year}-${month}-${strDate}`
}, },
onSelectChange (selectedRowKeys, selectedRows) { onSelectChange (selectedRowKeys, selectedRows) {