diff --git a/src/router/index.js b/src/router/index.js index 1e94969b..47f8f1c6 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -808,11 +808,11 @@ const routes2 = [ component: () => import("@/views/projectFront/examSystem/trainRecord/trainRecord.vue"), }, // 安全考试系统--教育培训 - // { - // path: "/project/examSystem/educationalTraining", - // name: "安全考试系统_教育培训", - // component: () => import("@/views/projectFront/examSystem/educationalTraining/educationalTraining.vue"), - // }, + { + path: "/project/examSystem/educationalTraining", + name: "安全考试系统_教育培训", + component: () => import("@/views/projectFront/examSystem/educationalTraining/educationalTraining.vue"), + }, { path: "/project/environmentalMonitor/alarmValueSet", name: "绿色施工_阈值设置1", diff --git a/src/views/projectFront/carManage/carManage.vue b/src/views/projectFront/carManage/carManage.vue index 1c325029..1a6c729d 100644 --- a/src/views/projectFront/carManage/carManage.vue +++ b/src/views/projectFront/carManage/carManage.vue @@ -1216,6 +1216,19 @@ import { xmglXzHikvisionSyncRetryAPI, } from "@/assets/js/api/laborPerson"; import store from "@/store"; +import mqtt from 'mqtt' +var client = null +const options = { + connectTimeout: 40000, + clientId: + 'mqttjs_' + + Math.random() + .toString(16) + .substr(2, 8), + username: 'root', + password: '123456', + clean: true +} export default { data() { var validReserveStartTime = (rule, value, callback) => { @@ -1456,10 +1469,21 @@ export default { showOtherDetail: false, entityDetail: {}, + topicName: 'topic', + userId: '', }; }, + beforeDestroy() { + if (client) { + client.unsubscribe(this.topicName + this.userId, options) + client.end() + } + client = null + }, mounted() { + this.userId = this.$store.state.userInfo.userId; + this.topicName = this.$store.state.userInfo.scope this.getWorkerList(); this.getList(); this.getLaborManagementList(); @@ -1467,8 +1491,37 @@ export default { this.getUDevList(); this.getEnterpriseListFn(); this.getBlackWhiteBoole(); + client = mqtt.connect(mqttUrl, options) + this.mqttMSG(); }, methods: { + // 监听mqtt下发信息然后刷新列表 + mqttMSG() { + // mqtt连接 +"/#" +workerId + client.on('connect', e => { + // console.log('连接成功:', this.topicName + this.userId) + client.subscribe(this.topicName + this.userId, { qos: 0 }, error => { + if (!error) { + // console.log('订阅成功123') + } else { + console.log('订阅失败') + } + }) + }) + // 接收消息处理 + client.on('message', (topic, message) => { + // console.log(message); + this.getList(); + }) + // 断开发起重连 + // client.on("reconnect", (error) => { + // console.log("正在重连:", error); + // }); + // 链接异常处理 + client.on('error', error => { + console.log('连接失败:', error) + }) + }, // 展示下发详情 async showDetail(id) { this.issueTeamDialog = true; diff --git a/src/views/projectFront/dangerousBigProject/detail.vue b/src/views/projectFront/dangerousBigProject/detail.vue index 4d11500d..f8986064 100644 --- a/src/views/projectFront/dangerousBigProject/detail.vue +++ b/src/views/projectFront/dangerousBigProject/detail.vue @@ -1334,6 +1334,7 @@ @click="openImg(item)" > --> - + - {{ workerInfo.nativePlace }} + {{ workerInfo.nowPlace }}