|
|
|
@ -7,6 +7,8 @@ |
|
|
|
import { analyzeChartData } from "@/api/chart/index"; |
|
|
|
import { echatsViews } from "@/api/DesignForm/types"; |
|
|
|
import * as echarts from "echarts"; |
|
|
|
import { useDesignEchartsStore } from "@/store/DesignForm/designForm"; |
|
|
|
const store = useDesignEchartsStore() as any; //自定义表单存储器 |
|
|
|
|
|
|
|
const props = withDefaults( |
|
|
|
defineProps<{ |
|
|
|
@ -36,18 +38,23 @@ var myChart = ref<any>(); |
|
|
|
const drawPictures = () => { |
|
|
|
if (props.uuid && props.uuid != "") { |
|
|
|
myChart.value = echarts.init(document.getElementById(props.uuid) as HTMLDivElement); |
|
|
|
analyzeChartData({ tableKey: props.tableKey, chartId: props.uuid }).then((data) => { |
|
|
|
console.log("火兔", data); |
|
|
|
analyzeChartData({ |
|
|
|
tableKey: props.tableKey, |
|
|
|
chartId: props.uuid, |
|
|
|
setConfig: controlData.value, |
|
|
|
}).then((data) => { |
|
|
|
console.log("火1111111兔", data); |
|
|
|
if (data.code == 0) { |
|
|
|
let optVal = data.data; |
|
|
|
optVal.grid = { |
|
|
|
left: "2%", |
|
|
|
right: "2%", |
|
|
|
bottom: "15%", |
|
|
|
top: "15%", |
|
|
|
containLabel: true, |
|
|
|
}; |
|
|
|
// optVal.grid = { |
|
|
|
// left: "2%", |
|
|
|
// right: "2%", |
|
|
|
// bottom: "15%", |
|
|
|
// top: "15%", |
|
|
|
// containLabel: true, |
|
|
|
// }; |
|
|
|
myChart.value.setOption(optVal); |
|
|
|
myChart.value.resize(); |
|
|
|
} else { |
|
|
|
myChart.value.setOption({ |
|
|
|
grid: { |
|
|
|
@ -77,6 +84,7 @@ const drawPictures = () => { |
|
|
|
}, |
|
|
|
], |
|
|
|
}); |
|
|
|
myChart.value.resize(); |
|
|
|
} |
|
|
|
}); |
|
|
|
// myChart.value.setOption({ |
|
|
|
@ -111,6 +119,10 @@ const drawPictures = () => { |
|
|
|
// myChart.value.resize(); |
|
|
|
} |
|
|
|
}; |
|
|
|
//获取当前激活的项目 |
|
|
|
const controlData = computed(() => { |
|
|
|
return store.controlAttr; |
|
|
|
}); |
|
|
|
watch( |
|
|
|
() => props.kuandu, |
|
|
|
(val: any) => { |
|
|
|
@ -120,7 +132,7 @@ watch( |
|
|
|
{ deep: true } |
|
|
|
); |
|
|
|
watch( |
|
|
|
() => props.data, |
|
|
|
() => controlData.value, |
|
|
|
(val: any) => { |
|
|
|
console.log("画图完毕--改变-->", val); |
|
|
|
drawPictures(); |
|
|
|
|