From 3e091224ab26252d8624b42b461ba773ee8bee0f Mon Sep 17 00:00:00 2001 From: gaoshp <291585735@qq.com> Date: 星期日, 03 十一月 2024 19:16:31 +0800 Subject: [PATCH] update --- src/views/mdc/components/TimeAlarm.vue | 89 +++++++++++++++++++++++++------------------- 1 files changed, 50 insertions(+), 39 deletions(-) diff --git a/src/views/mdc/components/TimeAlarm.vue b/src/views/mdc/components/TimeAlarm.vue index 8f1072e..5e8e0d5 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-22 22:32:05 + * @LastEditTime: 2024-06-20 23:37:09 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/mdc/components/TimeAlarm.vue --> <template> @@ -29,7 +29,7 @@ </el-collapse-item> <el-collapse-item title="鍛� 鎸夊懆鏌ョ湅" name="2"> <el-button-group style="margin-bottom: 14px"> - <el-button size="small" @click="queryWeek(item)" + <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> @@ -45,7 +45,7 @@ </el-collapse-item> <el-collapse-item title="鏈� 鎸夋湀鏌ョ湅" name="3"> <el-button-group style="margin-bottom: 14px"> - <el-button size="small" @click="queryMonth(item)" + <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> @@ -78,7 +78,7 @@ }, data() { return { - sheetUrl: '/api/blade-mdc/alarm/data-sheet', + sheetUrl: '/api/mdc/alarm/data-sheet', apiObj0: '', apiObj1: '', apiObj2: '', @@ -109,65 +109,77 @@ }, 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([ - this.$HTTP.post('/api/blade-mdc/efficiency-analysis/interval', { + this.$HTTP.post('/api/mdc/efficiency-analysis/interval', { ...data, 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]) }), - this.$HTTP.post('/api/blade-mdc/efficiency-analysis/interval', { + this.$HTTP.post('/api/mdc/efficiency-analysis/interval', { ...data, 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() } }), - this.$HTTP.post('/api/blade-mdc/efficiency-analysis/interval', { + this.$HTTP.post('/api/mdc/efficiency-analysis/interval', { ...data, 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() } }) @@ -217,7 +229,6 @@ }) }, query(data, flag) { - console.log('--------') this.queryTableData(data, flag) return this.$HTTP.post(this.url, data, {}).then(res => { return this.setOptions(res.data.res) -- Gitblit v1.9.3