Commit 1e4aa4cad921afc51d092c0ed89ccd67dc875919

Authored by fengtao
1 parent 1612a2ca

feat:联调首页服务端接口

1 <template> 1 <template>
2 - <!-- 首页基础信息 -->  
3 - <div class="md:flex">  
4 - <Card size="small" class="md:w-1/3 w-full !md:mt-0 !mt-4 !md:mr-4" style="color: #666">  
5 - <div class="flex" style="height: 100px">  
6 - <div class="mr-4"  
7 - ><img src="/src/assets/images/device-count.png" style="width: 5.625rem; height: 5.625rem"  
8 - /></div>  
9 - <div class="flex-auto">  
10 - <div class="flex justify-between" style="align-items: center">  
11 - <div style="font-size: 1.625rem; color: #333; font-weight: bold">  
12 - <CountTo  
13 - v-if="growCardList?.deviceInfo?.sumCount"  
14 - :endVal="growCardList.deviceInfo.sumCount"  
15 - />  
16 - <CountTo v-else :endVal="0" /> 2 + <div>
  3 + <!-- 首页基础信息 -->
  4 + <div class="md:flex">
  5 + <Card size="small" class="md:w-1/3 w-full !md:mt-0 !mt-4 !md:mr-4" style="color: #666">
  6 + <div class="flex" style="height: 100px">
  7 + <div class="mr-4"
  8 + ><img
  9 + src="/src/assets/images/device-count.png"
  10 + style="width: 5.625rem; height: 5.625rem"
  11 + /></div>
  12 + <div class="flex-auto">
  13 + <div class="flex justify-between" style="align-items: center">
  14 + <div style="font-size: 1.625rem; color: #333; font-weight: bold">
  15 + <CountTo
  16 + v-if="growCardList?.deviceInfo?.sumCount"
  17 + :endVal="growCardList.deviceInfo.sumCount"
  18 + />
  19 + <CountTo v-else :endVal="0" />
  20 + </div>
  21 + <Tooltip>
  22 + <template #title>
  23 + 设备数 : {{ growCardList?.deviceInfo.sumCount }} 今日新增
  24 + {{ toThousands(growCardList?.deviceInfo?.todayAdd) }}
  25 + </template>
  26 + <img src="/src/assets/images/tip.png" style="width: 1.125rem; height: 1.125rem" />
  27 + </Tooltip>
17 </div> 28 </div>
18 - <Tooltip>  
19 - <template #title>  
20 - 设备数 : {{ growCardList?.deviceInfo.sumCount }} 今日新增  
21 - {{ toThousands(growCardList?.deviceInfo?.todayAdd) }}  
22 - </template>  
23 - <img src="/src/assets/images/tip.png" style="width: 1.125rem; height: 1.125rem" />  
24 - </Tooltip> 29 + <div> 设备数 </div>
25 </div> 30 </div>
26 - <div> 设备数 </div>  
27 </div> 31 </div>
28 - </div>  
29 - <div class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5">  
30 - 今日新增 {{ toThousands(growCardList?.deviceInfo?.todayAdd) }}  
31 - </div>  
32 - </Card>  
33 - <Card size="small" class="md:w-1/3 w-full !md:mt-0 !mt-4 !md:mr-4" style="color: #666">  
34 - <div class="flex" style="height: 100px">  
35 - <div class="mr-4">  
36 - <img  
37 - v-if="!isAdmin(role)"  
38 - src="/src/assets/images/alarm-count.png"  
39 - style="width: 5.625rem; height: 5.625rem"  
40 - />  
41 - <img v-else src="/src/assets/images/zh.png" style="width: 5.625rem; height: 5.625rem" /> 32 + <div class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5">
  33 + 今日新增 {{ toThousands(growCardList?.deviceInfo?.todayAdd) }}
42 </div> 34 </div>
43 - <div class="flex-auto">  
44 - <div class="flex justify-between" style="align-items: center">  
45 - <div v-if="!isAdmin(role)" style="font-size: 1.625rem; color: #333; font-weight: bold">  
46 - <CountTo  
47 - v-if="growCardList?.alarmInfo?.sumCount"  
48 - :end-val="growCardList.alarmInfo.sumCount"  
49 - />  
50 - <CountTo v-else :end-val="0" /> 35 + </Card>
  36 + <Card size="small" class="md:w-1/3 w-full !md:mt-0 !mt-4 !md:mr-4" style="color: #666">
  37 + <div class="flex" style="height: 100px">
  38 + <div class="mr-4">
  39 + <img
  40 + v-if="!isAdmin(role)"
  41 + src="/src/assets/images/alarm-count.png"
  42 + style="width: 5.625rem; height: 5.625rem"
  43 + />
  44 + <img v-else src="/src/assets/images/zh.png" style="width: 5.625rem; height: 5.625rem" />
  45 + </div>
  46 + <div class="flex-auto">
  47 + <div class="flex justify-between" style="align-items: center">
  48 + <div
  49 + v-if="!isAdmin(role)"
  50 + style="font-size: 1.625rem; color: #333; font-weight: bold"
  51 + >
  52 + <CountTo
  53 + v-if="growCardList?.alarmInfo?.sumCount"
  54 + :end-val="growCardList.alarmInfo.sumCount"
  55 + />
  56 + <CountTo v-else :end-val="0" />
  57 + </div>
  58 + <div style="font-size: 1.625rem; color: #333; font-weight: bold" v-else>
  59 + <CountTo
  60 + v-if="growCardList?.tenantInfo?.sumCount"
  61 + :end-val="growCardList.tenantInfo.sumCount"
  62 + />
  63 + <CountTo v-else :end-val="0" />
  64 + </div>
  65 + <Tooltip>
  66 + <template #title>
  67 + {{
  68 + !isAdmin(role)
  69 + ? `告警数:${growCardList?.alarmInfo?.sumCount} 今日新增 ${toThousands(
  70 + growCardList?.alarmInfo?.todayAdd
  71 + )}`
  72 + : `租户总量:${growCardList?.tenantInfo?.sumCount} 今日新增 ${toThousands(
  73 + growCardList?.alarmInfo?.todayAdd
  74 + )}`
  75 + }}
  76 + </template>
  77 + <img src="/src/assets/images/tip.png" style="width: 1.125rem; height: 1.125rem" />
  78 + </Tooltip>
51 </div> 79 </div>
52 - <div style="font-size: 1.625rem; color: #333; font-weight: bold" v-else>  
53 - <CountTo  
54 - v-if="growCardList?.tenantInfo?.sumCount"  
55 - :end-val="growCardList.tenantInfo.sumCount"  
56 - />  
57 - <CountTo v-else :end-val="0" /> 80 + <div> {{ !isAdmin(role) ? `告警数` : '租户总量' }}</div>
  81 + </div>
  82 + </div>
  83 + <div v-if="!isAdmin(role)" class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5">
  84 + 今日新增 {{ toThousands(growCardList?.alarmInfo?.todayAdd) }}</div
  85 + >
  86 + <div v-else class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5">
  87 + 今日新增 {{ toThousands(growCardList?.tenantInfo?.todayAdd) }}</div
  88 + >
  89 + </Card>
  90 + <Card size="small" class="md:w-1/3 w-full !md:mt-0 !mt-4" style="color: #666">
  91 + <div class="flex" style="height: 100px">
  92 + <div class="mr-4">
  93 + <img
  94 + v-if="!isAdmin(role)"
  95 + src="/src/assets/images/msg-count.png"
  96 + style="width: 5.625rem; height: 5.625rem"
  97 + />
  98 + <img v-else src="/src/assets/images/kf.png" style="width: 5.625rem; height: 5.625rem" />
  99 + </div>
  100 + <div class="flex-auto">
  101 + <div class="flex justify-between" style="align-items: center">
  102 + <div
  103 + v-if="!isAdmin(role)"
  104 + style="font-size: 1.625rem; color: #333; font-weight: bold"
  105 + >
  106 + <CountTo
  107 + v-if="growCardList?.messageInfo?.messageCount"
  108 + :end-val="growCardList.messageInfo.messageCount"
  109 + />
  110 + <CountTo v-else :end-val="0" />
  111 + </div>
  112 + <div style="font-size: 1.625rem; color: #333; font-weight: bold" v-else>
  113 + <CountTo
  114 + v-if="growCardList?.customerInfo?.sumCount"
  115 + :end-val="growCardList.customerInfo.sumCount"
  116 + />
  117 + <CountTo v-else :end-val="0" />
  118 + </div>
  119 + <Tooltip>
  120 + <template #title>
  121 + {{
  122 + !isAdmin(role)
  123 + ? `消息数:${growCardList?.messageInfo?.messageCount} 今日新增 ${toThousands(
  124 + growCardList?.messageInfo?.todayMessageAdd
  125 + )}`
  126 + : `客户总量:${growCardList?.customerInfo?.sumCount} 今日新增 ${toThousands(
  127 + growCardList?.messageInfo?.todayMessageAdd
  128 + )}`
  129 + }}
  130 + </template>
  131 + <img src="/src/assets/images/tip.png" style="width: 1.125rem; height: 1.125rem" />
  132 + </Tooltip>
58 </div> 133 </div>
59 - <Tooltip>  
60 - <template #title>  
61 - {{  
62 - !isAdmin(role)  
63 - ? `告警数:${growCardList?.alarmInfo?.sumCount} 今日新增 ${toThousands(  
64 - growCardList?.alarmInfo?.todayAdd  
65 - )}`  
66 - : `租户总量:${growCardList?.tenantInfo?.sumCount} 今日新增 ${toThousands(  
67 - growCardList?.alarmInfo?.todayAdd  
68 - )}`  
69 - }}  
70 - </template>  
71 - <img src="/src/assets/images/tip.png" style="width: 1.125rem; height: 1.125rem" />  
72 - </Tooltip> 134 + <div> {{ !isAdmin(role) ? `消息数` : '客户总量' }}</div>
73 </div> 135 </div>
74 - <div> {{ !isAdmin(role) ? `告警数` : '租户总量' }}</div>  
75 </div> 136 </div>
76 - </div>  
77 - <div v-if="!isAdmin(role)" class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5">  
78 - 今日新增 {{ toThousands(growCardList?.alarmInfo?.todayAdd) }}</div  
79 - >  
80 - <div v-else class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5">  
81 - 今日新增 {{ toThousands(growCardList?.tenantInfo?.todayAdd) }}</div 137 + <div v-if="!isAdmin(role)" class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5">
  138 + 今日新增 {{ toThousands(growCardList?.messageInfo?.todayMessageAdd) }}</div
  139 + >
  140 + <div v-else class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5">
  141 + 今日新增 {{ toThousands(growCardList?.customerInfo?.todayAdd) }}</div
  142 + >
  143 + </Card>
  144 + <Card
  145 + v-if="!isAdmin(role)"
  146 + size="small"
  147 + class="md:w-1/3 w-full !md:mt-0 !mt-4 !md:ml-4"
  148 + style="color: #666"
82 > 149 >
83 - </Card>  
84 - <Card size="small" class="md:w-1/3 w-full !md:mt-0 !mt-4" style="color: #666">  
85 - <div class="flex" style="height: 100px">  
86 - <div class="mr-4">  
87 - <img  
88 - v-if="!isAdmin(role)"  
89 - src="/src/assets/images/msg-count.png"  
90 - style="width: 5.625rem; height: 5.625rem"  
91 - />  
92 - <img v-else src="/src/assets/images/kf.png" style="width: 5.625rem; height: 5.625rem" />  
93 - </div>  
94 - <div class="flex-auto">  
95 - <div class="flex justify-between" style="align-items: center">  
96 - <div v-if="!isAdmin(role)" style="font-size: 1.625rem; color: #333; font-weight: bold">  
97 - <CountTo  
98 - v-if="growCardList?.messageInfo?.messageCount"  
99 - :end-val="growCardList.messageInfo.messageCount"  
100 - />  
101 - <CountTo v-else :end-val="0" />  
102 - </div>  
103 - <div style="font-size: 1.625rem; color: #333; font-weight: bold" v-else>  
104 - <CountTo  
105 - v-if="growCardList?.customerInfo?.sumCount"  
106 - :end-val="growCardList.customerInfo.sumCount"  
107 - />  
108 - <CountTo v-else :end-val="0" /> 150 + <div class="flex" style="height: 100px">
  151 + <div class="mr-4">
  152 + <img
  153 + v-if="!isAdmin(role)"
  154 + src="/src/assets/images/product.png"
  155 + style="width: 5.625rem; height: 5.625rem"
  156 + />
  157 + <img
  158 + v-else
  159 + src="/src/assets/images/product.png"
  160 + style="width: 5.625rem; height: 5.625rem"
  161 + />
  162 + </div>
  163 + <div class="flex-auto">
  164 + <div class="flex justify-between" style="align-items: center">
  165 + <div
  166 + v-if="!isAdmin(role)"
  167 + style="font-size: 1.625rem; color: #333; font-weight: bold"
  168 + >
  169 + <CountTo
  170 + v-if="growCardList?.productInfo?.sumCount"
  171 + :end-val="growCardList.productInfo.sumCount"
  172 + />
  173 + <CountTo v-else :end-val="0" />
  174 + </div>
  175 + <div style="font-size: 1.625rem; color: #333; font-weight: bold" v-else>
  176 + <CountTo
  177 + v-if="growCardList?.productInfo?.sumCount"
  178 + :end-val="growCardList.productInfo?.sumCount"
  179 + />
  180 + <CountTo v-else :end-val="0" />
  181 + </div>
  182 + <Tooltip>
  183 + <template #title>
  184 + {{
  185 + !isAdmin(role)
  186 + ? `产品数:${growCardList?.productInfo?.sumCount} 今日新增 ${toThousands(
  187 + growCardList?.productInfo?.todayAdd
  188 + )}`
  189 + : `产品数:${growCardList?.customerInfo?.sumCount} 今日新增 ${toThousands(
  190 + growCardList?.productInfo?.todayAdd
  191 + )}`
  192 + }}
  193 + </template>
  194 + <img src="/src/assets/images/tip.png" style="width: 1.125rem; height: 1.125rem" />
  195 + </Tooltip>
109 </div> 196 </div>
110 - <Tooltip>  
111 - <template #title>  
112 - {{  
113 - !isAdmin(role)  
114 - ? `消息数:${growCardList?.messageInfo?.messageCount} 今日新增 ${toThousands(  
115 - growCardList?.messageInfo?.todayMessageAdd  
116 - )}`  
117 - : `客户总量:${growCardList?.customerInfo?.sumCount} 今日新增 ${toThousands(  
118 - growCardList?.messageInfo?.todayMessageAdd  
119 - )}`  
120 - }}  
121 - </template>  
122 - <img src="/src/assets/images/tip.png" style="width: 1.125rem; height: 1.125rem" />  
123 - </Tooltip> 197 + <div> {{ !isAdmin(role) ? `产品数` : '产品数' }}</div>
124 </div> 198 </div>
125 - <div> {{ !isAdmin(role) ? `消息数` : '客户总量' }}</div>  
126 </div> 199 </div>
127 - </div>  
128 - <div v-if="!isAdmin(role)" class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5">  
129 - 今日新增 {{ toThousands(growCardList?.messageInfo?.todayMessageAdd) }}</div  
130 - >  
131 - <div v-else class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5">  
132 - 今日新增 {{ toThousands(growCardList?.customerInfo?.todayAdd) }}</div 200 + <div v-if="!isAdmin(role)" class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5">
  201 + 今日新增 {{ toThousands(growCardList?.productInfo?.todayAdd) }}</div
  202 + >
  203 + <div v-else class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5">
  204 + 今日新增 {{ toThousands(growCardList?.productInfo?.todayAdd) }}</div
  205 + >
  206 + </Card>
  207 + </div>
  208 + <!-- 首页饼图 -->
  209 + <div class="md:flex mt-4" v-if="!isAdmin(role)">
  210 + <Card
  211 + size="small"
  212 + class="md:w-1/3 w-full !md:mt-0 !mt-4 !md:mr-4"
  213 + style="color: #666; width: 50%"
133 > 214 >
134 - </Card>  
135 - <Card  
136 - v-if="!isAdmin(role)"  
137 - size="small"  
138 - class="md:w-1/3 w-full !md:mt-0 !mt-4 !md:ml-4"  
139 - style="color: #666"  
140 - >  
141 - <div class="flex" style="height: 100px">  
142 - <div class="mr-4">  
143 - <img  
144 - v-if="!isAdmin(role)"  
145 - src="/src/assets/images/product.png"  
146 - style="width: 5.625rem; height: 5.625rem"  
147 - />  
148 - <img  
149 - v-else  
150 - src="/src/assets/images/product.png"  
151 - style="width: 5.625rem; height: 5.625rem"  
152 - />  
153 - </div>  
154 - <div class="flex-auto">  
155 - <div class="flex justify-between" style="align-items: center">  
156 - <div v-if="!isAdmin(role)" style="font-size: 1.625rem; color: #333; font-weight: bold">  
157 - <CountTo  
158 - v-if="growCardList?.messageInfo?.messageCount"  
159 - :end-val="growCardList.messageInfo.messageCount"  
160 - />  
161 - <CountTo v-else :end-val="0" />  
162 - </div>  
163 - <div style="font-size: 1.625rem; color: #333; font-weight: bold" v-else>  
164 - <CountTo  
165 - v-if="growCardList?.customerInfo?.sumCount"  
166 - :end-val="growCardList.customerInfo.sumCount"  
167 - />  
168 - <CountTo v-else :end-val="0" /> 215 + <div class="flex container">
  216 + <div class="mr-4 flex chart-top">
  217 + <PieChartDeviceSub :legendData="legendData" :seriesData="seriesData" :isCircle="true" />
  218 + </div>
  219 + <div class="ml-20 flex justify-around right-text">
  220 + <div class="text">
  221 + 直连设备:{{ growCardList?.deviceInfo?.directConnection ?? 0 }}个
169 </div> 222 </div>
170 - <Tooltip>  
171 - <template #title>  
172 - {{  
173 - !isAdmin(role)  
174 - ? `产品数:${growCardList?.messageInfo?.messageCount} 今日新增 ${toThousands(  
175 - growCardList?.messageInfo?.todayMessageAdd  
176 - )}`  
177 - : `产品数:${growCardList?.customerInfo?.sumCount} 今日新增 ${toThousands(  
178 - growCardList?.messageInfo?.todayMessageAdd  
179 - )}`  
180 - }}  
181 - </template>  
182 - <img src="/src/assets/images/tip.png" style="width: 1.125rem; height: 1.125rem" />  
183 - </Tooltip> 223 + <div class="text"> 网关设备:{{ growCardList?.deviceInfo?.gateWay ?? 0 }}个 </div>
  224 + <div class="text"> 网关子设备:{{ growCardList?.deviceInfo?.sensor ?? 0 }}个 </div>
184 </div> 225 </div>
185 - <div> {{ !isAdmin(role) ? `产品数` : '产品数' }}</div>  
186 </div> 226 </div>
187 - </div>  
188 - <div v-if="!isAdmin(role)" class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5">  
189 - 今日新增 {{ toThousands(growCardList?.messageInfo?.todayMessageAdd) }}</div 227 + </Card>
  228 + <Card
  229 + size="small"
  230 + class="md:w-1/3 w-full !md:mt-0 !mt-4 !md:ml-1"
  231 + style="color: #666; width: 50%"
190 > 232 >
191 - <div v-else class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5">  
192 - 今日新增 {{ toThousands(growCardList?.customerInfo?.todayAdd) }}</div  
193 - >  
194 - </Card>  
195 - </div>  
196 - <!-- 首页饼图 -->  
197 - <div class="md:flex mt-4" v-if="!isAdmin(role)">  
198 - <Card  
199 - size="small"  
200 - class="md:w-1/3 w-full !md:mt-0 !mt-4 !md:mr-4"  
201 - style="color: #666; width: 50%"  
202 - >  
203 - <div class="flex container">  
204 - <div class="mr-4 flex chart-top">  
205 - <PieChartDeviceSub :legendData="legendData" :seriesData="seriesData" :isCircle="true" />  
206 - </div>  
207 - <div class="ml-20 flex justify-around right-text">  
208 - <div class="text">  
209 - 直连设备:{{ growCardList?.deviceInfo?.directConnection ?? 0 }}个 233 + <div class="flex container">
  234 + <div class="mr-4 flex chart-top">
  235 + <PieChartDeviceSub
  236 + :legendData="legendStatusData"
  237 + :seriesData="seriesStatusData"
  238 + :isCircle="false"
  239 + />
  240 + </div>
  241 + <div class="ml-20 flex justify-around right-text">
  242 + <div class="text"> 待激活设备:{{ growCardList?.deviceInfo?.inActive ?? 0 }}个 </div>
  243 + <div class="text"> 在线设备:{{ growCardList?.deviceInfo?.onLine ?? 0 }}个 </div>
  244 + <div class="text"> 离线设备:{{ growCardList?.deviceInfo?.offLine ?? 0 }}个 </div>
210 </div> 245 </div>
211 - <div class="text"> 网关设备:{{ growCardList?.deviceInfo?.gateWay ?? 0 }}个 </div>  
212 - <div class="text"> 网关子设备:{{ growCardList?.deviceInfo?.sensor ?? 0 }}个 </div>  
213 - </div>  
214 - </div>  
215 - </Card>  
216 - <Card  
217 - size="small"  
218 - class="md:w-1/3 w-full !md:mt-0 !mt-4 !md:ml-1"  
219 - style="color: #666; width: 50%"  
220 - >  
221 - <div class="flex container">  
222 - <div class="mr-4 flex chart-top">  
223 - <PieChartDeviceSub  
224 - :legendData="legendStatusData"  
225 - :seriesData="seriesStatusData"  
226 - :isCircle="false"  
227 - />  
228 - </div>  
229 - <div class="ml-20 flex justify-around right-text">  
230 - <div class="text"> 待激活设备:{{ growCardList?.deviceInfo?.inActive ?? 0 }}个 </div>  
231 - <div class="text"> 在线设备:{{ growCardList?.deviceInfo?.onLine ?? 0 }}个 </div>  
232 - <div class="text"> 离线设备:{{ growCardList?.deviceInfo?.offLine ?? 0 }}个 </div>  
233 </div> 246 </div>
234 - </div>  
235 - </Card> 247 + </Card>
  248 + </div>
236 </div> 249 </div>
237 </template> 250 </template>
238 <script lang="ts" setup> 251 <script lang="ts" setup>
@@ -107,7 +107,6 @@ @@ -107,7 +107,6 @@
107 import { getAuthCache } from '/@/utils/auth'; 107 import { getAuthCache } from '/@/utils/auth';
108 import { JWT_TOKEN_KEY } from '/@/enums/cacheEnum'; 108 import { JWT_TOKEN_KEY } from '/@/enums/cacheEnum';
109 import { formatToDateTime } from '/@/utils/dateUtil'; 109 import { formatToDateTime } from '/@/utils/dateUtil';
110 - import { getEntitiesId } from '/@/api/dashboard/index';  
111 import CustomerTrend from './CustomerTrend.vue'; 110 import CustomerTrend from './CustomerTrend.vue';
112 // import TenantTrend from './TenantTrend.vue'; 111 // import TenantTrend from './TenantTrend.vue';
113 import CustomerAlarmMessage from './CustomerAlarmMessage.vue'; 112 import CustomerAlarmMessage from './CustomerAlarmMessage.vue';
@@ -120,6 +119,7 @@ @@ -120,6 +119,7 @@
120 }); 119 });
121 const props = defineProps<{ 120 const props = defineProps<{
122 role: string; 121 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,8 +159,9 @@ @@ -159,8 +159,9 @@
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 - const res = await getEntitiesId();  
163 - entityId = res.data[0]?.entityId; 162 + console.log(props.getEntityId);
  163 + let content = JSON.parse(window.localStorage.getItem('entityId'));
  164 + entityId = content;
164 const sendValue = JSON.stringify({ 165 const sendValue = JSON.stringify({
165 entityDataCmds: [ 166 entityDataCmds: [
166 { 167 {
@@ -106,7 +106,6 @@ @@ -106,7 +106,6 @@
106 import { getAuthCache } from '/@/utils/auth'; 106 import { getAuthCache } from '/@/utils/auth';
107 import { JWT_TOKEN_KEY } from '/@/enums/cacheEnum'; 107 import { JWT_TOKEN_KEY } from '/@/enums/cacheEnum';
108 import { formatToDateTime } from '/@/utils/dateUtil'; 108 import { formatToDateTime } from '/@/utils/dateUtil';
109 - import { getEntitiesId } from '/@/api/dashboard/index';  
110 // import CustomerTrend from './CustomerTrend.vue'; 109 // import CustomerTrend from './CustomerTrend.vue';
111 import TenantTrend from './TenantTrend.vue'; 110 import TenantTrend from './TenantTrend.vue';
112 import CustomerAlarmMessage from './CustomerAlarmMessage.vue'; 111 import CustomerAlarmMessage from './CustomerAlarmMessage.vue';
@@ -158,8 +157,8 @@ @@ -158,8 +157,8 @@
158 const { send, close } = useWebSocket(state.server, { 157 const { send, close } = useWebSocket(state.server, {
159 async onConnected() { 158 async onConnected() {
160 if (isAdmin(props.role)) return; 159 if (isAdmin(props.role)) return;
161 - const res = await getEntitiesId();  
162 - entityId = res.data[0]?.entityId; 160 + let content = JSON.parse(window.localStorage.getItem('entityId'));
  161 + entityId = content;
163 const sendValue = JSON.stringify({ 162 const sendValue = JSON.stringify({
164 entityDataCmds: [ 163 entityDataCmds: [
165 { 164 {
@@ -37,6 +37,10 @@ export interface CardList { @@ -37,6 +37,10 @@ export interface CardList {
37 todayDataPointsAdd: number; 37 todayDataPointsAdd: number;
38 todayMessageAdd: number; 38 todayMessageAdd: number;
39 }; 39 };
  40 + productInfo?: {
  41 + sumCount: number;
  42 + todayAdd: number;
  43 + };
40 } 44 }
41 export type seriesDataT = { 45 export type seriesDataT = {
42 value: number | undefined; 46 value: number | undefined;
@@ -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" /> 6 + <SiteAnalysis class="!my-4 enter-y" :loading="loading" :role="role" :getEntityId="entityId" />
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" />
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 </div> 21 </div>
22 </template> 22 </template>
23 <script lang="ts" setup> 23 <script lang="ts" setup>
24 - import { ref } from 'vue'; 24 + import { ref, onMounted } from 'vue';
25 import GrowCard from './components/GrowCard.vue'; 25 import GrowCard from './components/GrowCard.vue';
26 import SiteAnalysis from './components/SiteAnalysis.vue'; 26 import SiteAnalysis from './components/SiteAnalysis.vue';
27 import SiteAnalysisMessage from './components/SiteAnalysisMessage.vue'; 27 import SiteAnalysisMessage from './components/SiteAnalysisMessage.vue';
@@ -30,6 +30,7 @@ @@ -30,6 +30,7 @@
30 import { USER_INFO_KEY } from '/@/enums/cacheEnum'; 30 import { USER_INFO_KEY } from '/@/enums/cacheEnum';
31 import { getAuthCache } from '/@/utils/auth'; 31 import { getAuthCache } from '/@/utils/auth';
32 import { isAdmin } from '/@/enums/roleEnum'; 32 import { isAdmin } from '/@/enums/roleEnum';
  33 + import { getEntitiesId } from '/@/api/dashboard/index';
33 34
34 defineExpose({ 35 defineExpose({
35 isAdmin, 36 isAdmin,
@@ -44,4 +45,12 @@ @@ -44,4 +45,12 @@
44 setTimeout(() => { 45 setTimeout(() => {
45 loading.value = false; 46 loading.value = false;
46 }, 1500); 47 }, 1500);
  48 +
  49 + const entityId = ref({});
  50 +
  51 + onMounted(async () => {
  52 + const res = await getEntitiesId();
  53 + entityId.value = res.data[0]?.entityId;
  54 + window.localStorage.setItem('entityId', JSON.stringify(entityId.value));
  55 + });
47 </script> 56 </script>