Commit 7599ac86f23244300d38f0aa16ade2552b128a6d

Authored by sqy
1 parent 77398391

'换图标,换logo,修复路由,修复角色菜单不能正常清除,设备列表跳转修复'

@@ -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 = Things Kit 5 +VITE_GLOB_APP_TITLE = ThingsKit
6 6
7 # spa shortname 7 # spa shortname
8 # VITE_GLOB_APP_SHORT_NAME = Yunteng IOT 8 # VITE_GLOB_APP_SHORT_NAME = Yunteng IOT
No preview for this file type

3.95 KB | W: | H:

9.54 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

27.6 KB | W: | H:

9.54 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
@@ -12,5 +12,5 @@ export const PageEnum = { @@ -12,5 +12,5 @@ export const PageEnum = {
12 //消息配置 12 //消息配置
13 MESSAGE_CONFIG: '/config/message', 13 MESSAGE_CONFIG: '/config/message',
14 //设备配置 14 //设备配置
15 - DEVICE_PROFILE: '/deviceManager/deviceProfile', 15 + DEVICE_PROFILE: '/device/profiles',
16 }; 16 };
@@ -61,9 +61,7 @@ @@ -61,9 +61,7 @@
61 // components 61 // components
62 import { Dropdown, Menu } from 'ant-design-vue'; 62 import { Dropdown, Menu } from 'ant-design-vue';
63 63
64 - import { defineComponent, computed, getCurrentInstance, ref, reactive } from 'vue';  
65 -  
66 - import { DOC_URL } from '/@/settings/siteSetting'; 64 + import { defineComponent, computed, ref, reactive } from 'vue';
67 65
68 import { useUserStore } from '/@/store/modules/user'; 66 import { useUserStore } from '/@/store/modules/user';
69 import { useHeaderSetting } from '/@/hooks/setting/useHeaderSetting'; 67 import { useHeaderSetting } from '/@/hooks/setting/useHeaderSetting';
@@ -72,7 +70,6 @@ @@ -72,7 +70,6 @@
72 import { useModal } from '/@/components/Modal'; 70 import { useModal } from '/@/components/Modal';
73 import headerImg from '/@/assets/images/header.jpg'; 71 import headerImg from '/@/assets/images/header.jpg';
74 import { propTypes } from '/@/utils/propTypes'; 72 import { propTypes } from '/@/utils/propTypes';
75 - import { openWindow } from '/@/utils';  
76 import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent'; 73 import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
77 import { USER_INFO_KEY } from '/@/enums/cacheEnum'; 74 import { USER_INFO_KEY } from '/@/enums/cacheEnum';
78 import { getAuthCache } from '/@/utils/auth'; 75 import { getAuthCache } from '/@/utils/auth';
@@ -101,7 +98,6 @@ @@ -101,7 +98,6 @@
101 realName: '', 98 realName: '',
102 }); 99 });
103 const userInfo = getAuthCache(USER_INFO_KEY); 100 const userInfo = getAuthCache(USER_INFO_KEY);
104 - const { proxy } = getCurrentInstance();  
105 const personalRef = ref(null); 101 const personalRef = ref(null);
106 const { prefixCls } = useDesign('header-user-dropdown'); 102 const { prefixCls } = useDesign('header-user-dropdown');
107 const { t } = useI18n(); 103 const { t } = useI18n();
@@ -124,26 +120,17 @@ @@ -124,26 +120,17 @@
124 function handleLoginOut() { 120 function handleLoginOut() {
125 userStore.confirmLoginOut(); 121 userStore.confirmLoginOut();
126 } 122 }
127 -  
128 - // open doc  
129 - function openDoc() {  
130 - openWindow(DOC_URL);  
131 - }  
132 -  
133 function handleMenuClick(e: { key: MenuEvent }) { 123 function handleMenuClick(e: { key: MenuEvent }) {
134 switch (e.key) { 124 switch (e.key) {
135 case 'logout': 125 case 'logout':
136 handleLoginOut(); 126 handleLoginOut();
137 break; 127 break;
138 - case 'doc':  
139 - openDoc(); 128 + case 'personal':
  129 + openPersonalFunc();
140 break; 130 break;
141 case 'lock': 131 case 'lock':
142 handleLock(); 132 handleLock();
143 break; 133 break;
144 - case 'personal':  
145 - openPersonalFunc();  
146 - break;  
147 case 'changePassword': 134 case 'changePassword':
148 changePassword(); 135 changePassword();
149 break; 136 break;
@@ -29,14 +29,24 @@ export function createPermissionGuard(router: Router) { @@ -29,14 +29,24 @@ export function createPermissionGuard(router: Router) {
29 return; 29 return;
30 } 30 }
31 31
  32 + const token = userStore.getJwtToken;
32 // Whitelist can be directly entered 33 // Whitelist can be directly entered
  34 + // 路由守卫拦截, 如果是已经登陆情况, 就不要回到登陆页面了;
33 if (whitePathList.includes(to.path as PageEnum)) { 35 if (whitePathList.includes(to.path as PageEnum)) {
  36 + if (to.path === LOGIN_PATH && token) {
  37 + const isSessionTimeout = userStore.getSessionTimeout;
  38 + try {
  39 + // await userStore.afterLoginAction();
  40 + if (!isSessionTimeout) {
  41 + next((to.query?.redirect as string) || '/');
  42 + return;
  43 + }
  44 + } catch {}
  45 + }
34 next(); 46 next();
35 return; 47 return;
36 } 48 }
37 49
38 - const token = userStore.getJwtToken;  
39 -  
40 // token does not exist 50 // token does not exist
41 if (!token) { 51 if (!token) {
42 // You can access without permission. You need to set the routing meta.ignoreAuth to true 52 // You can access without permission. You need to set the routing meta.ignoreAuth to true
@@ -101,14 +101,14 @@ export const useUserStore = defineStore({ @@ -101,14 +101,14 @@ export const useUserStore = defineStore({
101 setAuthCache(REFRESH_TOKEN_KEY, refreshToken); 101 setAuthCache(REFRESH_TOKEN_KEY, refreshToken);
102 }, 102 },
103 setToken(info: string | undefined) { 103 setToken(info: string | undefined) {
104 - this.token = info;  
105 - setAuthCache(TOKEN_KEY, info); 104 + this.jwtToken = info;
  105 + setAuthCache(JWT_TOKEN_KEY, info);
106 }, 106 },
107 setRoleList(roleList: RoleEnum[]) { 107 setRoleList(roleList: RoleEnum[]) {
108 this.roleList = roleList; 108 this.roleList = roleList;
109 setAuthCache(ROLES_KEY, roleList); 109 setAuthCache(ROLES_KEY, roleList);
110 }, 110 },
111 - setUserInfo(info: UserInfo) { 111 + setUserInfo(info: UserInfo | null) {
112 this.userInfo = info; 112 this.userInfo = info;
113 this.lastUpdateTime = new Date().getTime(); 113 this.lastUpdateTime = new Date().getTime();
114 setAuthCache(USER_INFO_KEY, info); 114 setAuthCache(USER_INFO_KEY, info);
@@ -190,18 +190,23 @@ export const useUserStore = defineStore({ @@ -190,18 +190,23 @@ export const useUserStore = defineStore({
190 /** 190 /**
191 * @description: logout 191 * @description: logout
192 */ 192 */
193 - async logout() { 193 + async logout(goLogin = false) {
194 // try { 194 // try {
195 // await doLogout(); 195 // await doLogout();
196 // } catch { 196 // } catch {
197 // console.log('注销Token失败'); 197 // console.log('注销Token失败');
198 // } 198 // }
199 - this.resetState();  
200 - setAuthCache(JWT_TOKEN_KEY, undefined);  
201 - setAuthCache(REFRESH_TOKEN_KEY, undefined); 199 + // this.resetState();
  200 + // setAuthCache(JWT_TOKEN_KEY, undefined);
  201 + // setAuthCache(REFRESH_TOKEN_KEY, undefined);
202 // this.setSessionTimeout(false); 202 // this.setSessionTimeout(false);
203 - // goLogin && router.push(PageEnum.BASE_LOGIN);  
204 - await router.push(PageEnum.BASE_LOGIN); 203 + // // goLogin && router.push(PageEnum.BASE_LOGIN);
  204 +
  205 + this.setToken(undefined);
  206 + this.setSessionTimeout(false);
  207 + setAuthCache(REFRESH_TOKEN_KEY, undefined);
  208 + this.setUserInfo(null);
  209 + goLogin && router.push(PageEnum.BASE_LOGIN);
205 window.localStorage.clear(); 210 window.localStorage.clear();
206 window.localStorage.removeItem('updateUserInfo'); 211 window.localStorage.removeItem('updateUserInfo');
207 }, 212 },
@@ -228,7 +233,7 @@ export const useUserStore = defineStore({ @@ -228,7 +233,7 @@ export const useUserStore = defineStore({
228 title: t('sys.app.logoutTip'), 233 title: t('sys.app.logoutTip'),
229 content: t('sys.app.logoutMessage'), 234 content: t('sys.app.logoutMessage'),
230 onOk: async () => { 235 onOk: async () => {
231 - await this.logout(); 236 + await this.logout(true);
232 }, 237 },
233 }); 238 });
234 }, 239 },
@@ -64,14 +64,14 @@ export const step1Schemas: FormSchema[] = [ @@ -64,14 +64,14 @@ export const step1Schemas: FormSchema[] = [
64 64
65 onChange() { 65 onChange() {
66 setFieldsValue({ 66 setFieldsValue({
67 - gateWayId: null, 67 + gatewayId: null,
68 }); 68 });
69 }, 69 },
70 }; 70 };
71 }, 71 },
72 }, 72 },
73 { 73 {
74 - field: 'gateWayId', 74 + field: 'gatewayId',
75 label: '网关设备', 75 label: '网关设备',
76 required: true, 76 required: true,
77 component: 'ApiSelect', 77 component: 'ApiSelect',
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 <Step title="添加设备凭证" /> 15 <Step title="添加设备凭证" />
16 </Steps> 16 </Steps>
17 </div> 17 </div>
18 - <div class="mt-5"> 18 + <div class="mt-4">
19 <DeviceStep1 19 <DeviceStep1
20 @next="handleStep1Next" 20 @next="handleStep1Next"
21 ref="DeviceStep1Ref" 21 ref="DeviceStep1Ref"
@@ -70,13 +70,14 @@ @@ -70,13 +70,14 @@
70 const [register, { closeModal }] = useModalInner((data) => { 70 const [register, { closeModal }] = useModalInner((data) => {
71 isUpdate.value = data?.isUpdate; 71 isUpdate.value = data?.isUpdate;
72 if (unref(isUpdate)) { 72 if (unref(isUpdate)) {
73 - unref(DeviceStep1Ref)?.parentSetFieldsValue(data.record); 73 + const { record } = data;
74 unref(DeviceStep1Ref)?.parentSetFieldsValue({ 74 unref(DeviceStep1Ref)?.parentSetFieldsValue({
75 - profile: data.record.deviceProfile.name,  
76 - profileId: data.record.profileId,  
77 - deviceType: data.record.deviceType, 75 + ...record,
  76 + profile: record.deviceProfile.name,
  77 + profileId: record.profileId,
  78 + deviceType: record.deviceType,
78 }); 79 });
79 - deviceInfo.value = data.record.deviceInfo; 80 + deviceInfo.value = record.deviceInfo;
80 unref(DeviceStep1Ref)?.disabledDeviceType(true); 81 unref(DeviceStep1Ref)?.disabledDeviceType(true);
81 } else { 82 } else {
82 unref(DeviceStep1Ref)?.disabledDeviceType(false); 83 unref(DeviceStep1Ref)?.disabledDeviceType(false);
@@ -107,6 +108,7 @@ @@ -107,6 +108,7 @@
107 unref(DeviceStep2Ref)?.resetFieldsValueAndStatus(); 108 unref(DeviceStep2Ref)?.resetFieldsValueAndStatus();
108 } 109 }
109 // 提交 110 // 提交
  111 + const msg = computed(() => (unref(isUpdate) ? '更新设备成功' : '新增设备成功'));
110 async function handleOk() { 112 async function handleOk() {
111 if (current.value === 0) { 113 if (current.value === 0) {
112 // 验证 114 // 验证
@@ -114,10 +116,12 @@ @@ -114,10 +116,12 @@
114 if (!valid) return; 116 if (!valid) return;
115 stepState.value = unref(DeviceStep1Ref)?.parentGetFieldsValue(); 117 stepState.value = unref(DeviceStep1Ref)?.parentGetFieldsValue();
116 } else { 118 } else {
  119 + // !!!此处需要删除地图的属性,否则会报堆栈溢出的错误 Uncaught RangeError: Maximum call stack size exceeded
  120 + Reflect.deleteProperty(stepState.value, 'map');
  121 + Reflect.deleteProperty(stepState.value, 'marker');
117 if (unref(DeviceStep2Ref)?.getFieldsValue().addAgree) { 122 if (unref(DeviceStep2Ref)?.getFieldsValue().addAgree) {
118 const valid = await unref(DeviceStep2Ref)?.validate(); 123 const valid = await unref(DeviceStep2Ref)?.validate();
119 if (!valid) return; 124 if (!valid) return;
120 -  
121 // 第二页验证通过情况 125 // 第二页验证通过情况
122 stepState.value = { 126 stepState.value = {
123 ...unref(stepState), 127 ...unref(stepState),
@@ -126,11 +130,10 @@ @@ -126,11 +130,10 @@
126 } 130 }
127 } 131 }
128 // 验证成功 --调-- 新增或者编辑接口 132 // 验证成功 --调-- 新增或者编辑接口
129 - const msg = computed(() => (unref(stepState).id ? '更新设备成功' : '新增设备成功'));  
130 - // 此处需要删除地图的属性,否则会报堆栈溢出的错误 Uncaught RangeError: Maximum call stack size exceeded 133 + // !!!此处需要删除地图的属性,否则会报堆栈溢出的错误 Uncaught RangeError: Maximum call stack size exceeded
131 Reflect.deleteProperty(DeviceStep1Ref.value.positionState, 'map'); 134 Reflect.deleteProperty(DeviceStep1Ref.value.positionState, 'map');
132 Reflect.deleteProperty(DeviceStep1Ref.value.positionState, 'marker'); 135 Reflect.deleteProperty(DeviceStep1Ref.value.positionState, 'marker');
133 - if (unref(stepState).id) { 136 + if (unref(isUpdate)) {
134 const editData = { 137 const editData = {
135 ...unref(stepState), 138 ...unref(stepState),
136 deviceInfo: { 139 deviceInfo: {
@@ -138,7 +141,6 @@ @@ -138,7 +141,6 @@
138 ...DeviceStep1Ref.value?.positionState, 141 ...DeviceStep1Ref.value?.positionState,
139 }, 142 },
140 }; 143 };
141 -  
142 await createOrEditDevice(editData); 144 await createOrEditDevice(editData);
143 } else { 145 } else {
144 const createData = { 146 const createData = {
@@ -194,7 +194,6 @@ @@ -194,7 +194,6 @@
194 } 194 }
195 // 取消分配客户 195 // 取消分配客户
196 async function handleCancelDispatchCustomer(record: Recordable) { 196 async function handleCancelDispatchCustomer(record: Recordable) {
197 - console.log('record', record);  
198 await cancelDispatchCustomer(record); 197 await cancelDispatchCustomer(record);
199 handleSuccess(); 198 handleSuccess();
200 } 199 }
@@ -210,7 +209,8 @@ @@ -210,7 +209,8 @@
210 async function handleEdit(record: Recordable) { 209 async function handleEdit(record: Recordable) {
211 if (record.deviceType === 'SENSOR') { 210 if (record.deviceType === 'SENSOR') {
212 const res = await getGATEWAY(record.tbDeviceId); 211 const res = await getGATEWAY(record.tbDeviceId);
213 - Reflect.set(record, 'gateWayId', res.id); 212 + console.log(res);
  213 + Reflect.set(record, 'gatewayId', res.id);
214 } 214 }
215 openModal(true, { 215 openModal(true, {
216 isUpdate: true, 216 isUpdate: true,
@@ -221,6 +221,7 @@ @@ -221,6 +221,7 @@
221 function handleSuccess() { 221 function handleSuccess() {
222 reload(); 222 reload();
223 } 223 }
  224 + // 140049ee-6b8c-4ce1-93d4-00faeddf9719
224 function handleSelect(organization) { 225 function handleSelect(organization) {
225 searchInfo.organizationId = organization; 226 searchInfo.organizationId = organization;
226 handleSuccess(); 227 handleSuccess();
@@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
14 <PageWrapper dense contentFullHeight contentBackground> 14 <PageWrapper dense contentFullHeight contentBackground>
15 <div class="detail-notice-info"> 15 <div class="detail-notice-info">
16 <span class="mr-6" 16 <span class="mr-6"
17 - ><UserOutlined class="mr-2" />发送者:{{ dataSource?.user?.realName }}</span 17 + ><UserOutlined class="mr-2" />发送者:{{ dataSource?.sysNotice?.senderName }}</span
18 > 18 >
19 <span class="mr-6" 19 <span class="mr-6"
20 ><SolutionOutlined class="mr-2" />通知类型:{{ 20 ><SolutionOutlined class="mr-2" />通知类型:{{
@@ -74,5 +74,6 @@ @@ -74,5 +74,6 @@
74 border-bottom: 1px solid #ccc; 74 border-bottom: 1px solid #ccc;
75 padding-top: 5px; 75 padding-top: 5px;
76 padding-bottom: 5px; 76 padding-bottom: 5px;
  77 + margin-bottom: 16px;
77 } 78 }
78 </style> 79 </style>
@@ -80,6 +80,8 @@ @@ -80,6 +80,8 @@
80 const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { 80 const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
81 resetFields(); 81 resetFields();
82 roleId.value = ''; 82 roleId.value = '';
  83 + // 在打开弹窗时清除所有选择的菜单
  84 + treeRef.value && treeRef.value.checkAll(false);
83 isUpdate.value = data.isUpdate; 85 isUpdate.value = data.isUpdate;
84 // 需要在setFieldsValue之前先填充treeData,否则Tree组件可能会报key not exist警告 86 // 需要在setFieldsValue之前先填充treeData,否则Tree组件可能会报key not exist警告
85 if (!unref(treeData).length) { 87 if (!unref(treeData).length) {
@@ -101,7 +103,6 @@ @@ -101,7 +103,6 @@
101 } 103 }
102 } 104 }
103 treeRef.value.setCheckedKeys(roleMenus.value); 105 treeRef.value.setCheckedKeys(roleMenus.value);
104 - console.log(originMenus.value);  
105 roleId.value = data.record.id; 106 roleId.value = data.record.id;
106 setFieldsValue(data.record); 107 setFieldsValue(data.record);
107 } 108 }
@@ -82,6 +82,8 @@ @@ -82,6 +82,8 @@
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 = '';
  85 + // 在打开弹窗时清除所有选择的菜单
  86 + treeRef.value && treeRef.value.checkAll(false);
85 isUpdate.value = data.isUpdate; 87 isUpdate.value = data.isUpdate;
86 // 需要在setFieldsValue之前先填充treeData,否则Tree组件可能会报key not exist警告 88 // 需要在setFieldsValue之前先填充treeData,否则Tree组件可能会报key not exist警告
87 if (!unref(treeData).length) { 89 if (!unref(treeData).length) {