对接劳务管理右下角今日-实时数据。
This commit is contained in:
parent
3c22e2e7cc
commit
44138c463f
@ -267,7 +267,7 @@ function initOption() {
|
|||||||
|
|
||||||
function drawChart() {
|
function drawChart() {
|
||||||
initOption();
|
initOption();
|
||||||
console.log("绘制前数据", yData.value)
|
console.log("绘制前数据", yData.value);
|
||||||
let EchartsTime = echarts.init(document.getElementById("EchartsTime"));
|
let EchartsTime = echarts.init(document.getElementById("EchartsTime"));
|
||||||
EchartsTime.setOption(option.value);
|
EchartsTime.setOption(option.value);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,7 +63,12 @@ import { getRealTimeDataApi, getDevListApi } from "@/api/modules/distribution";
|
|||||||
import mitts from "@/utils/bus"; //兄弟组件传值
|
import mitts from "@/utils/bus"; //兄弟组件传值
|
||||||
// import Card from "@/components/card.vue";
|
// import Card from "@/components/card.vue";
|
||||||
import { GlobalStore } from "@/stores";
|
import { GlobalStore } from "@/stores";
|
||||||
const store = GlobalStore();
|
|
||||||
|
function selectChange(e: any) {
|
||||||
|
//发送设备编号
|
||||||
|
mitts.emit("devSn", e);
|
||||||
|
}
|
||||||
|
|
||||||
// 下拉框存放的value
|
// 下拉框存放的value
|
||||||
let devValue = ref(1 as any);
|
let devValue = ref(1 as any);
|
||||||
let noiseList = ref([
|
let noiseList = ref([
|
||||||
@ -76,18 +81,14 @@ let noiseList = ref([
|
|||||||
label: "电箱2"
|
label: "电箱2"
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
function selectChange(e: any) {
|
const store = GlobalStore();
|
||||||
//发送设备编号
|
|
||||||
mitts.emit("devSn", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
const getDevOption = async () => {
|
const getDevOption = async () => {
|
||||||
const res: any = await getDevListApi({
|
const res: any = await getDevListApi({
|
||||||
projectSn: store.sn
|
projectSn: store.sn
|
||||||
});
|
});
|
||||||
if (res.result) {
|
if (res.result) {
|
||||||
devValue.value = res.result[0].devSn;
|
devValue.value = res.result[0].devSn;
|
||||||
noiseList.value = res.result.map(item => {
|
noiseList.value = res.result.map((item: any) => {
|
||||||
return {
|
return {
|
||||||
value: item.devSn,
|
value: item.devSn,
|
||||||
label: item.devName
|
label: item.devName
|
||||||
@ -98,7 +99,7 @@ const getDevOption = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// let devSn = ref("" as any);
|
// let devSn = ref("" as any);
|
||||||
let realTimeData = ref(null as any)
|
let realTimeData = ref(null as any);
|
||||||
const getRealTimeList = async () => {
|
const getRealTimeList = async () => {
|
||||||
const res: any = await getRealTimeDataApi({
|
const res: any = await getRealTimeDataApi({
|
||||||
projectSn: store.sn,
|
projectSn: store.sn,
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<Card title="按分包单位分析">
|
<Card title="按分包单位分析">
|
||||||
<div class="rightHeader">
|
<div class="rightHeader">
|
||||||
<div class="day Selected">实时</div>
|
<div class="day Selected" @click="getNowData">实时</div>
|
||||||
<div class="year Selected">今日</div>
|
<div class="year Selected" @click="getTodayData">今日</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="echartsBottom" style="width: 100%; height: 100%"></div>
|
<div id="echartsBottom" style="width: 100%; height: 100%"></div>
|
||||||
</Card>
|
</Card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts" setup>
|
||||||
import { onMounted, reactive, ref, onBeforeUnmount } from "vue";
|
import { onMounted, reactive, ref, onBeforeUnmount } from "vue";
|
||||||
import * as echarts from "echarts";
|
import * as echarts from "echarts";
|
||||||
import { getComapnyWorkTotalListApi } from "@/api/modules/labor";
|
import { getComapnyWorkTotalListApi } from "@/api/modules/labor";
|
||||||
@ -16,11 +16,6 @@ import Card from "@/components/card.vue";
|
|||||||
import { GlobalStore } from "@/stores";
|
import { GlobalStore } from "@/stores";
|
||||||
const store = GlobalStore();
|
const store = GlobalStore();
|
||||||
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
Card
|
|
||||||
},
|
|
||||||
setup() {
|
|
||||||
const labelimg = ref(new URL("@/assets/images/larborManagement/greenX.png", import.meta.url).href);
|
const labelimg = ref(new URL("@/assets/images/larborManagement/greenX.png", import.meta.url).href);
|
||||||
const labelimg2 = ref(new URL("@/assets/images/larborManagement/orangeX.png", import.meta.url).href);
|
const labelimg2 = ref(new URL("@/assets/images/larborManagement/orangeX.png", import.meta.url).href);
|
||||||
let option = ref({
|
let option = ref({
|
||||||
@ -63,7 +58,7 @@ export default {
|
|||||||
width: 10,
|
width: 10,
|
||||||
show: true,
|
show: true,
|
||||||
rotate: 0,
|
rotate: 0,
|
||||||
interval: 0,
|
interval: 2,
|
||||||
textStyle: {
|
textStyle: {
|
||||||
// padding: [14, 0, 0, 0],
|
// padding: [14, 0, 0, 0],
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
@ -318,35 +313,56 @@ export default {
|
|||||||
draw();
|
draw();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function getNowData() {
|
||||||
|
yData.value = companyWorkTotalData.value.map((item: any) => item.presencePersonNum);
|
||||||
|
option.value.series[0].data = option.value.series[0].data.map((item, index) => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
value: yData.value[index]
|
||||||
|
};
|
||||||
|
});
|
||||||
|
draw();
|
||||||
|
// option.value.xAxis.data = xData.value;
|
||||||
|
// presencePersonNum
|
||||||
|
}
|
||||||
|
function getTodayData() {
|
||||||
|
yData.value = companyWorkTotalData.value.map((item: any) => item.attendancePersonNum);
|
||||||
|
option.value.series[0].data = option.value.series[0].data.map((item, index) => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
value: yData.value[index]
|
||||||
|
};
|
||||||
|
});
|
||||||
|
draw();
|
||||||
|
// option.value.xAxis.data = xData.value;
|
||||||
|
// attendancePersonNum
|
||||||
|
}
|
||||||
|
|
||||||
|
let companyWorkTotalData = ref([] as any);
|
||||||
|
let xData = ref([] as any);
|
||||||
|
let yData = ref([] as any);
|
||||||
async function getProjectWorkerList() {
|
async function getProjectWorkerList() {
|
||||||
let res = await getComapnyWorkTotalListApi({
|
let res = await getComapnyWorkTotalListApi({
|
||||||
projectSn: store.sn
|
projectSn: store.sn
|
||||||
});
|
});
|
||||||
let xData = [];
|
|
||||||
let yData = [];
|
|
||||||
console.log("按分包单位分析数据", res);
|
|
||||||
if (res.result) {
|
if (res.result) {
|
||||||
res.result.forEach(item => {
|
res.result.forEach((item: any) => {
|
||||||
// 只取有数据的工种
|
// 只取有数据的工种
|
||||||
if (item.totalPersonNum > 0) {
|
if (item.totalPersonNum > 0) {
|
||||||
xData.push(item.enterpriseName);
|
companyWorkTotalData.value.push(item);
|
||||||
yData.push(item.totalPersonNum);
|
xData.value.push(item.enterpriseName);
|
||||||
// 计算工人总和
|
yData.value.push(item.totalPersonNum);
|
||||||
// max.value = max.value + item.totalPersonNum;
|
|
||||||
// projectWorkerTypeOption.push({
|
|
||||||
// value: item.totalPersonNum,
|
|
||||||
// name: item.enterpriseName
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log(option.value.series[0].data, `series_old`);
|
console.log("按分包单位分析数据", companyWorkTotalData.value);
|
||||||
|
// console.log(option.value.series[0].data, `series_old`);
|
||||||
option.value.series[0].data = option.value.series[0].data.map((item, index) => {
|
option.value.series[0].data = option.value.series[0].data.map((item, index) => {
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
value: yData[index]
|
value: yData.value[index]
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
option.value.xAxis.data = xData;
|
option.value.xAxis.data = xData.value;
|
||||||
// option.value.yAxis.data = yData;
|
// option.value.yAxis.data = yData;
|
||||||
// 接口成功获取新值
|
// 接口成功获取新值
|
||||||
// optionData.value = getData(data);
|
// optionData.value = getData(data);
|
||||||
@ -359,8 +375,6 @@ export default {
|
|||||||
// projectSn: store.sn
|
// projectSn: store.sn
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<Card title="按工种分析">
|
<Card title="按工种分析">
|
||||||
<div class="rightHeader">
|
<div class="rightHeader">
|
||||||
<!-- <div class="day Selected">实时</div> -->
|
<!-- <div class="day Selected" @click="getNowData">实时</div> -->
|
||||||
<!-- <div class="year Selected">今日</div> -->
|
<!-- <div class="year Selected" @click="getTodayData">今日</div> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="num">{{ max }}</div>
|
<div class="num">{{ max }}</div>
|
||||||
<div id="echartTop" style="width: 100%; height: 100%"></div>
|
<div id="echartTop" style="width: 100%; height: 100%"></div>
|
||||||
@ -31,42 +31,8 @@ let data = reactive(
|
|||||||
return b.value - a.value;
|
return b.value - a.value;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
// let data = reactive(
|
|
||||||
// [
|
|
||||||
// {
|
|
||||||
// name: "塔吊司机",
|
|
||||||
// value: 1969
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: "架子工",
|
|
||||||
// value: 1476
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: "电焊工",
|
|
||||||
// value: 1500
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: "钢筋工",
|
|
||||||
// value: 1476
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: "抹灰工",
|
|
||||||
// value: 2997
|
|
||||||
// }
|
|
||||||
// ].sort(function (a, b) {
|
|
||||||
// return b.value - a.value;
|
|
||||||
// })
|
|
||||||
// );
|
|
||||||
|
|
||||||
// function array2obj(array, key) {
|
function getData(data: any) {
|
||||||
// let resObj = {};
|
|
||||||
// for (let i = 0; i < array.length; i++) {
|
|
||||||
// resObj[array[i][key]] = array[i];
|
|
||||||
// }
|
|
||||||
// return resObj;
|
|
||||||
// }
|
|
||||||
|
|
||||||
function getData(data) {
|
|
||||||
let res = {
|
let res = {
|
||||||
series: [],
|
series: [],
|
||||||
yAxis: []
|
yAxis: []
|
||||||
@ -114,7 +80,7 @@ function getData(data) {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
// let objData = array2obj(data, "name");
|
// let objData = array2obj(data, "name");
|
||||||
let option = ref({} as any)
|
let option = ref({} as any);
|
||||||
let optionData = ref(null as any);
|
let optionData = ref(null as any);
|
||||||
|
|
||||||
// 初始化option 绘制图表
|
// 初始化option 绘制图表
|
||||||
@ -123,8 +89,8 @@ function initOption() {
|
|||||||
legend: {
|
legend: {
|
||||||
show: true,
|
show: true,
|
||||||
itemGap: 20,
|
itemGap: 20,
|
||||||
itemWidth: 40,
|
itemWidth: 15,
|
||||||
itemHeight: 10,
|
itemHeight: 15,
|
||||||
icon: "rect",
|
icon: "rect",
|
||||||
orient: "horizontal",
|
orient: "horizontal",
|
||||||
// x: "right",
|
// x: "right",
|
||||||
@ -174,8 +140,8 @@ function draw() {
|
|||||||
// console.log('绘图数据',option.value);
|
// console.log('绘图数据',option.value);
|
||||||
}
|
}
|
||||||
// 存储最大值
|
// 存储最大值
|
||||||
let max = ref(0 as any)
|
let max = ref(0 as any);
|
||||||
|
let projectWorkerTypeData = ref([] as any);
|
||||||
//获取工种分析数据
|
//获取工种分析数据
|
||||||
// let timer = null
|
// let timer = null
|
||||||
const getProjectWorkerList = async () => {
|
const getProjectWorkerList = async () => {
|
||||||
@ -190,6 +156,9 @@ const getProjectWorkerList = async () => {
|
|||||||
if (item.workerNum > 0) {
|
if (item.workerNum > 0) {
|
||||||
// 计算工人总和
|
// 计算工人总和
|
||||||
max.value = max.value + item.workerNum;
|
max.value = max.value + item.workerNum;
|
||||||
|
// 所有数据
|
||||||
|
projectWorkerTypeData.value.push(item);
|
||||||
|
// 取
|
||||||
projectWorkerTypeOption.push({
|
projectWorkerTypeOption.push({
|
||||||
value: item.workerNum,
|
value: item.workerNum,
|
||||||
name: item.typeName
|
name: item.typeName
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user