修改了统计页面

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

View File

@ -11,60 +11,7 @@
<a-form-item style="display:none">
<a-input v-decorator="['id']" />
</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-col :span="10">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="所属分类">
@ -125,14 +72,21 @@
</a-form-item>
</a-col>
<a-col :span="10">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="门牌号">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="门牌号(地点)">
<a-input placeholder="门牌号"
v-decorator="['room', {rules: [{ required: true, message: '请输入门牌号' }]}]" />
</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="['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-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="报修内容">
<a-textarea placeholder="报修内容" v-decorator="['explain']" />

View File

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