From b38b07e5bbde91938911a1acf21a85628f56e4ac Mon Sep 17 00:00:00 2001 From: fhysy <1149505133@qq.com> Date: Fri, 22 Nov 2024 17:26:51 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=BD=91=E5=85=B3=E8=B0=83=E8=AF=95):=20?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=8D=97=E5=90=91=E5=8C=97=E5=90=91=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + .idea/gateway-ui.iml | 2 + src/renderer/index.html | 2 +- src/renderer/src/util/config.js | 32 +- .../src/views/gateway/northboundtask.vue | 249 +- .../src/views/gateway/southdirection.vue | 2158 ++++++++--------- 6 files changed, 1001 insertions(+), 1443 deletions(-) diff --git a/.gitignore b/.gitignore index dac037e..124dee0 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ out *.log* /dist/ /dist.zip +.idea diff --git a/.idea/gateway-ui.iml b/.idea/gateway-ui.iml index 0c8867d..7c8ce15 100644 --- a/.idea/gateway-ui.iml +++ b/.idea/gateway-ui.iml @@ -5,7 +5,9 @@ + + diff --git a/src/renderer/index.html b/src/renderer/index.html index dd305ce..415c409 100644 --- a/src/renderer/index.html +++ b/src/renderer/index.html @@ -9,7 +9,7 @@ - + diff --git a/src/renderer/src/util/config.js b/src/renderer/src/util/config.js index 73fa4b8..d5cb8d0 100644 --- a/src/renderer/src/util/config.js +++ b/src/renderer/src/util/config.js @@ -16,22 +16,22 @@ // wsUrl: 'ws://127.0.0.1:8000' // } -// export default { -// url: 'http://127.0.0.1:8888', -// wsUrl: 'ws://127.0.0.1:8888', -// swichWsUrl: 'ws://127.0.0.1:8001', -// serialPortUrl: 'http://127.0.0.1:8888', -// -// // 远程连接串口使用 -// // serialPortUrl: 'http://120.77.172.42:7202', -// // serialPortUrl: 'http://192.168.1.17:8888', -// } +export default { + url: 'http://127.0.0.1:8888', + wsUrl: 'ws://127.0.0.1:8888', + swichWsUrl: 'ws://127.0.0.1:8001', + serialPortUrl: 'http://127.0.0.1:8888', + + // 远程连接串口使用 + // serialPortUrl: 'http://120.77.172.42:7202', + // serialPortUrl: 'http://192.168.1.17:8888', +} // 手动配置的地址 -export default { - url: 'http://192.168.1.17:8000', - wsUrl: 'ws://192.168.1.17:8000', - swichWsUrl: 'ws://192.168.1.17:8001', - serialPortUrl: 'http://127.0.0.1:8888', -} +// export default { +// url: 'http://192.168.1.17:8000', +// wsUrl: 'ws://192.168.1.17:8000', +// swichWsUrl: 'ws://192.168.1.17:8001', +// serialPortUrl: 'http://127.0.0.1:8888', +// } diff --git a/src/renderer/src/views/gateway/northboundtask.vue b/src/renderer/src/views/gateway/northboundtask.vue index 5d1d017..e49646c 100644 --- a/src/renderer/src/views/gateway/northboundtask.vue +++ b/src/renderer/src/views/gateway/northboundtask.vue @@ -68,7 +68,7 @@ - + @@ -97,9 +97,10 @@ empty-text="配置为空" > - + @@ -120,7 +121,7 @@

上报测点{{activeDeviceConfig.taskId}}

- - + +
@@ -288,209 +289,11 @@ const createFilter = (queryString) => { } //北向任务列表(后面换请求获取) const taskList = ref([ - { - "dataId_entire": [ - { - "equipId": "dev102", - "idInfo": [{ "id": "", "uploadMode": "timer 10 || change 10" }] - }, - { - "equipId": "dev103", - "idInfo": [{ "id": "as", "uploadMode": "timer 10 || change 10" }] - }, - { - "equipId": "dev103", - "idInfo": [{ "id": "as", "uploadMode": "timer 10 || change 10" }] - }, - { - "equipId": "dev103", - "idInfo": [{ "id": "as", "uploadMode": "timer 10 || change 10" }] - }, - { - "equipId": "dev103", - "idInfo": [{ "id": "as", "uploadMode": "timer 10 || change 10" }] - }, - { - "equipId": "dev103", - "idInfo": [{ "id": "as", "uploadMode": "timer 10 || change 10" }] - }, - { - "equipId": "dev103", - "idInfo": [{ "id": "as", "uploadMode": "timer 10 || change 10" }] - }, - { - "equipId": "dev103", - "idInfo": [{ "id": "as", "uploadMode": "timer 10 || change 10" }] - }, - { - "equipId": "dev103", - "idInfo": [{ "id": "as", "uploadMode": "timer 10 || change 10" }] - }, - { - "equipId": "dev103", - "idInfo": [{ "id": "as", "uploadMode": "timer 10 || change 10" }] - }, - { - "equipId": "dev103", - "idInfo": [{ "id": "as", "uploadMode": "timer 10 || change 10" }] - }, - { - "equipId": "dev103", - "idInfo": [{ "id": "as", "uploadMode": "timer 10 || change 10" }] - }, - { - "equipId": "dev103", - "idInfo": [{ "id": "as", "uploadMode": "timer 10 || change 10" }] - }, - { - "equipId": "dev103", - "idInfo": [{ "id": "as", "uploadMode": "timer 10 || change 10" }] - }, - { - "equipId": "dev103", - "idInfo": [{ "id": "as", "uploadMode": "timer 10 || change 10" }] - }, - { - "equipId": "dev103", - "idInfo": [{ "id": "as", "uploadMode": "timer 10 || change 10" }] - }, - { - "equipId": "dev103", - "idInfo": [{ "id": "as", "uploadMode": "timer 10 || change 10" }] - } - ], - "taskId": "T1", - "taskType": "", - "uploadMode": "timer 1 || change 0.1" - }, - { - "dataId_entire": [ - { - "equipId": "dev103", - "idInfo": [{ "id": "xc", "uploadMode": "" }] - } - ], - "taskId": "T2", - "taskType": "", - "uploadMode": "timer 10 || change 1" - }, - { - "dataId_entire": [], - "taskId": "T3", - "taskType": "", - "uploadMode": "timer 120 || change 0.1" - }, - { - "dataId_entire": [], - "taskId": "T4", - "taskType": "", - "uploadMode": "timer 120 || change 1" - }, - { - "dataId_entire": [], - "taskId": "T5", - "taskType": "", - "uploadMode": "timer 120 || change 3" - } ]); const platConfigTableRef = ref(); const deviceDataTableRef = ref(); const tabelBox = ref(884) const platConfigList = ref([]) -// const platConfigList = ref([ -// { -// // 平台IP地址 -// "PlatformIp": "", -// // 任务列表 -// "tasks": [ -// "T1", -// "T2", -// "T3", -// "T4", -// "T5" -// ], -// // 平台类型 -// "type": "", -// // MQTT配置 -// "mqtt": { -// // MQTT用户名 -// "user": "", -// // MQTT密码 -// "passwd": "", -// // 是否使用SSL -// "isUseSsl": false, -// // 是否使用SSL配置 -// "isUseSslConf": false, -// // SSL配置 -// "sslConf": { -// // 本地证书文件 -// "localCertificate_file": "/etc/custom/sslConf/pupu_core_3501000001.pem", -// // 私钥文件 -// "privateKey_file": "/etc/custom/sslConf/pupu_core_3501000001.prv" -// } -// }, -// // 推送配置 -// "pushConf": { -// // 是否运行推送 -// "isRun": true, -// // 是否使用断点续传 -// "isUseResumeBrokenTransfer": false, -// // 断点续传配置 -// "broken": { -// // 续传间隔时间(毫秒) -// "resume": { -// "intervalTime_ms": 1000 -// }, -// // 过滤配置 -// "filter": { -// // 过滤时间窗口(秒) -// "filter_s": 600, -// // 相关任务ID列表 -// "relevanceTaskId": [ -// "T1", -// "T2", -// "T3", -// "T4", -// "T5" -// ] -// } -// } -// }, -// // 加密解密配置 -// "encrypt_decrypt": { -// // 加密配置 -// "encrypt_1": { -// // 加密算法 -// "algorithm": "AES", -// // 加密参数 -// "param": { -// "mode": "CBC", -// "key": "0123456789abcdef", -// "ivec": "0123456789abcdef", -// "bits": 128 -// }, -// // 是否启用加密 -// "enable": false -// }, -// // 解密配置 -// "decrypt_1": { -// // 解密算法 -// "algorithm": "AES", -// // 解密参数 -// "param": { -// "mode": "CBC", -// "key": "0123456789abcdef", -// "ivec": "0123456789abcdef", -// "bits": 128 -// }, -// // 是否启用解密 -// "enable": false -// } -// } -// } -// ]); - -const activeTaskIndex = ref(0); const uploadType = ref([ { label: 'DT-MQTT-DEFAULT', value: 'DT-MQTT-DEFAULT'}, @@ -591,18 +394,34 @@ const getDeviceConfig = () => { if (response.data.code == 0) { //缓存上下行主题 platConfigList.value = response.data.data.PlatformPar || []; + + taskList.value = response.data.data.tasks.map(item=>{ + if(item.dataIdEntire!=[]){ + let dataIdEntireList = []; + item.dataIdEntire.forEach(val=>{ + val.idInfo.forEach(info=>{ + dataIdEntireList.push({ + equipId: val.equipId, + idInfo:[info] + }) + }) + }) + item.dataIdEntire = dataIdEntireList; + } + return item; + }) || []; + // taskList.value = taskDataList; + console.log("格式化后数据",taskList.value) if(!platConfigList.value.length){ addDeviceConfig() } - // if(platConfigList.value.length){ - // if(platConfigList.value.length>ActiveRowIndex.value){ - // activeDeviceConfig.value = platConfigList.value[ActiveRowIndex.value]; - // }else{ - // activeDeviceConfig.value = platConfigList.value[0]; - // } - // }else{ - // addDeviceConfig() - // } + if(platConfigList.value.length){ + if(platConfigList.value.length>ActiveRowIndex.value){ + activeDeviceConfig.value = platConfigList.value[ActiveRowIndex.value]; + }else{ + activeDeviceConfig.value = platConfigList.value[0]; + } + } } else { ElMessage.error(response.data.message); @@ -617,7 +436,7 @@ const getDeviceConfig = () => { const setDeviceConfig = () => { console.log('提交配置',platConfigList.value) axios - .post(config.url + '/config/platform/add', {PlatformPar: platConfigList.value}) + .post(config.url + '/config/platform/add', {PlatformPar: platConfigList.value,tasks:taskList.value}) .then(response => { // 成功响应后的处理 console.log(response); // 打印响应数据 @@ -744,7 +563,7 @@ const activeDeviceConfig = ref({ watch( () => ({ ...activeDeviceConfig.value }), (newVal) => { - // console.log("数据变化",newVal) + console.log("数据变化",newVal) platConfigList.value[ActiveRowIndex.value] = newVal; }, { deep: true } diff --git a/src/renderer/src/views/gateway/southdirection.vue b/src/renderer/src/views/gateway/southdirection.vue index 5e924ae..3882535 100644 --- a/src/renderer/src/views/gateway/southdirection.vue +++ b/src/renderer/src/views/gateway/southdirection.vue @@ -1,787 +1,555 @@