| | |
| | | <!-- |
| | | * @Date: 2024-04-18 21:52:18 |
| | | * @LastEditors: Sneed |
| | | * @LastEditTime: 2024-06-18 20:09:02 |
| | | * @LastEditTime: 2024-06-21 00:15:44 |
| | | * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/mdc/components/Time.vue |
| | | --> |
| | | <template> |
| | |
| | | export default { |
| | | props: { |
| | | url: { |
| | | default: '/api/blade-mdc/efficiency-analysis', |
| | | default: '/api/mdc/efficiency-analysis', |
| | | type: String, |
| | | }, |
| | | options: { |
| | |
| | | startDate: params.startDate, |
| | | statisticalMethod: this.statisticalMethod |
| | | }).then(res => { |
| | | let startDate = Math.min(...res.data.map(v => new Date(v.startDate).getTime())) |
| | | let endDate = Math.max(...res.data.map(v => new Date(v.startDate).getTime())) |
| | | if (!res?.length) return |
| | | let startDate = Math.min(...res?.map(v => new Date(v.startDate).getTime())) |
| | | let endDate = Math.max(...res?.map(v => new Date(v.endDate).getTime())) |
| | | console.log('------') |
| | | let data = { |
| | | ...params, |
| | | statisticalMethod: this.statisticalMethod |
| | |
| | | if (this.statisticalMethod !== 'Day') { |
| | | data = { |
| | | ...data, |
| | | startDate: moment(startDate).format('YYYY-MM-DD'), |
| | | endDate: moment(endDate).format('YYYY-MM-DD'), |
| | | statisticalMethod: this.statisticalMethod |
| | | } |
| | |
| | | ...data |
| | | }) |
| | | this.queryChart({ |
| | | ...params, |
| | | statisticalMethod: this.statisticalMethod |
| | | ...data, |
| | | // statisticalMethod: this.statisticalMethod |
| | | }) |
| | | }) |
| | | |
| | | }, |
| | | getTime(data) { |
| | | //return Promise.resolve() |
| | | return this.$HTTP.post('/api/blade-mdc/efficiency-analysis/interval', { |
| | | return this.$HTTP.post('/api/mdc/efficiency-analysis/interval', { |
| | | ...data |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | this.btnListNew = res.data |
| | | return res |
| | | if (data.statisticalMethod === 'MONTH') { |
| | | return res?.data?.map(v => { |
| | | return { |
| | | ...v, |
| | | startDate: moment(v.id).startOf('month').format('YYYY-MM-DD'), |
| | | endDate: moment(v.id).endOf('month').format('YYYY-MM-DD') |
| | | } |
| | | }) |
| | | } else if (data.statisticalMethod === 'DAY') { |
| | | return res?.data?.map(v => { |
| | | return { |
| | | ...v, |
| | | startDate: v.id, |
| | | endDate: v.id |
| | | } |
| | | }) |
| | | } else { |
| | | return res.data |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | |
| | | console.log(option2) |
| | | }) |
| | | }, |
| | | query() { |
| | | query(res) { |
| | | this.apiObj = { |
| | | get: async (data) => { |
| | | let params = { |
| | |
| | | size: data.size |
| | | } |
| | | let dataSend = { |
| | | ...data, |
| | | ...res, |
| | | queryType: 1, |
| | | statisticalMethod: this.statisticalMethod |
| | | } |