| | |
| | | import { jobNumBar } from '@/api/home/task'; |
| | | import dayjs from 'dayjs'; |
| | | import useEchartsResize from '@/hooks/useEchartsResize' |
| | | import { useStore } from 'vuex'; |
| | | |
| | | const store = useStore(); |
| | | |
| | | // 日期 |
| | | const currenDate = dayjs().format('YYYY-MM-DD'); |
| | |
| | | bottom: '2%', |
| | | containLabel: true |
| | | }, |
| | | // xAxis: { |
| | | // type: 'category', |
| | | // axisLine: { |
| | | // lineStyle: { |
| | | // color: '#fff' |
| | | // } |
| | | // }, |
| | | // axisLabel: { |
| | | // color: '#fff', |
| | | // interval: 0, |
| | | // rotate: 30 |
| | | // } |
| | | // }, |
| | | xAxis: { |
| | | type: 'category', |
| | | axisLine: { |
| | | lineStyle: { |
| | | color: '#fff' |
| | | } |
| | | }, |
| | | axisLabel: { |
| | | color: '#fff', |
| | | interval: 0, |
| | | rotate: 30 |
| | | } |
| | | }, |
| | | type: 'category', |
| | | data: ['1'], |
| | | axisLine: { |
| | | show: false, // 隐藏轴线 |
| | | }, |
| | | axisTick: { |
| | | show: true, |
| | | length: 2, |
| | | lineStyle: { |
| | | color: '#ffffff', |
| | | }, |
| | | }, |
| | | axisLabel: { |
| | | color: '#ffffff', |
| | | margin: 8, |
| | | }, |
| | | }, |
| | | yAxis: { |
| | | type: 'value', |
| | | name: '单位:件', |
| | |
| | | }; |
| | | |
| | | // 获取任务时间统计数据 |
| | | const getJobNumBar = (value,date_enum) => { |
| | | jobNumBar({date_enum}).then(res => { |
| | | const getJobNumBar = (value) => { |
| | | jobNumBar(value).then(res => { |
| | | if (res.data.code !== 0) return; |
| | | option.xAxis.data = res.data.data.map(item => item.name); |
| | | option.series[0].data = res.data.data.map(item => item.value); |
| | |
| | | }); |
| | | }; |
| | | |
| | | // 添加监听 |
| | | watch(() => store.state.task.taskSearchParams, (newVal) => { |
| | | if (newVal) { |
| | | getJobNumBar(newVal); |
| | | (newVal); |
| | | } |
| | | }, { deep: true }); |
| | | |
| | | onMounted(() => { |
| | | getJobNumBar(newTime.value, 'CURRENT_YEAR'); |
| | | getJobNumBar({date_enum: 'TODAY'}); |
| | | }); |
| | | |
| | | </script> |