diff --git a/src/views/sysworkflow/lowcodepage/appPage/appPageForm/echatesUnit/chart/bar.vue b/src/views/sysworkflow/lowcodepage/appPage/appPageForm/echatesUnit/chart/bar.vue index 39e4baf..158e38b 100644 --- a/src/views/sysworkflow/lowcodepage/appPage/appPageForm/echatesUnit/chart/bar.vue +++ b/src/views/sysworkflow/lowcodepage/appPage/appPageForm/echatesUnit/chart/bar.vue @@ -38,15 +38,46 @@ const drawPictures = () => { myChart.value = echarts.init(document.getElementById(props.uuid) as HTMLDivElement); analyzeChartData({ tableKey: props.tableKey, chartId: props.uuid }).then((data) => { console.log("火兔", data); - let optVal = data.data; - optVal.grid = { - left: "2%", - right: "2%", - bottom: "15%", - top: "15%", - containLabel: true, - }; - myChart.value.setOption(optVal); + if (data.code == 0) { + let optVal = data.data; + optVal.grid = { + left: "2%", + right: "2%", + bottom: "15%", + top: "15%", + containLabel: true, + }; + myChart.value.setOption(optVal); + } else { + myChart.value.setOption({ + grid: { + left: "2%", + right: "2%", + bottom: "15%", + top: "15%", + containLabel: true, + }, + xAxis: { + data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"], + }, + yAxis: {}, + legend: { + data: ["销量", "销量科技"], + }, + series: [ + { + name: "销量", + type: "bar", + data: [5, 20, 36, 10, 10, 20], + }, + { + name: "销量科技", + type: "bar", + data: [15, 21, 26, 70, 18, 29], + }, + ], + }); + } }); // myChart.value.setOption({ // grid: { diff --git a/src/views/sysworkflow/lowcodepage/appPage/appPageForm/echatesUnit/chart/line.vue b/src/views/sysworkflow/lowcodepage/appPage/appPageForm/echatesUnit/chart/line.vue index 550922e..82e0234 100644 --- a/src/views/sysworkflow/lowcodepage/appPage/appPageForm/echatesUnit/chart/line.vue +++ b/src/views/sysworkflow/lowcodepage/appPage/appPageForm/echatesUnit/chart/line.vue @@ -36,49 +36,53 @@ const drawPie = () => { ); analyzeChartData({ tableKey: props.tableKey, chartId: props.uuid }).then((data) => { console.log("火兔", data); - let optVal = data.data; - optVal.grid = { - left: "2%", - right: "2%", - bottom: "15%", - top: "15%", - containLabel: true, - }; - myChartPie.value.setOption(optVal); + if (data.code == 0) { + let optVal = data.data; + optVal.grid = { + left: "2%", + right: "2%", + bottom: "15%", + top: "15%", + containLabel: true, + }; + myChartPie.value.setOption(optVal); + } else { + myChartPie.value.setOption({ + grid: { + left: "2%", + right: "2%", + bottom: "5%", + top: "15%", + containLabel: true, + }, + xAxis: { + type: "category", + data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], + }, + legend: { + data: ["销量", "销量科技"], + }, + yAxis: { + type: "value", + }, + series: [ + { + name: "销量", + data: [820, 932, 901, 934, 1290, 1330, 1320], + type: "line", + smooth: true, + }, + { + name: "销量科技", + data: [822, 942, 951, 4, 1290, 1330, 1320], + type: "line", + smooth: true, + }, + ], + }); + } }); - // myChartPie.value.setOption({ - // grid: { - // left: "2%", - // right: "2%", - // bottom: "5%", - // top: "15%", - // containLabel: true, - // }, - // xAxis: { - // type: "category", - // data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], - // }, - // legend: { - // data: ["销量", "销量科技"], - // }, - // yAxis: { - // type: "value", - // }, - // series: [ - // { - // name: "销量", - // data: [820, 932, 901, 934, 1290, 1330, 1320], - // type: "line", - // smooth: true, - // }, - // { - // name: "销量科技", - // data: [822, 942, 951, 4, 1290, 1330, 1320], - // type: "line", - // smooth: true, - // }, - // ], - // }); + // console.log("画图完毕---->", props); } };