Commit d8a5cdbb22238cb4ac25526cb87c8d0b85c4afc5

Authored by fengistao
1 parent e038a147

fix:修复修改密码和404

1 1 export const PageEnum = {
  2 + SYSTEM_PASSWORD: '/system/password',
2 3 // basic login path
3 4 BASE_LOGIN: '/login',
4 5 // basic home path
... ...
... ... @@ -21,7 +21,7 @@
21 21 </transition>
22 22 </template>
23 23 </RouterView>
24   - <BasicModal
  24 + <!-- <BasicModal
25 25 @register="register"
26 26 v-bind="$attrs"
27 27 :mask="true"
... ... @@ -38,13 +38,13 @@
38 38 :keyboard="false"
39 39 >
40 40 <PasswordDialog />
41   - </BasicModal>
  41 + </BasicModal> -->
42 42 <FrameLayout v-if="getCanEmbedIFramePage" />
43 43 </template>
44 44
45 45 <script lang="ts">
46   - import { computed, defineComponent, ref, unref, onMounted } from 'vue';
47   - import PasswordDialog from '/@/views/system/password/index.vue';
  46 + import { computed, defineComponent, unref, onMounted } from 'vue';
  47 + // import PasswordDialog from '/@/views/system/password/index.vue';
48 48
49 49 import FrameLayout from '/@/layouts/iframe/index.vue';
50 50
... ... @@ -55,12 +55,12 @@
55 55 import { getTransitionName } from './transition';
56 56
57 57 import { useMultipleTabStore } from '/@/store/modules/multipleTab';
58   - import { BasicModal, useModal } from '/@/components/Modal';
59   - import { USER_INFO_KEY } from '/@/enums/cacheEnum';
60   - import { getAuthCache } from '/@/utils/auth';
  58 + // import { BasicModal, useModal } from '/@/components/Modal';
  59 + // import { USER_INFO_KEY } from '/@/enums/cacheEnum';
  60 + // import { getAuthCache } from '/@/utils/auth';
61 61 export default defineComponent({
62 62 name: 'PageLayout',
63   - components: { FrameLayout, BasicModal, PasswordDialog },
  63 + components: { FrameLayout },
64 64 setup() {
65 65 const { getShowMultipleTab } = useMultipleTabSetting();
66 66 const tabStore = useMultipleTabStore();
... ... @@ -78,15 +78,15 @@
78 78 return tabStore.getCachedTabList;
79 79 });
80 80
81   - const [register, { openModal }] = useModal();
82   - const maskColor = ref({ backgroundColor: 'grey' });
83   - const statusModel = ref(false);
  81 + // const [register, { openModal }] = useModal();
  82 + // const maskColor = ref({ backgroundColor: 'grey' });
  83 + // const statusModel = ref(false);
84 84 onMounted(() => {
85   - const userInfo = getAuthCache(USER_INFO_KEY);
86   - if (userInfo.needSetPwd == true) {
87   - statusModel.value = true;
88   - openModal(statusModel.value);
89   - }
  85 + // const userInfo = getAuthCache(USER_INFO_KEY);
  86 + // if (userInfo.needSetPwd == true) {
  87 + // statusModel.value = true;
  88 + // openModal(statusModel.value);
  89 + // }
90 90 });
91 91
92 92 return {
... ... @@ -96,8 +96,8 @@
96 96 getBasicTransition,
97 97 getCaches,
98 98 getCanEmbedIFramePage,
99   - register,
100   - maskColor,
  99 + // register,
  100 + // maskColor,
101 101 };
102 102 },
103 103 });
... ...
... ... @@ -11,24 +11,30 @@ import { RootRoute } from '/@/router/routes';
11 11
12 12 import { router } from '/@/router';
13 13 import { getMenuList } from '/@/api/sys/menu';
  14 +import { USER_INFO_KEY } from '/@/enums/cacheEnum';
  15 +import { getAuthCache } from '/@/utils/auth';
  16 +import { ref } from 'vue';
14 17
15 18 const LOGIN_PATH = PageEnum.BASE_LOGIN;
16 19
17 20 const ROOT_PATH = RootRoute.path;
18 21
19 22 const whitePathList: PageEnum[] = [LOGIN_PATH];
  23 +// const userInfo1 = getAuthCache(USER_INFO_KEY);
  24 +// const userInfo = ref(userInfo1);
20 25
21 26 export function createPermissionGuard(router: Router) {
22 27 const userStore = useUserStoreWithOut();
23 28 const permissionStore = usePermissionStoreWithOut();
24 29 router.beforeEach(async (to, from, next) => {
  30 + const userInfo1 = await getAuthCache(USER_INFO_KEY);
  31 + const userInfo = ref(userInfo1);
25 32 if (
26 33 from.path === ROOT_PATH &&
27 34 to.path === PageEnum.BASE_HOME &&
28 35 userStore.getUserInfo.homePath &&
29 36 userStore.getUserInfo.homePath !== PageEnum.BASE_HOME
30 37 ) {
31   - console.log('根路径');
32 38 next(userStore.getUserInfo.homePath);
33 39 return;
34 40 }
... ... @@ -64,42 +70,87 @@ export function createPermissionGuard(router: Router) {
64 70 return;
65 71 }
66 72
  73 + if (from.path === LOGIN_PATH && userInfo.value?.needSetPwd == false) {
  74 + const getMenuListData = await getMenuList();
  75 + const getHomePage = getMenuListData.find((f) => {
  76 + return f.path == '/dashboard/workbench';
  77 + });
  78 + if (getHomePage?.path == '/dashboard/workbench') {
  79 + setTimeout(() => {
  80 + router.push('/dashboard/workbench');
  81 + }, 200);
  82 + } else {
  83 + const routeF = getMenuListData[0]?.children[0]?.path || getMenuListData[0].path;
  84 + setTimeout(() => {
  85 + router.push(routeF);
  86 + }, 200);
  87 + }
  88 + // setTimeout(() => {
  89 + // console.log('无需修改密码,跳到首页');
  90 + // router.push('/dashboard/workbench');
  91 + // }, 200);
  92 + }
  93 +
  94 + if (from.path === LOGIN_PATH && userInfo.value?.needSetPwd == true) {
  95 + // console.log('需要修改密码,跳到修改密码');
  96 + setTimeout(() => {
  97 + router.push('/system/password');
  98 + }, 200);
  99 + }
  100 +
67 101 // if (from.path === LOGIN_PATH) {
68   - // console.log('登录过后');
69   - // router.push('/system/password');
70   - // } else {
71   - // // return;
  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 + // // });
72 127 // }
  128 +
73 129 if (
74 130 from.path === LOGIN_PATH &&
75 131 to.name === PAGE_NOT_FOUND_ROUTE.name &&
76 132 to.fullPath !== (userStore.getUserInfo.homePath || PageEnum.BASE_HOME)
77 133 ) {
  134 + // console.log('404页面', 'res');
78 135 // Jump to the 404 page after processing the login
79   - getMenuList().then((res) => {
80   - if (res) {
81   - console.log(res);
82   - const getHomePage = res.find((f) => {
83   - return f.path == '/dashboard/workbench';
84   - });
85   - if (getHomePage?.path == '/dashboard/workbench') {
86   - setTimeout(() => {
87   - router.push('/stationnotification/notificationmanager');
88   - }, 10);
89   - } else {
90   - const routeF = res[0]?.children[0]?.path || res[0].path;
  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(() => {
91 149 router.push(routeF);
92   - }
  150 + }, 10);
93 151 }
94   - });
95   -
96   - // if (getHomePage?.path == '/dashboard/workbench') {
97   - // isDolang.value = '/dashboard/workbench';
98   - // } else {
99   - // const route = routeList[0].path + '';
100   - // isDolang.key = 1;
101   - // isDolang.value = route;
102   - // }
  152 + }
  153 + // });
103 154 next(userStore.getUserInfo.homePath || PageEnum.BASE_HOME);
104 155 return;
105 156 }
... ...
... ... @@ -76,3 +76,31 @@ export const ERROR_LOG_ROUTE: AppRouteRecordRaw = {
76 76 },
77 77 ],
78 78 };
  79 +
  80 +// export const UPDATE_SYSTEM_PASSWORD: AppRouteRecordRaw = {
  81 +// path: '/system',
  82 +// name: 'routes.common.system.system',
  83 +// component: LAYOUT,
  84 +// redirect: '/system/systemManagement',
  85 +// meta: {
  86 +// icon: 'bx:bx-home',
  87 +// title: 'routes.common.system.system',
  88 +// status: '0',
  89 +// menuType: '0',
  90 +// },
  91 +// children: [
  92 +// {
  93 +// path: '/system/password',
  94 +// name: 'routes.common.system.modifyPassword',
  95 +// component: () => import('/@/views/system/password/index.vue'),
  96 +// meta: {
  97 +// icon: 'bx:bx-home',
  98 +// title: 'routes.common.system.modifyPassword',
  99 +// menuType: '1',
  100 +// ignoreKeepAlive: true,
  101 +// hideMenu: false,
  102 +// status: '0',
  103 +// },
  104 +// },
  105 +// ],
  106 +// };
... ...
... ... @@ -16,7 +16,9 @@ import { getMenuList } from '/@/api/sys/menu';
16 16 import { getPermCode } from '/@/api/sys/user';
17 17 import { useMessage } from '/@/hooks/web/useMessage';
18 18 import { PageEnum } from '/@/enums/pageEnum';
19   -import { router } from '/@/router';
  19 +import { router as navRouter } from '/@/router';
  20 +import { USER_INFO_KEY } from '/@/enums/cacheEnum';
  21 +import { getAuthCache } from '/@/utils/auth';
20 22 interface PermissionState {
21 23 // Permission code list
22 24 permCodeList: string[] | number[];
... ... @@ -177,18 +179,55 @@ export const usePermissionStore = defineStore({
177 179 // this function may only need to be executed once, and the actual project can be put at the right time by itself
178 180 let routeList: AppRouteRecordRaw[] = [];
179 181 try {
180   - this.changePermissionCode();
181   - routeList = (await getMenuList()) as AppRouteRecordRaw[];
182   - //这里判断是否含有首页
183   - // console.log(routeList);
184   - const getHomePage = routeList.find((f) => {
185   - return f.path == '/dashboard';
186   - });
187   - if (getHomePage?.path == '/dashboard') {
188   - router.push('/dashboard/workbench');
  182 + // this.changePermissionCode();
  183 + // routeList = (await getMenuList()) as AppRouteRecordRaw[];
  184 + const userInfo = getAuthCache(USER_INFO_KEY);
  185 + if (userInfo?.needSetPwd == true) {
  186 + routeList = [
  187 + {
  188 + name: 'routes.common.system.system',
  189 + parentId: '',
  190 + children: [
  191 + {
  192 + id: 'a8ffa8c5-637e-476b-a9e6-b60cebe95718',
  193 + createTime: '2021-09-10 20:50:55',
  194 + updateTime: '2021-11-16 18:58:24',
  195 + name: 'routes.common.system.modifyPassword',
  196 + parentId: 'a8ffa8c5-637e-471b-a9e6-b60cebe95713',
  197 + children: [],
  198 + path: '/system/password',
  199 + type: 'SYSADMIN',
  200 + permission: 'system:password:view',
  201 + sort: 6,
  202 + component: '/system/password/index',
  203 + meta: {
  204 + icon: 'bx:bx-home',
  205 + title: 'routes.common.system.modifyPassword',
  206 + menuType: '1',
  207 + ignoreKeepAlive: true,
  208 + hideMenu: false,
  209 + status: '0',
  210 + },
  211 + redirect: '',
  212 + },
  213 + ],
  214 + path: '/system',
  215 + type: 'SYSADMIN',
  216 + permission: '',
  217 + sort: 6,
  218 + component: 'LAYOUT',
  219 + meta: {
  220 + icon: 'bx:bx-home',
  221 + title: 'routes.common.system.system',
  222 + status: '0',
  223 + menuType: '0',
  224 + },
  225 + redirect: '/system/systemManagement',
  226 + },
  227 + ] as AppRouteRecordRaw[];
189 228 } else {
190   - const route = routeList[0].path + '';
191   - router.push(route);
  229 + this.changePermissionCode();
  230 + routeList = (await getMenuList()) as AppRouteRecordRaw[];
192 231 }
193 232 } catch (error) {
194 233 console.error(error);
... ...
... ... @@ -20,26 +20,43 @@
20 20 <BasicForm :showSubmitButton="false" :showResetButton="false" @register="registerTrans"
21 21 /></TabPane>
22 22 <TabPane key="3" tab="报警规则">
23   - <BasicForm
24   - :showSubmitButton="false"
25   - :showResetButton="false"
26   - @register="registerStep3Schemas"
27   - />
28   - <BasicForm
29   - :showSubmitButton="false"
30   - :showResetButton="false"
31   - @register="registerStep3HighSetting"
32   - />
33   - <BasicForm
34   - :showSubmitButton="false"
35   - :showResetButton="false"
36   - @register="registerStep3CreateAlarm"
37   - />
38   - <BasicForm
39   - :showSubmitButton="false"
40   - :showResetButton="false"
41   - @register="registerStep3RuleAlarm"
42   - />
  23 + <div style="padding-top: 10px">
  24 + <BasicForm
  25 + :showSubmitButton="false"
  26 + :showResetButton="false"
  27 + @register="registerStep3Schemas"
  28 + />
  29 + <BasicForm
  30 + :showSubmitButton="false"
  31 + :showResetButton="false"
  32 + @register="registerStep3HighSetting"
  33 + />
  34 + <BasicForm
  35 + :showSubmitButton="false"
  36 + :showResetButton="false"
  37 + @register="registerStep3CreateAlarm"
  38 + />
  39 + <BasicForm
  40 + :showSubmitButton="false"
  41 + :showResetButton="false"
  42 + @register="registerStep3RuleAlarm"
  43 + />
  44 + <BasicForm
  45 + :showSubmitButton="false"
  46 + :showResetButton="false"
  47 + @register="registerStep3Condition"
  48 + />
  49 + <BasicForm
  50 + :showSubmitButton="false"
  51 + :showResetButton="false"
  52 + @register="registerStep3Enable"
  53 + />
  54 + <BasicForm
  55 + :showSubmitButton="false"
  56 + :showResetButton="false"
  57 + @register="registerStep3TemplateDetail"
  58 + />
  59 + </div>
43 60 </TabPane>
44 61 <TabPane key="4" tab="告警管理">
45 62 <BasicForm :showSubmitButton="false" :showResetButton="false" @register="registerContact"
... ... @@ -61,8 +78,13 @@
61 78 step3HighSetting,
62 79 step3CreateAlarm,
63 80 alertContactsSchemas,
  81 + echoFormSchema,
64 82 } from './step/data';
65 83
  84 + import { formSchema as conditionFormSchema } from './step/cpns/alarmruleconditions/config';
  85 + import { formSchema as enableSchema } from './step/cpns/enablerule/config';
  86 + import { formSchema as detailSchema } from './step/cpns/detailtemplate/config';
  87 +
66 88 export default defineComponent({
67 89 name: 'ConfigDrawer',
68 90 components: { Tabs, TabPane, BasicModal, BasicForm },
... ... @@ -76,89 +98,111 @@
76 98 () => activeKey.value,
77 99 (v) => {
78 100 dataInfo.value = v;
  101 + // switch (dataInfo.value) {
  102 + // case '1':
  103 + // console.log(1);
  104 + // break;
  105 + // case '2':
  106 + // console.log(2);
  107 + // break;
  108 + // case '3':
  109 + // console.log(3);
  110 + // break;
  111 + // case '4':
  112 + // console.log(4);
  113 + // break;
  114 + // }
79 115 }
80 116 );
81   - const [registerDetail, { setFieldsValue }] = useForm({
  117 + const [registerDetail, { setFieldsValue: setRegisterDetail }] = useForm({
82 118 schemas: step1Schemas,
83 119 actionColOptions: {
84 120 span: 24,
85 121 },
86 122 });
87   - const [registerTrans, { setFieldsValue }] = useForm({
  123 + const [registerTrans, { setFieldsValue: setRegisterTrans }] = useForm({
88 124 schemas: step2Schemas,
89 125 actionColOptions: {
90 126 span: 24,
91 127 },
92 128 });
93   - const [registerStep3Schemas, { setFieldsValue }] = useForm({
  129 + const [registerStep3Schemas, { setFieldsValue: setRegisterStep3Schemas }] = useForm({
94 130 schemas: step3Schemas,
95 131 actionColOptions: {
96 132 span: 24,
97 133 },
98 134 });
99   - const [registerStep3HighSetting, { setFieldsValue }] = useForm({
  135 + const [registerStep3HighSetting, { setFieldsValue: setRegisterStep3HighSetting }] = useForm({
100 136 schemas: step3HighSetting,
101 137 actionColOptions: {
102 138 span: 24,
103 139 },
104 140 });
105   - const [registerStep3CreateAlarm, { setFieldsValue }] = useForm({
  141 + const [registerStep3CreateAlarm, { setFieldsValue: setRegisterStep3CreateAlarm }] = useForm({
106 142 schemas: step3CreateAlarm,
107 143 actionColOptions: {
108 144 span: 24,
109 145 },
110 146 });
111   - const [registerContact, { setFieldsValue }] = useForm({
  147 + const [registerContact, { setFieldsValue: setRegisterContact }] = useForm({
112 148 schemas: alertContactsSchemas,
113 149 actionColOptions: {
114 150 span: 24,
115 151 },
116 152 });
117   - const [registerStep3RuleAlarm, { setFieldsValue }] = useForm({
118   - schemas: alertContactsSchemas,
  153 + const [registerStep3RuleAlarm, { setFieldsValue: setRegisterStep3RuleAlarm }] = useForm({
  154 + schemas: echoFormSchema,
  155 + actionColOptions: {
  156 + span: 24,
  157 + },
  158 + });
  159 + const [registerStep3Condition, { setFieldsValue: setRegisterStep3Condition }] = useForm({
  160 + schemas: conditionFormSchema,
119 161 actionColOptions: {
120 162 span: 24,
121 163 },
122 164 });
  165 + const [registerStep3Enable, { setFieldsValue: setRegisterStep3Enable }] = useForm({
  166 + schemas: enableSchema,
  167 + actionColOptions: {
  168 + span: 24,
  169 + },
  170 + });
  171 + const [registerStep3TemplateDetail, { setFieldsValue: setRegisterStep3TemplateDetail }] =
  172 + useForm({
  173 + schemas: detailSchema,
  174 + actionColOptions: {
  175 + span: 24,
  176 + },
  177 + });
  178 +
123 179 const [register] = useModalInner(async (data) => {
124 180 activeKey.value = '1';
125 181 isUpdate.value = !!data?.isUpdate;
126 182 descInfo.value = await deviceConfigGetDetail(data.record.id);
127   - console.log(descInfo.value);
128   - switch (dataInfo.value) {
129   - case '1':
130   - // await setRegisterDetail({ ...descInfo.value });
131   - setFieldsFunc(descInfo.value);
132   - break;
133   - case '2':
134   - // await setRegisterTrans({ ...descInfo.value });
135   - setFieldsFunc(descInfo.value);
136   -
137   - break;
138   - case '3':
139   - // await setRegisterStep3Schemas({ ...descInfo.value });
140   - // await setRegisterStep3HighSetting({ ...descInfo.value });
141   - // await setRegisterStep3CreateAlarm({ ...descInfo.value });
142   - // await setRegisterStep3RuleAlarm({ ...descInfo.value });
143   - setFieldsFunc(descInfo.value);
144   -
145   - break;
146   - case '4':
147   - // await setRegisterContact({ ...descInfo.value });
148   - setFieldsFunc(descInfo.value);
149   -
150   - break;
151   - deault: break;
  183 + try {
  184 + await setRegisterDetail({ ...descInfo.value });
  185 + await setRegisterTrans({ ...descInfo.value });
  186 + await setRegisterStep3Schemas({ ...descInfo.value });
  187 + await setRegisterStep3HighSetting({ ...descInfo.value });
  188 + await setRegisterStep3CreateAlarm({ ...descInfo.value });
  189 + await setRegisterStep3RuleAlarm({ ...descInfo.value });
  190 + await setRegisterContact({ ...descInfo.value });
  191 + await setRegisterStep3Condition({ ...descInfo.value });
  192 + await setRegisterStep3Enable({ ...descInfo.value });
  193 + await setRegisterStep3TemplateDetail({ ...descInfo.value });
  194 + } catch (e) {
  195 + return e;
152 196 }
153 197 });
154   - const setFieldsFunc = (v) => {
155   - setFieldsValue(v);
156   - };
157 198 const getTitle = computed(() => {
158 199 return '设备配置详情';
159 200 });
160 201
161 202 return {
  203 + registerStep3TemplateDetail,
  204 + registerStep3Enable,
  205 + registerStep3Condition,
162 206 registerStep3RuleAlarm,
163 207 registerContact,
164 208 registerStep3HighSetting,
... ...
... ... @@ -330,9 +330,12 @@
330 330 },
331 331 ];
332 332 const findDayByValue = findDay.map((f, i) => {
333   - console.log(i);
334   - if (f.value == v.daysOfWeek[i]) {
335   - return f.label;
  333 + try {
  334 + if (f.value == v.daysOfWeek[i]) {
  335 + return f.label;
  336 + }
  337 + } catch (e) {
  338 + console.log(e);
336 339 }
337 340 });
338 341
... ...
1   -{
2   - "name": "测试2",
3   - "description": "测试2",
4   - "transportType": "COAP",
5   - "profileData": {
6   - "alarms": [
7   - {
8   - "alarmType": "测试2",
9   - "propagate": true,
10   - "propagateRelationTypes": [
11   - "测试2"
12   - ],
13   - "createRules": {
14   - "MAJOR": {
15   - "alarmDetails": "测试2",
16   - "schedule": {
17   - "type": "SPECIFIC_TIME",
18   - "daysOfWeek": [
19   - "1",
20   - "2",
21   - "3"
22   - ],
23   - "endsOn": "14:11:27",
24   - "timezone": "Africa/Abidjan (UTC+00:00)"
25   - },
26   - "condition": {
27   - "condition": [
28   - {
29   - "key": {
30   - "type": "TIME_SERIES",
31   - "key": "CO2"
32   - },
33   - "valueType": "NUMERIC",
34   - "predicate": {
35   - "operation": "LESS",
36   - "value": {
37   - "defaultValue": 2
38   - },
39   - "type": "NUMERIC"
40   - }
41   - }
42   - ],
43   - "spec": {
44   - "type": "DURATION",
45   - "unit": "DAYS",
46   - "predicate": {
47   - "defaultValue": 3,
48   - "dynamicValue": {
49   - "sourceType": "CURRENT_TENANT",
50   - "sourceAttribute": "测试2"
51   - }
52   - }
53   - }
54   - }
55   - }
56   - }
57   - }
58   - ]
59   - },
60   - "alarmProfile": {
61   - "messageMode": "PHONE_MESSAGE"
62   - }
63   -}
... ... @@ -4,7 +4,7 @@ export const formSchema: FormSchema[] = [
4 4 {
5 5 field: 'alarmDetails',
6 6 label: '报警详细信息',
7   - colProps: { span: 24 },
  7 + colProps: { span: 12 },
8 8 required: true,
9 9 component: 'Input',
10 10 componentProps: {
... ...
... ... @@ -25,7 +25,7 @@ export const formSchema: FormSchema[] = [
25 25 {
26 26 field: 'schedule',
27 27 label: '报警日程表',
28   - colProps: { span: 24 },
  28 + colProps: { span: 12 },
29 29 required: true,
30 30 component: 'Select',
31 31 componentProps: {
... ... @@ -40,7 +40,8 @@ export const formSchema: FormSchema[] = [
40 40 {
41 41 field: 'timezone',
42 42 label: '时区',
43   - colProps: { span: 24 },
  43 + colProps: { span: 12 },
  44 +
44 45 required: true,
45 46 component: 'Select',
46 47 componentProps: {
... ... @@ -57,7 +58,7 @@ export const formSchema: FormSchema[] = [
57 58 },
58 59
59 60 {
60   - field: 'daysOfWeek',
  61 + field: 'daysOfWeek1',
61 62 component: 'Checkbox',
62 63 label: '星期一',
63 64 colProps: {
... ... @@ -67,18 +68,18 @@ export const formSchema: FormSchema[] = [
67 68 ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
68 69 },
69 70 {
70   - field: 'startsOn',
  71 + field: 'startsOn1',
71 72 component: 'TimePicker',
72   - label: '时间选择',
  73 + label: '开始时间选择',
73 74 colProps: {
74 75 span: 8,
75 76 },
76 77 ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
77 78 },
78 79 {
79   - field: 'endsOn',
  80 + field: 'endsOn1',
80 81 component: 'TimePicker',
81   - label: '时间选择',
  82 + label: '结束时间选择',
82 83 colProps: {
83 84 span: 8,
84 85 },
... ... @@ -86,7 +87,7 @@ export const formSchema: FormSchema[] = [
86 87 },
87 88
88 89 {
89   - field: 'daysOfWeek',
  90 + field: 'daysOfWeek2',
90 91 component: 'Checkbox',
91 92 label: '星期二',
92 93 colProps: {
... ... @@ -96,25 +97,25 @@ export const formSchema: FormSchema[] = [
96 97 ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
97 98 },
98 99 {
99   - field: 'startsOn',
  100 + field: 'startsOn2',
100 101 component: 'TimePicker',
101   - label: '时间选择',
  102 + label: '开始时间选择',
102 103 colProps: {
103 104 span: 8,
104 105 },
105 106 ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
106 107 },
107 108 {
108   - field: 'endsOn',
  109 + field: 'endsOn2',
109 110 component: 'TimePicker',
110   - label: '时间选择',
  111 + label: '结束时间选择',
111 112 colProps: {
112 113 span: 8,
113 114 },
114 115 ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
115 116 },
116 117 {
117   - field: 'daysOfWeek',
  118 + field: 'daysOfWeek3',
118 119 component: 'Checkbox',
119 120 label: '星期三',
120 121 colProps: {
... ... @@ -124,25 +125,25 @@ export const formSchema: FormSchema[] = [
124 125 ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
125 126 },
126 127 {
127   - field: 'startsOn',
  128 + field: 'startsOn3',
128 129 component: 'TimePicker',
129   - label: '时间选择',
  130 + label: '开始时间选择',
130 131 colProps: {
131 132 span: 8,
132 133 },
133 134 ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
134 135 },
135 136 {
136   - field: 'endsOn',
  137 + field: 'endsOn3',
137 138 component: 'TimePicker',
138   - label: '时间选择',
  139 + label: '结束时间选择',
139 140 colProps: {
140 141 span: 8,
141 142 },
142 143 ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
143 144 },
144 145 {
145   - field: 'daysOfWeek',
  146 + field: 'daysOfWeek4',
146 147 component: 'Checkbox',
147 148 label: '星期四',
148 149 colProps: {
... ... @@ -152,25 +153,25 @@ export const formSchema: FormSchema[] = [
152 153 ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
153 154 },
154 155 {
155   - field: 'startsOn',
  156 + field: 'startsOn4',
156 157 component: 'TimePicker',
157   - label: '时间选择',
  158 + label: '开始时间选择',
158 159 colProps: {
159 160 span: 8,
160 161 },
161 162 ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
162 163 },
163 164 {
164   - field: 'endsOn',
  165 + field: 'endsOn4',
165 166 component: 'TimePicker',
166   - label: '时间选择',
  167 + label: '结束时间选择',
167 168 colProps: {
168 169 span: 8,
169 170 },
170 171 ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
171 172 },
172 173 {
173   - field: 'daysOfWeek',
  174 + field: 'daysOfWeek5',
174 175 component: 'Checkbox',
175 176 label: '星期五',
176 177 colProps: {
... ... @@ -180,25 +181,25 @@ export const formSchema: FormSchema[] = [
180 181 ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
181 182 },
182 183 {
183   - field: 'startsOn',
  184 + field: 'startsOn5',
184 185 component: 'TimePicker',
185   - label: '时间选择',
  186 + label: '开始时间选择',
186 187 colProps: {
187 188 span: 8,
188 189 },
189 190 ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
190 191 },
191 192 {
192   - field: 'endsOn',
  193 + field: 'endsOn5',
193 194 component: 'TimePicker',
194   - label: '时间选择',
  195 + label: '结束时间选择',
195 196 colProps: {
196 197 span: 8,
197 198 },
198 199 ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
199 200 },
200 201 {
201   - field: 'daysOfWeek',
  202 + field: 'daysOfWeek6',
202 203 component: 'Checkbox',
203 204 label: '星期六',
204 205 colProps: {
... ... @@ -208,25 +209,25 @@ export const formSchema: FormSchema[] = [
208 209 ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
209 210 },
210 211 {
211   - field: 'startsOn',
  212 + field: 'startsOn6',
212 213 component: 'TimePicker',
213   - label: '时间选择',
  214 + label: '开始时间选择',
214 215 colProps: {
215 216 span: 8,
216 217 },
217 218 ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
218 219 },
219 220 {
220   - field: 'endsOn',
  221 + field: 'endsOn6',
221 222 component: 'TimePicker',
222   - label: '时间选择',
  223 + label: '结束时间选择',
223 224 colProps: {
224 225 span: 8,
225 226 },
226 227 ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
227 228 },
228 229 {
229   - field: 'daysOfWeek',
  230 + field: 'daysOfWeek7',
230 231 component: 'Checkbox',
231 232 label: '星期七',
232 233 colProps: {
... ... @@ -236,18 +237,18 @@ export const formSchema: FormSchema[] = [
236 237 ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
237 238 },
238 239 {
239   - field: 'startsOn',
  240 + field: 'startsOn7',
240 241 component: 'TimePicker',
241   - label: '时间选择',
  242 + label: '开始时间选择',
242 243 colProps: {
243 244 span: 8,
244 245 },
245 246 ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
246 247 },
247 248 {
248   - field: 'endsOn',
  249 + field: 'endsOn7',
249 250 component: 'TimePicker',
250   - label: '时间选择',
  251 + label: '结束时间选择',
251 252 colProps: {
252 253 span: 8,
253 254 },
... ... @@ -304,9 +305,9 @@ export const formSchema: FormSchema[] = [
304 305 {
305 306 field: 'startsOn',
306 307 component: 'TimePicker',
307   - label: '时间选择',
  308 + label: '开始时间选择',
308 309 colProps: {
309   - span: 8,
  310 + span: 12,
310 311 },
311 312 componentProps: {
312 313 valueFormat: 'HH:mm:ss',
... ... @@ -316,9 +317,9 @@ export const formSchema: FormSchema[] = [
316 317 {
317 318 field: 'endsOn',
318 319 component: 'TimePicker',
319   - label: '时间选择',
  320 + label: '结束时间选择',
320 321 colProps: {
321   - span: 8,
  322 + span: 12,
322 323 },
323 324 componentProps: {
324 325 valueFormat: 'HH:mm:ss',
... ...
... ... @@ -92,10 +92,10 @@ export const step3Schemas: FormSchema[] = [
92 92 field: 'alarmType',
93 93 component: 'Input',
94 94 label: '报警类型',
  95 + required: true,
95 96 colProps: {
96 97 span: 12,
97 98 },
98   - required: true,
99 99 componentProps: {
100 100 placeholder: '请输入报警类型',
101 101 },
... ... @@ -113,6 +113,9 @@ export const step3HighSetting: FormSchema[] = [
113 113 field: 'propagateRelationTypes',
114 114 component: 'Input',
115 115 label: '关联类型',
  116 + colProps: {
  117 + span: 11,
  118 + },
116 119 componentProps: {
117 120 placeholder: '要传递的关联类型',
118 121 },
... ... @@ -127,6 +130,9 @@ export const step3CreateAlarm: FormSchema[] = [
127 130 field: '',
128 131 component: 'Select',
129 132 label: '严重程度',
  133 + colProps: {
  134 + span: 16,
  135 + },
130 136 componentProps: {
131 137 placeholder: '请选择严重程度',
132 138 options: [
... ... @@ -174,13 +180,12 @@ export const dashboardFormScheme: FormSchema[] = [
174 180 field: 'dashboardId',
175 181 component: 'Select',
176 182 label: 'Mobile dashboard:',
  183 + colProps: {
  184 + span: 15,
  185 + },
177 186 componentProps: {
178 187 placeholder: '请选择Mobile dashboard',
179   - options: [
180   - { label: 'DASHBOARD', value: 'DASHBOARD' },
181   - { label: 'DASHBOARD1', value: 'DASHBOARD' },
182   - { label: 'DASHBOARD2', value: 'DASHBOARD' },
183   - ],
  188 + options: [{ label: 'DASHBOARD', value: 'DASHBOARD' }],
184 189 },
185 190 },
186 191 ];
... ... @@ -213,6 +218,47 @@ export const alertContactsSchemas: FormSchema[] = [
213 218 },
214 219 ];
215 220
  221 +/**
  222 + * 所使用的枚举值
  223 + */
  224 +
  225 +export enum TriggerEnum {
  226 + IS_DEVICE_ACT = '属性',
  227 + IS_TIME_ACT = 'TIME_SERIES',
  228 + IS_SCENE_ACT = '常量',
  229 + IS_STRING = 'STRING',
  230 + IS_NUMERIC = 'NUMERIC',
  231 + IS_BOOLEAN = 'BOOLEAN',
  232 + IS_COMPLEX = 'COMPLEX',
  233 +}
  234 +
  235 +export const isShiDu = (type: string) => {
  236 + return type === TriggerEnum.IS_DEVICE_ACT;
  237 +};
  238 +export const isWenDu = (type: string) => {
  239 + return type === TriggerEnum.IS_TIME_ACT;
  240 +};
  241 +
  242 +export const isTimeAll = (type: string) => {
  243 + return type === TriggerEnum.IS_SCENE_ACT;
  244 +};
  245 +
  246 +export const isString = (type: string) => {
  247 + return type === TriggerEnum.IS_STRING;
  248 +};
  249 +
  250 +export const isNumeric = (type: string) => {
  251 + return type === TriggerEnum.IS_NUMERIC;
  252 +};
  253 +
  254 +export const isBoolean = (type: string) => {
  255 + return type === TriggerEnum.IS_BOOLEAN;
  256 +};
  257 +
  258 +export const isComplex = (type: string) => {
  259 + return type === TriggerEnum.IS_COMPLEX;
  260 +};
  261 +
216 262 export const echoFormSchema: FormSchema[] = [
217 263 {
218 264 field: 'type',
... ... @@ -243,6 +289,7 @@ export const echoFormSchema: FormSchema[] = [
243 289 { label: 'lastDisconnectTime', value: 'lastDisconnectTime' },
244 290 ],
245 291 },
  292 + ifShow: ({ values }) => isShiDu(Reflect.get(values, 'type')),
246 293 },
247 294 {
248 295 field: 'key',
... ... @@ -257,6 +304,7 @@ export const echoFormSchema: FormSchema[] = [
257 304 { label: 'wet', value: 'wet' },
258 305 ],
259 306 },
  307 + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'type')),
260 308 },
261 309 {
262 310 field: 'key',
... ... @@ -266,6 +314,7 @@ export const echoFormSchema: FormSchema[] = [
266 314 componentProps: {
267 315 placeholder: '请输入键名',
268 316 },
  317 + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')),
269 318 },
270 319 {
271 320 field: 'type1',
... ... @@ -298,6 +347,7 @@ export const echoFormSchema: FormSchema[] = [
298 347 { label: '不包含', value: 'NOT_CONTAINS' },
299 348 ],
300 349 },
  350 + ifShow: ({ values }) => isString(Reflect.get(values, 'type1')),
301 351 },
302 352 {
303 353 field: 'operation',
... ... @@ -315,6 +365,7 @@ export const echoFormSchema: FormSchema[] = [
315 365 { label: '小于或等于', value: 'LESS_OR_EQUAL' },
316 366 ],
317 367 },
  368 + ifShow: ({ values }) => isNumeric(Reflect.get(values, 'type1')),
318 369 },
319 370 {
320 371 field: 'operation',
... ... @@ -328,6 +379,7 @@ export const echoFormSchema: FormSchema[] = [
328 379 { label: '不等于', value: 'NOT_EQUAL' },
329 380 ],
330 381 },
  382 + ifShow: ({ values }) => isBoolean(Reflect.get(values, 'type1')),
331 383 },
332 384 {
333 385 field: 'operation',
... ... @@ -345,6 +397,7 @@ export const echoFormSchema: FormSchema[] = [
345 397 { label: '小于或等于', value: 'LESS_OR_EQUAL' },
346 398 ],
347 399 },
  400 + ifShow: ({ values }) => isComplex(Reflect.get(values, 'type1')),
348 401 },
349 402 {
350 403 field: 'value1',
... ...
1 1 <template>
2 2 <div>
3   - <PageWrapper title="修改当前用户密码" content="修改成功后会自动退出当前登录!" class="p-4">
  3 + <PageWrapper
  4 + title="第一次使用请修改当前用户密码,待修改完成后退出登录,才能使用本系统!"
  5 + content="修改成功后会自动退出当前登录!"
  6 + class="p-4"
  7 + >
4 8 <div class="py-8 bg-white flex flex-col justify-center items-center">
5 9 <BasicForm @register="register" />
6 10 <div class="flex justify-center">
... ...
... ... @@ -38,6 +38,7 @@
38 38 },
39 39 {
40 40 field: 'username',
  41 + required: true,
41 42 label: '账号',
42 43 component: 'Input',
43 44 dynamicRules: ({ values }) => {
... ...