Commit 00427eef483be448a7f27ac3c9709e89cec5bf89

Authored by xp.Huang
2 parents e546627d daf8ad41

Merge branch 'ft-dev' into 'main'

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

See merge request huang/yun-teng-iot-front!49
@@ -15,7 +15,7 @@ enum ScreenManagerApi { @@ -15,7 +15,7 @@ enum ScreenManagerApi {
15 SCREEN_ADD_URL = '/sceneLinkage', 15 SCREEN_ADD_URL = '/sceneLinkage',
16 SCREEN_DELETE_URL = '/sceneLinkage', 16 SCREEN_DELETE_URL = '/sceneLinkage',
17 SCREEN_UPDATE_URL = '/sceneLinkage/update', 17 SCREEN_UPDATE_URL = '/sceneLinkage/update',
18 - SCREEN_ORGANIZATION_URL = '/organization/me/organizations', 18 + SCREEN_ORGANIZATION_URL = '/organization/me/list',
19 SCREEN_CHANGE_STATUS = '/sceneLinkage/updateSceneStatus', 19 SCREEN_CHANGE_STATUS = '/sceneLinkage/updateSceneStatus',
20 SCREEN_GET_BY_DEPTID = '/sceneLinkage/device/', 20 SCREEN_GET_BY_DEPTID = '/sceneLinkage/device/',
21 } 21 }
1 import type { Router, RouteRecordRaw } from 'vue-router'; 1 import type { Router, RouteRecordRaw } from 'vue-router';
2 -  
3 import { usePermissionStoreWithOut } from '/@/store/modules/permission'; 2 import { usePermissionStoreWithOut } from '/@/store/modules/permission';
4 -  
5 import { PageEnum } from '/@/enums/pageEnum'; 3 import { PageEnum } from '/@/enums/pageEnum';
6 import { useUserStoreWithOut } from '/@/store/modules/user'; 4 import { useUserStoreWithOut } from '/@/store/modules/user';
7 -  
8 import { PAGE_NOT_FOUND_ROUTE } from '/@/router/routes/basic'; 5 import { PAGE_NOT_FOUND_ROUTE } from '/@/router/routes/basic';
9 -  
10 import { RootRoute } from '/@/router/routes'; 6 import { RootRoute } from '/@/router/routes';
11 -  
12 import { router } from '/@/router'; 7 import { router } from '/@/router';
13 import { getMenuList } from '/@/api/sys/menu'; 8 import { getMenuList } from '/@/api/sys/menu';
14 import { USER_INFO_KEY } from '/@/enums/cacheEnum'; 9 import { USER_INFO_KEY } from '/@/enums/cacheEnum';
@@ -71,7 +66,10 @@ export function createPermissionGuard(router: Router) { @@ -71,7 +66,10 @@ export function createPermissionGuard(router: Router) {
71 } 66 }
72 67
73 if (from.path === LOGIN_PATH && userInfo.value?.needSetPwd == false) { 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 const getHomePage = getMenuListData.find((f) => { 73 const getHomePage = getMenuListData.find((f) => {
76 return f.path == '/dashboard/workbench'; 74 return f.path == '/dashboard/workbench';
77 }); 75 });
@@ -85,72 +83,19 @@ export function createPermissionGuard(router: Router) { @@ -85,72 +83,19 @@ export function createPermissionGuard(router: Router) {
85 router.push(routeF); 83 router.push(routeF);
86 }, 200); 84 }, 200);
87 } 85 }
88 - // setTimeout(() => {  
89 - // console.log('无需修改密码,跳到首页');  
90 - // router.push('/dashboard/workbench');  
91 - // }, 200);  
92 } 86 }
93 87
94 if (from.path === LOGIN_PATH && userInfo.value?.needSetPwd == true) { 88 if (from.path === LOGIN_PATH && userInfo.value?.needSetPwd == true) {
95 - // console.log('需要修改密码,跳到修改密码');  
96 setTimeout(() => { 89 setTimeout(() => {
97 router.push('/system/password'); 90 router.push('/system/password');
98 }, 200); 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 if ( 94 if (
130 from.path === LOGIN_PATH && 95 from.path === LOGIN_PATH &&
131 to.name === PAGE_NOT_FOUND_ROUTE.name && 96 to.name === PAGE_NOT_FOUND_ROUTE.name &&
132 to.fullPath !== (userStore.getUserInfo.homePath || PageEnum.BASE_HOME) 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 next(userStore.getUserInfo.homePath || PageEnum.BASE_HOME); 99 next(userStore.getUserInfo.homePath || PageEnum.BASE_HOME);
155 return; 100 return;
156 } 101 }
@@ -19,6 +19,8 @@ import { PageEnum } from '/@/enums/pageEnum'; @@ -19,6 +19,8 @@ import { PageEnum } from '/@/enums/pageEnum';
19 import { router as navRouter } from '/@/router'; 19 import { router as navRouter } from '/@/router';
20 import { USER_INFO_KEY } from '/@/enums/cacheEnum'; 20 import { USER_INFO_KEY } from '/@/enums/cacheEnum';
21 import { getAuthCache } from '/@/utils/auth'; 21 import { getAuthCache } from '/@/utils/auth';
  22 +import { createStorage } from '/@/utils/cache/index';
  23 +
22 interface PermissionState { 24 interface PermissionState {
23 // Permission code list 25 // Permission code list
24 permCodeList: string[] | number[]; 26 permCodeList: string[] | number[];
@@ -228,6 +230,8 @@ export const usePermissionStore = defineStore({ @@ -228,6 +230,8 @@ export const usePermissionStore = defineStore({
228 } else { 230 } else {
229 this.changePermissionCode(); 231 this.changePermissionCode();
230 routeList = (await getMenuList()) as AppRouteRecordRaw[]; 232 routeList = (await getMenuList()) as AppRouteRecordRaw[];
  233 + // createStorage('menuListCache', JSON.stringify(routeList));
  234 + window.localStorage.setItem('menuListStorage', JSON.stringify(routeList));
231 } 235 }
232 } catch (error) { 236 } catch (error) {
233 console.error(error); 237 console.error(error);
@@ -87,20 +87,20 @@ @@ -87,20 +87,20 @@
87 isUpdate.value = !!data?.isUpdate; 87 isUpdate.value = !!data?.isUpdate;
88 if (!unref(isUpdate)) { 88 if (!unref(isUpdate)) {
89 current.value = 0; 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 if (unref(isUpdate)) { 105 if (unref(isUpdate)) {
106 current.value = 0; 106 current.value = 0;
@@ -34,7 +34,12 @@ @@ -34,7 +34,12 @@
34 </BasicTable> 34 </BasicTable>
35 </CollapseContainer> 35 </CollapseContainer>
36 <CollapseContainer title="筛选器预览" class="border mb-8"> 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 </CollapseContainer> 43 </CollapseContainer>
39 <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerForm" /> 44 <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerForm" />
40 </BasicModal> 45 </BasicModal>
@@ -81,6 +86,7 @@ @@ -81,6 +86,7 @@
81 columns, 86 columns,
82 bordered: true, 87 bordered: true,
83 showIndexColumn: false, 88 showIndexColumn: false,
  89 + pagination: false,
84 actionColumn: { 90 actionColumn: {
85 width: 180, 91 width: 180,
86 title: '操作', 92 title: '操作',
@@ -22,21 +22,19 @@ export const step1Schemas: FormSchema[] = [ @@ -22,21 +22,19 @@ export const step1Schemas: FormSchema[] = [
22 label: '请选择规则链', 22 label: '请选择规则链',
23 component: 'ApiSelect', 23 component: 'ApiSelect',
24 componentProps: { 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,6 +91,7 @@
91 function getAllFields(getV) { 91 function getAllFields(getV) {
92 const values = getFieldsValue(); 92 const values = getFieldsValue();
93 getValueData.value = values; 93 getValueData.value = values;
  94 + console.log(getValueData.value);
94 getV = getValueData.value; 95 getV = getValueData.value;
95 return getV; 96 return getV;
96 } 97 }
@@ -167,12 +167,26 @@ export const formSchema: FormSchema[] = [ @@ -167,12 +167,26 @@ export const formSchema: FormSchema[] = [
167 if (v == undefined) { 167 if (v == undefined) {
168 formModel.deviceId = undefined; 168 formModel.deviceId = undefined;
169 const { updateSchema } = formActionType; 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 } else { 190 } else {
177 getData.value = v; 191 getData.value = v;
178 } 192 }
@@ -88,6 +88,7 @@ @@ -88,6 +88,7 @@
88 triggersArray.push(getTriggerChildValues); 88 triggersArray.push(getTriggerChildValues);
89 doConditionsArray.push(getconditionChildValues); 89 doConditionsArray.push(getconditionChildValues);
90 getValuesFormData = getFieldsValue(); 90 getValuesFormData = getFieldsValue();
  91 + console.log('触发器',triggersArray)
91 Object.assign(getAllFormData, getValuesFormData); 92 Object.assign(getAllFormData, getValuesFormData);
92 getAllFormData.triggers = triggersArray; 93 getAllFormData.triggers = triggersArray;
93 getAllFormData.doConditions = doConditionsArray; 94 getAllFormData.doConditions = doConditionsArray;