Showing
21 changed files
with
59 additions
and
63 deletions
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | VITE_PORT = 8083 | 2 | VITE_PORT = 8083 |
3 | 3 | ||
4 | # spa-title | 4 | # spa-title |
5 | -VITE_GLOB_APP_TITLE = Yunteng IOT | 5 | +VITE_GLOB_APP_TITLE = Things Kit |
6 | 6 | ||
7 | # spa shortname | 7 | # spa shortname |
8 | # VITE_GLOB_APP_SHORT_NAME = Yunteng IOT | 8 | # VITE_GLOB_APP_SHORT_NAME = Yunteng IOT |
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
@@ -69,6 +69,7 @@ export default { | @@ -69,6 +69,7 @@ export default { | ||
69 | backSignIn: 'Back sign in', | 69 | backSignIn: 'Back sign in', |
70 | mobileSignInFormTitle: 'Mobile sign in', | 70 | mobileSignInFormTitle: 'Mobile sign in', |
71 | qrSignInFormTitle: 'Qr code sign in', | 71 | qrSignInFormTitle: 'Qr code sign in', |
72 | + userNameInFormTitle: 'userName sign in', | ||
72 | signInFormTitle: 'Sign in', | 73 | signInFormTitle: 'Sign in', |
73 | signUpFormTitle: 'Sign up', | 74 | signUpFormTitle: 'Sign up', |
74 | forgetFormTitle: 'Reset password', | 75 | forgetFormTitle: 'Reset password', |
@@ -65,7 +65,7 @@ export default { | @@ -65,7 +65,7 @@ export default { | ||
65 | qrSignInFormTitle: '二维码登录', | 65 | qrSignInFormTitle: '二维码登录', |
66 | signUpFormTitle: '注册', | 66 | signUpFormTitle: '注册', |
67 | forgetFormTitle: '重置密码', | 67 | forgetFormTitle: '重置密码', |
68 | - | 68 | + userNameInFormTitle: '账号登录', |
69 | signInTitle: '物联网平台', | 69 | signInTitle: '物联网平台', |
70 | signInDesc: '输入您的个人详细信息开始使用!', | 70 | signInDesc: '输入您的个人详细信息开始使用!', |
71 | policy: '我同意xxx隐私政策', | 71 | policy: '我同意xxx隐私政策', |
1 | import '/@/design/index.less'; | 1 | import '/@/design/index.less'; |
2 | - | ||
3 | // Register windi | 2 | // Register windi |
4 | import 'virtual:windi.css'; | 3 | import 'virtual:windi.css'; |
5 | // Register icon sprite | 4 | // Register icon sprite |
@@ -19,10 +18,6 @@ if (import.meta.env.DEV) { | @@ -19,10 +18,6 @@ if (import.meta.env.DEV) { | ||
19 | } | 18 | } |
20 | async function bootstrap() { | 19 | async function bootstrap() { |
21 | const app = createApp(App); | 20 | const app = createApp(App); |
22 | - | ||
23 | - // app.use(VueBaidu, { | ||
24 | - // ak: '7uOPPyAHn2Y2ZryeQqHtcRqtIY374vKa', | ||
25 | - // }); | ||
26 | // Configure store | 21 | // Configure store |
27 | setupStore(app); | 22 | setupStore(app); |
28 | 23 |
@@ -44,7 +44,7 @@ export const useUserStore = defineStore({ | @@ -44,7 +44,7 @@ export const useUserStore = defineStore({ | ||
44 | id: 'app-user', | 44 | id: 'app-user', |
45 | state: (): UserState => ({ | 45 | state: (): UserState => ({ |
46 | //平台信息 | 46 | //平台信息 |
47 | - platInfo: storage.get('platInfo') || null, | 47 | + platInfo: storage.get('platformInfo') || null, |
48 | enterPriseInfo: storage.get('enterPriseInfo') || null, | 48 | enterPriseInfo: storage.get('enterPriseInfo') || null, |
49 | // user info | 49 | // user info |
50 | userInfo: null, | 50 | userInfo: null, |
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | <Card size="small" class="md:w-1/3 w-full !md:mt-0 !mt-4 !md:mr-4" style="color: #666"> | 3 | <Card size="small" class="md:w-1/3 w-full !md:mt-0 !mt-4 !md:mr-4" style="color: #666"> |
4 | <div class="flex" style="height: 100px"> | 4 | <div class="flex" style="height: 100px"> |
5 | <div class="mr-4" | 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 | /></div> | 7 | /></div> |
8 | <div class="flex-auto"> | 8 | <div class="flex-auto"> |
9 | <div class="flex justify-between" style="align-items: center"> | 9 | <div class="flex justify-between" style="align-items: center"> |
@@ -17,31 +17,36 @@ | @@ -17,31 +17,36 @@ | ||
17 | <img src="/src/assets/images/tip.png" style="width: 1.125rem; height: 1.125rem" /> | 17 | <img src="/src/assets/images/tip.png" style="width: 1.125rem; height: 1.125rem" /> |
18 | </div> | 18 | </div> |
19 | <div> 设备数(个) </div> | 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 | </div> | 35 | </div> |
21 | </div> | 36 | </div> |
22 | <div class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5"> | 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 | </Card> | 40 | </Card> |
32 | <Card size="small" class="md:w-1/3 w-full !md:mt-0 !mt-4 !md:mr-4" style="color: #666"> | 41 | <Card size="small" class="md:w-1/3 w-full !md:mt-0 !mt-4 !md:mr-4" style="color: #666"> |
33 | <div class="flex" style="height: 100px"> | 42 | <div class="flex" style="height: 100px"> |
34 | <div class="mr-4"> | 43 | <div class="mr-4"> |
35 | <img | 44 | <img |
36 | v-if="!isAdmin(role)" | 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 | style="width: 5.625rem; height: 5.625rem" | 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 | </div> | 50 | </div> |
46 | <div class="flex-auto"> | 51 | <div class="flex-auto"> |
47 | <div class="flex justify-between" style="align-items: center"> | 52 | <div class="flex justify-between" style="align-items: center"> |
@@ -61,7 +66,7 @@ | @@ -61,7 +66,7 @@ | ||
61 | </div> | 66 | </div> |
62 | <img src="/src/assets/images/tip.png" style="width: 1.125rem; height: 1.125rem" /> | 67 | <img src="/src/assets/images/tip.png" style="width: 1.125rem; height: 1.125rem" /> |
63 | </div> | 68 | </div> |
64 | - <div> {{ !isAdmin(role) ? `告警数(条)` : '租户总量(个)' }}</div> | 69 | + <div> {{ !isAdmin(role) ? `告警数(条)` : '租户总量(个)' }}</div> |
65 | </div> | 70 | </div> |
66 | </div> | 71 | </div> |
67 | <div v-if="!isAdmin(role)" class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5"> | 72 | <div v-if="!isAdmin(role)" class="ml-2 pt-4" style="border-top: 2px solid #f0f2f5"> |
@@ -76,13 +81,9 @@ | @@ -76,13 +81,9 @@ | ||
76 | <div class="mr-4" | 81 | <div class="mr-4" |
77 | ><img | 82 | ><img |
78 | v-if="!isAdmin(role)" | 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 | style="width: 5.625rem; height: 5.625rem" | 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 | </div> | 87 | </div> |
87 | <div v-if="!isAdmin(role)" style="display: flex; align-items: center"> | 88 | <div v-if="!isAdmin(role)" style="display: flex; align-items: center"> |
88 | <div> | 89 | <div> |
@@ -94,7 +95,7 @@ | @@ -94,7 +95,7 @@ | ||
94 | /> | 95 | /> |
95 | <CountTo v-else :end-val="0" /> | 96 | <CountTo v-else :end-val="0" /> |
96 | </div> | 97 | </div> |
97 | - 消息量(条) | 98 | + 消息量(条) |
98 | </div> | 99 | </div> |
99 | <div> | 100 | <div> |
100 | <span class="mr-2">数据点</span> | 101 | <span class="mr-2">数据点</span> |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | > | 15 | > |
16 | <List item-layout="horizontal" :dataSource="dataSource"> | 16 | <List item-layout="horizontal" :dataSource="dataSource"> |
17 | <template #renderItem="{ item }"> | 17 | <template #renderItem="{ item }"> |
18 | - <ListItem> | 18 | + <ListItem @click="go('/notice/myNotices')" class="cursor-pointer"> |
19 | <ListItemMeta> | 19 | <ListItemMeta> |
20 | <template #avatar> | 20 | <template #avatar> |
21 | <Avatar | 21 | <Avatar |
@@ -24,11 +24,7 @@ | @@ -24,11 +24,7 @@ | ||
24 | /> | 24 | /> |
25 | </template> | 25 | </template> |
26 | <template #description> | 26 | <template #description> |
27 | - <span | ||
28 | - class="cursor-pointer noticeTitle" | ||
29 | - @click="go('/stationnotification/mynotification')" | ||
30 | - >{{ item.sysNotice.title }} | ||
31 | - </span> | 27 | + <span class="cursor-pointer noticeTitle">{{ item.sysNotice.title }} </span> |
32 | </template> | 28 | </template> |
33 | <template #title> | 29 | <template #title> |
34 | <span>{{ item.sysNotice.senderName }}</span> | 30 | <span>{{ item.sysNotice.senderName }}</span> |
@@ -52,9 +48,9 @@ | @@ -52,9 +48,9 @@ | ||
52 | </template> | 48 | </template> |
53 | <CardMeta> | 49 | <CardMeta> |
54 | <template #description> | 50 | <template #description> |
55 | - <p>联系人: {{ getContacts }}</p> | ||
56 | - <p>联系电话: {{ getTel }}</p> | ||
57 | - <p>联系地址: {{ getAddress }} </p> | 51 | + <p v-if="getContacts">联系人: {{ getContacts }}</p> |
52 | + <p v-if="getTel">联系电话: {{ getTel }}</p> | ||
53 | + <p v-if="getAddress">联系地址: {{ getAddress }} </p> | ||
58 | </template> | 54 | </template> |
59 | </CardMeta> | 55 | </CardMeta> |
60 | </Card> | 56 | </Card> |
@@ -57,7 +57,7 @@ export const columns: BasicColumn[] = [ | @@ -57,7 +57,7 @@ export const columns: BasicColumn[] = [ | ||
57 | const enable = status === '已发布' ? '已发布' : status === '草稿' ? '草稿' : '其他'; | 57 | const enable = status === '已发布' ? '已发布' : status === '草稿' ? '草稿' : '其他'; |
58 | const color = enable === '已发布' ? 'green' : enable === '草稿' ? 'yellow' : 'red'; | 58 | const color = enable === '已发布' ? 'green' : enable === '草稿' ? 'yellow' : 'red'; |
59 | const text = enable === '已发布' ? '已发布' : enable === '草稿' ? '草稿' : '其他'; | 59 | const text = enable === '已发布' ? '已发布' : enable === '草稿' ? '草稿' : '其他'; |
60 | - return h(Tag, { color: color }, () => text); | 60 | + return h(Tag, { color }, () => text); |
61 | }, | 61 | }, |
62 | }, | 62 | }, |
63 | ]; | 63 | ]; |
@@ -172,7 +172,7 @@ export const searchFormSchema: FormSchema[] = [ | @@ -172,7 +172,7 @@ export const searchFormSchema: FormSchema[] = [ | ||
172 | export const detailColumns: BasicColumn[] = [ | 172 | export const detailColumns: BasicColumn[] = [ |
173 | { | 173 | { |
174 | title: '接收者', | 174 | title: '接收者', |
175 | - dataIndex: 'user.realName', | 175 | + dataIndex: 'receiverName', |
176 | width: 200, | 176 | width: 200, |
177 | }, | 177 | }, |
178 | { | 178 | { |
@@ -38,7 +38,6 @@ | @@ -38,7 +38,6 @@ | ||
38 | <ForgetPasswordForm /> | 38 | <ForgetPasswordForm /> |
39 | <RegisterForm /> | 39 | <RegisterForm /> |
40 | <MobileForm /> | 40 | <MobileForm /> |
41 | - <QrCodeForm /> | ||
42 | </div> | 41 | </div> |
43 | </div> | 42 | </div> |
44 | </div> | 43 | </div> |
@@ -46,14 +45,13 @@ | @@ -46,14 +45,13 @@ | ||
46 | </div> | 45 | </div> |
47 | </template> | 46 | </template> |
48 | <script lang="ts" setup> | 47 | <script lang="ts" setup> |
49 | - import { computed, ref } from 'vue'; | 48 | + import { computed } from 'vue'; |
50 | import { AppLogo } from '/@/components/Application'; | 49 | import { AppLogo } from '/@/components/Application'; |
51 | import { AppLocalePicker, AppDarkModeToggle } from '/@/components/Application'; | 50 | import { AppLocalePicker, AppDarkModeToggle } from '/@/components/Application'; |
52 | import LoginForm from './LoginForm.vue'; | 51 | import LoginForm from './LoginForm.vue'; |
53 | import ForgetPasswordForm from './ForgetPasswordForm.vue'; | 52 | import ForgetPasswordForm from './ForgetPasswordForm.vue'; |
54 | import RegisterForm from './RegisterForm.vue'; | 53 | import RegisterForm from './RegisterForm.vue'; |
55 | import MobileForm from './MobileForm.vue'; | 54 | import MobileForm from './MobileForm.vue'; |
56 | - import QrCodeForm from './QrCodeForm.vue'; | ||
57 | import { useGlobSetting } from '/@/hooks/setting'; | 55 | import { useGlobSetting } from '/@/hooks/setting'; |
58 | import { useI18n } from '/@/hooks/web/useI18n'; | 56 | import { useI18n } from '/@/hooks/web/useI18n'; |
59 | import { useDesign } from '/@/hooks/web/useDesign'; | 57 | import { useDesign } from '/@/hooks/web/useDesign'; |
@@ -49,13 +49,13 @@ | @@ -49,13 +49,13 @@ | ||
49 | </FormItem> | 49 | </FormItem> |
50 | <ARow class="enter-x flex justify-between"> | 50 | <ARow class="enter-x flex justify-between"> |
51 | <ACol :md="11" :xs="24"> | 51 | <ACol :md="11" :xs="24"> |
52 | - <Button block @click="setLoginState(LoginStateEnum.MOBILE)"> | ||
53 | - {{ t('sys.login.mobileSignInFormTitle') }} | 52 | + <Button block @click="setLoginState(LoginStateEnum.LOGIN)"> |
53 | + {{ t('sys.login.userNameInFormTitle') }} | ||
54 | </Button> | 54 | </Button> |
55 | </ACol> | 55 | </ACol> |
56 | <ACol :md="11" :xs="24"> | 56 | <ACol :md="11" :xs="24"> |
57 | - <Button block @click="setLoginState(LoginStateEnum.QR_CODE)"> | ||
58 | - {{ t('sys.login.qrSignInFormTitle') }} | 57 | + <Button block @click="setLoginState(LoginStateEnum.MOBILE)"> |
58 | + {{ t('sys.login.mobileSignInFormTitle') }} | ||
59 | </Button> | 59 | </Button> |
60 | </ACol> | 60 | </ACol> |
61 | </ARow> | 61 | </ARow> |
@@ -86,23 +86,28 @@ | @@ -86,23 +86,28 @@ | ||
86 | 86 | ||
87 | const { setLoginState, getLoginState } = useLoginState(); | 87 | const { setLoginState, getLoginState } = useLoginState(); |
88 | const { getFormRules } = useFormRules(); | 88 | const { getFormRules } = useFormRules(); |
89 | + const storage = createLocalStorage(); | ||
89 | 90 | ||
90 | const formRef = ref(); | 91 | const formRef = ref(); |
91 | const loading = ref(false); | 92 | const loading = ref(false); |
92 | const rememberMe = ref(false); | 93 | const rememberMe = ref(false); |
93 | - | 94 | + const userInfo = storage.get('userInfo'); |
94 | const formData = reactive({ | 95 | const formData = reactive({ |
95 | - account: '', | ||
96 | - password: '', | 96 | + account: userInfo?.account ?? '', |
97 | + password: userInfo?.password ?? '', | ||
97 | }); | 98 | }); |
98 | 99 | ||
99 | const { validForm } = useFormValid(formRef); | 100 | const { validForm } = useFormValid(formRef); |
100 | 101 | ||
101 | const getShow = computed(() => unref(getLoginState) === LoginStateEnum.LOGIN); | 102 | const getShow = computed(() => unref(getLoginState) === LoginStateEnum.LOGIN); |
102 | - const storage = createLocalStorage(); | ||
103 | async function handleLogin() { | 103 | async function handleLogin() { |
104 | const data = await validForm(); | 104 | const data = await validForm(); |
105 | if (!data) return; | 105 | if (!data) return; |
106 | + if (unref(rememberMe)) { | ||
107 | + storage.set('userInfo', formData); | ||
108 | + } else { | ||
109 | + storage.set('userInfo', null); | ||
110 | + } | ||
106 | try { | 111 | try { |
107 | loading.value = true; | 112 | loading.value = true; |
108 | const userInfo = await userStore.login({ | 113 | const userInfo = await userStore.login({ |
@@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
4 | title="第一次使用请修改当前用户密码,待修改完成后退出登录,才能使用本系统!" | 4 | title="第一次使用请修改当前用户密码,待修改完成后退出登录,才能使用本系统!" |
5 | content="修改成功后会自动退出当前登录!" | 5 | content="修改成功后会自动退出当前登录!" |
6 | class="p-4" | 6 | class="p-4" |
7 | + :contentStyle="{ margin: '16px 0 ' }" | ||
7 | > | 8 | > |
8 | <div class="py-8 bg-white flex flex-col justify-center items-center"> | 9 | <div class="py-8 bg-white flex flex-col justify-center items-center"> |
9 | <BasicForm @register="register" /> | 10 | <BasicForm @register="register" /> |
@@ -224,7 +224,7 @@ | @@ -224,7 +224,7 @@ | ||
224 | // 保存store | 224 | // 保存store |
225 | userStore.setPlatInfo(newFieldValue); | 225 | userStore.setPlatInfo(newFieldValue); |
226 | // 保存本地缓存 | 226 | // 保存本地缓存 |
227 | - storage.set('platInfo', newFieldValue); | 227 | + storage.set('platformInfo', newFieldValue); |
228 | } | 228 | } |
229 | 229 | ||
230 | onMounted(async () => { | 230 | onMounted(async () => { |
@@ -301,7 +301,6 @@ | @@ -301,7 +301,6 @@ | ||
301 | setFieldsValue({ nameCountry: codeCountry }); | 301 | setFieldsValue({ nameCountry: codeCountry }); |
302 | } | 302 | } |
303 | setFieldsValue(res); | 303 | setFieldsValue(res); |
304 | - console.log(res); | ||
305 | qrcodePic.value = res.qrCode; | 304 | qrcodePic.value = res.qrCode; |
306 | }); | 305 | }); |
307 | 306 |
@@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
26 | </BasicDrawer> | 26 | </BasicDrawer> |
27 | </template> | 27 | </template> |
28 | <script lang="ts"> | 28 | <script lang="ts"> |
29 | - import { defineComponent, ref, computed, unref, watch } from 'vue'; | 29 | + import { defineComponent, ref, computed, unref } from 'vue'; |
30 | import { BasicForm, useForm } from '/@/components/Form/index'; | 30 | import { BasicForm, useForm } from '/@/components/Form/index'; |
31 | import { formSchema } from './role.data'; | 31 | import { formSchema } from './role.data'; |
32 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | 32 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
@@ -54,9 +54,6 @@ | @@ -54,9 +54,6 @@ | ||
54 | schemas: formSchema, | 54 | schemas: formSchema, |
55 | showActionButtonGroup: false, | 55 | showActionButtonGroup: false, |
56 | }); | 56 | }); |
57 | - watch(roleMenus, (newValue) => { | ||
58 | - console.log(newValue); | ||
59 | - }); | ||
60 | 57 | ||
61 | // 递归函数,将RouteItem里面的字段换名称 | 58 | // 递归函数,将RouteItem里面的字段换名称 |
62 | function processChildren(items: RouteItem[]) { | 59 | function processChildren(items: RouteItem[]) { |
@@ -79,7 +76,7 @@ | @@ -79,7 +76,7 @@ | ||
79 | arr.splice(index, 1); | 76 | arr.splice(index, 1); |
80 | return arr; | 77 | return arr; |
81 | } | 78 | } |
82 | - | 79 | + const originMenus = ref(); |
83 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { | 80 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { |
84 | resetFields(); | 81 | resetFields(); |
85 | roleId.value = ''; | 82 | roleId.value = ''; |
@@ -95,6 +92,7 @@ | @@ -95,6 +92,7 @@ | ||
95 | if (unref(isUpdate)) { | 92 | if (unref(isUpdate)) { |
96 | //通过角色id去获取角色对应的菜单的ids | 93 | //通过角色id去获取角色对应的菜单的ids |
97 | roleMenus.value = await getMenusIdsByRoleId(data.record.id); | 94 | roleMenus.value = await getMenusIdsByRoleId(data.record.id); |
95 | + originMenus.value = [...roleMenus.value]; | ||
98 | for (let m of treeData.value) { | 96 | for (let m of treeData.value) { |
99 | for (let m1 of roleMenus.value) { | 97 | for (let m1 of roleMenus.value) { |
100 | // 利用continue特性优化一下性能 | 98 | // 利用continue特性优化一下性能 |
@@ -103,6 +101,7 @@ | @@ -103,6 +101,7 @@ | ||
103 | } | 101 | } |
104 | } | 102 | } |
105 | treeRef.value.setCheckedKeys(roleMenus.value); | 103 | treeRef.value.setCheckedKeys(roleMenus.value); |
104 | + console.log(originMenus.value); | ||
106 | roleId.value = data.record.id; | 105 | roleId.value = data.record.id; |
107 | setFieldsValue(data.record); | 106 | setFieldsValue(data.record); |
108 | } | 107 | } |
@@ -119,7 +118,7 @@ | @@ -119,7 +118,7 @@ | ||
119 | name: values.name, | 118 | name: values.name, |
120 | remark: values.remark, | 119 | remark: values.remark, |
121 | status: values.status, | 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 | saveOrUpdateRoleInfoWithMenu(req).then(() => { | 123 | saveOrUpdateRoleInfoWithMenu(req).then(() => { |
125 | closeDrawer(); | 124 | closeDrawer(); |
@@ -78,7 +78,7 @@ | @@ -78,7 +78,7 @@ | ||
78 | arr.splice(index, 1); | 78 | arr.splice(index, 1); |
79 | return arr; | 79 | return arr; |
80 | } | 80 | } |
81 | - | 81 | + const originMenus = ref(); |
82 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { | 82 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { |
83 | resetFields(); | 83 | resetFields(); |
84 | roleId.value = ''; | 84 | roleId.value = ''; |
@@ -94,6 +94,7 @@ | @@ -94,6 +94,7 @@ | ||
94 | if (unref(isUpdate)) { | 94 | if (unref(isUpdate)) { |
95 | //通过角色id去获取角色对应的菜单的ids | 95 | //通过角色id去获取角色对应的菜单的ids |
96 | roleMenus.value = await getMenusIdsByRoleId(data.record.id); | 96 | roleMenus.value = await getMenusIdsByRoleId(data.record.id); |
97 | + originMenus.value = [...roleMenus.value]; | ||
97 | for (let m of treeData.value) { | 98 | for (let m of treeData.value) { |
98 | for (let m1 of roleMenus.value) { | 99 | for (let m1 of roleMenus.value) { |
99 | // 利用continue特性优化一下性能 | 100 | // 利用continue特性优化一下性能 |
@@ -118,7 +119,7 @@ | @@ -118,7 +119,7 @@ | ||
118 | remark: values.remark, | 119 | remark: values.remark, |
119 | status: values.status, | 120 | status: values.status, |
120 | roleType: RoleEnum.TENANT_ADMIN, | 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 | await saveOrUpdateRoleInfoWithMenu(req); | 124 | await saveOrUpdateRoleInfoWithMenu(req); |
124 | closeDrawer(); | 125 | closeDrawer(); |