diff --git a/src/api/cs-device-boot/cloudDeviceEntry.ts b/src/api/cs-device-boot/cloudDeviceEntry.ts index 9ada857..0397dd1 100644 --- a/src/api/cs-device-boot/cloudDeviceEntry.ts +++ b/src/api/cs-device-boot/cloudDeviceEntry.ts @@ -130,3 +130,20 @@ export function updateLine(data: any) { }) } +//推送日志台账信息 +export function pushLog() { + return createAxios({ + url: '/cs-device-boot/csTerminalLogs/pushCldInfo', + method: 'post', + + }) +} + +//查询推送结果 +export function queryPushResult() { + return createAxios({ + url: '/cs-device-boot/csTerminalReply/queryData', + method: 'post', + + }) +} \ No newline at end of file diff --git a/src/api/cs-device-boot/frontManagement.ts b/src/api/cs-device-boot/frontManagement.ts index 7f9c5a1..59a6016 100644 --- a/src/api/cs-device-boot/frontManagement.ts +++ b/src/api/cs-device-boot/frontManagement.ts @@ -53,4 +53,5 @@ export function updateProcess(data: any) { method: 'post', params: data }) -} \ No newline at end of file +} + diff --git a/src/components/tree/govern/cloudDeviceEntryTree.vue b/src/components/tree/govern/cloudDeviceEntryTree.vue index 4c0a88d..f1bb9d3 100644 --- a/src/components/tree/govern/cloudDeviceEntryTree.vue +++ b/src/components/tree/govern/cloudDeviceEntryTree.vue @@ -1,5 +1,5 @@ diff --git a/src/views/govern/cloudDeviceEntry/index.vue b/src/views/govern/cloudDeviceEntry/index.vue index a92c564..6b98706 100644 --- a/src/views/govern/cloudDeviceEntry/index.vue +++ b/src/views/govern/cloudDeviceEntry/index.vue @@ -2,7 +2,7 @@
- +
@@ -98,7 +98,7 @@ class="form-item" label="省:" v-if="nodeLevel > 0 || pageStatus == 2" - prop="'engineeringParam.province'" + :rules="{ required: true, message: '请选择省', trigger: 'change' }" > --> + + + - + + + + + +
+ + + + +
+

推送日志:

+
+
+ {{ log.message }} +
+
+ 暂无日志信息 +
+
+
+
+
+ + + +

正在推送台账信息,请稍候...

+

预计需要30秒左右

+

已等待: {{ countdown }}秒

+
+
+
@@ -545,12 +598,13 @@ import { mainHeight } from '@/utils/layout' import { useDictData } from '@/stores/dictData' import { ref, reactive, onMounted, computed } from 'vue' import { ElMessage, ElMessageBox } from 'element-plus' -import {getById,getEngineerById,getProjectById,getEquipmentById,getInfoById,nodeAllList,addLedger,deleteProject,deleteLine,deleteEquipment,updateEquipment,updateLine} from '@/api/cs-device-boot/cloudDeviceEntry' +import {getById,getEngineerById,getProjectById,getEquipmentById,getInfoById,nodeAllList,addLedger,deleteProject,deleteLine,deleteEquipment,updateEquipment,updateLine,pushLog,queryPushResult} from '@/api/cs-device-boot/cloudDeviceEntry' import tree from '@/assets/map/area.json' import { queryByCode,queryCsDictTree } from '@/api/system-boot/dictTree' import MacAddressInput from '@/components/form/mac/MacAddressInput.vue' import { auditEngineering } from '@/api/cs-device-boot/edData' import { convertToObject } from 'typescript' +import { Loading } from '@element-plus/icons-vue' defineOptions({ name: '/cs-device-boot/cloudDeviceEntry' @@ -640,6 +694,7 @@ interface DeviceInfo { nodeId: string cntractNo: string sort: number + nodeProcess:number } // 设备信息列表 const deviceInfoList = ref([]) @@ -654,6 +709,7 @@ interface LineInfo { ct2Ratio: number volGrade: number | string devMac: string + } // 监测点信息列表 const lineInfoList = ref([]) @@ -755,6 +811,8 @@ const nodeClick = (e: anyObj, data: any) => { }else if(nodeData.value.level == 4){ //监测点 nodeLevel.value = 4 } + // 更新 nextfalg 状态 + nextfalg.value = nodeLevel.value >= 4; // 根据节点层级清理不需要的数据 cleanUnnecessaryData() /**不是根节点请求数据 */ @@ -763,6 +821,81 @@ const nodeClick = (e: anyObj, data: any) => { } + +const countdown = ref(0) +const resultDialogVisible = ref(false) +const pushResult = ref<{ + success: boolean; + message: string; + logs: Array<{message: string }> +} | null>(null) +const timer = ref(null) + +const handleDialogClose = () => { + pushResult.value = null + resultDialogVisible.value = false + if (timer.value) { + clearInterval(timer.value) + timer.value = null + } + countdown.value = 0 +} + +//台账推送 +const onAdd = async () => { + resultDialogVisible.value = true + pushResult.value = null + countdown.value = 0 + + // 启动倒计时 + if (timer.value) clearInterval(timer.value) + timer.value = window.setInterval(() => { + countdown.value++ + if (countdown.value >= 30) { + clearInterval(timer.value!) + timer.value = null + } + }, 1000) + + try { + // 调用推送日志接口 + await pushLog() + + // 等待30秒 + await new Promise(resolve => setTimeout(resolve, 30000)) + + // 30秒后调用查询推送结果接口 + const result = await queryPushResult() + + // 处理返回的日志数据 + const logs = Array.isArray(result.data) ? result.data : [] + + // 根据结果进行处理 + pushResult.value = { + success: true, + message: '台账推送成功', + logs: logs.map((item: any) => ({ + message: item.message || JSON.stringify(item) + })) + } + } catch (error: any) { + pushResult.value = { + success: false, + message: error.message || '推送过程中发生错误', + logs: [{ + message: error.message || '未知错误' + }] + } + } finally { + if (timer.value) { + clearInterval(timer.value) + timer.value = null + } + countdown.value = 0 + } +} + + /** * 根据当前节点层级清理不需要的数据 */ @@ -894,7 +1027,8 @@ const add = () => { ndid: '', nodeId: '', cntractNo: '', - sort: 0 + sort: 0, + nodeProcess: 1, }) busBarIndex.value = (deviceInfoList.value.length - 1).toString() // 清理监测点数据 @@ -1215,17 +1349,6 @@ const remove = () => { } // 下一步 const next = async () => { - console.log('mainForm',mainForm.value.validate) - await mainForm.value?.validate((valid: boolean) => { - console.log('valid', valid) - if (valid) { - - } - }) - -} - -const executeNextStep = () => { // 在新增模式下(pageStatus == 2)保存当前数据并创建下一个层级的Tab switch (nodeLevel.value) { case 0: // 工程层级,下一步创建项目Tab @@ -1257,7 +1380,8 @@ const executeNextStep = () => { ndid: '', nodeId: '', cntractNo: '', - sort: 0 + sort: 0, + nodeProcess: 1, }) busBarIndex.value = (deviceInfoList.value.length - 1).toString() nextfalg.value = false @@ -1282,7 +1406,7 @@ const executeNextStep = () => { devMac: '', }) lineIndex.value = (lineInfoList.value.length - 1).toString() - nextfalg.value = false + nextfalg.value = true nodeLevel.value = 3 break case 3: // 监测点层级 @@ -1294,8 +1418,11 @@ const executeNextStep = () => { nodeLevel.value = 4 break } + } + + // 撤销 const black = () => { pageStatus.value = 1 @@ -1952,7 +2079,8 @@ const handleBusBarTabsEdit = (targetName: any, action: any) => { ndid: '', nodeId: '', cntractNo: '', - sort: 0 + sort: 0, + nodeProcess: 1, }) busBarIndex.value = (deviceInfoList.value.length - 1).toString() } else if (action === 'remove') {