对接劳务班组出勤分析,右侧图

This commit is contained in:
严妍 2023-07-13 16:51:58 +08:00
parent ecd1c51e30
commit 31df8dcfd2

View File

@ -32,7 +32,10 @@ const form = ref({
});
let xData = ref([] as any);
let yData = ref([] as any);
const option = reactive({
let option = ref(null as any);
function initOption() {
option.value = {
grid: {
left: "5%",
right: "5%",
@ -179,10 +182,14 @@ const option = reactive({
z: 2
}
]
});
};
}
// let horizontalEcharts: any = null;
function horizontalChart() {
initOption();
let horizontalEcharts = echarts.init(document.getElementById("horizontalEcharts"));
horizontalEcharts.setOption(option);
console.log(option.value, "绘图数据");
horizontalEcharts.setOption(option.value);
}
// //
// const onDatePicker = () => {
@ -192,27 +199,33 @@ function horizontalChart() {
// };
//
const getList = async val => {
//
const res: any = await getWorkerInfoApi({
projectSn: store.sn,
enterpriseId: val
// queryStartTime: form.queryStartTime.value,
// queryEndTime: form.queryEndTime.value
});
if (res.result[0]) {
// console.log(res.result.length,'')
if (res.result.length != 0) {
for (let index = 0; index < res.result.length; index++) {
xData.value[index] = res.result[index].totalPersonNum;
yData.value[index] = res.result[index].teamName;
}
} else {
console.log("没有数据");
xData.value = [];
yData.value = [];
}
console.log("获取劳务班组人员数据2", res);
// console.log("2", res);
horizontalChart();
};
onMounted(async () => {
mitts.on("enterpriseId", e => {
// horizontalEcharts = echarts.init(document.getElementById('chart-view'))
//
xData.value = [];
yData.value = [];
getList(e);
});
});