+

{{ person.sh.mjCode }}
@@ -182,6 +186,7 @@ import no_warn2 from "@/assets/svg/no_warn2.svg";
import warn from "@/assets/svg/warn.svg";
import start from "@/assets/person_img/start.png";
import end from "@/assets/person_img/end.png";
+import { number } from "echarts";
export default {
name: 'personManage',
/* 人员树前端筛选 */
@@ -288,17 +293,7 @@ export default {
// 预警表格
warnTable: [],
//保存表格数据
- hatTable: [
- {
- name: '张三',
- devName: '1号智能安全帽'
- },
- {
- name: '张三',
- devName: '1号智能安全帽'
- }
- ],
-
+ hatTable: [],
//保存对话框隐藏展示
dialogVisible1: false,
dialogVisible2: false,
@@ -307,13 +302,77 @@ export default {
//保存抽检树形数据
teamTreeData: [],
// 查看班组施工定位前,是否选中了班组
- checkTeamId: null
+ checkTeamId: null,
+ // 定时刷新
+ intervalId: null,
+ // 选中树节点ID
+ checkNodeId: null,
+ // 选中树节点层级
+ checkNodeLevel: null,
+ // 选中树节点父节点的ID
+ checkNodeTowerId: null,
+ // 选中班组人员存的数据
+ checkPersonObj: {}
};
},
created() {
this.getPersonsTree();
},
+ mounted() {
+ this.startRefresh();
+ },
+ destroyed() {
+ this.stopRefresh();
+ },
methods: {
+ startRefresh() {
+ // 每3分钟刷新一次
+ this.intervalId = setInterval(this.refreshData, 1000 * 60 * 3);
+ },
+ stopRefresh() {
+ if (this.intervalId) {
+ clearInterval(this.intervalId);
+ this.intervalId = null;
+ }
+ },
+ async refreshData() {
+ // this.$message('页面刷新了');
+ // 定时刷新球机树数据
+ this.treeData.splice(0);
+ this.idArr.splice(0);
+ await this.getPersonsTree();
+ if (this.filterText) {
+ this.$refs.tree.filter(this.filterText);
+ }
+ if (this.checkNodeId) {
+ this.$refs.tree.setCurrentKey(this.checkNodeId);
+ if (this.checkNodeLevel === 4) {
+ this.idArr.push(this.checkNodeId);
+ }
+ if (this.checkNodeLevel === 2) { // 杆塔
+ this.loadWorkInfo();
+ } else if (this.checkNodeLevel === 3) { // 班组
+ this.removeOverlay();
+ const obj = {
+ 'id': this.checkNodeTowerId,
+ 'teamId': this.checkTeamId
+ }
+ this.loadPersonsInfo(obj, null);
+ } else if (this.checkNodeLevel === 4) { // 班组人员
+ if (!this.isShowHistoryGj) {
+ this.removeOverlay();
+ const obj = {
+ 'id': this.checkNodeTowerId,
+ 'teamId': this.checkTeamId
+ }
+ this.loadPersonsInfo(obj, this.checkPersonObj);
+ } else {
+ this.removeOverlay();
+ this.loadHistoryGj();
+ }
+ }
+ }
+ },
// 当前日期
getTodayDate() {
const today = new Date();
@@ -332,8 +391,8 @@ export default {
}).catch((res) => { })
},
/* 加载人员树 */
- getPersonsTree() {
- personsTree().then(res => {
+ async getPersonsTree() {
+ await personsTree().then(res => {
const treeData = res.data;
if (treeData && treeData.length > 0) {
this.treeData = treeData
@@ -352,14 +411,6 @@ export default {
},
/* 人员树过滤 */
filterNode(value, data, node) {
- if (!value) {
- if (node.level == 1 || node.level == 2) {
- node.expanded = true
- } else {
- node.expanded = false
- }
- return true
- }
// 查询列表是否有匹配数据
let val = value.toLowerCase()
return this.chooseNode(val, data, node)
@@ -407,7 +458,6 @@ export default {
/* 加载抽检班组人员树 */
getTeamPersonByTower(params) {
teamPersonByTower(params).then(res => {
- console.log(res);
const teamTreeData = res.data;
if (teamTreeData && teamTreeData.length > 0) {
this.teamTreeData = teamTreeData
@@ -416,6 +466,7 @@ export default {
this.idArr2.push(item.id);
})
}
+ this.dialogVisible1 = true;
}).catch(res => {
});
@@ -430,18 +481,22 @@ export default {
} else {
this.filterText2 = '';
this.getTeamPersonByTower({ 'id': this.towerId });
- this.dialogVisible1 = true;
}
},
// 自动验证配置详情
- getCheckConfigDetail() {
- getCheckConfig().then((res) => {
+ async getCheckConfigDetail() {
+ let loading = this.$loading({
+ lock: true,
+ text: "数据加载中,请稍候...",
+ background: 'rgba(0,0,0,0.2)'
+ })
+ await getCheckConfig().then((res) => {
if (res.data && res.data.length > 0) {
const data = res.data;
const configType = data[0].configType + '';
if (configType === '1') {
data.forEach((item, index) => {
- this.form.times.push({ value: item.time, key: Date.now() })
+ this.form.times.push({ value: item.time, key: Date.now() + index })
})
} else if (configType === '2') {
this.form.timeNum = parseInt(res.data[0].time);
@@ -450,9 +505,11 @@ export default {
} else {
this.form.configType = '1';
}
+
}).catch((res) => {
})
+ loading.close();
this.dialogVisible2 = true;
},
// 模式选择为固定时间-添加多个时间
@@ -532,8 +589,8 @@ export default {
}).catch((res) => { })
},
// 人员树选中人员加载的数据
- loadPersonDetail(params) {
- getPersonDetail(params).then((res) => {
+ async loadPersonDetail(params) {
+ await getPersonDetail(params).then((res) => {
const data = res.data;
if (data && data.vo) {
const obj = data.vo;
@@ -558,13 +615,13 @@ export default {
}).catch((res) => { })
},
// 人员历史轨迹
- loadHistoryGj() {
+ async loadHistoryGj() {
// 手环设备ID和开始时间
let obj = {
'id': this.person.sh.devId,
'startTime': this.chooseDate
};
- getHistoryGj(obj).then((res) => {
+ await getHistoryGj(obj).then((res) => {
const data = res.data;
if (data && data.length > 0) {
this.gjArr = data;
@@ -590,7 +647,12 @@ export default {
},
//人员树组件节点点击
handleNodeClick(data, node, item) {
+ this.checkNodeId = data.id;
+ this.checkNodeLevel = data.level;
this.towerId = undefined;
+ this.checkTeamId = null;
+ this.checkNodeTowerId = null;
+ this.checkPersonObj = {};
if (node.level === 2) {
this.removeOverlay();
// 选中杆塔赋值towerId,用于手环人员验证抽检
@@ -614,6 +676,7 @@ export default {
'teamId': teamId
}
this.checkTeamId = teamId;
+ this.checkNodeTowerId = towerId;
this.loadPersonsInfo(obj, null);
} else if (node.level === 4) {
this.isTower = false;
@@ -628,7 +691,18 @@ export default {
'teamId': teamId
}
this.checkTeamId = teamId;
- this.loadPersonsInfo(obj, data);
+ this.checkNodeTowerId = towerId;
+ this.checkPersonObj = _.cloneDeep(data);
+ if (this.isShowHistoryGj) {
+ // 历史轨迹打开,只切换历史轨迹数据
+ const obj = {
+ 'id': data.type === 0 ? parseInt(data.id.replace('zs-', '')) : parseInt(data.id.replace('ls-', '')),
+ 'type': data.type
+ }
+ this.relaodHistoryGj(obj);
+ } else {
+ this.loadPersonsInfo(obj, data);
+ }
} else {
// 选中班组人员 触发事件
this.clickMarker(data);
@@ -640,6 +714,11 @@ export default {
this.removeOverlay();
}
},
+ async relaodHistoryGj(obj){
+ this.removeOverlay();
+ await this.loadPersonDetail(obj);
+ await this.loadHistoryGj();
+ },
// 清除百度地图覆盖物
removeOverlay() {
this.map.clearOverlays();
@@ -650,6 +729,17 @@ export default {
},
// 点击地图人员覆盖物触发的事件
clickMarker(item) {
+ this.checkNodeLevel = 4;
+ this.checkPersonObj = item;
+ let userId = null;
+ if (new RegExp(/^[0-9]*$/).test(item.id)) {
+ userId = item.id;
+ this.$refs.tree.setCurrentKey(item.type === 0 ? 'zs-' + item.id : 'ls-' + item.id);
+ this.checkNodeId = item.type === 0 ? 'zs-' + item.id : 'ls-' + item.id;
+ } else {
+ userId = item.type === 0 ? parseInt(item.id.replace('zs-', '')) : parseInt(item.id.replace('ls-', ''))
+ this.checkNodeId = item.id;
+ }
const allOverlay = this.map.getOverlays();
for (let index = 0; index < allOverlay.length; index++) {
let overlay = allOverlay[index];
@@ -666,7 +756,7 @@ export default {
let overlay = allOverlay[index];
// 判断是否是点的覆盖物
const flag = this.isOverlayPoint(overlay);
- if (flag && ("marker-" + item.type + '-' + item.id === overlay.id)) {
+ if (flag && ("marker-" + item.type + '-' + userId === overlay.id)) {
if (item.isWarn === 0) {
let myIcon = new BMap.Icon(no_warn2, new BMap.Size(50, 50))
myIcon.setImageSize(new BMap.Size(50, 50));
@@ -680,7 +770,7 @@ export default {
this.isPerson = true;
// id:人员ID type: 0 班组成员 1 临时人员
const obj = {
- 'id': item.id,
+ 'id': userId,
'type': item.type
}
this.loadPersonDetail(obj);
@@ -693,7 +783,6 @@ export default {
},
/* 添加人员定位的覆盖物 */
addPersonMarker(item) {
- console.log(item);
let point = new BMap.Point(item.lon, item.lat)
let marker = "", myIcon = "";
if (item.isWarn === 0) {
@@ -711,23 +800,30 @@ export default {
marker.isWarn = item.isWarn;
this.map.addOverlay(marker);
// 添加监听事件
+
marker.addEventListener("click", () => { this.clickMarker(item) });
},
// 人员绑定手环历史轨迹
openHistoryGj() {
- this.removeOverlay();
- this.loadHistoryGj();
- this.isShowHistoryGj = true;
+ if (!this.isShowHistoryGj) {
+ this.removeOverlay();
+ this.loadHistoryGj();
+ this.isShowHistoryGj = true;
+ }
},
// 关闭历史轨迹
- clsoeHistoryGj() {
+ closeHistoryGj() {
this.removeOverlay();
this.isShowHistoryGj = false;
const obj = {
- 'id': this.id,
- 'teamId': this.teamId
+ 'id': this.checkNodeTowerId,
+ 'teamId': this.checkTeamId
+ }
+ if (Object.keys(this.checkPersonObj).length === 0) {
+ this.loadPersonsInfo(obj, null);
+ } else {
+ this.loadPersonsInfo(obj, this.checkPersonObj);
}
- this.loadPersonsInfo(obj, null);
},
// 获取人员运动轨迹
loadGj() {
@@ -760,8 +856,12 @@ export default {
},
//给人员树不同层级设置不同的icon
renderContent(h, { node, data }) {
+ let isTeamLeader = data.isTeamLeader, type = data.type, isWarn = data.isWarn, style = '';
+ if (isWarn === 1) {
+ style = 'warnColor'
+ }
// 根据层级使用不同的图标
- let icon, span =
{node.label}, isTeamLeader = data.isTeamLeader, type = data.type;
+ let icon, span =
{node.label};
if (node.level === 1) {
icon = 'pro_icon';
} else if (node.level === 2) {
@@ -770,10 +870,13 @@ export default {
icon = 'team_nocheck_icon';
} else if (node.level === 4 && isTeamLeader === 1) {
icon = '';
- span =
{node.label} 班组长;
+ span =
{node.label}班组长;
} else if (node.level === 4 && type === 1) {
icon = '';
- span =
{node.label} 临时人员;
+ span =
{node.label} 临时人员;
+ } else if (node.level === 4 && isTeamLeader === 0 && type === 0) {
+ icon = '';
+ span =
{node.label};
}
return (
@@ -820,7 +923,7 @@ export default {
checkedNodes.forEach(item => {
console.error(item.parentId);
if (item.parentId !== -1 && item.parentId !== 0) {
- checkArr.push({ "userId": item.id, "userType": item.userType, "devCode": item.devCode, "shCode": item.shCode })
+ checkArr.push({ "userId": parseInt(item.id.replace('team-', '')), "userType": item.userType, "devCode": item.devCode, "shCode": item.shCode })
}
});
if (checkArr.length == 0) {
@@ -832,6 +935,8 @@ export default {
const obj = {
'spotCheckList': checkArr
}
+ console.log(obj);
+
spotCheck(obj).then((res) => {
this.$modal.msgSuccess(res.msg);
this.dialogVisible1 = false;
@@ -1088,4 +1193,8 @@ export default {
::v-deep .team_nocheck_icon {
background-image: url("../../../../assets/images/team_nocheck_icon.png") !important;
}
+
+::v-deep .warnColor {
+ color: red;
+}
diff --git a/src/views/construction/manage/realTimeManage/realTimeManage.vue b/src/views/construction/manage/realTimeManage/realTimeManage.vue
index 1d37a32..10dbf55 100644
--- a/src/views/construction/manage/realTimeManage/realTimeManage.vue
+++ b/src/views/construction/manage/realTimeManage/realTimeManage.vue
@@ -76,7 +76,7 @@