| | |
| | | <!-- |
| | | * @Date: 2024-04-18 21:52:18 |
| | | * @LastEditors: Sneed |
| | | * @LastEditTime: 2024-05-14 20:42:32 |
| | | * @LastEditTime: 2024-06-20 23:13:35 |
| | | * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/mdc/components/ShiftAlarm.vue |
| | | --> |
| | | <template> |
| | |
| | | <el-row> |
| | | <el-col> |
| | | <el-button-group> |
| | | <el-button size="small" @click="btnListActive = item.id" |
| | | :type="btnListActive == item.id ? 'primary' : ''" v-for="item in btnList" :key="item.id">{{ |
| | | <el-button size="small" @click="change(item)" :type="btnListActive == item.id ? 'primary' : ''" |
| | | v-for="item in btnList" :key="item.id">{{ |
| | | item.title }}</el-button> |
| | | </el-button-group> |
| | | </el-col> |
| | |
| | | ], |
| | | } |
| | | }, |
| | | watch: { |
| | | btnListActive(val) { |
| | | // watch: { |
| | | // btnListActive(val) { |
| | | // this.queryChart({ |
| | | // ...this.params, |
| | | // }) |
| | | // } |
| | | // }, |
| | | methods: { |
| | | change(item) { |
| | | this.btnListActive = item.id |
| | | this.queryChart({ |
| | | ...this.params, |
| | | }) |
| | | } |
| | | }, |
| | | methods: { |
| | | }, |
| | | init(params) { |
| | | this.btnListActive = '' |
| | | console.log('++++++') |
| | | this.params = { |
| | | ...this.params, |
| | | workstationId: params.workstationId.toString() |
| | | } |
| | | this.getTime({ |
| | | endDate: params.endDate, |
| | | startDate: params.startDate, |
| | | }).then(res => { |
| | | this.$nextTick(() => { |
| | | this.params = { |
| | | ...this.params, |
| | | workstationId: params.workstationId.toString() |
| | | } |
| | | this.getTime({ |
| | | endDate: params.endDate, |
| | | startDate: params.startDate, |
| | | }) |
| | | }) |
| | | |
| | | }, |
| | | getTime(data) { |
| | | return new Promise(resolve => { |
| | |
| | | }) |
| | | } |
| | | this.btnList = arr; |
| | | this.btnListActive = arr[0].id |
| | | this.change(arr[0]) |
| | | resolve(arr) |
| | | }) |
| | | }, |
| | |
| | | <!-- |
| | | * @Date: 2024-04-18 21:52:18 |
| | | * @LastEditors: Sneed |
| | | * @LastEditTime: 2024-04-22 22:32:05 |
| | | * @LastEditTime: 2024-06-20 23:20:15 |
| | | * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/mdc/components/TimeAlarm.vue |
| | | --> |
| | | <template> |
| | |
| | | this.getTime({ |
| | | endDate: params.endDate, |
| | | startDate: params.startDate, |
| | | }).then(res => { |
| | | |
| | | }) |
| | | |
| | | }, |
| | | getTime(data) { |
| | | return Promise.all([ |
| | |
| | | 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]) |
| | | }), |
| | |
| | | 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() |
| | | |
| | | } |
| | | }), |
| | |
| | | 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() |
| | | |
| | | } |
| | | }) |
| | |
| | | }) |
| | | }, |
| | | query(data, flag) { |
| | | console.log('--------') |
| | | this.queryTableData(data, flag) |
| | | if (this.isShowTable) { |
| | | return this.queryTableData(data, flag) |
| | | } |
| | | |
| | | return this.$HTTP.post(this.url, data, {}).then(res => { |
| | | return this.setOptions(res.data.res) |
| | | }) |