Commit daf8ad4153be1215be75c437dbaa8290656ade87

Authored by fengistao
1 parent bf82116d

fix:修复菜单列表多个请求问题

... ... @@ -15,7 +15,7 @@ enum ScreenManagerApi {
15 15 SCREEN_ADD_URL = '/sceneLinkage',
16 16 SCREEN_DELETE_URL = '/sceneLinkage',
17 17 SCREEN_UPDATE_URL = '/sceneLinkage/update',
18   - SCREEN_ORGANIZATION_URL = '/organization/me/organizations',
  18 + SCREEN_ORGANIZATION_URL = '/organization/me/list',
19 19 SCREEN_CHANGE_STATUS = '/sceneLinkage/updateSceneStatus',
20 20 SCREEN_GET_BY_DEPTID = '/sceneLinkage/device/',
21 21 }
... ...
1 1 import type { Router, RouteRecordRaw } from 'vue-router';
2   -
3 2 import { usePermissionStoreWithOut } from '/@/store/modules/permission';
4   -
5 3 import { PageEnum } from '/@/enums/pageEnum';
6 4 import { useUserStoreWithOut } from '/@/store/modules/user';
7   -
8 5 import { PAGE_NOT_FOUND_ROUTE } from '/@/router/routes/basic';
9   -
10 6 import { RootRoute } from '/@/router/routes';
11   -
12 7 import { router } from '/@/router';
13 8 import { getMenuList } from '/@/api/sys/menu';
14 9 import { USER_INFO_KEY } from '/@/enums/cacheEnum';
... ... @@ -71,7 +66,10 @@ export function createPermissionGuard(router: Router) {
71 66 }
72 67
73 68 if (from.path === LOGIN_PATH && userInfo.value?.needSetPwd == false) {
74   - const getMenuListData = await getMenuList();
  69 + const getMenuListData1 =
  70 + window.localStorage.getItem('menuListStorage') || (await getMenuList());
  71 + const getMenuListData = JSON.parse(getMenuListData1);
  72 + // const getMenuListData = await getMenuList();
75 73 const getHomePage = getMenuListData.find((f) => {
76 74 return f.path == '/dashboard/workbench';
77 75 });
... ... @@ -85,72 +83,19 @@ export function createPermissionGuard(router: Router) {
85 83 router.push(routeF);
86 84 }, 200);
87 85 }
88   - // setTimeout(() => {
89   - // console.log('无需修改密码,跳到首页');
90   - // router.push('/dashboard/workbench');
91   - // }, 200);
92 86 }
93 87
94 88 if (from.path === LOGIN_PATH && userInfo.value?.needSetPwd == true) {
95   - // console.log('需要修改密码,跳到修改密码');
96 89 setTimeout(() => {
97 90 router.push('/system/password');
98 91 }, 200);
99 92 }
100 93
101   - // if (from.path === LOGIN_PATH) {
102   - // const getMenuListData = await getMenuList();
103   - // // getMenuList().then((res) => {
104   - // if (getMenuListData) {
105   - // const getHomePage = getMenuListData.map((f) => {
106   - // if (f?.children) {
107   - // const getFilterPath = f.children.filter((f1) => {
108   - // return f1.path == '/system/password';
109   - // });
110   - // return getFilterPath;
111   - // }
112   - // });
113   - // console.log(getHomePage?.at(-1)[0]?.path);
114   - // // getHomePage?.at(-1)[0]?.path == '/system/password'
115   - // if (userInfo.value?.needSetPwd == false) {
116   - // setTimeout(() => {
117   - // router.push('/dashboard/workbench');
118   - // }, 10);
119   - // }
120   - // if (userInfo.value?.needSetPwd == true && getHomePage?.at(-1)[0]?.path == undefined) {
121   - // setTimeout(() => {
122   - // router.push('/system/password');
123   - // }, 10);
124   - // }
125   - // }
126   - // // });
127   - // }
128   -
129 94 if (
130 95 from.path === LOGIN_PATH &&
131 96 to.name === PAGE_NOT_FOUND_ROUTE.name &&
132 97 to.fullPath !== (userStore.getUserInfo.homePath || PageEnum.BASE_HOME)
133 98 ) {
134   - // console.log('404页面', 'res');
135   - // Jump to the 404 page after processing the login
136   - const getMenuListData = await getMenuList();
137   - // getMenuList().then((res) => {
138   - if (getMenuListData) {
139   - const getHomePage = getMenuListData.find((f) => {
140   - return f.path == '/dashboard/workbench';
141   - });
142   - if (getHomePage?.path == '/dashboard/workbench') {
143   - setTimeout(() => {
144   - router.push('/dashboard/workbench');
145   - }, 10);
146   - } else {
147   - const routeF = res[0]?.children[0]?.path || res[0].path;
148   - setTimeout(() => {
149   - router.push(routeF);
150   - }, 10);
151   - }
152   - }
153   - // });
154 99 next(userStore.getUserInfo.homePath || PageEnum.BASE_HOME);
155 100 return;
156 101 }
... ...
... ... @@ -19,6 +19,8 @@ import { PageEnum } from '/@/enums/pageEnum';
19 19 import { router as navRouter } from '/@/router';
20 20 import { USER_INFO_KEY } from '/@/enums/cacheEnum';
21 21 import { getAuthCache } from '/@/utils/auth';
  22 +import { createStorage } from '/@/utils/cache/index';
  23 +
22 24 interface PermissionState {
23 25 // Permission code list
24 26 permCodeList: string[] | number[];
... ... @@ -228,6 +230,8 @@ export const usePermissionStore = defineStore({
228 230 } else {
229 231 this.changePermissionCode();
230 232 routeList = (await getMenuList()) as AppRouteRecordRaw[];
  233 + // createStorage('menuListCache', JSON.stringify(routeList));
  234 + window.localStorage.setItem('menuListStorage', JSON.stringify(routeList));
231 235 }
232 236 } catch (error) {
233 237 console.error(error);
... ...
... ... @@ -87,20 +87,20 @@
87 87 isUpdate.value = !!data?.isUpdate;
88 88 if (!unref(isUpdate)) {
89 89 current.value = 0;
90   - switch (current.value) {
91   - case 0:
92   - proxy.$refs.DeviceProfileStep1Ref.customResetFunc();
93   - break;
94   - case 1:
95   - proxy.$refs.DeviceProfileStep2Ref.customResetAndFunc();
96   - break;
97   - case 2:
98   - // proxy.$refs.DeviceProfileStep3Ref.customResetFunc();
99   - // break;
100   - case 3:
101   - proxy.$refs.DeviceProfileStep4Ref.customResetAndFunc();
102   - break;
103   - }
  90 + // switch (current.value) {
  91 + // case 0:
  92 + // proxy.$refs.DeviceProfileStep1Ref.customResetFunc();
  93 + // break;
  94 + // case 1:
  95 + // proxy.$refs.DeviceProfileStep2Ref.customResetAndFunc();
  96 + // break;
  97 + // case 2:
  98 + // // proxy.$refs.DeviceProfileStep3Ref.customResetFunc();
  99 + // // break;
  100 + // case 3:
  101 + // proxy.$refs.DeviceProfileStep4Ref.customResetAndFunc();
  102 + // break;
  103 + // }
104 104 }
105 105 if (unref(isUpdate)) {
106 106 current.value = 0;
... ...
... ... @@ -34,7 +34,12 @@
34 34 </BasicTable>
35 35 </CollapseContainer>
36 36 <CollapseContainer title="筛选器预览" class="border mb-8">
37   - <BasicTable :resizeHeightOffset="200" :columns="columnsView" :dataSource="detailData" />
  37 + <BasicTable
  38 + :resizeHeightOffset="200"
  39 + :columns="columnsView"
  40 + :dataSource="detailData"
  41 + :pagination="false"
  42 + />
38 43 </CollapseContainer>
39 44 <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerForm" />
40 45 </BasicModal>
... ... @@ -81,6 +86,7 @@
81 86 columns,
82 87 bordered: true,
83 88 showIndexColumn: false,
  89 + pagination: false,
84 90 actionColumn: {
85 91 width: 180,
86 92 title: '操作',
... ...
... ... @@ -22,21 +22,19 @@ export const step1Schemas: FormSchema[] = [
22 22 label: '请选择规则链',
23 23 component: 'ApiSelect',
24 24 componentProps: {
25   - // api: async () => {
26   - // const data = await deviceConfigGetRuleChain();
27   - // const returnData = data.map((m) => {
28   - // return {
29   - // labelField: m.name,
30   - // valueField: m.id.id,
31   - // };
32   - // });
33   - // console.log(returnData);
34   - // return returnData;
35   - // },
36   - api: deviceConfigGetRuleChain,
37   - labelField: 'name',
38   - valueField: '',
39   - // resultField: '',
  25 + api: async () => {
  26 + const data = await deviceConfigGetRuleChain();
  27 + const returnData = data.map((m) => {
  28 + return {
  29 + getValueField: m.name,
  30 + getKeyField: m.id.id,
  31 + };
  32 + });
  33 + return returnData;
  34 + },
  35 + labelField: 'getValueField',
  36 + valueField: 'getKeyField',
  37 + immediate: true,
40 38 },
41 39 },
42 40 // {
... ...
  1 +{
  2 + "name": "设备测试3",
  3 + "defaultRuleChainId": "354c7210-5d97-11ec-8ac9-f38ed935ea2a",
  4 + "description": "设备测试3",
  5 + "transportType": "CoAP",
  6 + "profileData": {
  7 + "alarms": [
  8 + {
  9 + "alarmType": "设备测试3",
  10 + "propagate": true,
  11 + "propagateRelationTypes": [
  12 + "设备测试3"
  13 + ],
  14 + "createRules": {
  15 + "MAJOR": {
  16 + "alarmDetails": "设备测试3",
  17 + "schedule": {
  18 + "type": "ANY_TIME"
  19 + },
  20 + "condition": {
  21 + "condition": [
  22 + {
  23 + "key": {
  24 + "type": "TIME_SERIES",
  25 + "key": "CO2"
  26 + },
  27 + "valueType": "COMPLEX",
  28 + "predicate": {
  29 + "operation": "LESS_OR_EQUAL",
  30 + "value": {
  31 + "defaultValue": 2
  32 + },
  33 + "type": "COMPLEX"
  34 + }
  35 + }
  36 + ],
  37 + "spec": {
  38 + "type": "DURATION"
  39 + }
  40 + }
  41 + }
  42 + }
  43 + }
  44 + ]
  45 + },
  46 + "alarmProfile": {
  47 + "alarmContactId": "a3004ddd-db8f-487c-aea0-4f6f3efc59a9",
  48 + "messageMode": "PHONE_MESSAGE"
  49 + }
  50 +}
... ...
... ... @@ -91,6 +91,7 @@
91 91 function getAllFields(getV) {
92 92 const values = getFieldsValue();
93 93 getValueData.value = values;
  94 + console.log(getValueData.value);
94 95 getV = getValueData.value;
95 96 return getV;
96 97 }
... ...
... ... @@ -167,12 +167,26 @@ export const formSchema: FormSchema[] = [
167 167 if (v == undefined) {
168 168 formModel.deviceId = undefined;
169 169 const { updateSchema } = formActionType;
170   - updateSchema({
171   - field: 'deviceId',
172   - componentProps: {
173   - options: undefined,
  170 + updateSchema(
  171 + {
  172 + field: 'deviceId',
  173 + componentProps: {
  174 + options: undefined,
  175 + },
174 176 },
175   - });
  177 + {
  178 + field: 'deviceId1',
  179 + componentProps: {
  180 + options: undefined,
  181 + },
  182 + },
  183 + {
  184 + field: 'deviceId2',
  185 + componentProps: {
  186 + options: undefined,
  187 + },
  188 + }
  189 + );
176 190 } else {
177 191 getData.value = v;
178 192 }
... ...
... ... @@ -88,6 +88,7 @@
88 88 triggersArray.push(getTriggerChildValues);
89 89 doConditionsArray.push(getconditionChildValues);
90 90 getValuesFormData = getFieldsValue();
  91 + console.log('触发器',triggersArray)
91 92 Object.assign(getAllFormData, getValuesFormData);
92 93 getAllFormData.triggers = triggersArray;
93 94 getAllFormData.doConditions = doConditionsArray;
... ...