Showing
3 changed files
with
11 additions
and
3 deletions
... | ... | @@ -113,13 +113,13 @@ |
113 | 113 | import { useDate } from '../hooks/useDate'; |
114 | 114 | import { getTrendData } from '/@/api/dashboard'; |
115 | 115 | import { useGlobSetting } from '/@/hooks/setting'; |
116 | + import { getEntitiesId } from '/@/api/dashboard/index'; | |
116 | 117 | |
117 | 118 | defineExpose({ |
118 | 119 | isAdmin, |
119 | 120 | }); |
120 | 121 | const props = defineProps<{ |
121 | 122 | role: string; |
122 | - getEntityId: object; | |
123 | 123 | }>(); |
124 | 124 | const activeKey = ref('1'); |
125 | 125 | let entityId = null; |
... | ... | @@ -159,9 +159,12 @@ |
159 | 159 | const { send, close } = useWebSocket(state.server, { |
160 | 160 | async onConnected() { |
161 | 161 | if (isAdmin(props.role)) return; |
162 | - console.log(props.getEntityId); | |
163 | 162 | let content = JSON.parse(window.localStorage.getItem('entityId')); |
164 | 163 | entityId = content; |
164 | + if (entityId == null) { | |
165 | + const res = await getEntitiesId(); | |
166 | + entityId = res.data[0]?.entityId; | |
167 | + } | |
165 | 168 | const sendValue = JSON.stringify({ |
166 | 169 | entityDataCmds: [ |
167 | 170 | { | ... | ... |
... | ... | @@ -112,6 +112,7 @@ |
112 | 112 | import { useDate } from '../hooks/useDate'; |
113 | 113 | import { getTrendData } from '/@/api/dashboard'; |
114 | 114 | import { useGlobSetting } from '/@/hooks/setting'; |
115 | + import { getEntitiesId } from '/@/api/dashboard/index'; | |
115 | 116 | |
116 | 117 | defineExpose({ |
117 | 118 | isAdmin, |
... | ... | @@ -159,6 +160,10 @@ |
159 | 160 | if (isAdmin(props.role)) return; |
160 | 161 | let content = JSON.parse(window.localStorage.getItem('entityId')); |
161 | 162 | entityId = content; |
163 | + if (entityId == null) { | |
164 | + const res = await getEntitiesId(); | |
165 | + entityId = res.data[0]?.entityId; | |
166 | + } | |
162 | 167 | const sendValue = JSON.stringify({ |
163 | 168 | entityDataCmds: [ |
164 | 169 | { | ... | ... |
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 | <div class="md:w-7/10 w-full !mr-4 enter-y"> |
4 | 4 | <GrowCard :loading="loading" class="enter-y" :role="role" /> |
5 | 5 | <SiteAnalysisMessage class="!my-4 enter-y" :loading="loading" :role="role" /> |
6 | - <SiteAnalysis class="!my-4 enter-y" :loading="loading" :role="role" :getEntityId="entityId" /> | |
6 | + <SiteAnalysis class="!my-4 enter-y" :loading="loading" :role="role" /> | |
7 | 7 | <div class="md:flex enter-y" v-if="!isAdmin(role)"> |
8 | 8 | <Card title="核心流程指南" style="width: 100%"> |
9 | 9 | <img alt="核心流程指南" src="/src/assets/images/flow.png" /> | ... | ... |