| | |
| | | industryJobNumPieChart(params).then(res => { |
| | | const resList = res?.data?.data || []; |
| | | jcOrder.value = resList; |
| | | if (resList.length > 0) { |
| | | nextTick(() => { |
| | | nextTick(() => { |
| | | initChart() |
| | | pieInit(resList) |
| | | }) |
| | | } |
| | | }); |
| | | }; |
| | | watch( |
| | |
| | | { immediate: true } |
| | | ); |
| | | const pieInit = resList => { |
| | | if (!jcchart.value || !resList?.length) return |
| | | |
| | | // if (!jcchart.value || !resList?.length) return |
| | | const validData = resList?.filter(item => item.name).sort((a, b) => b.value - a.value); // 从大到小排序 |
| | | const colors = [ |
| | | '#F87E04', // 橙色 |
| | |
| | | yAxisData: validData.map(item => item.name), |
| | | seriesData: validData.map(item => item.value), |
| | | }; |
| | | |
| | | |
| | | const option = { |
| | | title: { |
| | | text: optionData.seriesData?.length ? '' :'暂无数据', |
| | | text: resList.length ? '' :'暂无数据', |
| | | left: 'center', |
| | | top: 'center', |
| | | textStyle: { |