From a52ce4c9a594e78b5931d487e05d0dd54ac8cd36 Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期一, 07 十月 2024 22:38:28 +0800
Subject: [PATCH] Merge branch 'release' of http://122.9.151.159:9090/r/smart-web into release
---
src/views/mdc/components/TimeAlarm.vue | 155 +++++++++++++++++++++++++++++++--------------------
1 files changed, 95 insertions(+), 60 deletions(-)
diff --git a/src/views/mdc/components/TimeAlarm.vue b/src/views/mdc/components/TimeAlarm.vue
index 2aedb51..f6a0932 100644
--- a/src/views/mdc/components/TimeAlarm.vue
+++ b/src/views/mdc/components/TimeAlarm.vue
@@ -1,7 +1,7 @@
<!--
* @Date: 2024-04-18 21:52:18
* @LastEditors: Sneed
- * @LastEditTime: 2024-04-21 19:15:52
+ * @LastEditTime: 2024-06-20 23:37:09
* @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/mdc/components/TimeAlarm.vue
-->
<template>
@@ -12,32 +12,51 @@
<el-col style="margin-top: 12px;">
<el-collapse v-model="active" accordion>
<el-collapse-item title="鏃� 鎸夋棩鏌ョ湅" name="1">
- <el-button-group>
+ <el-button-group style="margin-bottom: 14px">
<el-button size="small" @click="queryDay(item)" :type="valueDay == item.value ? 'primary' : ''"
v-for="item in btnListDay" :key="item.value">{{
item.label
}}</el-button>
</el-button-group>
- <scEcharts v-if="active == 1" style="width:100%" height="300px" :option="dayCharts"></scEcharts>
+ <scEcharts v-show="!isShowTable" style="width:100%" height="300px" :option="dayCharts">
+ </scEcharts>
+ <scTable v-show="isShowTable" ref="table0" row-key="id" border :params="params" :apiObj="apiObj0"
+ stripe>
+ <el-table-column prop="alarmCode" label="鎶ヨ浠g爜" />
+ <el-table-column prop="alarmMsg" label="鎶ヨ淇℃伅" />
+ <el-table-column prop="count" label="鎶ヨ娆℃暟" />
+ </scTable>
</el-collapse-item>
<el-collapse-item title="鍛� 鎸夊懆鏌ョ湅" name="2">
- <el-button-group>
- <el-button size="small" @click="queryWeek(item)"
+ <el-button-group style="margin-bottom: 14px">
+ <el-button :title="`${item.startDate} -${item.endDate} `" size="small" @click="queryWeek(item)"
:type="valueWeek == item.value ? 'primary' : ''" v-for="item in btnListWeek"
:key="item.value">{{ item.label
}}</el-button>
</el-button-group>
- <scEcharts v-if="active == 2" style="width:100%" height="300px" :option="weekCharts"></scEcharts>
+ <scEcharts v-show="!isShowTable" style="width:100%" height="300px" :option="weekCharts">
+ </scEcharts>
+ <scTable v-show="isShowTable" ref="table1" row-key="id" border :params="params" :apiObj="apiObj1"
+ stripe>
+ <el-table-column prop="alarmCode" label="鎶ヨ浠g爜" />
+ <el-table-column prop="alarmMsg" label="鎶ヨ淇℃伅" />
+ <el-table-column prop="count" label="鎶ヨ娆℃暟" />
+ </scTable>
</el-collapse-item>
<el-collapse-item title="鏈� 鎸夋湀鏌ョ湅" name="3">
- <el-button-group>
- <el-button size="small" @click="queryMonth(item)"
+ <el-button-group style="margin-bottom: 14px">
+ <el-button :title="`${item.startDate} -${item.endDate} `" size="small" @click="queryMonth(item)"
:type="valueMonth == item.value ? 'primary' : ''" v-for="item in btnListMonth"
:key="item.value">{{ item.label
}}</el-button>
</el-button-group>
- <scEcharts v-if="active == 3" height="300px" :option="monthCharts"></scEcharts>
-
+ <scEcharts v-show="!isShowTable" height="300px" :option="monthCharts"></scEcharts>
+ <scTable v-show="isShowTable" ref="table2" row-key="id" border :params="params" :apiObj="apiObj2"
+ stripe>
+ <el-table-column prop="alarmCode" label="鎶ヨ浠g爜" />
+ <el-table-column prop="alarmMsg" label="鎶ヨ淇℃伅" />
+ <el-table-column prop="count" label="鎶ヨ娆℃暟" />
+ </scTable>
</el-collapse-item>
</el-collapse>
</el-col>
@@ -60,7 +79,10 @@
data() {
return {
sheetUrl: '/api/blade-mdc/alarm/data-sheet',
- apiObj: '',
+ apiObj0: '',
+ apiObj1: '',
+ apiObj2: '',
+ isShowTable: false,
params: {
enums: "DAY",
month: 0,
@@ -70,7 +92,7 @@
workstationId: "",
year: 0,
},
- active: '1',
+ active: ['1', '2', '3'],
valueDay: '',
valueWeek: '',
valueMonth: '',
@@ -87,14 +109,15 @@
},
methods: {
init(params) {
- this.params.workstationId = params.workstationId.toString()
+ if (params) {
+ this.params.workstationId = params?.workstationId?.toString()
+ this.params.startDate = params.startDate
+ this.params.endDate = params.endDate
+ }
this.getTime({
endDate: params.endDate,
startDate: params.startDate,
- }).then(res => {
-
})
-
},
getTime(data) {
return Promise.all([
@@ -103,15 +126,18 @@
statisticalMethod: "DAY"
}).then(res => {
if (res.code === 200) {
- this.btnListDay = res.data.map(item => ({
- label: item.title,
- value: item.id,
- startDate: item.startDate,
- endDate: item.endDate,
- week: moment(item.id).week(),
- month: moment(item.id).month() + 1,
- year: moment(item.id).year()
- })).reverse()
+ this.btnListDay = res.data.map(item => {
+ return {
+ label: item.title,
+ value: item.id,
+ startDate: item.startDate,
+ endDate: item.endDate,
+ week: moment(item.id).week(),
+ month: moment(item.id).month() + 1,
+ year: moment(item.id).year()
+ }
+
+ }).reverse()
}
this.queryDay(this.btnListDay[0])
}),
@@ -120,15 +146,18 @@
statisticalMethod: "WEEK"
}).then(res => {
if (res.code === 200) {
- this.btnListWeek = res.data.map(item => ({
- label: item.title,
- value: item.id,
- startDate: item.startDate,
- endDate: item.endDate,
- week: moment(item.startDate).week(),
- month: moment(item.startDate).month() + 1,
- year: moment(item.startDate).year()
- })).reverse()
+ this.btnListWeek = res.data.map(item => {
+ return {
+ label: item.title,
+ value: item.id,
+ startDate: item.startDate,
+ endDate: item.endDate,
+ week: moment(item.startDate).week(),
+ month: moment(item.startDate).month() + 1,
+ year: moment(item.startDate).year()
+ }
+
+ }).reverse()
}
}),
@@ -137,15 +166,20 @@
statisticalMethod: "MONTH"
}).then(res => {
if (res.code === 200) {
- this.btnListMonth = res.data.map(item => ({
- label: item.title,
- value: item.id,
- startDate: item.startDate,
- endDate: item.endDate,
- week: moment(item.id + '-1').week(),
- month: moment(item.id + '-1').month() + 1,
- year: moment(item.id + '-1').year()
- })).reverse()
+ this.btnListMonth = res.data.map(item => {
+ let startDate = moment(item.id).startOf('month').format('YYYY-MM-DD')
+ let endDate = moment(item.id).endOf('month').format('YYYY-MM-DD')
+ return {
+ label: item.title,
+ value: item.id,
+ startDate,
+ endDate,
+ week: moment(item.id + '-1').week(),
+ month: moment(item.id + '-1').month() + 1,
+ year: moment(item.id + '-1').year()
+ }
+
+ }).reverse()
}
})
@@ -164,13 +198,12 @@
year: row.year,
shiftIndex: 1,
workstationId: this.params.workstationId,
- }).then(res => {
+ }, 0).then(res => {
this.dayCharts = res
})
},
queryWeek(row) {
this.valueWeek = row.value
- console.log(row)
this.query({
enums: "WEEK",
queryTime: this.valueDay,
@@ -178,7 +211,7 @@
month: row.month,
year: row.year,
workstationId: this.params.workstationId,
- }).then(res => {
+ }, 1).then(res => {
this.weekCharts = res
})
},
@@ -191,13 +224,12 @@
month: row.month,
year: row.year,
workstationId: this.params.workstationId,
- }).then(res => {
+ }, 2).then(res => {
this.monthCharts = res
})
},
- query(data) {
- console.log(data)
- this.queryTableData(data)
+ query(data, flag) {
+ this.queryTableData(data, flag)
return this.$HTTP.post(this.url, data, {}).then(res => {
return this.setOptions(res.data.res)
})
@@ -235,17 +267,20 @@
}]
}
},
- queryTableData() {
- return this.$HTTP.post(this.sheetUrl, data, {}).then(res => {
- this.tableData = res.data.map(item => {
- return {
- title: `鐝${item.shiftIndex}`,
- shiftName: item.shiftName,
- shiftIndex: item.shiftIndex,
- data: item.alarmDataSheetVOList
+ queryTableData(dataConf, flag) {
+ console.log(dataConf, '>>>>>>>')
+ this[`apiObj${flag}`] = {
+ get: async (data) => {
+ let params = {
+ current: data.current,
+ size: data.size
}
- })
- })
+ return await this.$HTTP.post(this.sheetUrl, dataConf, { params }).then(res => {
+ return res
+ })
+ }
+ }
+ // this.$refs[`table${flag}`].reload()
}
}
}
--
Gitblit v1.9.3