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