From 7a81c008c3d942bc97a22196f9b4942785d859b6 Mon Sep 17 00:00:00 2001 From: guanj Date: Tue, 6 Jan 2026 15:42:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=84=E4=BB=B6=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/user-boot/roleFuction.ts | 54 +++--- src/utils/request.ts | 1 + src/views/auth/role/index.vue | 35 ++-- src/views/auth/role/popupForm.vue | 160 ++++++++++-------- src/views/govern/device/control/index.vue | 20 ++- .../govern/device/control/moduleData.vue | 4 +- .../control/tabs/components/realtrend.vue | 126 +++++++------- .../govern/manage/basic/popupDictionary.vue | 23 ++- .../govern/reportCore/lineReport/index.vue | 2 +- src/views/govern/reportCore/report/index.vue | 2 +- .../setting/dictionary/component/add.vue | 55 +++--- .../setting/dictionary/component/index.vue | 6 +- 12 files changed, 266 insertions(+), 222 deletions(-) diff --git a/src/api/user-boot/roleFuction.ts b/src/api/user-boot/roleFuction.ts index ccfcb8c..36bc262 100644 --- a/src/api/user-boot/roleFuction.ts +++ b/src/api/user-boot/roleFuction.ts @@ -1,21 +1,33 @@ -import createAxios from '@/utils/request' - -export function getFunctionsByRoleIndex(data) { - return createAxios({ - url: '/user-boot/roleFunction/getFunctionsByRoleIndex', - method: 'post', - params: data - }) -} - -export function updateRoleMenu(data:any) { - return createAxios({ - url: '/user-boot/function/assignFunctionByRoleIndexes', - method: 'post', - data: data - // params: roleIndex,functionIndexList - // data:{ - // roleIndex,functionIndexList - // } - }) -} \ No newline at end of file +import createAxios from '@/utils/request' + +export function getFunctionsByRoleIndex(data) { + return createAxios({ + url: '/user-boot/roleFunction/getFunctionsByRoleIndex', + method: 'post', + params: data + }) +} + +export function updateRoleMenu(data: any) { + return createAxios({ + url: '/user-boot/function/assignFunctionByRoleIndexes', + method: 'post', + data: data + }) +} +// 新增角色与系统关系 +export function systemAdd(data: any) { + return createAxios({ + url: '/user-boot/sysRoleSystem/add', + method: 'post', + data: data + }) +} +// 根据角色id获取系统信息 +export function getSystemByRoleId(params: any) { + return createAxios({ + url: '/user-boot/sysRoleSystem/getSystemByRoleId', + method: 'get', + params + }) +} diff --git a/src/utils/request.ts b/src/utils/request.ts index f827b1c..6b25d25 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -66,6 +66,7 @@ function createAxios>( !( config.url == '/system-boot/file/upload' || config.url == '/system-boot/file/getFileUrl' || + config.url == '/cs-harmonic-boot/realData/getBaseRealData' || config.url == '/harmonic-boot/grid/getAssessOverview' || config.url == '/harmonic-boot/gridDiagram/getGridDiagramAreaData' || config.url == '/cs-device-boot/csline/list' || diff --git a/src/views/auth/role/index.vue b/src/views/auth/role/index.vue index 0cd2310..3247949 100644 --- a/src/views/auth/role/index.vue +++ b/src/views/auth/role/index.vue @@ -29,7 +29,7 @@
保存
- + @@ -46,7 +46,7 @@ import Table from '@/components/table/index.vue' import TableHeader from '@/components/table/header/index.vue' import Tree from '@/components/tree/allocation.vue' import { functionTree } from '@/api/user-boot/function' -import { getFunctionsByRoleIndex, updateRoleMenu } from '@/api/user-boot/roleFuction' +import { getFunctionsByRoleIndex, updateRoleMenu, getSystemByRoleId, systemAdd } from '@/api/user-boot/roleFuction' import { mainHeight } from '@/utils/layout' import { del } from '@/api/user-boot/role' import { ElMessage } from 'element-plus' @@ -163,6 +163,9 @@ const currentChange = (data: any) => { getFunctionsByRoleIndex({ id: data.row.id }).then((res: any) => { treeRef.value.treeRef.setCheckedKeys(res.data.map((item: any) => item.id)) }) + getSystemByRoleId({ id: data.row.id }).then((res: any) => { + systemIds.value = res.data.systemIds || [] + }) } const timeout = ref() @@ -185,17 +188,17 @@ const checkChange = (data: any) => { }) } const saveSystem = () => { - // updateRoleMenu({ - // id: menuListId.value, - // idList: systemIds.value - // }) - // .then(() => { - // ElMessage.success('操作成功!') - // treeRef.value.loading = false - // }) - // .catch(() => { - // treeRef.value.loading = false - // }) + systemAdd({ + roleId: menuListId.value, + systemIds: systemIds.value + }) + .then(() => { + ElMessage.success('操作成功!') + treeRef.value.loading = false + }) + .catch(() => { + treeRef.value.loading = false + }) } onMounted(() => { tableStore.index() @@ -209,11 +212,11 @@ const addRole = () => { :deep(.el-tabs--border-card > .el-tabs__content) { padding: 0px !important; } -.system{ +.system { width: 330px; height: calc(100vh - 225px); - border: 1px solid var(--el-border-color); - padding: 5px 10px; + border: 1px solid var(--el-border-color); + padding: 5px 10px; display: flex; flex-direction: column; } diff --git a/src/views/auth/role/popupForm.vue b/src/views/auth/role/popupForm.vue index 722c33d..5eb3501 100644 --- a/src/views/auth/role/popupForm.vue +++ b/src/views/auth/role/popupForm.vue @@ -1,74 +1,86 @@ - - + + diff --git a/src/views/govern/device/control/index.vue b/src/views/govern/device/control/index.vue index 942e19f..c3df524 100644 --- a/src/views/govern/device/control/index.vue +++ b/src/views/govern/device/control/index.vue @@ -700,7 +700,7 @@ const handleTrend = async () => { // } }) } else { - ElMessage.success('装置应答失败') + ElMessage.warning('装置应答失败') } }) .catch(e => { @@ -748,11 +748,13 @@ const handleHarmonicSpectrum = async () => { //返回 const handleReturn = async () => { if (realDataTimer.value) { - clearInterval(realDataTimer.value) + window.clearInterval(realDataTimer.value) } + if (trendTimer.value) { - clearInterval(trendTimer.value) + window.clearInterval(trendTimer.value) } + realTimeFlag.value = true sonTab.value = null activeTrendName.value = 0 @@ -981,10 +983,10 @@ const getRealDataMqttMsg = async () => { }) }, 30000) mqttRef.value.on('message', (topic: any, message: any) => { - console.log( - '实时数据&实时趋势---mqtt接收到消息', - JSON.parse(JSON.stringify(JSON.parse(new TextDecoder().decode(message)))) - ) + // console.log( + // '实时数据&实时趋势---mqtt接收到消息', + // JSON.parse(JSON.stringify(JSON.parse(new TextDecoder().decode(message)))) + // ) let obj = JSON.parse(JSON.stringify(JSON.parse(new TextDecoder().decode(message)))) if (lineId.value != obj.lineId || adminInfo.userIndex != obj.userId) return @@ -1152,10 +1154,10 @@ const mqttMessage = ref({}) const handleClick = async (tab?: any) => { tableLoading.value = true if (realDataTimer.value) { - clearInterval(realDataTimer.value) + window.clearInterval(realDataTimer.value) } if (trendTimer.value) { - clearInterval(trendTimer.value) + window.clearInterval(trendTimer.value) } sonTab.value = null activeTrendName.value = 0 diff --git a/src/views/govern/device/control/moduleData.vue b/src/views/govern/device/control/moduleData.vue index 592f5e1..6203e99 100644 --- a/src/views/govern/device/control/moduleData.vue +++ b/src/views/govern/device/control/moduleData.vue @@ -375,10 +375,10 @@ const changeDataType = () => { let flag = dataType.value.includes(0) || dataType.value.includes(1) if (flag) { let data1 = dataType.value.includes(0) - ? list.value[activeTab.value].loadList.map(k => (k.data == 3.14159 ? 0 : k.data)) + ? list.value[activeTab.value]?.loadList.map(k => (k.data == 3.14159 ? 0 : k.data)) : [0] let data2 = dataType.value.includes(1) - ? list.value[activeTab.value].modOutList.map(k => (k.data == 3.14159 ? 0 : k.data)) + ? list.value[activeTab.value]?.modOutList.map(k => (k.data == 3.14159 ? 0 : k.data)) : [0] let [modOuMin, modOuMax] = yMethod([...data1, ...data2]) console.log("🚀 ~ changeDataType ~ modOuMin:", modOuMin,modOuMax) diff --git a/src/views/govern/device/control/tabs/components/realtrend.vue b/src/views/govern/device/control/tabs/components/realtrend.vue index 2ae9f8c..bb5d136 100644 --- a/src/views/govern/device/control/tabs/components/realtrend.vue +++ b/src/views/govern/device/control/tabs/components/realtrend.vue @@ -2,7 +2,7 @@