Commit bf82116df7a175af4097914f1789f4f9c690ca49
Merge branch 'ft-dev' into 'main'
fix:修复修改密码和404 See merge request huang/yun-teng-iot-front!47
Showing
13 changed files
with
390 additions
and
228 deletions
| @@ -21,7 +21,7 @@ | @@ -21,7 +21,7 @@ | ||
| 21 | </transition> | 21 | </transition> |
| 22 | </template> | 22 | </template> |
| 23 | </RouterView> | 23 | </RouterView> |
| 24 | - <BasicModal | 24 | + <!-- <BasicModal |
| 25 | @register="register" | 25 | @register="register" |
| 26 | v-bind="$attrs" | 26 | v-bind="$attrs" |
| 27 | :mask="true" | 27 | :mask="true" |
| @@ -38,13 +38,13 @@ | @@ -38,13 +38,13 @@ | ||
| 38 | :keyboard="false" | 38 | :keyboard="false" |
| 39 | > | 39 | > |
| 40 | <PasswordDialog /> | 40 | <PasswordDialog /> |
| 41 | - </BasicModal> | 41 | + </BasicModal> --> |
| 42 | <FrameLayout v-if="getCanEmbedIFramePage" /> | 42 | <FrameLayout v-if="getCanEmbedIFramePage" /> |
| 43 | </template> | 43 | </template> |
| 44 | 44 | ||
| 45 | <script lang="ts"> | 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 | import FrameLayout from '/@/layouts/iframe/index.vue'; | 49 | import FrameLayout from '/@/layouts/iframe/index.vue'; |
| 50 | 50 | ||
| @@ -55,12 +55,12 @@ | @@ -55,12 +55,12 @@ | ||
| 55 | import { getTransitionName } from './transition'; | 55 | import { getTransitionName } from './transition'; |
| 56 | 56 | ||
| 57 | import { useMultipleTabStore } from '/@/store/modules/multipleTab'; | 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 | export default defineComponent({ | 61 | export default defineComponent({ |
| 62 | name: 'PageLayout', | 62 | name: 'PageLayout', |
| 63 | - components: { FrameLayout, BasicModal, PasswordDialog }, | 63 | + components: { FrameLayout }, |
| 64 | setup() { | 64 | setup() { |
| 65 | const { getShowMultipleTab } = useMultipleTabSetting(); | 65 | const { getShowMultipleTab } = useMultipleTabSetting(); |
| 66 | const tabStore = useMultipleTabStore(); | 66 | const tabStore = useMultipleTabStore(); |
| @@ -78,15 +78,15 @@ | @@ -78,15 +78,15 @@ | ||
| 78 | return tabStore.getCachedTabList; | 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 | onMounted(() => { | 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 | return { | 92 | return { |
| @@ -96,8 +96,8 @@ | @@ -96,8 +96,8 @@ | ||
| 96 | getBasicTransition, | 96 | getBasicTransition, |
| 97 | getCaches, | 97 | getCaches, |
| 98 | getCanEmbedIFramePage, | 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,24 +11,30 @@ import { RootRoute } from '/@/router/routes'; | ||
| 11 | 11 | ||
| 12 | import { router } from '/@/router'; | 12 | import { router } from '/@/router'; |
| 13 | import { getMenuList } from '/@/api/sys/menu'; | 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 | const LOGIN_PATH = PageEnum.BASE_LOGIN; | 18 | const LOGIN_PATH = PageEnum.BASE_LOGIN; |
| 16 | 19 | ||
| 17 | const ROOT_PATH = RootRoute.path; | 20 | const ROOT_PATH = RootRoute.path; |
| 18 | 21 | ||
| 19 | const whitePathList: PageEnum[] = [LOGIN_PATH]; | 22 | const whitePathList: PageEnum[] = [LOGIN_PATH]; |
| 23 | +// const userInfo1 = getAuthCache(USER_INFO_KEY); | ||
| 24 | +// const userInfo = ref(userInfo1); | ||
| 20 | 25 | ||
| 21 | export function createPermissionGuard(router: Router) { | 26 | export function createPermissionGuard(router: Router) { |
| 22 | const userStore = useUserStoreWithOut(); | 27 | const userStore = useUserStoreWithOut(); |
| 23 | const permissionStore = usePermissionStoreWithOut(); | 28 | const permissionStore = usePermissionStoreWithOut(); |
| 24 | router.beforeEach(async (to, from, next) => { | 29 | router.beforeEach(async (to, from, next) => { |
| 30 | + const userInfo1 = await getAuthCache(USER_INFO_KEY); | ||
| 31 | + const userInfo = ref(userInfo1); | ||
| 25 | if ( | 32 | if ( |
| 26 | from.path === ROOT_PATH && | 33 | from.path === ROOT_PATH && |
| 27 | to.path === PageEnum.BASE_HOME && | 34 | to.path === PageEnum.BASE_HOME && |
| 28 | userStore.getUserInfo.homePath && | 35 | userStore.getUserInfo.homePath && |
| 29 | userStore.getUserInfo.homePath !== PageEnum.BASE_HOME | 36 | userStore.getUserInfo.homePath !== PageEnum.BASE_HOME |
| 30 | ) { | 37 | ) { |
| 31 | - console.log('根路径'); | ||
| 32 | next(userStore.getUserInfo.homePath); | 38 | next(userStore.getUserInfo.homePath); |
| 33 | return; | 39 | return; |
| 34 | } | 40 | } |
| @@ -64,42 +70,87 @@ export function createPermissionGuard(router: Router) { | @@ -64,42 +70,87 @@ export function createPermissionGuard(router: Router) { | ||
| 64 | return; | 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 | // if (from.path === LOGIN_PATH) { | 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 | if ( | 129 | if ( |
| 74 | from.path === LOGIN_PATH && | 130 | from.path === LOGIN_PATH && |
| 75 | to.name === PAGE_NOT_FOUND_ROUTE.name && | 131 | to.name === PAGE_NOT_FOUND_ROUTE.name && |
| 76 | to.fullPath !== (userStore.getUserInfo.homePath || PageEnum.BASE_HOME) | 132 | to.fullPath !== (userStore.getUserInfo.homePath || PageEnum.BASE_HOME) |
| 77 | ) { | 133 | ) { |
| 134 | + // console.log('404页面', 'res'); | ||
| 78 | // Jump to the 404 page after processing the login | 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 | router.push(routeF); | 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 | next(userStore.getUserInfo.homePath || PageEnum.BASE_HOME); | 154 | next(userStore.getUserInfo.homePath || PageEnum.BASE_HOME); |
| 104 | return; | 155 | return; |
| 105 | } | 156 | } |
| @@ -76,3 +76,31 @@ export const ERROR_LOG_ROUTE: AppRouteRecordRaw = { | @@ -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,7 +16,9 @@ import { getMenuList } from '/@/api/sys/menu'; | ||
| 16 | import { getPermCode } from '/@/api/sys/user'; | 16 | import { getPermCode } from '/@/api/sys/user'; |
| 17 | import { useMessage } from '/@/hooks/web/useMessage'; | 17 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 18 | import { PageEnum } from '/@/enums/pageEnum'; | 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 | interface PermissionState { | 22 | interface PermissionState { |
| 21 | // Permission code list | 23 | // Permission code list |
| 22 | permCodeList: string[] | number[]; | 24 | permCodeList: string[] | number[]; |
| @@ -177,18 +179,55 @@ export const usePermissionStore = defineStore({ | @@ -177,18 +179,55 @@ export const usePermissionStore = defineStore({ | ||
| 177 | // this function may only need to be executed once, and the actual project can be put at the right time by itself | 179 | // this function may only need to be executed once, and the actual project can be put at the right time by itself |
| 178 | let routeList: AppRouteRecordRaw[] = []; | 180 | let routeList: AppRouteRecordRaw[] = []; |
| 179 | try { | 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 | } else { | 228 | } else { |
| 190 | - const route = routeList[0].path + ''; | ||
| 191 | - router.push(route); | 229 | + this.changePermissionCode(); |
| 230 | + routeList = (await getMenuList()) as AppRouteRecordRaw[]; | ||
| 192 | } | 231 | } |
| 193 | } catch (error) { | 232 | } catch (error) { |
| 194 | console.error(error); | 233 | console.error(error); |
| @@ -20,26 +20,43 @@ | @@ -20,26 +20,43 @@ | ||
| 20 | <BasicForm :showSubmitButton="false" :showResetButton="false" @register="registerTrans" | 20 | <BasicForm :showSubmitButton="false" :showResetButton="false" @register="registerTrans" |
| 21 | /></TabPane> | 21 | /></TabPane> |
| 22 | <TabPane key="3" tab="报警规则"> | 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 | </TabPane> | 60 | </TabPane> |
| 44 | <TabPane key="4" tab="告警管理"> | 61 | <TabPane key="4" tab="告警管理"> |
| 45 | <BasicForm :showSubmitButton="false" :showResetButton="false" @register="registerContact" | 62 | <BasicForm :showSubmitButton="false" :showResetButton="false" @register="registerContact" |
| @@ -61,8 +78,13 @@ | @@ -61,8 +78,13 @@ | ||
| 61 | step3HighSetting, | 78 | step3HighSetting, |
| 62 | step3CreateAlarm, | 79 | step3CreateAlarm, |
| 63 | alertContactsSchemas, | 80 | alertContactsSchemas, |
| 81 | + echoFormSchema, | ||
| 64 | } from './step/data'; | 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 | export default defineComponent({ | 88 | export default defineComponent({ |
| 67 | name: 'ConfigDrawer', | 89 | name: 'ConfigDrawer', |
| 68 | components: { Tabs, TabPane, BasicModal, BasicForm }, | 90 | components: { Tabs, TabPane, BasicModal, BasicForm }, |
| @@ -76,89 +98,111 @@ | @@ -76,89 +98,111 @@ | ||
| 76 | () => activeKey.value, | 98 | () => activeKey.value, |
| 77 | (v) => { | 99 | (v) => { |
| 78 | dataInfo.value = v; | 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 | schemas: step1Schemas, | 118 | schemas: step1Schemas, |
| 83 | actionColOptions: { | 119 | actionColOptions: { |
| 84 | span: 24, | 120 | span: 24, |
| 85 | }, | 121 | }, |
| 86 | }); | 122 | }); |
| 87 | - const [registerTrans, { setFieldsValue }] = useForm({ | 123 | + const [registerTrans, { setFieldsValue: setRegisterTrans }] = useForm({ |
| 88 | schemas: step2Schemas, | 124 | schemas: step2Schemas, |
| 89 | actionColOptions: { | 125 | actionColOptions: { |
| 90 | span: 24, | 126 | span: 24, |
| 91 | }, | 127 | }, |
| 92 | }); | 128 | }); |
| 93 | - const [registerStep3Schemas, { setFieldsValue }] = useForm({ | 129 | + const [registerStep3Schemas, { setFieldsValue: setRegisterStep3Schemas }] = useForm({ |
| 94 | schemas: step3Schemas, | 130 | schemas: step3Schemas, |
| 95 | actionColOptions: { | 131 | actionColOptions: { |
| 96 | span: 24, | 132 | span: 24, |
| 97 | }, | 133 | }, |
| 98 | }); | 134 | }); |
| 99 | - const [registerStep3HighSetting, { setFieldsValue }] = useForm({ | 135 | + const [registerStep3HighSetting, { setFieldsValue: setRegisterStep3HighSetting }] = useForm({ |
| 100 | schemas: step3HighSetting, | 136 | schemas: step3HighSetting, |
| 101 | actionColOptions: { | 137 | actionColOptions: { |
| 102 | span: 24, | 138 | span: 24, |
| 103 | }, | 139 | }, |
| 104 | }); | 140 | }); |
| 105 | - const [registerStep3CreateAlarm, { setFieldsValue }] = useForm({ | 141 | + const [registerStep3CreateAlarm, { setFieldsValue: setRegisterStep3CreateAlarm }] = useForm({ |
| 106 | schemas: step3CreateAlarm, | 142 | schemas: step3CreateAlarm, |
| 107 | actionColOptions: { | 143 | actionColOptions: { |
| 108 | span: 24, | 144 | span: 24, |
| 109 | }, | 145 | }, |
| 110 | }); | 146 | }); |
| 111 | - const [registerContact, { setFieldsValue }] = useForm({ | 147 | + const [registerContact, { setFieldsValue: setRegisterContact }] = useForm({ |
| 112 | schemas: alertContactsSchemas, | 148 | schemas: alertContactsSchemas, |
| 113 | actionColOptions: { | 149 | actionColOptions: { |
| 114 | span: 24, | 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 | actionColOptions: { | 161 | actionColOptions: { |
| 120 | span: 24, | 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 | const [register] = useModalInner(async (data) => { | 179 | const [register] = useModalInner(async (data) => { |
| 124 | activeKey.value = '1'; | 180 | activeKey.value = '1'; |
| 125 | isUpdate.value = !!data?.isUpdate; | 181 | isUpdate.value = !!data?.isUpdate; |
| 126 | descInfo.value = await deviceConfigGetDetail(data.record.id); | 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 | const getTitle = computed(() => { | 198 | const getTitle = computed(() => { |
| 158 | return '设备配置详情'; | 199 | return '设备配置详情'; |
| 159 | }); | 200 | }); |
| 160 | 201 | ||
| 161 | return { | 202 | return { |
| 203 | + registerStep3TemplateDetail, | ||
| 204 | + registerStep3Enable, | ||
| 205 | + registerStep3Condition, | ||
| 162 | registerStep3RuleAlarm, | 206 | registerStep3RuleAlarm, |
| 163 | registerContact, | 207 | registerContact, |
| 164 | registerStep3HighSetting, | 208 | registerStep3HighSetting, |
| @@ -330,9 +330,12 @@ | @@ -330,9 +330,12 @@ | ||
| 330 | }, | 330 | }, |
| 331 | ]; | 331 | ]; |
| 332 | const findDayByValue = findDay.map((f, i) => { | 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 |
src/views/device/profile/step/cpns/1.json
deleted
100644 → 0
| 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,7 +4,7 @@ export const formSchema: FormSchema[] = [ | ||
| 4 | { | 4 | { |
| 5 | field: 'alarmDetails', | 5 | field: 'alarmDetails', |
| 6 | label: '报警详细信息', | 6 | label: '报警详细信息', |
| 7 | - colProps: { span: 24 }, | 7 | + colProps: { span: 12 }, |
| 8 | required: true, | 8 | required: true, |
| 9 | component: 'Input', | 9 | component: 'Input', |
| 10 | componentProps: { | 10 | componentProps: { |
| @@ -25,7 +25,7 @@ export const formSchema: FormSchema[] = [ | @@ -25,7 +25,7 @@ export const formSchema: FormSchema[] = [ | ||
| 25 | { | 25 | { |
| 26 | field: 'schedule', | 26 | field: 'schedule', |
| 27 | label: '报警日程表', | 27 | label: '报警日程表', |
| 28 | - colProps: { span: 24 }, | 28 | + colProps: { span: 12 }, |
| 29 | required: true, | 29 | required: true, |
| 30 | component: 'Select', | 30 | component: 'Select', |
| 31 | componentProps: { | 31 | componentProps: { |
| @@ -40,7 +40,8 @@ export const formSchema: FormSchema[] = [ | @@ -40,7 +40,8 @@ export const formSchema: FormSchema[] = [ | ||
| 40 | { | 40 | { |
| 41 | field: 'timezone', | 41 | field: 'timezone', |
| 42 | label: '时区', | 42 | label: '时区', |
| 43 | - colProps: { span: 24 }, | 43 | + colProps: { span: 12 }, |
| 44 | + | ||
| 44 | required: true, | 45 | required: true, |
| 45 | component: 'Select', | 46 | component: 'Select', |
| 46 | componentProps: { | 47 | componentProps: { |
| @@ -57,7 +58,7 @@ export const formSchema: FormSchema[] = [ | @@ -57,7 +58,7 @@ export const formSchema: FormSchema[] = [ | ||
| 57 | }, | 58 | }, |
| 58 | 59 | ||
| 59 | { | 60 | { |
| 60 | - field: 'daysOfWeek', | 61 | + field: 'daysOfWeek1', |
| 61 | component: 'Checkbox', | 62 | component: 'Checkbox', |
| 62 | label: '星期一', | 63 | label: '星期一', |
| 63 | colProps: { | 64 | colProps: { |
| @@ -67,18 +68,18 @@ export const formSchema: FormSchema[] = [ | @@ -67,18 +68,18 @@ export const formSchema: FormSchema[] = [ | ||
| 67 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 68 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), |
| 68 | }, | 69 | }, |
| 69 | { | 70 | { |
| 70 | - field: 'startsOn', | 71 | + field: 'startsOn1', |
| 71 | component: 'TimePicker', | 72 | component: 'TimePicker', |
| 72 | - label: '时间选择', | 73 | + label: '开始时间选择', |
| 73 | colProps: { | 74 | colProps: { |
| 74 | span: 8, | 75 | span: 8, |
| 75 | }, | 76 | }, |
| 76 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 77 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), |
| 77 | }, | 78 | }, |
| 78 | { | 79 | { |
| 79 | - field: 'endsOn', | 80 | + field: 'endsOn1', |
| 80 | component: 'TimePicker', | 81 | component: 'TimePicker', |
| 81 | - label: '时间选择', | 82 | + label: '结束时间选择', |
| 82 | colProps: { | 83 | colProps: { |
| 83 | span: 8, | 84 | span: 8, |
| 84 | }, | 85 | }, |
| @@ -86,7 +87,7 @@ export const formSchema: FormSchema[] = [ | @@ -86,7 +87,7 @@ export const formSchema: FormSchema[] = [ | ||
| 86 | }, | 87 | }, |
| 87 | 88 | ||
| 88 | { | 89 | { |
| 89 | - field: 'daysOfWeek', | 90 | + field: 'daysOfWeek2', |
| 90 | component: 'Checkbox', | 91 | component: 'Checkbox', |
| 91 | label: '星期二', | 92 | label: '星期二', |
| 92 | colProps: { | 93 | colProps: { |
| @@ -96,25 +97,25 @@ export const formSchema: FormSchema[] = [ | @@ -96,25 +97,25 @@ export const formSchema: FormSchema[] = [ | ||
| 96 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 97 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), |
| 97 | }, | 98 | }, |
| 98 | { | 99 | { |
| 99 | - field: 'startsOn', | 100 | + field: 'startsOn2', |
| 100 | component: 'TimePicker', | 101 | component: 'TimePicker', |
| 101 | - label: '时间选择', | 102 | + label: '开始时间选择', |
| 102 | colProps: { | 103 | colProps: { |
| 103 | span: 8, | 104 | span: 8, |
| 104 | }, | 105 | }, |
| 105 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 106 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), |
| 106 | }, | 107 | }, |
| 107 | { | 108 | { |
| 108 | - field: 'endsOn', | 109 | + field: 'endsOn2', |
| 109 | component: 'TimePicker', | 110 | component: 'TimePicker', |
| 110 | - label: '时间选择', | 111 | + label: '结束时间选择', |
| 111 | colProps: { | 112 | colProps: { |
| 112 | span: 8, | 113 | span: 8, |
| 113 | }, | 114 | }, |
| 114 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 115 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), |
| 115 | }, | 116 | }, |
| 116 | { | 117 | { |
| 117 | - field: 'daysOfWeek', | 118 | + field: 'daysOfWeek3', |
| 118 | component: 'Checkbox', | 119 | component: 'Checkbox', |
| 119 | label: '星期三', | 120 | label: '星期三', |
| 120 | colProps: { | 121 | colProps: { |
| @@ -124,25 +125,25 @@ export const formSchema: FormSchema[] = [ | @@ -124,25 +125,25 @@ export const formSchema: FormSchema[] = [ | ||
| 124 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 125 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), |
| 125 | }, | 126 | }, |
| 126 | { | 127 | { |
| 127 | - field: 'startsOn', | 128 | + field: 'startsOn3', |
| 128 | component: 'TimePicker', | 129 | component: 'TimePicker', |
| 129 | - label: '时间选择', | 130 | + label: '开始时间选择', |
| 130 | colProps: { | 131 | colProps: { |
| 131 | span: 8, | 132 | span: 8, |
| 132 | }, | 133 | }, |
| 133 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 134 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), |
| 134 | }, | 135 | }, |
| 135 | { | 136 | { |
| 136 | - field: 'endsOn', | 137 | + field: 'endsOn3', |
| 137 | component: 'TimePicker', | 138 | component: 'TimePicker', |
| 138 | - label: '时间选择', | 139 | + label: '结束时间选择', |
| 139 | colProps: { | 140 | colProps: { |
| 140 | span: 8, | 141 | span: 8, |
| 141 | }, | 142 | }, |
| 142 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 143 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), |
| 143 | }, | 144 | }, |
| 144 | { | 145 | { |
| 145 | - field: 'daysOfWeek', | 146 | + field: 'daysOfWeek4', |
| 146 | component: 'Checkbox', | 147 | component: 'Checkbox', |
| 147 | label: '星期四', | 148 | label: '星期四', |
| 148 | colProps: { | 149 | colProps: { |
| @@ -152,25 +153,25 @@ export const formSchema: FormSchema[] = [ | @@ -152,25 +153,25 @@ export const formSchema: FormSchema[] = [ | ||
| 152 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 153 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), |
| 153 | }, | 154 | }, |
| 154 | { | 155 | { |
| 155 | - field: 'startsOn', | 156 | + field: 'startsOn4', |
| 156 | component: 'TimePicker', | 157 | component: 'TimePicker', |
| 157 | - label: '时间选择', | 158 | + label: '开始时间选择', |
| 158 | colProps: { | 159 | colProps: { |
| 159 | span: 8, | 160 | span: 8, |
| 160 | }, | 161 | }, |
| 161 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 162 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), |
| 162 | }, | 163 | }, |
| 163 | { | 164 | { |
| 164 | - field: 'endsOn', | 165 | + field: 'endsOn4', |
| 165 | component: 'TimePicker', | 166 | component: 'TimePicker', |
| 166 | - label: '时间选择', | 167 | + label: '结束时间选择', |
| 167 | colProps: { | 168 | colProps: { |
| 168 | span: 8, | 169 | span: 8, |
| 169 | }, | 170 | }, |
| 170 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 171 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), |
| 171 | }, | 172 | }, |
| 172 | { | 173 | { |
| 173 | - field: 'daysOfWeek', | 174 | + field: 'daysOfWeek5', |
| 174 | component: 'Checkbox', | 175 | component: 'Checkbox', |
| 175 | label: '星期五', | 176 | label: '星期五', |
| 176 | colProps: { | 177 | colProps: { |
| @@ -180,25 +181,25 @@ export const formSchema: FormSchema[] = [ | @@ -180,25 +181,25 @@ export const formSchema: FormSchema[] = [ | ||
| 180 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 181 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), |
| 181 | }, | 182 | }, |
| 182 | { | 183 | { |
| 183 | - field: 'startsOn', | 184 | + field: 'startsOn5', |
| 184 | component: 'TimePicker', | 185 | component: 'TimePicker', |
| 185 | - label: '时间选择', | 186 | + label: '开始时间选择', |
| 186 | colProps: { | 187 | colProps: { |
| 187 | span: 8, | 188 | span: 8, |
| 188 | }, | 189 | }, |
| 189 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 190 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), |
| 190 | }, | 191 | }, |
| 191 | { | 192 | { |
| 192 | - field: 'endsOn', | 193 | + field: 'endsOn5', |
| 193 | component: 'TimePicker', | 194 | component: 'TimePicker', |
| 194 | - label: '时间选择', | 195 | + label: '结束时间选择', |
| 195 | colProps: { | 196 | colProps: { |
| 196 | span: 8, | 197 | span: 8, |
| 197 | }, | 198 | }, |
| 198 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 199 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), |
| 199 | }, | 200 | }, |
| 200 | { | 201 | { |
| 201 | - field: 'daysOfWeek', | 202 | + field: 'daysOfWeek6', |
| 202 | component: 'Checkbox', | 203 | component: 'Checkbox', |
| 203 | label: '星期六', | 204 | label: '星期六', |
| 204 | colProps: { | 205 | colProps: { |
| @@ -208,25 +209,25 @@ export const formSchema: FormSchema[] = [ | @@ -208,25 +209,25 @@ export const formSchema: FormSchema[] = [ | ||
| 208 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 209 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), |
| 209 | }, | 210 | }, |
| 210 | { | 211 | { |
| 211 | - field: 'startsOn', | 212 | + field: 'startsOn6', |
| 212 | component: 'TimePicker', | 213 | component: 'TimePicker', |
| 213 | - label: '时间选择', | 214 | + label: '开始时间选择', |
| 214 | colProps: { | 215 | colProps: { |
| 215 | span: 8, | 216 | span: 8, |
| 216 | }, | 217 | }, |
| 217 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 218 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), |
| 218 | }, | 219 | }, |
| 219 | { | 220 | { |
| 220 | - field: 'endsOn', | 221 | + field: 'endsOn6', |
| 221 | component: 'TimePicker', | 222 | component: 'TimePicker', |
| 222 | - label: '时间选择', | 223 | + label: '结束时间选择', |
| 223 | colProps: { | 224 | colProps: { |
| 224 | span: 8, | 225 | span: 8, |
| 225 | }, | 226 | }, |
| 226 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 227 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), |
| 227 | }, | 228 | }, |
| 228 | { | 229 | { |
| 229 | - field: 'daysOfWeek', | 230 | + field: 'daysOfWeek7', |
| 230 | component: 'Checkbox', | 231 | component: 'Checkbox', |
| 231 | label: '星期七', | 232 | label: '星期七', |
| 232 | colProps: { | 233 | colProps: { |
| @@ -236,18 +237,18 @@ export const formSchema: FormSchema[] = [ | @@ -236,18 +237,18 @@ export const formSchema: FormSchema[] = [ | ||
| 236 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 237 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), |
| 237 | }, | 238 | }, |
| 238 | { | 239 | { |
| 239 | - field: 'startsOn', | 240 | + field: 'startsOn7', |
| 240 | component: 'TimePicker', | 241 | component: 'TimePicker', |
| 241 | - label: '时间选择', | 242 | + label: '开始时间选择', |
| 242 | colProps: { | 243 | colProps: { |
| 243 | span: 8, | 244 | span: 8, |
| 244 | }, | 245 | }, |
| 245 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 246 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), |
| 246 | }, | 247 | }, |
| 247 | { | 248 | { |
| 248 | - field: 'endsOn', | 249 | + field: 'endsOn7', |
| 249 | component: 'TimePicker', | 250 | component: 'TimePicker', |
| 250 | - label: '时间选择', | 251 | + label: '结束时间选择', |
| 251 | colProps: { | 252 | colProps: { |
| 252 | span: 8, | 253 | span: 8, |
| 253 | }, | 254 | }, |
| @@ -304,9 +305,9 @@ export const formSchema: FormSchema[] = [ | @@ -304,9 +305,9 @@ export const formSchema: FormSchema[] = [ | ||
| 304 | { | 305 | { |
| 305 | field: 'startsOn', | 306 | field: 'startsOn', |
| 306 | component: 'TimePicker', | 307 | component: 'TimePicker', |
| 307 | - label: '时间选择', | 308 | + label: '开始时间选择', |
| 308 | colProps: { | 309 | colProps: { |
| 309 | - span: 8, | 310 | + span: 12, |
| 310 | }, | 311 | }, |
| 311 | componentProps: { | 312 | componentProps: { |
| 312 | valueFormat: 'HH:mm:ss', | 313 | valueFormat: 'HH:mm:ss', |
| @@ -316,9 +317,9 @@ export const formSchema: FormSchema[] = [ | @@ -316,9 +317,9 @@ export const formSchema: FormSchema[] = [ | ||
| 316 | { | 317 | { |
| 317 | field: 'endsOn', | 318 | field: 'endsOn', |
| 318 | component: 'TimePicker', | 319 | component: 'TimePicker', |
| 319 | - label: '时间选择', | 320 | + label: '结束时间选择', |
| 320 | colProps: { | 321 | colProps: { |
| 321 | - span: 8, | 322 | + span: 12, |
| 322 | }, | 323 | }, |
| 323 | componentProps: { | 324 | componentProps: { |
| 324 | valueFormat: 'HH:mm:ss', | 325 | valueFormat: 'HH:mm:ss', |
| @@ -92,10 +92,10 @@ export const step3Schemas: FormSchema[] = [ | @@ -92,10 +92,10 @@ export const step3Schemas: FormSchema[] = [ | ||
| 92 | field: 'alarmType', | 92 | field: 'alarmType', |
| 93 | component: 'Input', | 93 | component: 'Input', |
| 94 | label: '报警类型', | 94 | label: '报警类型', |
| 95 | + required: true, | ||
| 95 | colProps: { | 96 | colProps: { |
| 96 | span: 12, | 97 | span: 12, |
| 97 | }, | 98 | }, |
| 98 | - required: true, | ||
| 99 | componentProps: { | 99 | componentProps: { |
| 100 | placeholder: '请输入报警类型', | 100 | placeholder: '请输入报警类型', |
| 101 | }, | 101 | }, |
| @@ -113,6 +113,9 @@ export const step3HighSetting: FormSchema[] = [ | @@ -113,6 +113,9 @@ export const step3HighSetting: FormSchema[] = [ | ||
| 113 | field: 'propagateRelationTypes', | 113 | field: 'propagateRelationTypes', |
| 114 | component: 'Input', | 114 | component: 'Input', |
| 115 | label: '关联类型', | 115 | label: '关联类型', |
| 116 | + colProps: { | ||
| 117 | + span: 11, | ||
| 118 | + }, | ||
| 116 | componentProps: { | 119 | componentProps: { |
| 117 | placeholder: '要传递的关联类型', | 120 | placeholder: '要传递的关联类型', |
| 118 | }, | 121 | }, |
| @@ -127,6 +130,9 @@ export const step3CreateAlarm: FormSchema[] = [ | @@ -127,6 +130,9 @@ export const step3CreateAlarm: FormSchema[] = [ | ||
| 127 | field: '', | 130 | field: '', |
| 128 | component: 'Select', | 131 | component: 'Select', |
| 129 | label: '严重程度', | 132 | label: '严重程度', |
| 133 | + colProps: { | ||
| 134 | + span: 16, | ||
| 135 | + }, | ||
| 130 | componentProps: { | 136 | componentProps: { |
| 131 | placeholder: '请选择严重程度', | 137 | placeholder: '请选择严重程度', |
| 132 | options: [ | 138 | options: [ |
| @@ -174,13 +180,12 @@ export const dashboardFormScheme: FormSchema[] = [ | @@ -174,13 +180,12 @@ export const dashboardFormScheme: FormSchema[] = [ | ||
| 174 | field: 'dashboardId', | 180 | field: 'dashboardId', |
| 175 | component: 'Select', | 181 | component: 'Select', |
| 176 | label: 'Mobile dashboard:', | 182 | label: 'Mobile dashboard:', |
| 183 | + colProps: { | ||
| 184 | + span: 15, | ||
| 185 | + }, | ||
| 177 | componentProps: { | 186 | componentProps: { |
| 178 | placeholder: '请选择Mobile dashboard', | 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,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 | export const echoFormSchema: FormSchema[] = [ | 262 | export const echoFormSchema: FormSchema[] = [ |
| 217 | { | 263 | { |
| 218 | field: 'type', | 264 | field: 'type', |
| @@ -243,6 +289,7 @@ export const echoFormSchema: FormSchema[] = [ | @@ -243,6 +289,7 @@ export const echoFormSchema: FormSchema[] = [ | ||
| 243 | { label: 'lastDisconnectTime', value: 'lastDisconnectTime' }, | 289 | { label: 'lastDisconnectTime', value: 'lastDisconnectTime' }, |
| 244 | ], | 290 | ], |
| 245 | }, | 291 | }, |
| 292 | + ifShow: ({ values }) => isShiDu(Reflect.get(values, 'type')), | ||
| 246 | }, | 293 | }, |
| 247 | { | 294 | { |
| 248 | field: 'key', | 295 | field: 'key', |
| @@ -257,6 +304,7 @@ export const echoFormSchema: FormSchema[] = [ | @@ -257,6 +304,7 @@ export const echoFormSchema: FormSchema[] = [ | ||
| 257 | { label: 'wet', value: 'wet' }, | 304 | { label: 'wet', value: 'wet' }, |
| 258 | ], | 305 | ], |
| 259 | }, | 306 | }, |
| 307 | + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'type')), | ||
| 260 | }, | 308 | }, |
| 261 | { | 309 | { |
| 262 | field: 'key', | 310 | field: 'key', |
| @@ -266,6 +314,7 @@ export const echoFormSchema: FormSchema[] = [ | @@ -266,6 +314,7 @@ export const echoFormSchema: FormSchema[] = [ | ||
| 266 | componentProps: { | 314 | componentProps: { |
| 267 | placeholder: '请输入键名', | 315 | placeholder: '请输入键名', |
| 268 | }, | 316 | }, |
| 317 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), | ||
| 269 | }, | 318 | }, |
| 270 | { | 319 | { |
| 271 | field: 'type1', | 320 | field: 'type1', |
| @@ -298,6 +347,7 @@ export const echoFormSchema: FormSchema[] = [ | @@ -298,6 +347,7 @@ export const echoFormSchema: FormSchema[] = [ | ||
| 298 | { label: '不包含', value: 'NOT_CONTAINS' }, | 347 | { label: '不包含', value: 'NOT_CONTAINS' }, |
| 299 | ], | 348 | ], |
| 300 | }, | 349 | }, |
| 350 | + ifShow: ({ values }) => isString(Reflect.get(values, 'type1')), | ||
| 301 | }, | 351 | }, |
| 302 | { | 352 | { |
| 303 | field: 'operation', | 353 | field: 'operation', |
| @@ -315,6 +365,7 @@ export const echoFormSchema: FormSchema[] = [ | @@ -315,6 +365,7 @@ export const echoFormSchema: FormSchema[] = [ | ||
| 315 | { label: '小于或等于', value: 'LESS_OR_EQUAL' }, | 365 | { label: '小于或等于', value: 'LESS_OR_EQUAL' }, |
| 316 | ], | 366 | ], |
| 317 | }, | 367 | }, |
| 368 | + ifShow: ({ values }) => isNumeric(Reflect.get(values, 'type1')), | ||
| 318 | }, | 369 | }, |
| 319 | { | 370 | { |
| 320 | field: 'operation', | 371 | field: 'operation', |
| @@ -328,6 +379,7 @@ export const echoFormSchema: FormSchema[] = [ | @@ -328,6 +379,7 @@ export const echoFormSchema: FormSchema[] = [ | ||
| 328 | { label: '不等于', value: 'NOT_EQUAL' }, | 379 | { label: '不等于', value: 'NOT_EQUAL' }, |
| 329 | ], | 380 | ], |
| 330 | }, | 381 | }, |
| 382 | + ifShow: ({ values }) => isBoolean(Reflect.get(values, 'type1')), | ||
| 331 | }, | 383 | }, |
| 332 | { | 384 | { |
| 333 | field: 'operation', | 385 | field: 'operation', |
| @@ -345,6 +397,7 @@ export const echoFormSchema: FormSchema[] = [ | @@ -345,6 +397,7 @@ export const echoFormSchema: FormSchema[] = [ | ||
| 345 | { label: '小于或等于', value: 'LESS_OR_EQUAL' }, | 397 | { label: '小于或等于', value: 'LESS_OR_EQUAL' }, |
| 346 | ], | 398 | ], |
| 347 | }, | 399 | }, |
| 400 | + ifShow: ({ values }) => isComplex(Reflect.get(values, 'type1')), | ||
| 348 | }, | 401 | }, |
| 349 | { | 402 | { |
| 350 | field: 'value1', | 403 | field: 'value1', |
| 1 | <template> | 1 | <template> |
| 2 | <div> | 2 | <div> |
| 3 | - <PageWrapper title="修改当前用户密码" content="修改成功后会自动退出当前登录!" class="p-4"> | 3 | + <PageWrapper |
| 4 | + title="第一次使用请修改当前用户密码,待修改完成后退出登录,才能使用本系统!" | ||
| 5 | + content="修改成功后会自动退出当前登录!" | ||
| 6 | + class="p-4" | ||
| 7 | + > | ||
| 4 | <div class="py-8 bg-white flex flex-col justify-center items-center"> | 8 | <div class="py-8 bg-white flex flex-col justify-center items-center"> |
| 5 | <BasicForm @register="register" /> | 9 | <BasicForm @register="register" /> |
| 6 | <div class="flex justify-center"> | 10 | <div class="flex justify-center"> |