Commit 15ab35231b4d13692dff8d538e4db01364342754
1 parent
fd167432
'fix:角色菜单调整,fix:修复平台logo刷新后丢失,主页修改'
Showing
16 changed files
with
43 additions
and
42 deletions
src/assets/images/alarm-count.png
0 → 100644
1.78 KB
src/assets/images/device-count.png
0 → 100644
1.89 KB
src/assets/images/kf.png
0 → 100644
1.71 KB
src/assets/images/msg-count.png
0 → 100644
1.06 KB
src/assets/images/zh.png
0 → 100644
2.33 KB
| ... | ... | @@ -44,7 +44,7 @@ export const useUserStore = defineStore({ |
| 44 | 44 | id: 'app-user', |
| 45 | 45 | state: (): UserState => ({ |
| 46 | 46 | //平台信息 |
| 47 | - platInfo: storage.get('platInfo') || null, | |
| 47 | + platInfo: storage.get('platformInfo') || null, | |
| 48 | 48 | enterPriseInfo: storage.get('enterPriseInfo') || null, |
| 49 | 49 | // user info |
| 50 | 50 | userInfo: null, | ... | ... |
| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | <Card size="small" class="md:w-1/3 w-full !md:mt-0 !mt-4 !md:mr-4" style="color: #666"> |
| 4 | 4 | <div class="flex" style="height: 100px"> |
| 5 | 5 | <div class="mr-4" |
| 6 | - ><img src="/src/assets/svg/device-num.svg" style="width: 5.625rem; height: 5.625rem" | |
| 6 | + ><img src="/src/assets/images/device-count.png" style="width: 5.625rem; height: 5.625rem" | |
| 7 | 7 | /></div> |
| 8 | 8 | <div class="flex-auto"> |
| 9 | 9 | <div class="flex justify-between" style="align-items: center"> |
| ... | ... | @@ -17,31 +17,36 @@ |
| 17 | 17 | <img src="/src/assets/images/tip.png" style="width: 1.125rem; height: 1.125rem" /> |
| 18 | 18 | </div> |
| 19 | 19 | <div> 设备数(个) </div> |
| 20 | + <div class="flex" style="align-items: center"> | |
| 21 | + <div class="mr-2" | |
| 22 | + >在线 | |
| 23 | + <span style="color: #41b883">{{ growCardList?.deviceInfo?.onLine ?? 0 }}</span></div | |
| 24 | + > | |
| 25 | + <div class="mr-2"> | |
| 26 | + 离线 | |
| 27 | + <span style="color: #f5222d">{{ growCardList?.deviceInfo?.offLine ?? 0 }} </span></div | |
| 28 | + > | |
| 29 | + | |
| 30 | + <div> | |
| 31 | + 未激活 | |
| 32 | + <span style="color: #fa8c16">{{ growCardList?.deviceInfo?.inActive ?? 0 }}</span> | |
| 33 | + </div> | |
| 34 | + </div> | |
| 20 | 35 | </div> |
| 21 | 36 | </div> |
| 22 | 37 | <div class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5"> |
| 23 | - <div class="flex" style="align-items: center"> | |
| 24 | - <span class="mr-2">在线{{ growCardList?.deviceInfo?.onLine }}</span> | |
| 25 | - | |
| 26 | - <span class="mr-2"> 离线{{ growCardList?.deviceInfo?.offLine }} </span> | |
| 27 | - | |
| 28 | - <span> 未激活{{ growCardList?.deviceInfo?.inActive }} </span> | |
| 29 | - </div></div | |
| 30 | - > | |
| 38 | + 今日新增 {{ toThousands(growCardList?.deviceInfo?.todayAdd) }} | |
| 39 | + </div> | |
| 31 | 40 | </Card> |
| 32 | 41 | <Card size="small" class="md:w-1/3 w-full !md:mt-0 !mt-4 !md:mr-4" style="color: #666"> |
| 33 | 42 | <div class="flex" style="height: 100px"> |
| 34 | 43 | <div class="mr-4"> |
| 35 | 44 | <img |
| 36 | 45 | v-if="!isAdmin(role)" |
| 37 | - src="/src/assets/svg/alarm-num.svg" | |
| 38 | - style="width: 5.625rem; height: 5.625rem" | |
| 39 | - /> | |
| 40 | - <img | |
| 41 | - v-else | |
| 42 | - src="/src/assets/svg/tenant-num.svg" | |
| 46 | + src="/src/assets/images/alarm-count.png" | |
| 43 | 47 | style="width: 5.625rem; height: 5.625rem" |
| 44 | 48 | /> |
| 49 | + <img v-else src="/src/assets/images/zh.png" style="width: 5.625rem; height: 5.625rem" /> | |
| 45 | 50 | </div> |
| 46 | 51 | <div class="flex-auto"> |
| 47 | 52 | <div class="flex justify-between" style="align-items: center"> |
| ... | ... | @@ -61,7 +66,7 @@ |
| 61 | 66 | </div> |
| 62 | 67 | <img src="/src/assets/images/tip.png" style="width: 1.125rem; height: 1.125rem" /> |
| 63 | 68 | </div> |
| 64 | - <div> {{ !isAdmin(role) ? `告警数(条)` : '租户总量(个)' }}</div> | |
| 69 | + <div> {{ !isAdmin(role) ? `告警数(条)` : '租户总量(个)' }}</div> | |
| 65 | 70 | </div> |
| 66 | 71 | </div> |
| 67 | 72 | <div v-if="!isAdmin(role)" class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5"> |
| ... | ... | @@ -76,13 +81,9 @@ |
| 76 | 81 | <div class="mr-4" |
| 77 | 82 | ><img |
| 78 | 83 | v-if="!isAdmin(role)" |
| 79 | - src="/src/assets/svg/msg-num.svg" | |
| 80 | - style="width: 5.625rem; height: 5.625rem" | |
| 81 | - /><img | |
| 82 | - v-else | |
| 83 | - src="/src/assets/svg/custom-num.svg" | |
| 84 | + src="/src/assets/images/msg-count.png" | |
| 84 | 85 | style="width: 5.625rem; height: 5.625rem" |
| 85 | - /> | |
| 86 | + /><img v-else src="/src/assets/images/kf.png" style="width: 5.625rem; height: 5.625rem" /> | |
| 86 | 87 | </div> |
| 87 | 88 | <div v-if="!isAdmin(role)" style="display: flex; align-items: center"> |
| 88 | 89 | <div> |
| ... | ... | @@ -94,7 +95,7 @@ |
| 94 | 95 | /> |
| 95 | 96 | <CountTo v-else :end-val="0" /> |
| 96 | 97 | </div> |
| 97 | - 消息量(条) | |
| 98 | + 消息量(条) | |
| 98 | 99 | </div> |
| 99 | 100 | <div> |
| 100 | 101 | <span class="mr-2">数据点</span> | ... | ... |
| ... | ... | @@ -48,9 +48,9 @@ |
| 48 | 48 | </template> |
| 49 | 49 | <CardMeta> |
| 50 | 50 | <template #description> |
| 51 | - <p>联系人: {{ getContacts }}</p> | |
| 52 | - <p>联系电话: {{ getTel }}</p> | |
| 53 | - <p>联系地址: {{ getAddress }} </p> | |
| 51 | + <p v-if="getContacts">联系人: {{ getContacts }}</p> | |
| 52 | + <p v-if="getTel">联系电话: {{ getTel }}</p> | |
| 53 | + <p v-if="getAddress">联系地址: {{ getAddress }} </p> | |
| 54 | 54 | </template> |
| 55 | 55 | </CardMeta> |
| 56 | 56 | </Card> | ... | ... |
| ... | ... | @@ -86,11 +86,12 @@ |
| 86 | 86 | |
| 87 | 87 | const { setLoginState, getLoginState } = useLoginState(); |
| 88 | 88 | const { getFormRules } = useFormRules(); |
| 89 | + const storage = createLocalStorage(); | |
| 89 | 90 | |
| 90 | 91 | const formRef = ref(); |
| 91 | 92 | const loading = ref(false); |
| 92 | 93 | const rememberMe = ref(false); |
| 93 | - const userInfo = JSON.parse(localStorage.getItem('userInfo')); | |
| 94 | + const userInfo = storage.get('userInfo'); | |
| 94 | 95 | const formData = reactive({ |
| 95 | 96 | account: userInfo?.account ?? '', |
| 96 | 97 | password: userInfo?.password ?? '', |
| ... | ... | @@ -99,14 +100,13 @@ |
| 99 | 100 | const { validForm } = useFormValid(formRef); |
| 100 | 101 | |
| 101 | 102 | const getShow = computed(() => unref(getLoginState) === LoginStateEnum.LOGIN); |
| 102 | - const storage = createLocalStorage(); | |
| 103 | 103 | async function handleLogin() { |
| 104 | 104 | const data = await validForm(); |
| 105 | 105 | if (!data) return; |
| 106 | 106 | if (unref(rememberMe)) { |
| 107 | - localStorage.setItem('userInfo', JSON.stringify(formData)); | |
| 107 | + storage.set('userInfo', formData); | |
| 108 | 108 | } else { |
| 109 | - localStorage.setItem('userInfo', null); | |
| 109 | + storage.set('userInfo', null); | |
| 110 | 110 | } |
| 111 | 111 | try { |
| 112 | 112 | loading.value = true; | ... | ... |
| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 | </BasicDrawer> |
| 27 | 27 | </template> |
| 28 | 28 | <script lang="ts"> |
| 29 | - import { defineComponent, ref, computed, unref, watch } from 'vue'; | |
| 29 | + import { defineComponent, ref, computed, unref } from 'vue'; | |
| 30 | 30 | import { BasicForm, useForm } from '/@/components/Form/index'; |
| 31 | 31 | import { formSchema } from './role.data'; |
| 32 | 32 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
| ... | ... | @@ -54,9 +54,6 @@ |
| 54 | 54 | schemas: formSchema, |
| 55 | 55 | showActionButtonGroup: false, |
| 56 | 56 | }); |
| 57 | - watch(roleMenus, (newValue) => { | |
| 58 | - console.log(newValue); | |
| 59 | - }); | |
| 60 | 57 | |
| 61 | 58 | // 递归函数,将RouteItem里面的字段换名称 |
| 62 | 59 | function processChildren(items: RouteItem[]) { |
| ... | ... | @@ -79,7 +76,7 @@ |
| 79 | 76 | arr.splice(index, 1); |
| 80 | 77 | return arr; |
| 81 | 78 | } |
| 82 | - | |
| 79 | + const originMenus = ref(); | |
| 83 | 80 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { |
| 84 | 81 | resetFields(); |
| 85 | 82 | roleId.value = ''; |
| ... | ... | @@ -95,6 +92,7 @@ |
| 95 | 92 | if (unref(isUpdate)) { |
| 96 | 93 | //通过角色id去获取角色对应的菜单的ids |
| 97 | 94 | roleMenus.value = await getMenusIdsByRoleId(data.record.id); |
| 95 | + originMenus.value = [...roleMenus.value]; | |
| 98 | 96 | for (let m of treeData.value) { |
| 99 | 97 | for (let m1 of roleMenus.value) { |
| 100 | 98 | // 利用continue特性优化一下性能 |
| ... | ... | @@ -103,6 +101,7 @@ |
| 103 | 101 | } |
| 104 | 102 | } |
| 105 | 103 | treeRef.value.setCheckedKeys(roleMenus.value); |
| 104 | + console.log(originMenus.value); | |
| 106 | 105 | roleId.value = data.record.id; |
| 107 | 106 | setFieldsValue(data.record); |
| 108 | 107 | } |
| ... | ... | @@ -119,7 +118,7 @@ |
| 119 | 118 | name: values.name, |
| 120 | 119 | remark: values.remark, |
| 121 | 120 | status: values.status, |
| 122 | - menu: allCheckedKeys.value.length ? allCheckedKeys.value : roleMenus.value, | |
| 121 | + menu: allCheckedKeys.value.length ? allCheckedKeys.value : originMenus.value, | |
| 123 | 122 | }; |
| 124 | 123 | saveOrUpdateRoleInfoWithMenu(req).then(() => { |
| 125 | 124 | closeDrawer(); | ... | ... |
| ... | ... | @@ -78,7 +78,7 @@ |
| 78 | 78 | arr.splice(index, 1); |
| 79 | 79 | return arr; |
| 80 | 80 | } |
| 81 | - | |
| 81 | + const originMenus = ref(); | |
| 82 | 82 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { |
| 83 | 83 | resetFields(); |
| 84 | 84 | roleId.value = ''; |
| ... | ... | @@ -94,6 +94,7 @@ |
| 94 | 94 | if (unref(isUpdate)) { |
| 95 | 95 | //通过角色id去获取角色对应的菜单的ids |
| 96 | 96 | roleMenus.value = await getMenusIdsByRoleId(data.record.id); |
| 97 | + originMenus.value = [...roleMenus.value]; | |
| 97 | 98 | for (let m of treeData.value) { |
| 98 | 99 | for (let m1 of roleMenus.value) { |
| 99 | 100 | // 利用continue特性优化一下性能 |
| ... | ... | @@ -118,7 +119,7 @@ |
| 118 | 119 | remark: values.remark, |
| 119 | 120 | status: values.status, |
| 120 | 121 | roleType: RoleEnum.TENANT_ADMIN, |
| 121 | - menu: allCheckedKeys.value.length ? allCheckedKeys.value : roleMenus.value, | |
| 122 | + menu: allCheckedKeys.value.length ? allCheckedKeys.value : originMenus.value, | |
| 122 | 123 | }; |
| 123 | 124 | await saveOrUpdateRoleInfoWithMenu(req); |
| 124 | 125 | closeDrawer(); | ... | ... |