diff --git a/src/views/BI/components/personnel.vue b/src/views/BI/components/personnel.vue index 94ca9ef..8cba58a 100644 --- a/src/views/BI/components/personnel.vue +++ b/src/views/BI/components/personnel.vue @@ -4,14 +4,14 @@
-
{{ item.label }}
+
{{ item.name }}
- +
@@ -22,29 +22,27 @@
-
{{ item.label }}
+
{{ typeList[item.eleType] }}
- +
- +
-
姓名
-
卡号
-
电量
+
区域
+
人员
-
{{ item.name }}
-
{{ item.cardNo }}
-
{{ item.stset + "%" }}
+
{{ item.group }}
+
{{ item.count }}
@@ -57,7 +55,7 @@ />
{ + const res = await handleGetPerList(); + data.block1OptionsList = res.perDataList; + data.block2OptionsList = res.armDataList; + data.block3List = res.regPerDataList; +}, 2000); +const fnInit = async () => { + await handleInit(); +}; +fnInit(); const getPersonnelData = async () => { const resData = await getPersonnelTypeCount(); await nextTick(() => { @@ -146,7 +124,7 @@ const getPersonnelData = async () => { const fnAlarmTypeClick = (e) => { data.drawer = true; data.form.title = e.label; - data.eleType = e.type; + data.eleType = e.eleType; }; const getAlarmTypeData = async () => { const resData = await getAlarmTypeCount(); diff --git a/src/views/BI/js/trajectory.js b/src/views/BI/js/trajectory.js index 9fd02e9..18ff38a 100644 --- a/src/views/BI/js/trajectory.js +++ b/src/views/BI/js/trajectory.js @@ -10,7 +10,12 @@ const pls_ip = userStore.getUserInfo.POST_URL; let entityArr = []; let billboardArr = []; const fencesArr = []; - +const leftObj = { + perDataList: [], + armDataList: [], + regPerDataList: [], // 区域人员统计 + deptDataList: [], // 部门统计 +}; const { open, close } = useWebSocket( encodeURI("ws://" + pls_ip.replace("http://", "") + "/netty/test.io?u=1"), // encodeURI("ws://58.58.162.14:8084/netty/test.io?userid=1"), @@ -25,13 +30,13 @@ const { open, close } = useWebSocket( onMessage: (ws, event) => { const msg = unzip(event.data); const decodedMsg = JSON.parse(decodeURIComponent(msg)); - console.log(decodedMsg); if (decodedMsg.msg === "000") { peoMovement(decodedMsg.data); } if (decodedMsg.msg === "006") { addNewPerson(decodedMsg.data); } + changeLeftObjData(decodedMsg); }, onDisconnected: () => { if (entityArr && entityArr.children) { @@ -47,6 +52,13 @@ const { open, close } = useWebSocket( }, } ); +export const handleGetPerList = async () => { + return leftObj; +}; +export const handleInit = async () => { + getOnlineUser(); + open(); +}; export const handleTrajectory = (b) => { if (b) { getOnlineUser(); @@ -149,7 +161,20 @@ const drawCanvas = (name, floor) => { ctx.fillText((name || "未知人员") + `(${floor}F)`, width / 2, height / 2); return canvas; }; - +const changeLeftObjData = (decodedMsg) => { + if (decodedMsg.msg === "005") { + leftObj.perDataList = decodedMsg.data; + } + if (decodedMsg.msg === "003") { + leftObj.armDataList = decodedMsg.data; + } + if (decodedMsg.msg === "002") { + leftObj.regPerDataList = decodedMsg.data; + } + if (decodedMsg.msg === "008") { + leftObj.deptDataList = decodedMsg.data; + } +}; const addNewPerson = (data) => { data.forEach((item) => { const entity = item.split(","); @@ -203,8 +228,8 @@ function peoMovement(moveData) { Number(Number(itData[4]) + 2.05), 2000 ); // 人物铭牌平滑移动 - console.log(b.entity.floor); - console.log(Number(itData[6])); + // console.log(b.entity.floor); + // console.log(Number(itData[6])); if (Number(itData[6]) !== Number(b.entity.floor)) { b.entity.floor = itData[6]; billboardArr.children[m].uopdateImg(