修改组态
This commit is contained in:
@@ -43,9 +43,9 @@
|
||||
@drag-canvas-mouse-up="dragCanvasMouseUp"
|
||||
></drag-canvas>
|
||||
</div>
|
||||
<!-- 弹框 -->
|
||||
<iframeDia :steadyState="dataList" ref="iframeDiaRef" @lineListChange="indicator"></iframeDia>
|
||||
</div>
|
||||
<!-- 弹框 -->
|
||||
<iframeDia :steadyState="dataList" ref="iframeDiaRef" @lineListChange="indicator"></iframeDia>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -611,7 +611,7 @@ const setImportJson = (exportJson: IExportJson) => {
|
||||
if (!useData.loading) {
|
||||
if (exportJson == null) {
|
||||
setDoneJson(useData.dataTree[0].kId)
|
||||
publish(useData.dataTree[0].id)
|
||||
publish(useData.dataTree[0])
|
||||
} else {
|
||||
executeOperations()
|
||||
}
|
||||
@@ -624,7 +624,7 @@ const setImportJson = (exportJson: IExportJson) => {
|
||||
// 当loading变为true时执行操作
|
||||
if (exportJson == null) {
|
||||
setDoneJson(useData.dataTree[0].kId)
|
||||
publish(useData.dataTree[0].id)
|
||||
publish(useData.dataTree[0])
|
||||
} else {
|
||||
executeOperations()
|
||||
}
|
||||
@@ -869,6 +869,7 @@ const setMqtt = async () => {
|
||||
// 设置消息接收回调
|
||||
mqttClient.value.onMessage((subscribe: string, message: any) => {
|
||||
const msg: any = uint8ArrayToObject(message)
|
||||
console.log('🚀 ~ setMqtt ~ msg:', msg)
|
||||
if (subscribe.split('/')[2] === 'csConfigRtData') {
|
||||
// 指标数据
|
||||
dataList.value = JSON.parse(msg.message)
|
||||
@@ -878,22 +879,28 @@ const setMqtt = async () => {
|
||||
console.error('MQTT 初始化失败:', error)
|
||||
}
|
||||
}
|
||||
const publish = async (id: string) => {
|
||||
// if (mqttClient.value) {
|
||||
// await mqttClient.value.subscribe('zl/askCSConfigWarnData/' + id)
|
||||
// // 发送消息
|
||||
// await mqttClient.value.publish('/zl/askCSConfigWarnData/' + id, '{}')
|
||||
// if (timer.value) {
|
||||
// clearInterval(timer.value)
|
||||
// timer.value = null
|
||||
// }
|
||||
// timer.value = setInterval(
|
||||
// () => {
|
||||
// mqttClient.value.publish('/zl/askCSConfigWarnData/' + id, '{}')
|
||||
// },
|
||||
// 3 * 60 * 1000
|
||||
// )
|
||||
// }
|
||||
const publish = async (list: any) => {
|
||||
console.log('🚀 ~ publish ~ list:', JSON.parse(list.path).canvasCfg.lineList)
|
||||
if (mqttClient.value) {
|
||||
// 发送消息
|
||||
await mqttClient.value.publish(
|
||||
'/zl/askCSConfigWarnData/' + useData.dataTree[0].id,
|
||||
`[${JSON.parse(list.path).canvasCfg.lineList}]`
|
||||
)
|
||||
if (timer.value) {
|
||||
clearInterval(timer.value)
|
||||
timer.value = null
|
||||
}
|
||||
timer.value = setInterval(
|
||||
() => {
|
||||
mqttClient.value.publish(
|
||||
'/zl/askCSConfigWarnData/' + useData.dataTree[0].id,
|
||||
`[${JSON.parse(list.path).canvasCfg.lineList}]`
|
||||
)
|
||||
},
|
||||
3 * 60 * 1000
|
||||
)
|
||||
}
|
||||
}
|
||||
// 绑定指标
|
||||
const indicator = async (ids: string[]) => {
|
||||
|
||||
Reference in New Issue
Block a user