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

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