Merge remote-tracking branch 'origin/shoot-hand-html' into shoot-hand-html

This commit is contained in:
chenze 2024-08-28 21:35:28 +08:00
commit c114f791ec
2 changed files with 143 additions and 328 deletions

View File

@ -53,7 +53,7 @@ export function repairStats (parameter) {
params: parameter params: parameter
}) })
} }
//第四行 左侧 楼层负责人情况统计
export function floorStats (parameter) { export function floorStats (parameter) {
return axios({ return axios({
url: api.repairStats + '/floorStats', url: api.repairStats + '/floorStats',
@ -61,23 +61,23 @@ export function floorStats (parameter) {
params: parameter params: parameter
}) })
} }
//第四行 右上 设备故障统计
export function selectDeviceStats (parameter) { export function deviceStats (parameter) {
return axios({ return axios({
url: api.repairStats + '/deviceStats', url: api.repairStats + '/deviceStats',
method: 'get', method: 'get',
params: parameter params: parameter
}) })
} }
//第四行 右下 故障类型统计
export function selectFailureStats (parameter) { export function failureStats (parameter) {
return axios({ return axios({
url: api.repairStats + '/failureStats', url: api.repairStats + '/failureStats',
method: 'get', method: 'get',
params: parameter params: parameter
}) })
} }
//第五行 设备、品牌、评价 统计
export function deviceTypeStats (parameter) { export function deviceTypeStats (parameter) {
return axios({ return axios({
url: api.repairStats + '/deviceTypeStats', url: api.repairStats + '/deviceTypeStats',

View File

@ -30,8 +30,8 @@
<div class="caseStatisticsView"> <div class="caseStatisticsView">
<div class="headView"> <div class="headView">
<div class="titleView">工单统计</div> <div class="titleView">工单统计</div>
<div class="typeView"> <div class="typeView" style="width: 200px;">
<a-range-picker @change="onChange" /> <a-range-picker v-model="dateRange2" @change="onChange2" />
</div> </div>
</div> </div>
<div class="contentView"> <div class="contentView">
@ -66,10 +66,9 @@
<div class="caseStatusView"> <div class="caseStatusView">
<div class="headView"> <div class="headView">
<div class="titleView">工单完成情况</div> <div class="titleView">工单完成情况</div>
<!-- <div class="typeView">--> <div class="typeView" style="width: 200px;">
<!-- <div class="type activity">本周</div>--> <a-range-picker v-model="dateRange3L" @change="onChange3L" />
<!-- <div class="type">本年</div>--> </div>
<!-- </div>-->
</div> </div>
<div class="contentView"> <div class="contentView">
<div class="circularView"> <div class="circularView">
@ -84,6 +83,9 @@
<div class="evaluateView"> <div class="evaluateView">
<div class="headView"> <div class="headView">
<div class="titleView">评价情况</div> <div class="titleView">评价情况</div>
<div class="typeView" style="width: 200px;">
<a-range-picker v-model="dateRange3R" @change="onChange3R" />
</div>
</div> </div>
<div class="contentView"> <div class="contentView">
<div id="echart3" style="width: 400px; height: 300px"></div> <div id="echart3" style="width: 400px; height: 300px"></div>
@ -94,24 +96,8 @@
<div class="floorView"> <div class="floorView">
<div class="headView"> <div class="headView">
<div class="titleView">网格长</div> <div class="titleView">网格长</div>
<div class="conditionView"> <div class="typeView" style="width: 200px;">
<a-select :value="floor.type" @select="selectFloor" style="width: 120px;margin-right: 10px"> <a-range-picker v-model="dateRange4L" @change="onChange4L" />
<a-select-option value="month">按月</a-select-option>
<a-select-option value="year">按年</a-select-option>
</a-select>
<a-date-picker
v-if="floor.type == 'year' || floor.type == ''"
format="YYYY"
mode="year"
:value="floor.time"
placeholder="选择年份"
:open="floor.open"
@openChange="openChange"
@panelChange="panelChange"
>
</a-date-picker>
<a-month-picker v-if='floor.type =="month"' @change="clickFloor" :value="floor.time"
placeholder="请选择月" />
</div> </div>
</div> </div>
<div class="contentView"> <div class="contentView">
@ -122,24 +108,8 @@
<div class="blockView"> <div class="blockView">
<div class="headView"> <div class="headView">
<div class="titleView">故障统计</div> <div class="titleView">故障统计</div>
<div class="conditionView"> <div class="typeView" style="width: 200px;">
<a-select :value="fault.type" @select="selectFault" style="width: 120px;margin-right: 10px"> <a-range-picker v-model="dateRange4R1" @change="onChange4R1" />
<a-select-option value="month">按月</a-select-option>
<a-select-option value="year">按年</a-select-option>
</a-select>
<a-date-picker
v-if="fault.type == 'year' || fault.type == ''"
format="YYYY"
mode="year"
:value="fault.time"
placeholder="选择年份"
:open="fault.open"
@openChange="openFaultChange"
@panelChange="panelFaultChange"
>
</a-date-picker>
<a-month-picker v-if='fault.type =="month"' @change="clickFault" :value="fault.time"
placeholder="请选择月" />
</div> </div>
</div> </div>
<div class="contentView"> <div class="contentView">
@ -149,24 +119,8 @@
<div class="blockView"> <div class="blockView">
<div class="headView"> <div class="headView">
<div class="titleView">故障类型</div> <div class="titleView">故障类型</div>
<div class="conditionView"> <div class="typeView" style="width: 200px;">
<a-select :value="faultType.type" @select="selectFaultType" style="width: 120px;margin-right: 10px"> <a-range-picker v-model="dateRange4R2" @change="onChange4R2" />
<a-select-option value="month">按月</a-select-option>
<a-select-option value="year">按年</a-select-option>
</a-select>
<a-date-picker
v-if="faultType.type == 'year' || faultType.type == ''"
format="YYYY"
mode="year"
:value="faultType.time"
placeholder="选择年份"
:open="faultType.open"
@openChange="openFaultTypeChange"
@panelChange="panelFaultTypeChange"
>
</a-date-picker>
<a-month-picker v-if='faultType.type =="month"' @change="clickFaultType" :value="faultType.time"
placeholder="请选择月" />
</div> </div>
</div> </div>
<div class="contentView"> <div class="contentView">
@ -179,33 +133,17 @@
<div class="tableView"> <div class="tableView">
<div class="headView"> <div class="headView">
<div class="titleView">项目详情</div> <div class="titleView">项目详情</div>
<div class="conditionView"> <div class="typeView" style="width: 200px;">
<a-select :value="deviceType.type" @select="selectDeviceType" style="width: 120px;margin-right: 10px"> <a-range-picker v-model="dateRange5" @change="onChange5" />
<a-select-option value="month">按月</a-select-option>
<a-select-option value="year">按年</a-select-option>
</a-select>
<a-date-picker
v-if="deviceType.type == 'year' || deviceType.type == ''"
format="YYYY"
mode="year"
:value="deviceType.time"
placeholder="选择年份"
:open="deviceType.open"
@openChange="openDeviceTypeChange"
@panelChange="panelDeviceTypeChange"
>
</a-date-picker>
<a-month-picker v-if='deviceType.type =="month"' @change="clickDeviceType" :value="deviceType.time"
placeholder="请选择月" />
</div> </div>
</div> </div>
<div class="contentView"> <div class="contentView">
<a-table <a-table
size="default"
ref="table"
style="width: 100%" style="width: 100%"
:columns="columns" :columns="columns"
:data-source="loadData" :data-source="loadData"
showPagination="true"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
> >
</a-table> </a-table>
@ -217,22 +155,36 @@
<script> <script>
import * as echarts from 'echarts' import * as echarts from 'echarts'
import moment from 'moment'
import { STable } from '@/components'
import { import {
repairAdminStats, repairAdminStats,
repairStats, repairStats,
floorStats, floorStats,
deviceTypeStats, deviceStats,
selectDeviceStats, failureStats,
selectFailureStats deviceTypeStats
} from '@/api/admin/repair/repairStats' } from '@/api/admin/repair/repairStats'
//
const initStart=moment().startOf('isoWeek'),initEnd=moment().endOf('isoWeek');
export default { export default {
name: 'RepairStatistics', name: 'RepairStatistics',
components: {
STable
},
data () { data () {
return { return {
dateRange2: [initStart, initEnd],
dateRange3L: [initStart, initEnd],
dateRange3R: [initStart, initEnd],
dateRange4L: [initStart, initEnd],
dateRange4R1: [initStart, initEnd],
dateRange4R2: [initStart, initEnd],
dateRange5: [initStart, initEnd],
baseUrl: process.env.BASE_URL, baseUrl: process.env.BASE_URL,
type: '',
adminStatsCount: [], adminStatsCount: [],
repairStatsCount: [], repairStatsCount: [],
finishCount: [], finishCount: [],
@ -303,260 +255,124 @@ export default {
dataIndex: 'll' dataIndex: 'll'
} }
], ],
// Promise loadData: []
loadData: [],
startTime: '',
endTime: ''
} }
}, },
mounted () { mounted () {
this.adminStats() this.adminStats()//
this.repairCount() this.repairCount2()//
this.getfloorStats() this.repairCount3L()//
this.deviceStats() this.repairCount3R()//
this.faultStats() this.floorStats()//
this.selectFailureStats() this.deviceStats()//
this.failureStats()//
this.deviceTypeStats()//
}, },
methods: { methods: {
onChange (value, dateString) { onChange2 () {
this.startTime = dateString[0] this.repairCount2();
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 onChange3L() {
openChange (open) { this.repairCount3L();
this.floor.open = open
}, },
// 使panelChange onChange3R() {
panelChange (value) { this.repairCount3R();
// panelChange
this.floor.time = value
const date1 = new Date(this.floor.time).getFullYear()
floorStats({ date: date1 }).then(res => {
this.createEchartLine('echart4', res.data)
})
this.floor.open = false
}, },
// - onChange4L(){
selectFloor (value, option) { this.floorStats();
this.floor.type = value
}, },
clickFloor (a, c) { onChange4R1(){
this.floor.time = c this.deviceStats();
console.log(c)
floorStats({ date: c }).then(res => {
this.createEchartLine('echart4', res.data)
})
}, },
onChange4R2(){
// 使openChange this.failureStats();
openFaultChange (open) {
this.fault.open = open
}, },
// 使panelChange onChange5(){
panelFaultChange (value) { this.deviceTypeStats();
// panelChange
this.fault.time = value
const date1 = new Date(this.fault.time).getFullYear()
selectDeviceStats({ date: date1 }).then(res => {
this.faultStatsCount = res.data
this.createColumnEcharrt('echart5', res.data)
})
this.fault.open = false
}, },
// -
selectFault (value, option) {
this.fault.type = value
},
clickFault (a, c) {
this.fault.time = c
selectDeviceStats({ date: c }).then(res => {
this.faultStatsCount = res.data
this.createColumnEcharrt('echart5', res.data)
})
},
// 使openChange
openFaultTypeChange (open) {
this.faultType.open = open
},
// 使panelChange
panelFaultTypeChange (value) {
// panelChange
this.faultType.time = value
const date1 = new Date(this.faultType.time).getFullYear()
selectFailureStats({ date: date1 }).then(res => {
console.log(res)
this.selectFaultStatsCount = res.data
this.createEchartCake('echart6', {
bottom: 10,
left: 'right',
orient: 'vertical'
}, this.selectFaultStatsCount)
})
this.faultType.open = false
},
// -
selectFaultType (value, option) {
this.faultType.type = value
},
clickFaultType (a, c) {
this.faultType.time = c
selectFailureStats({ date: c }).then(res => {
console.log(res)
this.selectFaultStatsCount = res.data
this.createEchartCake('echart6', {
bottom: 10,
left: 'right',
orient: 'vertical'
}, this.selectFaultStatsCount)
})
},
// 使openChange
openDeviceTypeChange (open) {
this.deviceType.open = open
},
// 使panelChange
panelDeviceTypeChange (value) {
// panelChange
this.deviceType.time = value
this.deviceType.open = false
const date1 = new Date(this.deviceType.time).getFullYear()
deviceTypeStats({ date: date1 }).then(res => {
this.loadData = res.rows
})
},
// -
selectDeviceType (value, option) {
this.deviceType.type = value
},
clickDeviceType (a, c) {
console.log(c)
this.deviceType.time = c
deviceTypeStats({ date: c }).then(res => {
this.loadData = res.rows
})
},
adminStats () { adminStats () {
repairAdminStats().then(res => { repairAdminStats().then(res => {
this.adminStatsCount = res.repairAdminStats this.adminStatsCount = res.repairAdminStats
}) })
}, },
deviceStats () { repairCount2 (){
let date = this.formatDate() const startDate = this.dateRange2[0].format('YYYY-MM-DD');
deviceTypeStats({ date: date }).then(res => { const endDate = this.dateRange2[1].format('YYYY-MM-DD');
this.loadData = res.rows repairStats({ startDate: startDate, endDate: endDate, type: 'repair' }).then(res => {
})
},
faultStats () {
let date = this.formatDate()
selectDeviceStats({ date: date }).then(res => {
this.faultStatsCount = res.data
this.createColumnEcharrt('echart5', res.data)
})
},
selectFailureStats () {
let date = this.formatDate()
selectFailureStats({ date: date }).then(res => {
console.log(res)
this.selectFaultStatsCount = res.data
this.createEchartCake('echart6', {
bottom: 10,
left: 'right',
orient: 'vertical'
}, this.selectFaultStatsCount)
})
},
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 this.repairStatsCount = res.data.stats
}) })
repairStats({ startDate: date, endDate: endDate, type: 'end' }).then(res => { },
repairCount3L (){
const startDate = this.dateRange3L[0].format('YYYY-MM-DD');
const endDate = this.dateRange3L[1].format('YYYY-MM-DD');
repairStats({startDate: startDate, endDate: endDate, type: 'end'}).then(res => {
this.finishCount = res.data.wc this.finishCount = res.data.wc
this.timeout = res.data.timeout this.timeout = res.data.timeout
this.createEchartCake('echart1', { this.createEchartCake('echart1', {
bottom: 10, bottom: 10,
left: 'right', left: 'right',
orient: 'vertical' orient: 'vertical'
}, this.finishCount) }, ['#91cd77', '#ef6567'], this.finishCount)
this.createEchartCake('echart2', { this.createEchartCake('echart2', {
bottom: 10, bottom: 10,
left: 'right', left: 'right',
orient: 'vertical' orient: 'vertical'
}, this.timeout) }, ['#ef6567', '#fc8251', '#f9c956', '#91cd77'], this.timeout)
this.createEchartCake('echart3', {
bottom: 10,
left: 'right',
orient: 'vertical'
}, this.pj)
}) })
repairStats({ startDate: date, endDate: endDate, type: 'eval' }).then(res => { },
repairCount3R (){
const startDate = this.dateRange3R[0].format('YYYY-MM-DD');
const endDate = this.dateRange3R[1].format('YYYY-MM-DD');
repairStats({ startDate: startDate, endDate: endDate, type: 'eval' }).then(res => {
this.pj = res.data.pj this.pj = res.data.pj
this.createEchartCake('echart3', { this.createEchartCake('echart3', {
bottom: 10, bottom: 10,
left: 'right', left: 'right',
orient: 'vertical' orient: 'vertical'
}, this.pj) }, ['#91cd77','#fc8251','#ef6567'],this.pj)
}) })
}, },
// //
getfloorStats () { floorStats () {
let date = this.formatDate() const startDate = this.dateRange4L[0].format('YYYY-MM-DD');
floorStats({ date: date }).then(res => { const endDate = this.dateRange4L[1].format('YYYY-MM-DD');
floorStats({startDate: startDate, endDate: endDate}).then(res => {
this.createEchartLine('echart4', res.data) this.createEchartLine('echart4', res.data)
}) })
}, },
formatDate (date) { //
let year = date.getFullYear() // (4) deviceStats () {
let month = date.getMonth() + 1 // (0-11,01) const startDate = this.dateRange4R1[0].format('YYYY-MM-DD');
let strDate = date.getDate() // (1-31) const endDate = this.dateRange4R1[1].format('YYYY-MM-DD');
if (month < 10) month = `0${month}` // 0 deviceStats({ startDate: startDate, endDate: endDate }).then(res => {
if (strDate < 10) strDate = `0${strDate}` // 0 this.faultStatsCount = res.data
return `${year}-${month}-${strDate}` this.createColumnEcharrt('echart5', res.data)
})
},
//
failureStats () {
const startDate = this.dateRange4R2[0].format('YYYY-MM-DD');
const endDate = this.dateRange4R2[1].format('YYYY-MM-DD');
failureStats({ startDate: startDate, endDate: endDate }).then(res => {
this.selectFaultStatsCount = res.data
this.createEchartCake('echart6', {
bottom: 10,
left: 'right',
orient: 'vertical'
},['#ef6567', '#fc8251', '#f9c956', '#91cd77'],this.selectFaultStatsCount)
})
},
//
deviceTypeStats () {
const startDate = this.dateRange5[0].format('YYYY-MM-DD');
const endDate = this.dateRange5[1].format('YYYY-MM-DD');
deviceTypeStats({ startDate: startDate, endDate: endDate}).then(res => {
this.loadData = res.rows
})
}, },
onSelectChange (selectedRowKeys, selectedRows) { createEchartCake(id, legend, colors, data) {
this.selectedRowKeys = selectedRowKeys //console.log(data)
this.selectedRows = selectedRows
},
createEchartCake (id, legend, data) {
console.log(data)
// domecharts // domecharts
let myChart = echarts.init(document.getElementById(id)) let myChart = echarts.init(document.getElementById(id))
// //
@ -565,6 +381,7 @@ export default {
trigger: 'item' trigger: 'item'
}, },
legend: legend, legend: legend,
color: colors,
series: [ series: [
{ {
name: '完成率', name: '完成率',
@ -610,6 +427,7 @@ export default {
} }
}, },
legend: {}, legend: {},
color: ['#75bedc','#f9c956'],
grid: { grid: {
left: '3%', left: '3%',
right: '4%', right: '4%',
@ -628,11 +446,13 @@ export default {
{ {
name: '故障数量', name: '故障数量',
type: 'bar', type: 'bar',
barWidth: '5px',
data: data.total data: data.total
}, },
{ {
name: '数量类型', name: '已完成数量',
type: 'bar', type: 'bar',
barWidth: '5px',
data: data.finish data: data.finish
} }
] ]
@ -656,13 +476,9 @@ export default {
data.total, data.total,
data.finish data.finish
] ]
const totalData = [] //-=
for (let i = 0; i < rawData[0].length; ++i) { for (let i = 0; i < rawData[0].length; ++i) {
let sum = 0 rawData[0][i]-=rawData[1][i];
for (let j = 0; j < rawData.length; ++j) {
sum += rawData[j][i]
}
totalData.push(sum)
} }
const grid = { const grid = {
left: 100, left: 100,
@ -678,20 +494,19 @@ export default {
name, name,
type: 'bar', type: 'bar',
stack: 'total', stack: 'total',
barWidth: '60%', barWidth: '10px',
label: { label: {
show: true, show: true,
formatter: (params) => Math.round(params.value * 1000) / 10 + '%' formatter: (params) => params.value>0 ? params.value : ""
}, },
data: rawData[sid].map((d, did) => data: rawData[sid].map((d, did) => rawData[sid][did])
totalData[did] <= 0 ? 0 : d / totalData[did]
)
} }
}) })
let option = { let option = {
legend: { legend: {
selectedMode: false selectedMode: false
}, },
color: ['#f9c956','#75bedc'],
grid, grid,
yAxis: { yAxis: {
type: 'value' type: 'value'