Commit c9c558934936be2c04a932241bc1497f9f30efa5
Merge branch 'v1.4.0_dev' into 'main_dev'
V1.4.0 dev See merge request yunteng/thingskit-front!1366
Showing
8 changed files
with
74 additions
and
8 deletions
@@ -5,6 +5,7 @@ export interface HomeStatisticsRecordType { | @@ -5,6 +5,7 @@ export interface HomeStatisticsRecordType { | ||
5 | customerInfo: TotalInfo; | 5 | customerInfo: TotalInfo; |
6 | productInfo: TotalInfo; | 6 | productInfo: TotalInfo; |
7 | messageInfo: MessageInfo; | 7 | messageInfo: MessageInfo; |
8 | + alarmNoticeInfo: AlarmNoticeInfo; | ||
8 | } | 9 | } |
9 | 10 | ||
10 | export interface TotalInfo { | 11 | export interface TotalInfo { |
@@ -29,3 +30,8 @@ export interface MessageInfo { | @@ -29,3 +30,8 @@ export interface MessageInfo { | ||
29 | todayMessageAdd: number; | 30 | todayMessageAdd: number; |
30 | todayDataPointsAdd: number; | 31 | todayDataPointsAdd: number; |
31 | } | 32 | } |
33 | + | ||
34 | +export interface AlarmNoticeInfo { | ||
35 | + sumCount: number; | ||
36 | + todayAdd: number; | ||
37 | +} |
@@ -22,6 +22,22 @@ enum Api { | @@ -22,6 +22,22 @@ enum Api { | ||
22 | ResetCode = '/noauth/reset_code/', | 22 | ResetCode = '/noauth/reset_code/', |
23 | ResetPassword = '/noauth/reset/', | 23 | ResetPassword = '/noauth/reset/', |
24 | APP_GET_TOKEN = '/third/login/id/', | 24 | APP_GET_TOKEN = '/third/login/id/', |
25 | + AUTH_LOGOUT = '/auth/logout', | ||
26 | +} | ||
27 | + | ||
28 | +/** | ||
29 | + * @description: user logout api | ||
30 | + */ | ||
31 | +export function logoutApi(_, mode: ErrorMessageMode = 'modal') { | ||
32 | + return defHttp.post( | ||
33 | + { | ||
34 | + url: Api.AUTH_LOGOUT, | ||
35 | + }, | ||
36 | + { | ||
37 | + errorMessageMode: mode, | ||
38 | + joinPrefix: false, | ||
39 | + } | ||
40 | + ); | ||
25 | } | 41 | } |
26 | 42 | ||
27 | /** | 43 | /** |
src/enums/permissionEnum.ts
0 → 100644
@@ -19,7 +19,7 @@ import { | @@ -19,7 +19,7 @@ import { | ||
19 | RefreshTokenParams, | 19 | RefreshTokenParams, |
20 | SmsLoginParams, | 20 | SmsLoginParams, |
21 | } from '/@/api/sys/model/userModel'; | 21 | } from '/@/api/sys/model/userModel'; |
22 | -import { doRefreshToken, getMyInfo, loginApi, smsCodeLoginApi } from '/@/api/sys/user'; | 22 | +import { doRefreshToken, getMyInfo, loginApi, logoutApi, smsCodeLoginApi } from '/@/api/sys/user'; |
23 | import { useI18n } from '/@/hooks/web/useI18n'; | 23 | import { useI18n } from '/@/hooks/web/useI18n'; |
24 | import { useMessage } from '/@/hooks/web/useMessage'; | 24 | import { useMessage } from '/@/hooks/web/useMessage'; |
25 | import { router } from '/@/router'; | 25 | import { router } from '/@/router'; |
@@ -240,7 +240,6 @@ export const useUserStore = defineStore({ | @@ -240,7 +240,6 @@ export const useUserStore = defineStore({ | ||
240 | // setAuthCache(REFRESH_TOKEN_KEY, undefined); | 240 | // setAuthCache(REFRESH_TOKEN_KEY, undefined); |
241 | // this.setSessionTimeout(false); | 241 | // this.setSessionTimeout(false); |
242 | // // goLogin && router.push(PageEnum.BASE_LOGIN); | 242 | // // goLogin && router.push(PageEnum.BASE_LOGIN); |
243 | - | ||
244 | this.setToken(undefined); | 243 | this.setToken(undefined); |
245 | this.setSessionTimeout(false); | 244 | this.setSessionTimeout(false); |
246 | setAuthCache(REFRESH_TOKEN_KEY, undefined); | 245 | setAuthCache(REFRESH_TOKEN_KEY, undefined); |
@@ -284,6 +283,7 @@ export const useUserStore = defineStore({ | @@ -284,6 +283,7 @@ export const useUserStore = defineStore({ | ||
284 | title: t('sys.app.logoutTip'), | 283 | title: t('sys.app.logoutTip'), |
285 | content: t('sys.app.logoutMessage'), | 284 | content: t('sys.app.logoutMessage'), |
286 | onOk: async () => { | 285 | onOk: async () => { |
286 | + await logoutApi(null, 'modal'); //新增退出登录接口 | ||
287 | await this.logout(true); | 287 | await this.logout(true); |
288 | }, | 288 | }, |
289 | }); | 289 | }); |
@@ -90,7 +90,7 @@ | @@ -90,7 +90,7 @@ | ||
90 | </div> | 90 | </div> |
91 | </template> | 91 | </template> |
92 | <script lang="ts" setup> | 92 | <script lang="ts" setup> |
93 | - import { ref, onMounted, defineComponent, Ref } from 'vue'; | 93 | + import { ref, onMounted, defineComponent, Ref, computed } from 'vue'; |
94 | import { Card } from 'ant-design-vue'; | 94 | import { Card } from 'ant-design-vue'; |
95 | import { getHomeData } from '/@/api/dashboard'; | 95 | import { getHomeData } from '/@/api/dashboard'; |
96 | import { isAdmin } from '/@/enums/roleEnum'; | 96 | import { isAdmin } from '/@/enums/roleEnum'; |
@@ -109,6 +109,8 @@ | @@ -109,6 +109,8 @@ | ||
109 | import msgPicture from '/@/assets/images/msg-count.png'; | 109 | import msgPicture from '/@/assets/images/msg-count.png'; |
110 | import tenantPicture from '/@/assets/images/zh.png'; | 110 | import tenantPicture from '/@/assets/images/zh.png'; |
111 | import customerPicture from '/@/assets/images/kf.png'; | 111 | import customerPicture from '/@/assets/images/kf.png'; |
112 | + import { useUserStore } from '/@/store/modules/user'; | ||
113 | + import { PermissionEnum } from '/@/enums/permissionEnum'; | ||
112 | 114 | ||
113 | interface RecordType { | 115 | interface RecordType { |
114 | value: number; | 116 | value: number; |
@@ -156,8 +158,23 @@ | @@ -156,8 +158,23 @@ | ||
156 | ]; | 158 | ]; |
157 | 159 | ||
158 | const { isSysadmin, isPlatformAdmin } = useRole(); | 160 | const { isSysadmin, isPlatformAdmin } = useRole(); |
161 | + | ||
162 | + const userStore = useUserStore(); | ||
163 | + | ||
164 | + const hasTenantSubAdminPermission = computed(() => { | ||
165 | + return userStore.getUserInfo?.level === PermissionEnum.TENANT_SUB_ADMINISTRATOR; | ||
166 | + }); | ||
167 | + | ||
159 | const handleTransformStatisticalInfo = (record: HomeStatisticsRecordType) => { | 168 | const handleTransformStatisticalInfo = (record: HomeStatisticsRecordType) => { |
160 | - const { deviceInfo, productInfo, alarmInfo, messageInfo, customerInfo, tenantInfo } = record; | 169 | + const { |
170 | + deviceInfo, | ||
171 | + productInfo, | ||
172 | + alarmInfo, | ||
173 | + messageInfo, | ||
174 | + customerInfo, | ||
175 | + tenantInfo, | ||
176 | + alarmNoticeInfo, | ||
177 | + } = record; | ||
161 | 178 | ||
162 | const productTotal: StatisticalItemType = { | 179 | const productTotal: StatisticalItemType = { |
163 | images: productPicture, | 180 | images: productPicture, |
@@ -226,10 +243,25 @@ | @@ -226,10 +243,25 @@ | ||
226 | todayTotals: [{ label: '今日新增', value: customerInfo?.todayAdd }], | 243 | todayTotals: [{ label: '今日新增', value: customerInfo?.todayAdd }], |
227 | }; | 244 | }; |
228 | 245 | ||
246 | + const alarmNoticeInfoTotal: StatisticalItemType = { | ||
247 | + images: msgPicture, | ||
248 | + totals: [{ label: '告警通知数', value: alarmNoticeInfo?.sumCount }], | ||
249 | + tooltips: [ | ||
250 | + { label: '告警通知数', value: alarmNoticeInfo?.sumCount }, | ||
251 | + { label: '今日新增', value: alarmNoticeInfo?.todayAdd }, | ||
252 | + ], | ||
253 | + todayTotals: [{ label: '今日新增', value: alarmNoticeInfo?.todayAdd }], | ||
254 | + }; | ||
255 | + | ||
229 | if (unref(isSysadmin) || unref(isPlatformAdmin)) { | 256 | if (unref(isSysadmin) || unref(isPlatformAdmin)) { |
230 | statisticalPanelList.value = [deviceTotal, tenantTotal, customerTotal]; | 257 | statisticalPanelList.value = [deviceTotal, tenantTotal, customerTotal]; |
231 | } else { | 258 | } else { |
232 | - statisticalPanelList.value = [productTotal, deviceTotal, alarmTotal, messageTotal]; | 259 | + statisticalPanelList.value = [ |
260 | + productTotal, | ||
261 | + deviceTotal, | ||
262 | + alarmTotal, | ||
263 | + hasTenantSubAdminPermission.value ? alarmNoticeInfoTotal : messageTotal, | ||
264 | + ]; | ||
233 | } | 265 | } |
234 | }; | 266 | }; |
235 | 267 |
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | v-bind="$attrs" | 4 | v-bind="$attrs" |
5 | :active-tab-key="activeKey" | 5 | :active-tab-key="activeKey" |
6 | @tabChange="onTabChange" | 6 | @tabChange="onTabChange" |
7 | - v-if="!isAdmin(role)" | 7 | + v-if="!isAdmin(role) && !hasTenantSubAdminPermission" |
8 | > | 8 | > |
9 | <template #messageStatistics> | 9 | <template #messageStatistics> |
10 | <span>消息量统计</span> | 10 | <span>消息量统计</span> |
@@ -169,7 +169,7 @@ | @@ -169,7 +169,7 @@ | ||
169 | </div> | 169 | </div> |
170 | </template> | 170 | </template> |
171 | <script lang="ts" setup> | 171 | <script lang="ts" setup> |
172 | - import { ref, reactive, unref } from 'vue'; | 172 | + import { ref, reactive, unref, computed } from 'vue'; |
173 | import { Card, DatePicker, Tooltip, Button } from 'ant-design-vue'; | 173 | import { Card, DatePicker, Tooltip, Button } from 'ant-design-vue'; |
174 | import { QuestionCircleOutlined } from '@ant-design/icons-vue'; | 174 | import { QuestionCircleOutlined } from '@ant-design/icons-vue'; |
175 | // import VisitAnalysis from './VisitAnalysis.vue'; | 175 | // import VisitAnalysis from './VisitAnalysis.vue'; |
@@ -186,6 +186,8 @@ | @@ -186,6 +186,8 @@ | ||
186 | import { getTrendData } from '/@/api/dashboard'; | 186 | import { getTrendData } from '/@/api/dashboard'; |
187 | import { useGlobSetting } from '/@/hooks/setting'; | 187 | import { useGlobSetting } from '/@/hooks/setting'; |
188 | import { RangePickerValue } from 'ant-design-vue/lib/date-picker/interface'; | 188 | import { RangePickerValue } from 'ant-design-vue/lib/date-picker/interface'; |
189 | + import { useUserStore } from '/@/store/modules/user'; | ||
190 | + import { PermissionEnum } from '/@/enums/permissionEnum'; | ||
189 | 191 | ||
190 | defineExpose({ | 192 | defineExpose({ |
191 | isAdmin, | 193 | isAdmin, |
@@ -208,6 +210,12 @@ | @@ -208,6 +210,12 @@ | ||
208 | }, | 210 | }, |
209 | ]; | 211 | ]; |
210 | 212 | ||
213 | + const userStore = useUserStore(); | ||
214 | + | ||
215 | + const hasTenantSubAdminPermission = computed(() => { | ||
216 | + return userStore.getUserInfo?.level === PermissionEnum.TENANT_SUB_ADMINISTRATOR; | ||
217 | + }); | ||
218 | + | ||
211 | // 快速选择日期 | 219 | // 快速选择日期 |
212 | const activeIndex = ref(3); | 220 | const activeIndex = ref(3); |
213 | const dateValue = ref(); | 221 | const dateValue = ref(); |
@@ -58,7 +58,7 @@ | @@ -58,7 +58,7 @@ | ||
58 | }); | 58 | }); |
59 | } | 59 | } |
60 | getTenantRoles(data.record.tenantId).then((result) => { | 60 | getTenantRoles(data.record.tenantId).then((result) => { |
61 | - const { ...params } = data.record; | 61 | + const { icon: _, ...params } = data.record; // icon这个字段不能回显 |
62 | //为表单赋值 | 62 | //为表单赋值 |
63 | setFieldsValue({ | 63 | setFieldsValue({ |
64 | ...params, | 64 | ...params, |
@@ -43,6 +43,7 @@ export interface UserInfo { | @@ -43,6 +43,7 @@ export interface UserInfo { | ||
43 | phoneNumber?: string; | 43 | phoneNumber?: string; |
44 | email?: string; | 44 | email?: string; |
45 | tenantId?: string; | 45 | tenantId?: string; |
46 | + level?: number; | ||
46 | } | 47 | } |
47 | 48 | ||
48 | export interface BeforeMiniState { | 49 | export interface BeforeMiniState { |