Showing
35 changed files
with
1311 additions
and
617 deletions
| ... | ... | @@ -8,10 +8,10 @@ VITE_PUBLIC_PATH = / |
| 8 | 8 | # Please note that no line breaks |
| 9 | 9 | |
| 10 | 10 | # 本地 |
| 11 | -VITE_PROXY = [["/api","http://192.168.10.107:8080/api"]] | |
| 11 | +# VITE_PROXY = [["/api","http://192.168.10.147:8080/api"]] | |
| 12 | 12 | |
| 13 | 13 | # 线上 |
| 14 | -# VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]] | |
| 14 | +VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]] | |
| 15 | 15 | |
| 16 | 16 | # 实时数据的ws地址 |
| 17 | 17 | VITE_WEB_SOCKET = ws://101.133.234.90:8080/api/ws/plugins/telemetry?token= | ... | ... |
| ... | ... | @@ -17,10 +17,12 @@ enum Api { |
| 17 | 17 | export const getMenuList = () => { |
| 18 | 18 | const userStore = useUserStore(); |
| 19 | 19 | let url = Api.GetMenuList; |
| 20 | - if (userStore.getRoleList.find((v) => v == RoleEnum.SYS_ADMIN)) { | |
| 21 | - url = Api.SysAdminMenuList; | |
| 22 | - } | |
| 23 | - return defHttp.get<getMenuListResultModel>({ url }); | |
| 20 | + try { | |
| 21 | + if (userStore.getRoleList.find((v) => v == RoleEnum.SYS_ADMIN)) { | |
| 22 | + url = Api.SysAdminMenuList; | |
| 23 | + } | |
| 24 | + return defHttp.get<getMenuListResultModel>({ url }); | |
| 25 | + } catch (e) {} | |
| 24 | 26 | }; |
| 25 | 27 | |
| 26 | 28 | export const delMenu = (menuIds: string[]) => { | ... | ... |
src/assets/images/delete.png
0 → 100644
688 Bytes
| ... | ... | @@ -63,7 +63,7 @@ |
| 63 | 63 | document.createElement('link')) as HTMLLinkElement; |
| 64 | 64 | link.type = 'image/x-icon'; |
| 65 | 65 | link.rel = 'shortcut icon'; |
| 66 | - link.href = userStore.platInfo?.icon ?? '/public/favicon.ico'; | |
| 66 | + link.href = userStore.platInfo?.icon ?? '/favicon.ico'; | |
| 67 | 67 | document.getElementsByTagName('head')[0].appendChild(link); |
| 68 | 68 | return userStore.platInfo?.name ?? title; |
| 69 | 69 | }); | ... | ... |
| ... | ... | @@ -33,7 +33,7 @@ |
| 33 | 33 | :before-upload="beforeUploadqrcodePic" |
| 34 | 34 | > |
| 35 | 35 | <img |
| 36 | - style="text-align: center; border-radius: 50%; width: 8vw; height: 15vh" | |
| 36 | + style="text-align: center; border-radius: 50%; width: 8.5vw; height: 15.2vh" | |
| 37 | 37 | v-if="peresonalPic" |
| 38 | 38 | :src="peresonalPic" |
| 39 | 39 | alt="avatar" |
| ... | ... | @@ -92,7 +92,6 @@ |
| 92 | 92 | import { Upload } from 'ant-design-vue'; |
| 93 | 93 | import { PlusOutlined } from '@ant-design/icons-vue'; |
| 94 | 94 | import type { FileItem } from '/@/components/Upload/src/typing'; |
| 95 | - import { useUserStore } from '/@/store/modules/user'; | |
| 96 | 95 | |
| 97 | 96 | const schema: DescItem[] = [ |
| 98 | 97 | { |
| ... | ... | @@ -125,7 +124,6 @@ |
| 125 | 124 | components: { BasicModal, BasicForm, Description, Upload, PlusOutlined }, |
| 126 | 125 | emits: ['refreshPersonl', 'register'], |
| 127 | 126 | setup(_, { emit }) { |
| 128 | - // const userStore = useUserStore(); | |
| 129 | 127 | const userInfo = getAuthCache(USER_INFO_KEY); |
| 130 | 128 | const { createMessage } = useMessage(); |
| 131 | 129 | const getPersonalValue: any = ref({}); |
| ... | ... | @@ -177,7 +175,6 @@ |
| 177 | 175 | |
| 178 | 176 | const [registerModal, { closeModal }] = useModalInner(async (data) => { |
| 179 | 177 | refreshCacheGetData(); |
| 180 | - console.log(updataPersonlData.value); | |
| 181 | 178 | try { |
| 182 | 179 | if (updataPersonlData.value != null) { |
| 183 | 180 | (peresonalPic.value = updataPersonlData.value.avatar), |
| ... | ... | @@ -246,7 +243,7 @@ |
| 246 | 243 | </script> |
| 247 | 244 | <style scoped lang="less"> |
| 248 | 245 | .change-avatar { |
| 249 | - /deep/ .ant-upload-select-picture-card { | |
| 246 | + :deep .ant-upload-select-picture-card { | |
| 250 | 247 | display: inherit; |
| 251 | 248 | float: none; |
| 252 | 249 | width: 8.6vw; | ... | ... |
| ... | ... | @@ -30,6 +30,7 @@ export function createPermissionGuard(router: Router) { |
| 30 | 30 | userStore.getUserInfo.homePath && |
| 31 | 31 | userStore.getUserInfo.homePath !== PageEnum.BASE_HOME |
| 32 | 32 | ) { |
| 33 | + console.log(userStore.getUserInfo.homePath); | |
| 33 | 34 | next(userStore.getUserInfo.homePath); |
| 34 | 35 | return; |
| 35 | 36 | } | ... | ... |
| ... | ... | @@ -4,8 +4,6 @@ import { mainOutRoutes } from './mainOut'; |
| 4 | 4 | import { PageEnum } from '/@/enums/pageEnum'; |
| 5 | 5 | import { t } from '/@/hooks/web/useI18n'; |
| 6 | 6 | import { LAYOUT } from '../constant'; |
| 7 | -import { getMenuList } from '/@/api/sys/menu'; | |
| 8 | -import { router } from '/@/router'; | |
| 9 | 7 | |
| 10 | 8 | const modules = import.meta.globEager('./modules/**/*.ts'); |
| 11 | 9 | const routeModuleList: AppRouteModule[] = []; |
| ... | ... | @@ -14,40 +12,6 @@ Object.keys(modules).forEach((key) => { |
| 14 | 12 | const modList = Array.isArray(mod) ? [...mod] : [mod]; |
| 15 | 13 | routeModuleList.push(...modList); |
| 16 | 14 | }); |
| 17 | -let pushPath = ''; | |
| 18 | -let pushSubPath = ''; | |
| 19 | - | |
| 20 | -async function hashChangeFunc() { | |
| 21 | - const getMenuListData1 = window.localStorage.getItem('menuListStorage') || (await getMenuList()); | |
| 22 | - const getMenuListData = JSON.parse(getMenuListData1); | |
| 23 | - const getHomePage = getMenuListData.find((f) => { | |
| 24 | - return f.path == '/dashboard/workbench'; | |
| 25 | - }); | |
| 26 | - if (getHomePage?.path == '/dashboard/workbench') { | |
| 27 | - setTimeout(() => { | |
| 28 | - router.push('/dashboard/workbench'); | |
| 29 | - }, 200); | |
| 30 | - } else { | |
| 31 | - const routeF = getMenuListData[0]?.children[0]?.path || getMenuListData[0].path; | |
| 32 | - pushPath = routeF; | |
| 33 | - pushSubPath = pushPath.substring(1); | |
| 34 | - } | |
| 35 | -} | |
| 36 | -hashChangeFunc(); | |
| 37 | - | |
| 38 | -window.onhashchange = (e) => { | |
| 39 | - console.log(e); | |
| 40 | - setTimeout(() => { | |
| 41 | - if ( | |
| 42 | - e.newURL == 'http://localhost:8083/#/' || | |
| 43 | - e.newURL == 'http://localhost:8083/#' || | |
| 44 | - e.newURL == 'http://localhost:8083/' || | |
| 45 | - e.newURL == 'http://localhost:8083' | |
| 46 | - ) { | |
| 47 | - window.location.href = e.newURL + pushSubPath; | |
| 48 | - } | |
| 49 | - }, 1000); | |
| 50 | -}; | |
| 51 | 15 | |
| 52 | 16 | export const asyncRoutes = [PAGE_NOT_FOUND_ROUTE, ...routeModuleList]; |
| 53 | 17 | export const RootRoute: AppRouteRecordRaw = { | ... | ... |
| ... | ... | @@ -122,7 +122,6 @@ const transform: AxiosTransform = { |
| 122 | 122 | const err: string = error?.toString?.() ?? ''; |
| 123 | 123 | let errMessage = ''; |
| 124 | 124 | try { |
| 125 | - console.log(response.data); | |
| 126 | 125 | if (response.data.status == '401' || response.data.message == '"Authentication failed"') { |
| 127 | 126 | window.localStorage.clear(); |
| 128 | 127 | window.sessionStorage.clear(); | ... | ... |
| ... | ... | @@ -281,13 +281,13 @@ |
| 281 | 281 | .noticeTitle:hover { |
| 282 | 282 | border-bottom: 1px solid #ccc; |
| 283 | 283 | } |
| 284 | - :deep().ant-anchor-link-active > .ant-anchor-link-title { | |
| 284 | + :deep.ant-anchor-link-active > .ant-anchor-link-title { | |
| 285 | 285 | color: #666; |
| 286 | 286 | } |
| 287 | - :deep().ant-pagination-prev { | |
| 287 | + :deep.ant-pagination-prev { | |
| 288 | 288 | display: none; |
| 289 | 289 | } |
| 290 | - :deep().ant-pagination-next { | |
| 290 | + :deep.ant-pagination-next { | |
| 291 | 291 | display: none; |
| 292 | 292 | } |
| 293 | 293 | </style> | ... | ... |
| ... | ... | @@ -65,7 +65,14 @@ |
| 65 | 65 | props: { |
| 66 | 66 | userData: { type: Object }, |
| 67 | 67 | }, |
| 68 | - emits: ['success', 'register'], | |
| 68 | + emits: [ | |
| 69 | + 'success', | |
| 70 | + 'register', | |
| 71 | + 'handleStepPrev', | |
| 72 | + 'handleStep3Next', | |
| 73 | + 'handleRedo', | |
| 74 | + 'handleStep2Next', | |
| 75 | + ], | |
| 69 | 76 | setup(_, { emit }) { |
| 70 | 77 | const DeviceProfileStep1Ref = ref(null); |
| 71 | 78 | const DeviceProfileStep2Ref = ref(null); |
| ... | ... | @@ -133,11 +140,9 @@ |
| 133 | 140 | current.value--; |
| 134 | 141 | } |
| 135 | 142 | function handleStepNext1(v, v1) { |
| 136 | - console.log(v, v1); | |
| 137 | 143 | current.value++; |
| 138 | 144 | getStepOneData.value = v; |
| 139 | 145 | getStepOneData.value.icon = v1; |
| 140 | - console.log(getStepOneData.value); | |
| 141 | 146 | if (unref(isUpdate)) { |
| 142 | 147 | proxy.$refs.DeviceProfileStep2Ref.resetFieldsFunc({ |
| 143 | 148 | transportType: editEchoData.value.profileData.transportConfiguration.type, |
| ... | ... | @@ -148,7 +153,6 @@ |
| 148 | 153 | } |
| 149 | 154 | function handleStep2Next(v) { |
| 150 | 155 | current.value++; |
| 151 | - | |
| 152 | 156 | getStepTwoData.value = v; |
| 153 | 157 | if (unref(isUpdate)) { |
| 154 | 158 | proxy.$refs.DeviceProfileStep3Ref.retryRegisterFormFunc({ |
| ... | ... | @@ -157,7 +161,7 @@ |
| 157 | 161 | proxy.$refs.DeviceProfileStep3Ref.retryRegisterFormHighSettingmFunc({ |
| 158 | 162 | propagate: editEchoData.value.profileData.alarms[0].propagate, |
| 159 | 163 | propagateRelationTypes: |
| 160 | - editEchoData.value.profileData?.alarms[0].propagateRelationTypes, | |
| 164 | + editEchoData.value.profileData?.alarms[0].propagateRelationTypes[0], | |
| 161 | 165 | }); |
| 162 | 166 | const getKey = Object.keys(editEchoData.value.profileData?.alarms[0].createRules); |
| 163 | 167 | proxy.$refs.DeviceProfileStep3Ref.retryRegisterFormCreateAlarmFunc({ |
| ... | ... | @@ -207,13 +211,11 @@ |
| 207 | 211 | ` |
| 208 | 212 | ); |
| 209 | 213 | proxy.$refs.DeviceProfileStep3Ref.retryEnableFormDataFunc(`始终启用`); |
| 210 | - proxy.$refs.DeviceProfileStep3Ref.retryTemplateFormDataFunc( | |
| 211 | - ` | |
| 212 | - 报警详细信息:${ | |
| 213 | - editEchoData.value.profileData?.alarms[0].createRules[getKey[0]].alarmDetails | |
| 214 | - } | |
| 215 | - ` | |
| 216 | - ); | |
| 214 | + proxy.$refs.DeviceProfileStep3Ref.setRegisterFormChangeDetailFunc({ | |
| 215 | + alarmDetails: | |
| 216 | + editEchoData.value.profileData?.alarms[0].createRules[getKey[0]].alarmDetails, | |
| 217 | + }); | |
| 218 | + | |
| 217 | 219 | //清除报警 |
| 218 | 220 | proxy.$refs.DeviceProfileStep3Ref.retryRulesClearFormDataFunc( |
| 219 | 221 | ` |
| ... | ... | @@ -221,21 +223,23 @@ |
| 221 | 223 | ` |
| 222 | 224 | ); |
| 223 | 225 | proxy.$refs.DeviceProfileStep3Ref.retryEnableClearFormDataFunc(`始终启用`); |
| 224 | - proxy.$refs.DeviceProfileStep3Ref.retryTemplateClearFormDataFunc( | |
| 225 | - ` | |
| 226 | - 报警详细信息:${editEchoData.value.profileData?.alarms[0].clearRule.alarmDetails} | |
| 227 | - ` | |
| 228 | - ); | |
| 226 | + proxy.$refs.DeviceProfileStep3Ref.setRegisterFormClearChangeDetailFunc({ | |
| 227 | + alarmDetails: editEchoData.value.profileData?.alarms[0].clearRule.alarmDetails, | |
| 228 | + }); | |
| 229 | 229 | } else { |
| 230 | - proxy.$refs.DeviceProfileStep3Ref.resetRegisterFormFunc(); | |
| 231 | - proxy.$refs.DeviceProfileStep3Ref.resetRegisterFormHighSettingmFunc(); | |
| 232 | - proxy.$refs.DeviceProfileStep3Ref.resetRegisterFormCreateAlarmFunc(); | |
| 233 | - proxy.$refs.DeviceProfileStep3Ref.resetRulesFormDataFunc(); | |
| 234 | - proxy.$refs.DeviceProfileStep3Ref.resetEnableFormDataFunc(); | |
| 235 | - proxy.$refs.DeviceProfileStep3Ref.resetTemplateFormDataFunc(); | |
| 236 | - proxy.$refs.DeviceProfileStep3Ref.resetRulesClearFormDataFunc(); | |
| 237 | - proxy.$refs.DeviceProfileStep3Ref.resetEnableClearFormDataFunc(); | |
| 238 | - proxy.$refs.DeviceProfileStep3Ref.resetTemplateClearFormDataFunc(); | |
| 230 | + try { | |
| 231 | + proxy.$refs.DeviceProfileStep3Ref.resetRegisterFormFunc(); | |
| 232 | + proxy.$refs.DeviceProfileStep3Ref.resetRegisterFormHighSettingmFunc(); | |
| 233 | + proxy.$refs.DeviceProfileStep3Ref.resetRegisterFormCreateAlarmFunc(); | |
| 234 | + proxy.$refs.DeviceProfileStep3Ref.resetRulesFormDataFunc(); | |
| 235 | + proxy.$refs.DeviceProfileStep3Ref.resetEnableFormDataFunc(); | |
| 236 | + proxy.$refs.DeviceProfileStep3Ref.resetTemplateFormDataFunc(); | |
| 237 | + proxy.$refs.DeviceProfileStep3Ref.resetRulesClearFormDataFunc(); | |
| 238 | + proxy.$refs.DeviceProfileStep3Ref.resetEnableClearFormDataFunc(); | |
| 239 | + proxy.$refs.DeviceProfileStep3Ref.resetTemplateClearFormDataFunc(); | |
| 240 | + proxy.$refs.DeviceProfileStep3Ref.resetRegisterFormChangeDetailFunc(); | |
| 241 | + proxy.$refs.DeviceProfileStep3Ref.resetRegisterFormClearChangeDetailFunc(); | |
| 242 | + } catch (e) {} | |
| 239 | 243 | } |
| 240 | 244 | } |
| 241 | 245 | function handleStep3Next(v) { |
| ... | ... | @@ -243,18 +247,24 @@ |
| 243 | 247 | getStepThreeData.value = v; |
| 244 | 248 | try { |
| 245 | 249 | if (unref(isUpdate)) { |
| 246 | - setTimeout(() => { | |
| 250 | + try { | |
| 247 | 251 | proxy.$refs.DeviceProfileStep4Ref.resetFieldsFunc({ |
| 248 | 252 | alarmContactId: editEchoData.value.alarmProfile.alarmContactId, |
| 249 | 253 | messageMode: editEchoData.value.alarmProfile.messageMode, |
| 250 | 254 | }); |
| 251 | - }, 1000); | |
| 255 | + } catch (e) { | |
| 256 | + return e; | |
| 257 | + } | |
| 258 | + } else { | |
| 259 | + try { | |
| 260 | + proxy.$refs.DeviceProfileStep4Ref.resetFieldsFunc({ | |
| 261 | + alarmContactId: '', | |
| 262 | + messageMode: '', | |
| 263 | + }); | |
| 264 | + } catch (e) { | |
| 265 | + return e; | |
| 266 | + } | |
| 252 | 267 | } |
| 253 | - // if (!unref(isUpdate)) { | |
| 254 | - // setTimeout(() => { | |
| 255 | - // proxy.$refs.DeviceProfileStep4Ref.customResetAndFunc(); | |
| 256 | - // }, 1000); | |
| 257 | - // } | |
| 258 | 268 | } catch (e) { |
| 259 | 269 | return e; |
| 260 | 270 | } |
| ... | ... | @@ -298,7 +308,7 @@ |
| 298 | 308 | } |
| 299 | 309 | }; |
| 300 | 310 | const handleCancel = () => { |
| 301 | - return; | |
| 311 | + closeModal(); | |
| 302 | 312 | }; |
| 303 | 313 | return { |
| 304 | 314 | handleChange, | ... | ... |
| ... | ... | @@ -10,7 +10,7 @@ |
| 10 | 10 | components: { BasicForm }, |
| 11 | 11 | setup() { |
| 12 | 12 | const getValueData: any = ref({}); |
| 13 | - const [register, { setProps, getFieldsValue }] = useForm({ | |
| 13 | + const [register, { getFieldsValue, resetFields }] = useForm({ | |
| 14 | 14 | schemas: alertContactsSchemas, |
| 15 | 15 | actionColOptions: { |
| 16 | 16 | span: 24, |
| ... | ... | @@ -22,10 +22,13 @@ |
| 22 | 22 | getV = getValueData.value; |
| 23 | 23 | return getV; |
| 24 | 24 | } |
| 25 | + const customResetStep4AndFunc = () => { | |
| 26 | + resetFields(); | |
| 27 | + }; | |
| 25 | 28 | return { |
| 29 | + customResetStep4AndFunc, | |
| 26 | 30 | getAllFields, |
| 27 | 31 | register, |
| 28 | - setProps, | |
| 29 | 32 | }; |
| 30 | 33 | }, |
| 31 | 34 | }); | ... | ... |
| 1 | 1 | <template> |
| 2 | 2 | <div> |
| 3 | 3 | <BasicModal |
| 4 | - :showCancelBtn="true" | |
| 4 | + :showCancelBtn="false" | |
| 5 | 5 | :showOkBtn="false" |
| 6 | 6 | v-bind="$attrs" |
| 7 | 7 | width="55rem" |
| ... | ... | @@ -140,72 +140,111 @@ |
| 140 | 140 | span: 24, |
| 141 | 141 | }, |
| 142 | 142 | }); |
| 143 | - const [registerStep3Schemas, { setFieldsValue: setRegisterStep3Schemas }] = useForm({ | |
| 143 | + const [ | |
| 144 | + registerStep3Schemas, | |
| 145 | + { setFieldsValue: setRegisterStep3Schemas, resetFields: resetFieldsStep3Schemas }, | |
| 146 | + ] = useForm({ | |
| 144 | 147 | schemas: step3Schemas, |
| 145 | 148 | actionColOptions: { |
| 146 | 149 | span: 24, |
| 147 | 150 | }, |
| 148 | 151 | }); |
| 149 | - const [registerStep3HighSetting, { setFieldsValue: setRegisterStep3HighSetting }] = useForm({ | |
| 152 | + const [ | |
| 153 | + registerStep3HighSetting, | |
| 154 | + { setFieldsValue: setRegisterStep3HighSetting, resetFields: resetFieldsStep3HighSetting }, | |
| 155 | + ] = useForm({ | |
| 150 | 156 | schemas: step3ViewHighSetting, |
| 151 | 157 | actionColOptions: { |
| 152 | 158 | span: 24, |
| 153 | 159 | }, |
| 154 | 160 | }); |
| 155 | - const [registerStep3CreateAlarm, { setFieldsValue: setRegisterStep3CreateAlarm }] = useForm({ | |
| 161 | + const [ | |
| 162 | + registerStep3CreateAlarm, | |
| 163 | + { setFieldsValue: setRegisterStep3CreateAlarm, resetFields: resetFieldsStep3CreateAlarm }, | |
| 164 | + ] = useForm({ | |
| 156 | 165 | schemas: step3CreateAlarm, |
| 157 | 166 | actionColOptions: { |
| 158 | 167 | span: 24, |
| 159 | 168 | }, |
| 160 | 169 | }); |
| 161 | - const [registerContact, { setFieldsValue: setRegisterContact }] = useForm({ | |
| 170 | + const [ | |
| 171 | + registerContact, | |
| 172 | + { setFieldsValue: setRegisterContact, resetFields: resetFieldsContact }, | |
| 173 | + ] = useForm({ | |
| 162 | 174 | schemas: alertContactsSchemas, |
| 163 | 175 | actionColOptions: { |
| 164 | 176 | span: 24, |
| 165 | 177 | }, |
| 166 | 178 | }); |
| 167 | - const [registerStep3RuleAlarm, { setFieldsValue: setRegisterStep3RuleAlarm }] = useForm({ | |
| 179 | + const [ | |
| 180 | + registerStep3RuleAlarm, | |
| 181 | + { setFieldsValue: setRegisterStep3RuleAlarm, resetFields: resetFieldsStep3RuleAlarm }, | |
| 182 | + ] = useForm({ | |
| 168 | 183 | schemas: echoFormSchema, |
| 169 | 184 | actionColOptions: { |
| 170 | 185 | span: 24, |
| 171 | 186 | }, |
| 172 | 187 | }); |
| 173 | - const [registerStep3Condition, { setFieldsValue: setRegisterStep3Condition }] = useForm({ | |
| 188 | + const [ | |
| 189 | + registerStep3Condition, | |
| 190 | + { setFieldsValue: setRegisterStep3Condition, resetFields: resetFieldsrStep3Condition }, | |
| 191 | + ] = useForm({ | |
| 174 | 192 | schemas: conditionFormSchema, |
| 175 | 193 | actionColOptions: { |
| 176 | 194 | span: 24, |
| 177 | 195 | }, |
| 178 | 196 | }); |
| 179 | - const [registerStep3Enable, { setFieldsValue: setRegisterStep3Enable }] = useForm({ | |
| 197 | + const [ | |
| 198 | + registerStep3Enable, | |
| 199 | + { setFieldsValue: setRegisterStep3Enable, resetFields: resetFieldsStep3Enable }, | |
| 200 | + ] = useForm({ | |
| 180 | 201 | schemas: enableSchema, |
| 181 | 202 | actionColOptions: { |
| 182 | 203 | span: 24, |
| 183 | 204 | }, |
| 184 | 205 | }); |
| 185 | - const [registerStep3TemplateDetail, { setFieldsValue: setRegisterStep3TemplateDetail }] = | |
| 186 | - useForm({ | |
| 187 | - schemas: detailSchema, | |
| 188 | - actionColOptions: { | |
| 189 | - span: 24, | |
| 190 | - }, | |
| 191 | - }); | |
| 206 | + const [ | |
| 207 | + registerStep3TemplateDetail, | |
| 208 | + { | |
| 209 | + setFieldsValue: setRegisterStep3TemplateDetail, | |
| 210 | + resetFields: resetFieldsStep3TemplateDetail, | |
| 211 | + }, | |
| 212 | + ] = useForm({ | |
| 213 | + schemas: detailSchema, | |
| 214 | + actionColOptions: { | |
| 215 | + span: 24, | |
| 216 | + }, | |
| 217 | + }); | |
| 192 | 218 | |
| 193 | 219 | //清除报警 |
| 194 | - const [registerStep3ClearRuleAlarm, { setFieldsValue: setRegisterStep3ClearRuleAlarm }] = | |
| 195 | - useForm({ | |
| 196 | - schemas: echoFormClearSchema, | |
| 197 | - actionColOptions: { | |
| 198 | - span: 24, | |
| 199 | - }, | |
| 200 | - }); | |
| 201 | - const [registerStep3ClearCondition, { setFieldsValue: setRegisterStep3ClearCondition }] = | |
| 202 | - useForm({ | |
| 203 | - schemas: conditionFormClearschema, | |
| 204 | - actionColOptions: { | |
| 205 | - span: 24, | |
| 206 | - }, | |
| 207 | - }); | |
| 208 | - const [registerStep3ClearEnable, { setFieldsValue: setRegisterStep3ClearEnable }] = useForm({ | |
| 220 | + const [ | |
| 221 | + registerStep3ClearRuleAlarm, | |
| 222 | + { | |
| 223 | + setFieldsValue: setRegisterStep3ClearRuleAlarm, | |
| 224 | + resetFields: resetFieldsStep3ClearRuleAlarm, | |
| 225 | + }, | |
| 226 | + ] = useForm({ | |
| 227 | + schemas: echoFormClearSchema, | |
| 228 | + actionColOptions: { | |
| 229 | + span: 24, | |
| 230 | + }, | |
| 231 | + }); | |
| 232 | + const [ | |
| 233 | + registerStep3ClearCondition, | |
| 234 | + { | |
| 235 | + setFieldsValue: setRegisterStep3ClearCondition, | |
| 236 | + resetFields: resetFieldsStep3ClearCondition, | |
| 237 | + }, | |
| 238 | + ] = useForm({ | |
| 239 | + schemas: conditionFormClearschema, | |
| 240 | + actionColOptions: { | |
| 241 | + span: 24, | |
| 242 | + }, | |
| 243 | + }); | |
| 244 | + const [ | |
| 245 | + registerStep3ClearEnable, | |
| 246 | + { setFieldsValue: setRegisterStep3ClearEnable, resetFields: resetFieldStep3ClearEnablel }, | |
| 247 | + ] = useForm({ | |
| 209 | 248 | schemas: enableClearSchema, |
| 210 | 249 | actionColOptions: { |
| 211 | 250 | span: 24, |
| ... | ... | @@ -213,7 +252,10 @@ |
| 213 | 252 | }); |
| 214 | 253 | const [ |
| 215 | 254 | registerStep3ClearTemplateDetail, |
| 216 | - { setFieldsValue: setRegisterStep3ClearTemplateDetail }, | |
| 255 | + { | |
| 256 | + setFieldsValue: setRegisterStep3ClearTemplateDetail, | |
| 257 | + resetFields: resetFieldStep3ClearTemplateDetail, | |
| 258 | + }, | |
| 217 | 259 | ] = useForm({ |
| 218 | 260 | schemas: detailClearSchema, |
| 219 | 261 | actionColOptions: { |
| ... | ... | @@ -246,80 +288,113 @@ |
| 246 | 288 | break; |
| 247 | 289 | case '3': |
| 248 | 290 | setTimeout(() => { |
| 249 | - setRegisterStep3Schemas({ | |
| 250 | - alarmType: descInfo.value.profileData?.alarms[0]?.alarmType, | |
| 251 | - }); | |
| 252 | - setRegisterStep3HighSetting({ | |
| 253 | - propagate: descInfo.value.profileData?.alarms[0]?.propagate, | |
| 254 | - propagateRelationTypes: | |
| 255 | - descInfo.value.profileData?.alarms[0]?.propagateRelationTypes, | |
| 256 | - }); | |
| 257 | - const getKey = Object.keys(descInfo.value.profileData?.alarms[0]?.createRules); | |
| 258 | - setRegisterStep3CreateAlarm({ | |
| 259 | - default: getKey[0], | |
| 260 | - }); | |
| 261 | - setRegisterStep3RuleAlarm({ | |
| 262 | - type: descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | |
| 263 | - .condition[0].key.type, | |
| 264 | - key1: descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | |
| 265 | - .condition[0].key.key, | |
| 266 | - type1: | |
| 267 | - descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | |
| 268 | - .condition[0].valueType, | |
| 269 | - value1: | |
| 270 | - descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | |
| 271 | - .condition[0].predicate.value.defaultValue, | |
| 272 | - operation: | |
| 273 | - descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | |
| 274 | - .condition[0].predicate.operation, | |
| 275 | - }); | |
| 276 | - setRegisterStep3Condition({ | |
| 277 | - conditionType: | |
| 278 | - descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition.spec | |
| 291 | + resetFieldsStep3SchemasFunc(); | |
| 292 | + resetFieldsStep3HighSettingFunc(); | |
| 293 | + resetFieldsStep3CreateAlarmFunc(); | |
| 294 | + resetFieldsStep3RuleAlarmFunc(); | |
| 295 | + resetFieldsStep3RuleAlarmFunc1(); | |
| 296 | + resetFieldsrStep3ConditionFunc(); | |
| 297 | + resetFieldsStep3EnableFunc(); | |
| 298 | + resetFieldsStep3TemplateDetailFunc(); | |
| 299 | + resetFieldsStep3ClearRuleAlarmFunc(); | |
| 300 | + resetFieldsStep3ClearRuleAlarmlFunc(); | |
| 301 | + resetFieldsStep3ClearConditionFunc(); | |
| 302 | + resetFieldStep3ClearEnablelFunc(); | |
| 303 | + resetFieldStep3ClearTemplateDetailFunc(); | |
| 304 | + }, 100); | |
| 305 | + setTimeout(() => { | |
| 306 | + try { | |
| 307 | + setRegisterStep3Schemas({ | |
| 308 | + alarmType: descInfo.value.profileData?.alarms[0]?.alarmType, | |
| 309 | + }); | |
| 310 | + } catch (e) { | |
| 311 | + return e; | |
| 312 | + } | |
| 313 | + | |
| 314 | + try { | |
| 315 | + setRegisterStep3HighSetting({ | |
| 316 | + propagate: descInfo.value.profileData?.alarms[0]?.propagate, | |
| 317 | + propagateRelationTypes: | |
| 318 | + descInfo.value.profileData?.alarms[0]?.propagateRelationTypes[0], | |
| 319 | + }); | |
| 320 | + const getKey = Object.keys(descInfo.value.profileData?.alarms[0]?.createRules); | |
| 321 | + setRegisterStep3CreateAlarm({ | |
| 322 | + default: getKey[0], | |
| 323 | + }); | |
| 324 | + setRegisterStep3RuleAlarm({ | |
| 325 | + type: descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | |
| 326 | + .condition[0].key.type, | |
| 327 | + key1: descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | |
| 328 | + .condition[0].key.key, | |
| 329 | + type1: | |
| 330 | + descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | |
| 331 | + .condition[0].valueType, | |
| 332 | + value1: | |
| 333 | + descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | |
| 334 | + .condition[0].predicate.value.defaultValue, | |
| 335 | + operation: | |
| 336 | + descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | |
| 337 | + .condition[0].predicate.operation, | |
| 338 | + }); | |
| 339 | + setRegisterStep3Condition({ | |
| 340 | + conditionType: | |
| 341 | + descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition.spec | |
| 342 | + .type, | |
| 343 | + }); | |
| 344 | + setRegisterStep3Enable({ | |
| 345 | + schedule: | |
| 346 | + descInfo.value.profileData?.alarms[0].createRules[getKey[0]].schedule.type, | |
| 347 | + }); | |
| 348 | + setRegisterStep3TemplateDetail({ | |
| 349 | + alarmDetails: | |
| 350 | + descInfo.value.profileData?.alarms[0].createRules[getKey[0]].alarmDetails, | |
| 351 | + }); | |
| 352 | + //清除报警 | |
| 353 | + setRegisterStep3ClearRuleAlarm({ | |
| 354 | + type: descInfo.value.profileData?.alarms[0].clearRule.condition.condition[0].key | |
| 279 | 355 | .type, |
| 280 | - }); | |
| 281 | - setRegisterStep3Enable({ | |
| 282 | - schedule: | |
| 283 | - descInfo.value.profileData?.alarms[0].createRules[getKey[0]].schedule.type, | |
| 284 | - }); | |
| 285 | - setRegisterStep3TemplateDetail({ | |
| 286 | - alarmDetails: | |
| 287 | - descInfo.value.profileData?.alarms[0].createRules[getKey[0]].alarmDetails, | |
| 288 | - }); | |
| 289 | - //清除报警 | |
| 290 | - setRegisterStep3ClearRuleAlarm({ | |
| 291 | - type: descInfo.value.profileData?.alarms[0].clearRule.condition.condition[0].key | |
| 292 | - .type, | |
| 293 | - key1: descInfo.value.profileData?.alarms[0].clearRule.condition.condition[0].key | |
| 294 | - .key, | |
| 295 | - type1: | |
| 296 | - descInfo.value.profileData?.alarms[0].clearRule.condition.condition[0] | |
| 297 | - .valueType, | |
| 298 | - value1: | |
| 299 | - descInfo.value.profileData?.alarms[0].clearRule.condition.condition[0].predicate | |
| 300 | - .value.defaultValue, | |
| 301 | - operation: | |
| 302 | - descInfo.value.profileData?.alarms[0].clearRule.condition.condition[0].predicate | |
| 303 | - .operation, | |
| 304 | - }); | |
| 305 | - setRegisterStep3ClearCondition({ | |
| 306 | - conditionType: | |
| 307 | - descInfo.value.profileData?.alarms[0].clearRule.condition.spec.type, | |
| 308 | - }); | |
| 309 | - setRegisterStep3ClearEnable({ | |
| 310 | - schedule: descInfo.value.profileData?.alarms[0].clearRule.schedule.type, | |
| 311 | - }); | |
| 312 | - setRegisterStep3ClearTemplateDetail({ | |
| 313 | - alarmDetails: descInfo.value.profileData?.alarms[0].clearRule.alarmDetails, | |
| 314 | - }); | |
| 356 | + key1: descInfo.value.profileData?.alarms[0].clearRule.condition.condition[0].key | |
| 357 | + .key, | |
| 358 | + type1: | |
| 359 | + descInfo.value.profileData?.alarms[0].clearRule.condition.condition[0] | |
| 360 | + .valueType, | |
| 361 | + value1: | |
| 362 | + descInfo.value.profileData?.alarms[0].clearRule.condition.condition[0] | |
| 363 | + .predicate.value.defaultValue, | |
| 364 | + operation: | |
| 365 | + descInfo.value.profileData?.alarms[0].clearRule.condition.condition[0] | |
| 366 | + .predicate.operation, | |
| 367 | + }); | |
| 368 | + setRegisterStep3ClearCondition({ | |
| 369 | + conditionType: | |
| 370 | + descInfo.value.profileData?.alarms[0].clearRule.condition.spec.type, | |
| 371 | + }); | |
| 372 | + setRegisterStep3ClearEnable({ | |
| 373 | + schedule: descInfo.value.profileData?.alarms[0].clearRule.schedule.type, | |
| 374 | + }); | |
| 375 | + setRegisterStep3ClearTemplateDetail({ | |
| 376 | + alarmDetails: descInfo.value.profileData?.alarms[0].clearRule.alarmDetails, | |
| 377 | + }); | |
| 378 | + } catch (e) { | |
| 379 | + return e; | |
| 380 | + } | |
| 315 | 381 | }, 1000); |
| 382 | + break; | |
| 316 | 383 | case '4': |
| 317 | 384 | setTimeout(() => { |
| 318 | - setRegisterContact({ | |
| 319 | - alarmContactId: descInfo.value?.alarmProfile?.alarmContactId, | |
| 320 | - messageMode: descInfo.value?.alarmProfile?.messageMode, | |
| 321 | - }); | |
| 322 | - }, 1000); | |
| 385 | + resetFieldsContactFunc(); | |
| 386 | + }, 100); | |
| 387 | + setTimeout(() => { | |
| 388 | + try { | |
| 389 | + setRegisterContact({ | |
| 390 | + alarmContactId: descInfo.value.alarmProfile.alarmContactId, | |
| 391 | + messageMode: descInfo.value.alarmProfile.messageMode, | |
| 392 | + }); | |
| 393 | + } catch (e) { | |
| 394 | + return e; | |
| 395 | + } | |
| 396 | + }, 500); | |
| 397 | + | |
| 323 | 398 | break; |
| 324 | 399 | } |
| 325 | 400 | } catch (e) { |
| ... | ... | @@ -327,6 +402,53 @@ |
| 327 | 402 | } |
| 328 | 403 | }; |
| 329 | 404 | |
| 405 | + const resetFieldsContactFunc = () => { | |
| 406 | + resetFieldsContact(); | |
| 407 | + }; | |
| 408 | + const resetFieldsStep3SchemasFunc = () => { | |
| 409 | + resetFieldsStep3Schemas(); | |
| 410 | + }; | |
| 411 | + | |
| 412 | + const resetFieldsStep3HighSettingFunc = () => { | |
| 413 | + resetFieldsStep3HighSetting(); | |
| 414 | + }; | |
| 415 | + const resetFieldsStep3CreateAlarmFunc = () => { | |
| 416 | + resetFieldsStep3CreateAlarm(); | |
| 417 | + }; | |
| 418 | + const resetFieldsStep3RuleAlarmFunc = () => { | |
| 419 | + resetFieldsStep3RuleAlarm(); | |
| 420 | + }; | |
| 421 | + | |
| 422 | + const resetFieldsrStep3ConditionFunc = () => { | |
| 423 | + resetFieldsrStep3Condition(); | |
| 424 | + }; | |
| 425 | + | |
| 426 | + const resetFieldsStep3RuleAlarmFunc1 = () => { | |
| 427 | + resetFieldsStep3RuleAlarm(); | |
| 428 | + }; | |
| 429 | + | |
| 430 | + const resetFieldsStep3EnableFunc = () => { | |
| 431 | + resetFieldsStep3Enable(); | |
| 432 | + }; | |
| 433 | + const resetFieldsStep3TemplateDetailFunc = () => { | |
| 434 | + resetFieldsStep3TemplateDetail(); | |
| 435 | + }; | |
| 436 | + //清除报警 | |
| 437 | + const resetFieldsStep3ClearRuleAlarmFunc = () => { | |
| 438 | + resetFieldsStep3ClearRuleAlarm(); | |
| 439 | + }; | |
| 440 | + const resetFieldsStep3ClearRuleAlarmlFunc = () => { | |
| 441 | + resetFieldsStep3ClearRuleAlarm(); | |
| 442 | + }; | |
| 443 | + const resetFieldsStep3ClearConditionFunc = () => { | |
| 444 | + resetFieldsStep3ClearCondition(); | |
| 445 | + }; | |
| 446 | + const resetFieldStep3ClearEnablelFunc = () => { | |
| 447 | + resetFieldStep3ClearEnablel(); | |
| 448 | + }; | |
| 449 | + const resetFieldStep3ClearTemplateDetailFunc = () => { | |
| 450 | + resetFieldStep3ClearTemplateDetail(); | |
| 451 | + }; | |
| 330 | 452 | watch( |
| 331 | 453 | () => activeKey.value, |
| 332 | 454 | (v) => { |
| ... | ... | @@ -338,6 +460,7 @@ |
| 338 | 460 | }); |
| 339 | 461 | |
| 340 | 462 | return { |
| 463 | + resetFieldsContactFunc, | |
| 341 | 464 | registerStep3ClearTemplateDetail, |
| 342 | 465 | registerStep3ClearEnable, |
| 343 | 466 | registerStep3ClearCondition, |
| ... | ... | @@ -363,13 +486,13 @@ |
| 363 | 486 | |
| 364 | 487 | <style scoped lang="less"> |
| 365 | 488 | .input-style { |
| 366 | - /deep/ .ant-form-item-control-input { | |
| 489 | + :deep .ant-form-item-control-input { | |
| 367 | 490 | position: relative; |
| 368 | 491 | display: flex; |
| 369 | 492 | align-items: center; |
| 370 | 493 | min-height: 02px; |
| 371 | 494 | } |
| 372 | - /deep/.ant-col-24 { | |
| 495 | + :deep.ant-col-24 { | |
| 373 | 496 | display: block; |
| 374 | 497 | flex: 0 0 100%; |
| 375 | 498 | max-width: 100%; |
| ... | ... | @@ -378,13 +501,13 @@ |
| 378 | 501 | } |
| 379 | 502 | |
| 380 | 503 | .clear-input-style { |
| 381 | - /deep/ .ant-form-item-control-input { | |
| 504 | + :deep .ant-form-item-control-input { | |
| 382 | 505 | position: relative; |
| 383 | 506 | display: flex; |
| 384 | 507 | align-items: center; |
| 385 | 508 | min-height: 02px; |
| 386 | 509 | } |
| 387 | - /deep/.ant-col-24 { | |
| 510 | + :deep.ant-col-24 { | |
| 388 | 511 | display: block; |
| 389 | 512 | flex: 0 0 100%; |
| 390 | 513 | max-width: 100%; | ... | ... |
| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 | :actions="[ |
| 20 | 20 | { |
| 21 | 21 | label: '详情', |
| 22 | - icon: 'clarity:note-edit-line', | |
| 22 | + icon: 'ant-design:eye-outlined', | |
| 23 | 23 | onClick: handleDetailView.bind(null, record), |
| 24 | 24 | }, |
| 25 | 25 | { |
| ... | ... | @@ -29,7 +29,7 @@ |
| 29 | 29 | }, |
| 30 | 30 | { |
| 31 | 31 | label: '导出', |
| 32 | - icon: 'clarity:note-edit-line', | |
| 32 | + icon: 'ant-design:login-outlined', | |
| 33 | 33 | onClick: handleExport.bind(null, record), |
| 34 | 34 | }, |
| 35 | 35 | { |
| ... | ... | @@ -46,12 +46,16 @@ |
| 46 | 46 | </template> |
| 47 | 47 | </BasicTable> |
| 48 | 48 | <DeviceProfileModal v-if="isJudgeStatus" @register="registerModal" @success="handleSuccess" /> |
| 49 | - <DeviceConfigDetail @register="registerModalDetail" @success="handleSuccess" /> | |
| 49 | + <DeviceConfigDetail | |
| 50 | + ref="deviceDetailRef" | |
| 51 | + @register="registerModalDetail" | |
| 52 | + @success="handleSuccess" | |
| 53 | + /> | |
| 50 | 54 | <!-- <ExpExcelModal @register="register1" @success="defaultHeader" /> --> |
| 51 | 55 | </div> |
| 52 | 56 | </template> |
| 53 | 57 | <script lang="ts"> |
| 54 | - import { defineComponent, ref, reactive } from 'vue'; | |
| 58 | + import { defineComponent, ref, reactive, getCurrentInstance } from 'vue'; | |
| 55 | 59 | import { BasicTable, useTable, TableAction, BasicColumn } from '/@/components/Table'; |
| 56 | 60 | import { columns, searchFormSchema } from './device.profile.data'; |
| 57 | 61 | import { useMessage } from '/@/hooks/web/useMessage'; |
| ... | ... | @@ -66,6 +70,8 @@ |
| 66 | 70 | name: 'DeviceProfileManagement', |
| 67 | 71 | components: { BasicTable, DeviceProfileModal, TableAction, ImpExcel, DeviceConfigDetail }, |
| 68 | 72 | setup() { |
| 73 | + const { proxy } = getCurrentInstance(); | |
| 74 | + const deviceDetailRef = ref(null); | |
| 69 | 75 | let selectedRowKeys: string[] = reactive([]); |
| 70 | 76 | let isJudgeStatus = ref(true); |
| 71 | 77 | const getPathUrl = ref(''); |
| ... | ... | @@ -148,17 +154,21 @@ |
| 148 | 154 | } |
| 149 | 155 | |
| 150 | 156 | function handleCreate() { |
| 151 | - openModal(true, { | |
| 152 | - isUpdate: false, | |
| 153 | - }); | |
| 157 | + setTimeout(() => { | |
| 158 | + openModal(true, { | |
| 159 | + isUpdate: false, | |
| 160 | + }); | |
| 161 | + }, 100); | |
| 154 | 162 | isJudgeStatus.value = true; |
| 155 | 163 | } |
| 156 | 164 | |
| 157 | 165 | function handleEdit(record: Recordable) { |
| 158 | - openModal(true, { | |
| 159 | - record, | |
| 160 | - isUpdate: true, | |
| 161 | - }); | |
| 166 | + setTimeout(() => { | |
| 167 | + openModal(true, { | |
| 168 | + record, | |
| 169 | + isUpdate: true, | |
| 170 | + }); | |
| 171 | + }, 100); | |
| 162 | 172 | isJudgeStatus.value = true; |
| 163 | 173 | } |
| 164 | 174 | const useSelectionChange = () => { |
| ... | ... | @@ -183,6 +193,9 @@ |
| 183 | 193 | record, |
| 184 | 194 | isUpdate: false, |
| 185 | 195 | }); |
| 196 | + setTimeout(() => { | |
| 197 | + // proxy.$refs.deviceDetailRef.resetFieldsContactFunc(); | |
| 198 | + }, 2000); | |
| 186 | 199 | isJudgeStatus.value = false; |
| 187 | 200 | } |
| 188 | 201 | |
| ... | ... | @@ -211,6 +224,7 @@ |
| 211 | 224 | reload(); |
| 212 | 225 | } |
| 213 | 226 | return { |
| 227 | + deviceDetailRef, | |
| 214 | 228 | setRowClassName, |
| 215 | 229 | registerModalDetail, |
| 216 | 230 | // register1, | ... | ... |
| ... | ... | @@ -42,7 +42,9 @@ |
| 42 | 42 | </Upload> |
| 43 | 43 | </div> |
| 44 | 44 | </div> |
| 45 | - <BasicForm @register="register" /> | |
| 45 | + <div style="margin-top: -50px"> | |
| 46 | + <BasicForm @register="register" /> | |
| 47 | + </div> | |
| 46 | 48 | </div> |
| 47 | 49 | </div> |
| 48 | 50 | </template> |
| ... | ... | @@ -67,7 +69,7 @@ |
| 67 | 69 | Upload, |
| 68 | 70 | PlusOutlined, |
| 69 | 71 | }, |
| 70 | - emits: ['next', 'resetFunc'], | |
| 72 | + emits: ['next', 'resetFunc', 'register'], | |
| 71 | 73 | setup(_, { emit }) { |
| 72 | 74 | const { createMessage } = useMessage(); |
| 73 | 75 | |
| ... | ... | @@ -167,7 +169,7 @@ |
| 167 | 169 | color: @text-color; |
| 168 | 170 | } |
| 169 | 171 | .device-icon-style { |
| 170 | - /deep/ .ant-upload-select-picture-card { | |
| 172 | + :deep .ant-upload-select-picture-card { | |
| 171 | 173 | display: inherit; |
| 172 | 174 | float: none; |
| 173 | 175 | width: 8.6vw; | ... | ... |
| ... | ... | @@ -17,7 +17,7 @@ |
| 17 | 17 | [Descriptions.name]: Descriptions, |
| 18 | 18 | [Descriptions.Item.name]: Descriptions.Item, |
| 19 | 19 | }, |
| 20 | - emits: ['next', 'prev'], | |
| 20 | + emits: ['next', 'prev', 'register'], | |
| 21 | 21 | setup(_, { emit }) { |
| 22 | 22 | const [register, { validate, setFieldsValue, resetFields }] = useForm({ |
| 23 | 23 | labelWidth: 80, |
| ... | ... | @@ -47,7 +47,9 @@ |
| 47 | 47 | try { |
| 48 | 48 | const values = await validate(); |
| 49 | 49 | emit('next', values); |
| 50 | - } catch (error) {} | |
| 50 | + } catch (error) { | |
| 51 | + } finally { | |
| 52 | + } | |
| 51 | 53 | } |
| 52 | 54 | return { register, resetFieldsFunc, customResetAndFunc }; |
| 53 | 55 | }, | ... | ... |
| 1 | 1 | <template> |
| 2 | - <div class="step3"> | |
| 2 | + <div class="step3" style="background-color: #f6f8f9"> | |
| 3 | 3 | <template v-for="(item, index) in profileData" :key="item.id"> |
| 4 | 4 | <CollapseContainer class="border mb-1" :canExpan="false"> |
| 5 | 5 | <template #action> |
| ... | ... | @@ -8,110 +8,125 @@ |
| 8 | 8 | style="cursor: pointer" |
| 9 | 9 | @click="deleteAlarmRule(index)" |
| 10 | 10 | alt="移除" |
| 11 | - src="../../../../assets/images/close.png" | |
| 11 | + src="../../../../assets/images/delete.png" | |
| 12 | 12 | /> |
| 13 | 13 | </div> |
| 14 | 14 | </template> |
| 15 | - <div class="alert-type" style="margin-left: -26px; margin-top: -10px"> | |
| 16 | - <BasicForm @register="registerForm" | |
| 17 | - /></div> | |
| 18 | - <div style="margin-top: -20px"> | |
| 19 | - <div style="margin-left: 20px; margin-top: -10px"> | |
| 20 | - <BasicForm | |
| 21 | - @register="registerFormHighSetting" | |
| 22 | - style="margin-left: 12px; margin-top: -10px" | |
| 23 | - > | |
| 24 | - <template #checkBox="{ model, field }"> | |
| 25 | - <Checkbox v-model:checked="model[field]">传递报警</Checkbox> | |
| 26 | - </template> | |
| 27 | - </BasicForm> | |
| 15 | + <div style="margin-top: -15px; margin-left: 10px"> | |
| 16 | + <div class="alert-type" style="margin-left: -50px; margin-top: -10px"> | |
| 17 | + <BasicForm @register="registerForm" | |
| 18 | + /></div> | |
| 19 | + <div style="margin-top: -15px"> | |
| 20 | + <div style="margin-left: -8px; margin-top: -10px"> | |
| 21 | + <BasicForm | |
| 22 | + @register="registerFormHighSetting" | |
| 23 | + style="margin-left: 12px; margin-top: -10px" | |
| 24 | + > | |
| 25 | + <template #checkBox="{ model, field }"> | |
| 26 | + <Checkbox v-model:checked="model[field]">传递报警</Checkbox> | |
| 27 | + </template> | |
| 28 | + </BasicForm> | |
| 29 | + </div> | |
| 28 | 30 | </div> |
| 29 | 31 | </div> |
| 30 | - <p>创建报警规则</p> | |
| 31 | - <template v-for="(childItem, createIndex) in item.alarms" :key="childItem.id"> | |
| 32 | - <div class="aic" style="border: 1px solid #bfbfbf"> | |
| 33 | - <div class="w-3/4"> | |
| 34 | - <div style="margin-left: -33px; margin-top: 20px" | |
| 35 | - ><BasicForm @register="registerFormCreateAlarm" /> | |
| 36 | - </div> | |
| 37 | - <div style="margin-left: 5px; margin-top: -50px"> | |
| 38 | - <div style="color: #f5594e" class="ml-4" | |
| 39 | - >报警规则条件: | |
| 40 | - <Button size="small" type="primary" @click="handleOpenAlaramRuleConditions" | |
| 41 | - >添加</Button | |
| 42 | - > | |
| 43 | - <p>{{ ruleTemplateData }}</p> | |
| 32 | + <div style="margin-top: -57px"> | |
| 33 | + <p style="margin-left: 10px">创建报警规则</p> | |
| 34 | + <template v-for="(childItem, createIndex) in item.alarms" :key="childItem.id"> | |
| 35 | + <div class="aic" style="border: 1px solid #bfbfbf"> | |
| 36 | + <div class="w-3/4" style="margin-left: 40px"> | |
| 37 | + <div style="margin-left: -33px; margin-top: 20px" | |
| 38 | + ><BasicForm @register="registerFormCreateAlarm" /> | |
| 44 | 39 | </div> |
| 45 | - <div style="white-space: wrap" class="mt-4 ml-4" | |
| 46 | - >启用规则: | |
| 47 | - <Button size="small" type="primary" @click="handleOpenEnableRule">添加</Button> | |
| 48 | - <p>{{ enableTemplateData }}</p> | |
| 49 | - <div class="mt-4 ml-4" style="margin-left: 0px" | |
| 50 | - >详情模板: | |
| 51 | - <Button size="small" type="primary" @click="handleOpenDetailTemplate" | |
| 40 | + <div style="margin-left: 5px; margin-top: -50px"> | |
| 41 | + <div style="color: #f5594e" class="ml-4" | |
| 42 | + >报警规则条件: | |
| 43 | + <Button size="small" type="primary" @click="handleOpenAlaramRuleConditions" | |
| 52 | 44 | >添加</Button |
| 53 | 45 | > |
| 54 | - <p>{{ detailTemplateData }}</p> | |
| 46 | + <p>{{ ruleTemplateData }}</p> | |
| 55 | 47 | </div> |
| 56 | - <div style="margin-left: 0px; position: relative"> | |
| 57 | - <BasicForm @register="dashboardForm" /> | |
| 48 | + <div style="white-space: wrap; margin-top: 25px" class="mt-4 ml-4" | |
| 49 | + >启用规则: | |
| 50 | + <Button size="small" type="primary" @click="handleOpenEnableRule">添加</Button> | |
| 51 | + <p>{{ enableTemplateData }}</p> | |
| 52 | + <div | |
| 53 | + class="mt-4 ml-4" | |
| 54 | + style="margin-left: 0px; position: relative; margin-top: 25px" | |
| 55 | + >详情模板: | |
| 56 | + <div style="position: absolute; top: -5px; left: 80px; width: 571px"> | |
| 57 | + <BasicForm @register="registerFormChangeDetail" /> | |
| 58 | + </div> | |
| 59 | + <!-- <Button size="small" type="primary" @click="handleOpenDetailTemplate" | |
| 60 | + >添加</Button | |
| 61 | + > --> | |
| 62 | + </div> | |
| 63 | + <div style="margin-left: 0px; margin-top: 25px; position: relative"> | |
| 64 | + <BasicForm @register="dashboardForm" /> | |
| 65 | + </div> | |
| 58 | 66 | </div> |
| 59 | 67 | </div> |
| 60 | - </div> | |
| 61 | - <div | |
| 62 | - class="remove-type" | |
| 63 | - style="display: inline-block; position: relative; top: -237px; left: 800px" | |
| 64 | - > | |
| 65 | - <img | |
| 66 | - style="cursor: pointer" | |
| 67 | - @click="deleteCondition(index, createIndex)" | |
| 68 | - alt="移除" | |
| 69 | - src="../../../../assets/images/close.png" | |
| 70 | - /> | |
| 68 | + <div | |
| 69 | + class="remove-type" | |
| 70 | + style="display: inline-block; position: relative; top: -257px; left: 757px" | |
| 71 | + > | |
| 72 | + <img | |
| 73 | + style="cursor: pointer" | |
| 74 | + @click="deleteCondition(index, createIndex)" | |
| 75 | + alt="移除" | |
| 76 | + src="../../../../assets/images/close.png" | |
| 77 | + /> | |
| 78 | + </div> | |
| 71 | 79 | </div> |
| 72 | 80 | </div> |
| 73 | - </div> | |
| 74 | - </template> | |
| 75 | - <a-button style="border-radius: 10px" class="mt-5" @click="addCreateRole(index)" | |
| 76 | - ><PlusCircleOutlined />添加创建条件</a-button | |
| 77 | - > | |
| 81 | + </template> | |
| 82 | + <a-button style="border-radius: 10px" class="mt-5" @click="addCreateRole(index)" | |
| 83 | + ><PlusCircleOutlined />添加创建条件</a-button | |
| 84 | + > | |
| 85 | + </div> | |
| 78 | 86 | <div style="height: 20px"></div> |
| 79 | - <p>清除报警规则</p> | |
| 80 | - <template | |
| 81 | - v-for="(childClearItem, clearIndexItem) in item.clearRule" | |
| 82 | - :key="childClearItem.id" | |
| 83 | - > | |
| 84 | - <div class="aic mb-1" style="border: 1px solid #bfbfbf"> | |
| 85 | - <div class="w-3/4"> | |
| 86 | - <div style="margin-left: 5px"> | |
| 87 | - <div style="color: #f5594e" class="mt-4 ml-4" | |
| 88 | - >报警规则条件: | |
| 89 | - <Button size="small" type="primary" @click="handleOpenClearAlaramRuleConditions" | |
| 90 | - >添加</Button | |
| 91 | - > | |
| 92 | - <p>{{ ruleClearTemplateData }}</p> | |
| 93 | - </div> | |
| 94 | - <div style="white-space: wrap" class="mt-4 ml-4" | |
| 95 | - >启用规则: | |
| 96 | - <Button size="small" type="primary" @click="handleOpenClearEnableRule" | |
| 97 | - >添加</Button | |
| 98 | - > | |
| 99 | - <p>{{ enableClearTemplateData }}</p> | |
| 100 | - <div class="mt-4 ml-4" style="margin-left: 0px" | |
| 101 | - >详情模板: | |
| 102 | - <Button size="small" type="primary" @click="handleOpenClearDetailTemplate" | |
| 87 | + <div> | |
| 88 | + <p style="margin-left: 10px">清除报警规则</p> | |
| 89 | + <template | |
| 90 | + v-for="(childClearItem, clearIndexItem) in item.clearRule" | |
| 91 | + :key="childClearItem.id" | |
| 92 | + > | |
| 93 | + <div class="aic mb-1" style="border: 1px solid #bfbfbf"> | |
| 94 | + <div class="w-3/4" style="margin-left: 40px"> | |
| 95 | + <div style="margin-left: 5px"> | |
| 96 | + <div style="color: #f5594e" class="mt-4 ml-4" | |
| 97 | + >报警规则条件: | |
| 98 | + <Button size="small" type="primary" @click="handleOpenClearAlaramRuleConditions" | |
| 103 | 99 | >添加</Button |
| 104 | 100 | > |
| 105 | - <p>{{ detailClearTemplateData }}</p> | |
| 101 | + <p>{{ ruleClearTemplateData }}</p> | |
| 106 | 102 | </div> |
| 107 | - <div style="margin-left: 0px"> | |
| 108 | - <BasicForm @register="dashboardForm" /> | |
| 103 | + <div style="white-space: wrap; margin-top: 25px" class="mt-4 ml-4" | |
| 104 | + >启用规则: | |
| 105 | + <Button size="small" type="primary" @click="handleOpenClearEnableRule" | |
| 106 | + >添加</Button | |
| 107 | + > | |
| 108 | + <p>{{ enableClearTemplateData }}</p> | |
| 109 | + <div | |
| 110 | + class="mt-4 ml-4" | |
| 111 | + style="margin-left: 0px; position: relative; margin-top: 25px" | |
| 112 | + >详情模板: | |
| 113 | + <div style="position: absolute; top: -5px; left: 80px; width: 571px"> | |
| 114 | + <BasicForm @register="registerFormChangeClearDetail" /> | |
| 115 | + </div> | |
| 116 | + <!-- <Button size="small" type="primary" @click="handleOpenClearDetailTemplate" | |
| 117 | + >添加</Button | |
| 118 | + > | |
| 119 | + <p>{{ detailClearTemplateData }}</p> --> | |
| 120 | + </div> | |
| 121 | + <div style="margin-left: 0px; margin-top: 25px"> | |
| 122 | + <BasicForm @register="dashboardForm" /> | |
| 123 | + </div> | |
| 109 | 124 | </div> |
| 110 | 125 | </div> |
| 111 | 126 | </div> |
| 112 | 127 | </div> |
| 113 | - </div> | |
| 114 | - </template> | |
| 128 | + </template> | |
| 129 | + </div> | |
| 115 | 130 | </CollapseContainer> |
| 116 | 131 | </template> |
| 117 | 132 | </div> |
| ... | ... | @@ -120,48 +135,52 @@ |
| 120 | 135 | <a-button @click="handleFormStep3toStep4Next">下一步</a-button> |
| 121 | 136 | <a-button style="margin-left: 20px" type="primary" @click="addAlarmRule">添加报警规则</a-button> |
| 122 | 137 | </div> |
| 123 | - <!-- 详情模板 --> | |
| 124 | - <DetailTemplate | |
| 125 | - v-if="isRuleAlarmRuleConditions == 1" | |
| 126 | - @getAllFields="getAllFieldsFunc" | |
| 127 | - @register="registerModal1" | |
| 128 | - /> | |
| 129 | - <!-- 启用规则 --> | |
| 130 | - <EnableRule | |
| 131 | - v-if="isRuleAlarmRuleConditions == 2" | |
| 132 | - ref="getChildData2" | |
| 133 | - @getAllFieldsEnab="getAllFieldsEnabFunc" | |
| 134 | - @register="registerModal2" | |
| 135 | - /> | |
| 136 | - <!-- 报警规则条件 --> | |
| 137 | - <AlarmRuleConditions | |
| 138 | - v-if="isRuleAlarmRuleConditions == 3" | |
| 139 | - ref="getChildData3" | |
| 140 | - @getAllFieldsRule="getAllFieldsRuleFunc" | |
| 141 | - @register="registerModal3" | |
| 142 | - /> | |
| 138 | + <div> | |
| 139 | + <!-- 详情模板 --> | |
| 140 | + <DetailTemplate | |
| 141 | + v-if="isRuleAlarmRuleConditions == 1" | |
| 142 | + @getAllFields="getAllFieldsFunc" | |
| 143 | + @register="registerModal1" | |
| 144 | + /> | |
| 145 | + <!-- 启用规则 --> | |
| 146 | + <EnableRule | |
| 147 | + v-if="isRuleAlarmRuleConditions == 2" | |
| 148 | + ref="getChildData2" | |
| 149 | + @getAllFieldsEnab="getAllFieldsEnabFunc" | |
| 150 | + @register="registerModal2" | |
| 151 | + /> | |
| 152 | + <!-- 报警规则条件 --> | |
| 153 | + <AlarmRuleConditions | |
| 154 | + v-if="isRuleAlarmRuleConditions == 3" | |
| 155 | + ref="getChildData3" | |
| 156 | + @getAllFieldsRule="getAllFieldsRuleFunc" | |
| 157 | + @register="registerModal3" | |
| 158 | + /> | |
| 159 | + </div> | |
| 143 | 160 | |
| 144 | - <!-- 清除条件 --> | |
| 145 | - <!-- 详情模板 --> | |
| 146 | - <DetailTemplate | |
| 147 | - v-if="isRuleAlarmRuleConditions == 4" | |
| 148 | - @getAllFields="getAllClearFieldsFunc" | |
| 149 | - @register="registerModal4" | |
| 150 | - /> | |
| 151 | - <!-- 启用规则 --> | |
| 152 | - <EnableRule | |
| 153 | - v-if="isRuleAlarmRuleConditions == 5" | |
| 154 | - ref="getChildData2" | |
| 155 | - @getAllFieldsEnab="getAllClearFieldsEnabFunc" | |
| 156 | - @register="registerModal5" | |
| 157 | - /> | |
| 158 | - <!-- 报警规则条件 --> | |
| 159 | - <AlarmRuleConditions | |
| 160 | - v-if="isRuleAlarmRuleConditions == 6" | |
| 161 | - ref="getChildData3" | |
| 162 | - @getAllFieldsRule="getAllClearFieldsRuleFunc" | |
| 163 | - @register="registerModal6" | |
| 164 | - /> | |
| 161 | + <div> | |
| 162 | + <!-- 清除条件 --> | |
| 163 | + <!-- 详情模板 --> | |
| 164 | + <DetailTemplate | |
| 165 | + v-if="isRuleAlarmRuleConditions == 4" | |
| 166 | + @getAllFields="getAllClearFieldsFunc" | |
| 167 | + @register="registerModal4" | |
| 168 | + /> | |
| 169 | + <!-- 启用规则 --> | |
| 170 | + <EnableRule | |
| 171 | + v-if="isRuleAlarmRuleConditions == 5" | |
| 172 | + ref="getChildData2" | |
| 173 | + @getAllFieldsEnab="getAllClearFieldsEnabFunc" | |
| 174 | + @register="registerModal5" | |
| 175 | + /> | |
| 176 | + <!-- 报警规则条件 --> | |
| 177 | + <AlarmRuleConditions | |
| 178 | + v-if="isRuleAlarmRuleConditions == 6" | |
| 179 | + ref="getChildData3" | |
| 180 | + @getAllFieldsRule="getAllClearFieldsRuleFunc" | |
| 181 | + @register="registerModal6" | |
| 182 | + /> | |
| 183 | + </div> | |
| 165 | 184 | </template> |
| 166 | 185 | |
| 167 | 186 | <script lang="ts"> |
| ... | ... | @@ -175,6 +194,7 @@ |
| 175 | 194 | step3CreateAlarm, |
| 176 | 195 | dashboardFormScheme, |
| 177 | 196 | isWhereType, |
| 197 | + formChangeDetailSchema, | |
| 178 | 198 | } from './data'; |
| 179 | 199 | import { PlusCircleOutlined } from '@ant-design/icons-vue'; |
| 180 | 200 | import { Checkbox } from 'ant-design-vue'; |
| ... | ... | @@ -185,7 +205,6 @@ |
| 185 | 205 | import { Button } from '/@/components/Button'; |
| 186 | 206 | |
| 187 | 207 | export const isWhereTypeValueDisabled = ref(false); |
| 188 | - | |
| 189 | 208 | export default defineComponent({ |
| 190 | 209 | components: { |
| 191 | 210 | BasicForm, |
| ... | ... | @@ -197,8 +216,11 @@ |
| 197 | 216 | AlarmRuleConditions, |
| 198 | 217 | Button, |
| 199 | 218 | }, |
| 200 | - emits: ['prev', 'next'], | |
| 219 | + emits: ['prev', 'next', 'redo', 'handleFormStep3toStep4Next'], | |
| 201 | 220 | setup(_, { emit }) { |
| 221 | + const changeGetDetailValue: any = ref(null); | |
| 222 | + const changeGetClearDetailValue: any = ref(null); | |
| 223 | + const ruleNumber = ref(0); | |
| 202 | 224 | const { proxy } = getCurrentInstance(); |
| 203 | 225 | const getChildData1 = ref(null); |
| 204 | 226 | const getChildData2 = ref(null); |
| ... | ... | @@ -238,6 +260,7 @@ |
| 238 | 260 | }; |
| 239 | 261 | //删除告警配置 |
| 240 | 262 | const deleteAlarmRule = (index: number) => { |
| 263 | + ruleNumber.value--; | |
| 241 | 264 | unref(profileData).splice(index, 1); |
| 242 | 265 | }; |
| 243 | 266 | // 上一步 |
| ... | ... | @@ -246,6 +269,7 @@ |
| 246 | 269 | }; |
| 247 | 270 | //添加报警规则 |
| 248 | 271 | const addAlarmRule = () => { |
| 272 | + ruleNumber.value++; | |
| 249 | 273 | clearIndex.value++; |
| 250 | 274 | unref(profileData).push({ |
| 251 | 275 | configuration: { |
| ... | ... | @@ -262,7 +286,6 @@ |
| 262 | 286 | id: Date.now() + Math.random() + '', |
| 263 | 287 | alarmType: '', |
| 264 | 288 | createRules: {}, |
| 265 | - | |
| 266 | 289 | propagate: false, |
| 267 | 290 | propagateRelationTypes: [''], |
| 268 | 291 | }, |
| ... | ... | @@ -323,6 +346,40 @@ |
| 323 | 346 | span: 24, |
| 324 | 347 | }, |
| 325 | 348 | }); |
| 349 | + //详情模板 | |
| 350 | + const [ | |
| 351 | + registerFormChangeDetail, | |
| 352 | + { | |
| 353 | + getFieldsValue: getRegisterFormChangeDetail, | |
| 354 | + setFieldsValue: setRegisterFormChangeDetail, | |
| 355 | + resetFields: resetRegisterFormChangeDetail, | |
| 356 | + }, | |
| 357 | + ] = useForm({ | |
| 358 | + labelWidth: 120, | |
| 359 | + schemas: formChangeDetailSchema, | |
| 360 | + showResetButton: false, | |
| 361 | + showSubmitButton: false, | |
| 362 | + actionColOptions: { | |
| 363 | + span: 24, | |
| 364 | + }, | |
| 365 | + }); | |
| 366 | + //清除详情模板 | |
| 367 | + const [ | |
| 368 | + registerFormChangeClearDetail, | |
| 369 | + { | |
| 370 | + getFieldsValue: getRegisterFormClearChangeDetail, | |
| 371 | + setFieldsValue: setRegisterFormClearChangeDetail, | |
| 372 | + resetFields: resetRegisterFormClearChangeDetail, | |
| 373 | + }, | |
| 374 | + ] = useForm({ | |
| 375 | + labelWidth: 120, | |
| 376 | + schemas: formChangeDetailSchema, | |
| 377 | + showResetButton: false, | |
| 378 | + showSubmitButton: false, | |
| 379 | + actionColOptions: { | |
| 380 | + span: 24, | |
| 381 | + }, | |
| 382 | + }); | |
| 326 | 383 | // 添加创建条件表单 |
| 327 | 384 | const [ |
| 328 | 385 | registerFormCreateAlarm, |
| ... | ... | @@ -369,6 +426,14 @@ |
| 369 | 426 | const resetTemplateClearFormDataFunc = () => { |
| 370 | 427 | detailClearTemplateData.value = ``; |
| 371 | 428 | }; |
| 429 | + //修改详情模板 | |
| 430 | + const resetRegisterFormChangeDetailFunc = () => { | |
| 431 | + resetRegisterFormChangeDetail(); | |
| 432 | + }; | |
| 433 | + //清除修改详情模板 | |
| 434 | + const resetRegisterFormClearChangeDetailFunc = () => { | |
| 435 | + resetRegisterFormClearChangeDetail(); | |
| 436 | + }; | |
| 372 | 437 | |
| 373 | 438 | //回显表单数据 |
| 374 | 439 | const retryRegisterFormFunc = (v) => { |
| ... | ... | @@ -398,6 +463,14 @@ |
| 398 | 463 | const retryTemplateClearFormDataFunc = (v) => { |
| 399 | 464 | detailClearTemplateData.value = v; |
| 400 | 465 | }; |
| 466 | + //修改详情模板 | |
| 467 | + const setRegisterFormChangeDetailFunc = (v) => { | |
| 468 | + setRegisterFormChangeDetail(v); | |
| 469 | + }; | |
| 470 | + //清除修改详情模板 | |
| 471 | + const setRegisterFormClearChangeDetailFunc = (v) => { | |
| 472 | + setRegisterFormClearChangeDetail(v); | |
| 473 | + }; | |
| 401 | 474 | |
| 402 | 475 | const tempValue1: string = ref<string>(''); |
| 403 | 476 | // 添加‘创建条件’ |
| ... | ... | @@ -483,6 +556,7 @@ |
| 483 | 556 | // isWhereTypeValueDisabled.value = false; |
| 484 | 557 | } |
| 485 | 558 | }); |
| 559 | + | |
| 486 | 560 | //详情模板 |
| 487 | 561 | const getAllFieldsFunc = (v) => { |
| 488 | 562 | detailObj.value = v; |
| ... | ... | @@ -760,19 +834,18 @@ |
| 760 | 834 | return uuid; |
| 761 | 835 | } |
| 762 | 836 | const handleFormStep3toStep4Next = async () => { |
| 763 | - console.log(enableObj.value); | |
| 764 | 837 | try { |
| 838 | + changeGetDetailValue.value = getRegisterFormChangeDetail(); | |
| 839 | + changeGetClearDetailValue.value = getRegisterFormClearChangeDetail(); | |
| 765 | 840 | if (enableObj.value.schedule == 'CUSTOM') { |
| 766 | - for (let i in enableObj.value) { | |
| 767 | - console.log(enableObj.value[i]); | |
| 768 | - console.log(i); | |
| 769 | - // let o = {}; | |
| 770 | - // if(enableObj.value[i]=='1') | |
| 771 | - // o[i] = enableObj.value[i]; | |
| 772 | - // getSchduleCustomValue.value.push(o); | |
| 773 | - // getSchduleCustomValue.value.push(enableObj.value[i]); | |
| 774 | - } | |
| 775 | - console.log(getSchduleCustomValue.value); | |
| 841 | + // for (let i in enableObj.value) { | |
| 842 | + // console.log(i); | |
| 843 | + // // let o = {}; | |
| 844 | + // // if(enableObj.value[i]=='1') | |
| 845 | + // // o[i] = enableObj.value[i]; | |
| 846 | + // // getSchduleCustomValue.value.push(o); | |
| 847 | + // // getSchduleCustomValue.value.push(enableObj.value[i]); | |
| 848 | + // } | |
| 776 | 849 | // switch (enableObj.value.daysOfWeek1[0]) { |
| 777 | 850 | // case '1': |
| 778 | 851 | // getSchduleCustomValue.value.push({ |
| ... | ... | @@ -852,7 +925,11 @@ |
| 852 | 925 | ? scheduleCustomClearValue.value |
| 853 | 926 | : scheduleClearValue, |
| 854 | 927 | }; |
| 855 | - const getClearAdditionalProp = Object.assign({}, detailClearObj.value, getClearSchedule); | |
| 928 | + const getClearAdditionalProp = Object.assign( | |
| 929 | + {}, | |
| 930 | + changeGetClearDetailValue.value, | |
| 931 | + getClearSchedule | |
| 932 | + ); | |
| 856 | 933 | const scheduleValue = { |
| 857 | 934 | type: enableObj.value.schedule, |
| 858 | 935 | daysOfWeek: enableObj.value.daysOfWeek, |
| ... | ... | @@ -865,7 +942,7 @@ |
| 865 | 942 | enableObj.value.schedule == 'CUSTOM' ? scheduleCustomValue.value : scheduleValue, |
| 866 | 943 | }; |
| 867 | 944 | |
| 868 | - const getAdditionalProp = Object.assign({}, detailObj.value, getSchedule); | |
| 945 | + const getAdditionalProp = Object.assign({}, changeGetDetailValue.value, getSchedule); | |
| 869 | 946 | const getScheduleAndAlarmDetails = Object.assign( |
| 870 | 947 | {}, |
| 871 | 948 | getAdditionalProp, |
| ... | ... | @@ -928,50 +1005,73 @@ |
| 928 | 1005 | isRuleAlarmRuleConditions.value = 1; |
| 929 | 1006 | setTimeout(() => { |
| 930 | 1007 | openModal1(true); |
| 931 | - proxy.$refs.getChildData1.resetDataFunc(); | |
| 1008 | + setTimeout(() => { | |
| 1009 | + proxy.$refs.getChildData1.resetDataFunc(); | |
| 1010 | + }, 1000); | |
| 932 | 1011 | }, 50); |
| 933 | 1012 | }; |
| 934 | 1013 | const handleOpenEnableRule = () => { |
| 935 | 1014 | isRuleAlarmRuleConditions.value = 2; |
| 936 | 1015 | setTimeout(() => { |
| 937 | 1016 | openModal2(true); |
| 938 | - proxy.$refs.getChildData2.resetDataFunc(); | |
| 1017 | + setTimeout(() => { | |
| 1018 | + proxy.$refs.getChildData2.resetDataFunc(); | |
| 1019 | + }, 1000); | |
| 939 | 1020 | }, 50); |
| 940 | 1021 | }; |
| 941 | 1022 | const handleOpenAlaramRuleConditions = () => { |
| 942 | 1023 | isRuleAlarmRuleConditions.value = 3; |
| 943 | 1024 | setTimeout(() => { |
| 944 | 1025 | openModal3(true); |
| 945 | - proxy.$refs.getChildData3.resetDataFunc(); | |
| 946 | - }, 50); | |
| 1026 | + try { | |
| 1027 | + setTimeout(() => { | |
| 1028 | + proxy.$refs.getChildData3.resetDataFunc(); | |
| 1029 | + }, 1000); | |
| 1030 | + } catch (e) { | |
| 1031 | + return e; | |
| 1032 | + } | |
| 1033 | + }, 500); | |
| 947 | 1034 | }; |
| 948 | 1035 | const handleOpenClearDetailTemplate = () => { |
| 949 | 1036 | isRuleAlarmRuleConditions.value = 4; |
| 950 | 1037 | setTimeout(() => { |
| 951 | 1038 | openModal4(true); |
| 952 | 1039 | try { |
| 953 | - proxy.$refs.getChildData1.resetDataFunc(); | |
| 1040 | + setTimeout(() => { | |
| 1041 | + proxy.$refs.getChildData1.resetDataFunc(); | |
| 1042 | + }, 1000); | |
| 954 | 1043 | } catch (e) { |
| 955 | 1044 | return e; |
| 956 | 1045 | } |
| 957 | - }, 50); | |
| 1046 | + }, 500); | |
| 958 | 1047 | }; |
| 959 | 1048 | const handleOpenClearEnableRule = () => { |
| 960 | 1049 | isRuleAlarmRuleConditions.value = 5; |
| 961 | 1050 | setTimeout(() => { |
| 962 | 1051 | openModal5(true); |
| 963 | - proxy.$refs.getChildData2.resetDataFunc(); | |
| 1052 | + setTimeout(() => { | |
| 1053 | + proxy.$refs.getChildData2.resetDataFunc(); | |
| 1054 | + }, 1000); | |
| 964 | 1055 | }, 50); |
| 965 | 1056 | }; |
| 966 | 1057 | const handleOpenClearAlaramRuleConditions = () => { |
| 967 | 1058 | isRuleAlarmRuleConditions.value = 6; |
| 968 | 1059 | setTimeout(() => { |
| 969 | 1060 | openModal6(true); |
| 970 | - proxy.$refs.getChildData3.resetDataFunc(); | |
| 1061 | + setTimeout(() => { | |
| 1062 | + proxy.$refs.getChildData3.resetDataFunc(); | |
| 1063 | + }, 1000); | |
| 971 | 1064 | }, 50); |
| 972 | 1065 | }; |
| 973 | 1066 | |
| 974 | 1067 | return { |
| 1068 | + resetRegisterFormChangeDetailFunc, | |
| 1069 | + resetRegisterFormClearChangeDetailFunc, | |
| 1070 | + setRegisterFormClearChangeDetailFunc, | |
| 1071 | + setRegisterFormChangeDetailFunc, | |
| 1072 | + registerFormChangeClearDetail, | |
| 1073 | + registerFormChangeDetail, | |
| 1074 | + ruleNumber, | |
| 975 | 1075 | resetEnableClearFormDataFunc, |
| 976 | 1076 | resetTemplateClearFormDataFunc, |
| 977 | 1077 | resetRulesClearFormDataFunc, |
| ... | ... | @@ -1040,6 +1140,8 @@ |
| 1040 | 1140 | <style lang="less" scoped> |
| 1041 | 1141 | .step3 { |
| 1042 | 1142 | width: 100%; |
| 1143 | + background-color: #f6f8f9; | |
| 1144 | + z-index: 1; | |
| 1043 | 1145 | } |
| 1044 | 1146 | .border { |
| 1045 | 1147 | border: 1px solid #bfbfbf; |
| ... | ... | @@ -1055,7 +1157,4 @@ |
| 1055 | 1157 | :deep(.vben-collapse-container__header) { |
| 1056 | 1158 | border: none; |
| 1057 | 1159 | } |
| 1058 | - // :deep(.anticon svg) { | |
| 1059 | - // display: none !important; | |
| 1060 | - // } | |
| 1061 | 1160 | </style> | ... | ... |
| 1 | 1 | <template> |
| 2 | - <div> | |
| 2 | + <div class="step-4"> | |
| 3 | 3 | <!-- <span>请选择告警通知联系人:</span> --> |
| 4 | 4 | <!-- <Tag v-for="(item, index) in 15" closable :key="index"> 冯涛+{{ item }}</Tag> --> |
| 5 | 5 | <BasicForm :showSubmitButton="false" @register="register" /> |
| ... | ... | @@ -15,7 +15,7 @@ |
| 15 | 15 | components: { |
| 16 | 16 | BasicForm, |
| 17 | 17 | }, |
| 18 | - emits: ['prev'], | |
| 18 | + emits: ['prev', 'register'], | |
| 19 | 19 | setup(_, { emit }) { |
| 20 | 20 | const getValueData: any = ref({}); |
| 21 | 21 | const [register, { setProps, validate, setFieldsValue, resetFields }] = useForm({ |
| ... | ... | @@ -31,8 +31,8 @@ |
| 31 | 31 | const resetFieldsFunc = (v) => { |
| 32 | 32 | setFieldsValue(v); |
| 33 | 33 | }; |
| 34 | - const customResetAndFunc = async () => { | |
| 35 | - await resetFields(); | |
| 34 | + const customResetAndFunc = () => { | |
| 35 | + resetFields(); | |
| 36 | 36 | }; |
| 37 | 37 | async function customResetFunc() { |
| 38 | 38 | emit('prev'); |
| ... | ... | @@ -54,3 +54,12 @@ |
| 54 | 54 | }, |
| 55 | 55 | }); |
| 56 | 56 | </script> |
| 57 | +<style lang="less" scoped> | |
| 58 | + .step-4 { | |
| 59 | + :deep .ant-btn { | |
| 60 | + position: relative; | |
| 61 | + right: 375px; | |
| 62 | + top: 18px; | |
| 63 | + } | |
| 64 | + } | |
| 65 | +</style> | ... | ... |
| 1 | 1 | <template> |
| 2 | - <BasicModal | |
| 3 | - v-bind="$attrs" | |
| 4 | - width="55rem" | |
| 5 | - @register="register" | |
| 6 | - :title="getTitle" | |
| 7 | - @ok="handleSubmit" | |
| 8 | - > | |
| 9 | - <CollapseContainer title="键名筛选器" class="border mb-8"> | |
| 10 | - <BasicTable | |
| 11 | - :showIndexColumn="false" | |
| 12 | - :resizeHeightOffset="200" | |
| 13 | - :dataSource="getTableApiData" | |
| 14 | - @register="registerTable" | |
| 15 | - > | |
| 16 | - <template #toolbar> | |
| 17 | - <a-button type="primary" @click="handleAddKey">新增键名筛选器</a-button> | |
| 18 | - </template> | |
| 19 | - <template #action="{ record }"> | |
| 20 | - <TableAction | |
| 21 | - :actions="[ | |
| 22 | - { | |
| 23 | - label: '编辑', | |
| 24 | - icon: 'clarity:note-edit-line', | |
| 25 | - onClick: handleEdit.bind(null, record), | |
| 26 | - }, | |
| 27 | - { | |
| 28 | - label: '删除', | |
| 29 | - icon: 'ant-design:delete-outlined', | |
| 30 | - color: 'error', | |
| 31 | - popConfirm: { | |
| 32 | - title: '是否确认删除', | |
| 33 | - confirm: handleDelete.bind(null, record), | |
| 2 | + <div class="key-style"> | |
| 3 | + <BasicModal | |
| 4 | + v-bind="$attrs" | |
| 5 | + width="55rem" | |
| 6 | + @register="register" | |
| 7 | + :title="getTitle" | |
| 8 | + @ok="handleSubmit" | |
| 9 | + > | |
| 10 | + <CollapseContainer title="键名筛选器" class="border mb-8"> | |
| 11 | + <BasicTable | |
| 12 | + :showIndexColumn="false" | |
| 13 | + :resizeHeightOffset="200" | |
| 14 | + :dataSource="getTableApiData" | |
| 15 | + @register="registerTable" | |
| 16 | + > | |
| 17 | + <template #toolbar> | |
| 18 | + <a-button type="primary" @click="handleAddKey">新增键名筛选器</a-button> | |
| 19 | + </template> | |
| 20 | + <template #action="{ record }"> | |
| 21 | + <TableAction | |
| 22 | + :actions="[ | |
| 23 | + { | |
| 24 | + label: '编辑', | |
| 25 | + icon: 'clarity:note-edit-line', | |
| 26 | + onClick: handleEdit.bind(null, record), | |
| 34 | 27 | }, |
| 35 | - }, | |
| 36 | - ]" | |
| 37 | - /> | |
| 38 | - </template> | |
| 39 | - </BasicTable> | |
| 40 | - </CollapseContainer> | |
| 41 | - <CollapseContainer title="筛选器预览" class="border mb-8"> | |
| 42 | - <!-- <p v-for="(item, index) in detailData" :key="index">{{ item }}</p> --> | |
| 43 | - <Description | |
| 44 | - v-for="(item, index) in detailData" | |
| 45 | - :key="index" | |
| 46 | - :column="3" | |
| 47 | - :data="item" | |
| 48 | - :schema="schema" | |
| 49 | - /> | |
| 50 | - </CollapseContainer> | |
| 51 | - <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerForm" /> | |
| 52 | - </BasicModal> | |
| 53 | - <KeyValueModal @register="registerModal" @success="handleSuccess" /> | |
| 28 | + { | |
| 29 | + label: '删除', | |
| 30 | + icon: 'ant-design:delete-outlined', | |
| 31 | + color: 'error', | |
| 32 | + popConfirm: { | |
| 33 | + title: '是否确认删除', | |
| 34 | + confirm: handleDelete.bind(null, record), | |
| 35 | + }, | |
| 36 | + }, | |
| 37 | + ]" | |
| 38 | + /> | |
| 39 | + </template> | |
| 40 | + </BasicTable> | |
| 41 | + </CollapseContainer> | |
| 42 | + <CollapseContainer title="筛选器预览" class="border mb-8"> | |
| 43 | + <!-- <p v-for="(item, index) in detailData" :key="index">{{ item }}</p> --> | |
| 44 | + <Description | |
| 45 | + v-for="(item, index) in detailData" | |
| 46 | + :key="index" | |
| 47 | + :column="3" | |
| 48 | + :data="item" | |
| 49 | + :schema="schema" | |
| 50 | + /> | |
| 51 | + </CollapseContainer> | |
| 52 | + <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerForm" /> | |
| 53 | + </BasicModal> | |
| 54 | + <KeyValueModal @register="registerModal" @success="handleSuccess" /> | |
| 55 | + </div> | |
| 54 | 56 | </template> |
| 55 | 57 | <script lang="ts"> |
| 56 | 58 | import { defineComponent, ref, computed, unref } from 'vue'; |
| ... | ... | @@ -218,3 +220,10 @@ |
| 218 | 220 | }, |
| 219 | 221 | }); |
| 220 | 222 | </script> |
| 223 | +<style lang="less" scoped> | |
| 224 | + :deep.ant-table-body { | |
| 225 | + overflow-y: auto !important; | |
| 226 | + min-height: 173px !important; | |
| 227 | + height: 100px !important; | |
| 228 | + } | |
| 229 | +</style> | ... | ... |
| ... | ... | @@ -98,6 +98,7 @@ export const step3Schemas: FormSchema[] = [ |
| 98 | 98 | { |
| 99 | 99 | field: 'alarmType', |
| 100 | 100 | component: 'Input', |
| 101 | + required: true, | |
| 101 | 102 | label: '报警类型', |
| 102 | 103 | colProps: { |
| 103 | 104 | span: 12, |
| ... | ... | @@ -106,19 +107,6 @@ export const step3Schemas: FormSchema[] = [ |
| 106 | 107 | maxLength: 255, |
| 107 | 108 | placeholder: '请输入报警类型', |
| 108 | 109 | }, |
| 109 | - dynamicRules: () => { | |
| 110 | - return [ | |
| 111 | - { | |
| 112 | - required: false, | |
| 113 | - validator: (_, value) => { | |
| 114 | - if (String(value).length > 255) { | |
| 115 | - return Promise.reject('字数不超过255个字'); | |
| 116 | - } | |
| 117 | - return Promise.resolve(); | |
| 118 | - }, | |
| 119 | - }, | |
| 120 | - ]; | |
| 121 | - }, | |
| 122 | 110 | }, |
| 123 | 111 | ]; |
| 124 | 112 | |
| ... | ... | @@ -127,7 +115,6 @@ export const step3ViewHighSetting: FormSchema[] = [ |
| 127 | 115 | field: 'propagate', |
| 128 | 116 | component: 'Checkbox', |
| 129 | 117 | label: '传递报警', |
| 130 | - // renderComponentContent: '忽略大小写', | |
| 131 | 118 | }, |
| 132 | 119 | { |
| 133 | 120 | field: 'propagateRelationTypes', |
| ... | ... | @@ -140,19 +127,6 @@ export const step3ViewHighSetting: FormSchema[] = [ |
| 140 | 127 | maxLength: 255, |
| 141 | 128 | placeholder: '请输入关联类型', |
| 142 | 129 | }, |
| 143 | - dynamicRules: () => { | |
| 144 | - return [ | |
| 145 | - { | |
| 146 | - required: false, | |
| 147 | - validator: (_, value) => { | |
| 148 | - if (String(value).length > 255) { | |
| 149 | - return Promise.reject('字数不超过255个字'); | |
| 150 | - } | |
| 151 | - return Promise.resolve(); | |
| 152 | - }, | |
| 153 | - }, | |
| 154 | - ]; | |
| 155 | - }, | |
| 156 | 130 | }, |
| 157 | 131 | ]; |
| 158 | 132 | |
| ... | ... | @@ -174,19 +148,6 @@ export const step3HighSetting: FormSchema[] = [ |
| 174 | 148 | maxLength: 255, |
| 175 | 149 | placeholder: '请输入关联类型', |
| 176 | 150 | }, |
| 177 | - dynamicRules: () => { | |
| 178 | - return [ | |
| 179 | - { | |
| 180 | - required: false, | |
| 181 | - validator: (_, value) => { | |
| 182 | - if (String(value).length > 255) { | |
| 183 | - return Promise.reject('字数不超过255个字'); | |
| 184 | - } | |
| 185 | - return Promise.resolve(); | |
| 186 | - }, | |
| 187 | - }, | |
| 188 | - ]; | |
| 189 | - }, | |
| 190 | 151 | ifShow: ({ values }) => !!values.propagate, |
| 191 | 152 | }, |
| 192 | 153 | ]; |
| ... | ... | @@ -265,7 +226,6 @@ export const alertContactsSchemas: FormSchema[] = [ |
| 265 | 226 | field: 'alarmContactId', |
| 266 | 227 | label: '告警通知联系人', |
| 267 | 228 | component: 'ApiSelect', |
| 268 | - required: true, | |
| 269 | 229 | componentProps: { |
| 270 | 230 | placeholder: '请选择告警通知联系人', |
| 271 | 231 | api: alarmContactGetPage, |
| ... | ... | @@ -277,7 +237,6 @@ export const alertContactsSchemas: FormSchema[] = [ |
| 277 | 237 | { |
| 278 | 238 | field: 'messageMode', |
| 279 | 239 | label: '告警通知方式', |
| 280 | - required: true, | |
| 281 | 240 | component: 'ApiSelect', |
| 282 | 241 | componentProps: { |
| 283 | 242 | placeholder: '请选择告警通知方式', |
| ... | ... | @@ -290,3 +249,17 @@ export const alertContactsSchemas: FormSchema[] = [ |
| 290 | 249 | }, |
| 291 | 250 | }, |
| 292 | 251 | ]; |
| 252 | + | |
| 253 | +export const formChangeDetailSchema: FormSchema[] = [ | |
| 254 | + { | |
| 255 | + field: 'alarmDetails', | |
| 256 | + label: '', | |
| 257 | + colProps: { span: 13 }, | |
| 258 | + required: true, | |
| 259 | + component: 'Input', | |
| 260 | + componentProps: { | |
| 261 | + maxLength: 255, | |
| 262 | + placeholder: '请输入报警详细信息', | |
| 263 | + }, | |
| 264 | + }, | |
| 265 | +]; | ... | ... |
| ... | ... | @@ -227,19 +227,6 @@ export const formSchema: FormSchema[] = [ |
| 227 | 227 | maxLength: 255, |
| 228 | 228 | placeholder: '请输入消息配置', |
| 229 | 229 | }, |
| 230 | - dynamicRules: () => { | |
| 231 | - return [ | |
| 232 | - { | |
| 233 | - required: false, | |
| 234 | - validator: (_, value) => { | |
| 235 | - if (String(value).length > 255) { | |
| 236 | - return Promise.reject('字数不超过255个字'); | |
| 237 | - } | |
| 238 | - return Promise.resolve(); | |
| 239 | - }, | |
| 240 | - }, | |
| 241 | - ]; | |
| 242 | - }, | |
| 243 | 230 | }, |
| 244 | 231 | { |
| 245 | 232 | field: 'id', |
| ... | ... | @@ -270,19 +257,6 @@ export const formSchema: FormSchema[] = [ |
| 270 | 257 | maxLength: 255, |
| 271 | 258 | placeholder: '请输入备注', |
| 272 | 259 | }, |
| 273 | - dynamicRules: () => { | |
| 274 | - return [ | |
| 275 | - { | |
| 276 | - required: false, | |
| 277 | - validator: (_, value) => { | |
| 278 | - if (String(value).length > 255) { | |
| 279 | - return Promise.reject('字数不超过255个字'); | |
| 280 | - } | |
| 281 | - return Promise.resolve(); | |
| 282 | - }, | |
| 283 | - }, | |
| 284 | - ]; | |
| 285 | - }, | |
| 286 | 260 | |
| 287 | 261 | component: 'InputTextArea', |
| 288 | 262 | }, | ... | ... |
| ... | ... | @@ -3,6 +3,8 @@ import { FormSchema } from '/@/components/Table'; |
| 3 | 3 | import { h } from 'vue'; |
| 4 | 4 | import { Tag } from 'ant-design-vue'; |
| 5 | 5 | import { useI18n } from '/@/hooks/web/useI18n'; |
| 6 | +import { phoneRule } from '/@/utils/rules'; | |
| 7 | + | |
| 6 | 8 | const { t } = useI18n(); |
| 7 | 9 | export const columns: BasicColumn[] = [ |
| 8 | 10 | { |
| ... | ... | @@ -52,6 +54,7 @@ export const searchFormSchema: FormSchema[] = [ |
| 52 | 54 | label: '发送手机', |
| 53 | 55 | component: 'Input', |
| 54 | 56 | colProps: { span: 6 }, |
| 57 | + rules: phoneRule, | |
| 55 | 58 | componentProps: { |
| 56 | 59 | maxLength: 36, |
| 57 | 60 | }, | ... | ... |
| ... | ... | @@ -12,17 +12,12 @@ |
| 12 | 12 | <Button |
| 13 | 13 | style="margin-left: -99px; margin-top: 0px; display: inline-block" |
| 14 | 14 | v-if="Number(field) === 0" |
| 15 | + :style="addHideButton > 1 ? 'display:none' : 'display:inline-block'" | |
| 15 | 16 | @click="add" |
| 16 | 17 | type="primary" |
| 17 | 18 | >+新增执行条件</Button |
| 18 | 19 | > |
| 19 | - <!-- <Button | |
| 20 | - @click="del(field)" | |
| 21 | - style="margin-left: 10px" | |
| 22 | - v-if="Number(field) === 0" | |
| 23 | - type="primary" | |
| 24 | - >删除</Button | |
| 25 | - > --> | |
| 20 | + | |
| 26 | 21 | <Button |
| 27 | 22 | style="margin-left: -95px; margin-top: 20px" |
| 28 | 23 | v-if="field > 0" |
| ... | ... | @@ -49,9 +44,13 @@ |
| 49 | 44 | |
| 50 | 45 | export default defineComponent({ |
| 51 | 46 | components: { CollapseContainer, BasicForm, [Input.name]: Input, Button }, |
| 47 | + // eslint-disable-next-line vue/require-prop-types | |
| 52 | 48 | props: ['deviceInfo1'], |
| 53 | - setup(props) { | |
| 54 | - const getValueData: any = ref({}); | |
| 49 | + emits: ['eDoConditionGetAddPushValueData'], | |
| 50 | + setup(props, { emit }) { | |
| 51 | + const addHideButton = ref(1); | |
| 52 | + const getAddPushValueData: any = ref([]); | |
| 53 | + | |
| 55 | 54 | const [ |
| 56 | 55 | registerCondition, |
| 57 | 56 | { |
| ... | ... | @@ -69,7 +68,9 @@ |
| 69 | 68 | }); |
| 70 | 69 | let isJudge = ref(1); |
| 71 | 70 | if (isJudge.value == 1) { |
| 72 | - resetFields(); | |
| 71 | + setTimeout(() => { | |
| 72 | + resetFields(); | |
| 73 | + }, 1000); | |
| 73 | 74 | } |
| 74 | 75 | watch( |
| 75 | 76 | () => props.deviceInfo1, |
| ... | ... | @@ -90,12 +91,13 @@ |
| 90 | 91 | const setFieldsFormValue = (v) => { |
| 91 | 92 | setFieldsValue(v); |
| 92 | 93 | }; |
| 93 | - function getAllFields(getV) { | |
| 94 | - const values = getFieldsValue(); | |
| 95 | - getValueData.value = values; | |
| 96 | - getV = getValueData.value; | |
| 94 | + const getAllFields = (getV: any) => { | |
| 95 | + getV = { | |
| 96 | + data: getFieldsValue(), | |
| 97 | + count: 1, | |
| 98 | + }; | |
| 97 | 99 | return getV; |
| 98 | - } | |
| 100 | + }; | |
| 99 | 101 | function funcResetFields() { |
| 100 | 102 | resetFields(); |
| 101 | 103 | } |
| ... | ... | @@ -119,6 +121,64 @@ |
| 119 | 121 | |
| 120 | 122 | const n = ref(1); |
| 121 | 123 | function add() { |
| 124 | + const pushValue = getFieldsValue(); | |
| 125 | + getAddPushValueData.value.push(pushValue); | |
| 126 | + emit('eDoConditionGetAddPushValueData', { | |
| 127 | + data: getAddPushValueData.value, | |
| 128 | + count: 2, | |
| 129 | + }); | |
| 130 | + addHideButton.value++; | |
| 131 | + if (addHideButton.value == 3) { | |
| 132 | + setTimeout(() => { | |
| 133 | + let getDom1 = document.getElementById('1') as HTMLElement; | |
| 134 | + getDom1.style.display = 'none'; | |
| 135 | + }, 500); | |
| 136 | + } | |
| 137 | + if (addHideButton.value == 4) { | |
| 138 | + setTimeout(() => { | |
| 139 | + let getDom2 = document.getElementById('2') as HTMLElement; | |
| 140 | + getDom2.style.display = 'none'; | |
| 141 | + let getDom41 = document.getElementById('1') as HTMLElement; | |
| 142 | + getDom41.style.display = 'none'; | |
| 143 | + }, 500); | |
| 144 | + } | |
| 145 | + if (addHideButton.value == 5) { | |
| 146 | + setTimeout(() => { | |
| 147 | + let getDom3 = document.getElementById('3') as HTMLElement; | |
| 148 | + getDom3.style.display = 'none'; | |
| 149 | + let getDom51 = document.getElementById('1') as HTMLElement; | |
| 150 | + getDom51.style.display = 'none'; | |
| 151 | + let getDom52 = document.getElementById('2') as HTMLElement; | |
| 152 | + getDom52.style.display = 'none'; | |
| 153 | + }, 500); | |
| 154 | + } | |
| 155 | + if (addHideButton.value == 6) { | |
| 156 | + setTimeout(() => { | |
| 157 | + let getDom4 = document.getElementById('4') as HTMLElement; | |
| 158 | + getDom4.style.display = 'none'; | |
| 159 | + let getDom61 = document.getElementById('1') as HTMLElement; | |
| 160 | + getDom61.style.display = 'none'; | |
| 161 | + let getDom62 = document.getElementById('2') as HTMLElement; | |
| 162 | + getDom62.style.display = 'none'; | |
| 163 | + let getDom63 = document.getElementById('3') as HTMLElement; | |
| 164 | + getDom63.style.display = 'none'; | |
| 165 | + }, 500); | |
| 166 | + } | |
| 167 | + if (addHideButton.value == 7) { | |
| 168 | + setTimeout(() => { | |
| 169 | + let getDom7 = document.getElementById('5') as HTMLElement; | |
| 170 | + getDom7.style.display = 'none'; | |
| 171 | + let getDom71 = document.getElementById('1') as HTMLElement; | |
| 172 | + getDom71.style.display = 'none'; | |
| 173 | + let getDom72 = document.getElementById('2') as HTMLElement; | |
| 174 | + getDom72.style.display = 'none'; | |
| 175 | + let getDom73 = document.getElementById('3') as HTMLElement; | |
| 176 | + getDom73.style.display = 'none'; | |
| 177 | + let getDom74 = document.getElementById('4') as HTMLElement; | |
| 178 | + getDom74.style.display = 'none'; | |
| 179 | + }, 500); | |
| 180 | + } | |
| 181 | + | |
| 122 | 182 | appendSchemaByField( |
| 123 | 183 | { |
| 124 | 184 | field: `kong${n.value}`, |
| ... | ... | @@ -312,6 +372,73 @@ |
| 312 | 372 | n.value++; |
| 313 | 373 | } |
| 314 | 374 | function del(field) { |
| 375 | + addHideButton.value--; | |
| 376 | + if (addHideButton.value == 2) { | |
| 377 | + setTimeout(() => { | |
| 378 | + let getDom1 = document.getElementById('1') as HTMLElement; | |
| 379 | + getDom1.style.display = 'flex'; | |
| 380 | + }, 500); | |
| 381 | + } | |
| 382 | + if (addHideButton.value == 3) { | |
| 383 | + setTimeout(() => { | |
| 384 | + let getDom2 = document.getElementById('2') as HTMLElement; | |
| 385 | + getDom2.style.display = 'flex'; | |
| 386 | + let getDom21 = document.getElementById('1') as HTMLElement; | |
| 387 | + getDom21.style.display = 'none'; | |
| 388 | + }, 500); | |
| 389 | + } | |
| 390 | + if (addHideButton.value == 4) { | |
| 391 | + setTimeout(() => { | |
| 392 | + let getDom3 = document.getElementById('3') as HTMLElement; | |
| 393 | + getDom3.style.display = 'flex'; | |
| 394 | + let getDom31 = document.getElementById('1') as HTMLElement; | |
| 395 | + getDom31.style.display = 'none'; | |
| 396 | + let getDom32 = document.getElementById('2') as HTMLElement; | |
| 397 | + getDom32.style.display = 'none'; | |
| 398 | + }, 500); | |
| 399 | + } | |
| 400 | + if (addHideButton.value == 5) { | |
| 401 | + setTimeout(() => { | |
| 402 | + let getDom4 = document.getElementById('4') as HTMLElement; | |
| 403 | + getDom4.style.display = 'flex'; | |
| 404 | + let getDom41 = document.getElementById('1') as HTMLElement; | |
| 405 | + getDom41.style.display = 'none'; | |
| 406 | + let getDom42 = document.getElementById('2') as HTMLElement; | |
| 407 | + getDom42.style.display = 'none'; | |
| 408 | + let getDom43 = document.getElementById('3') as HTMLElement; | |
| 409 | + getDom43.style.display = 'none'; | |
| 410 | + }, 500); | |
| 411 | + } | |
| 412 | + if (addHideButton.value == 6) { | |
| 413 | + setTimeout(() => { | |
| 414 | + let getDom5 = document.getElementById('5') as HTMLElement; | |
| 415 | + getDom5.style.display = 'flex'; | |
| 416 | + let getDom51 = document.getElementById('1') as HTMLElement; | |
| 417 | + getDom51.style.display = 'none'; | |
| 418 | + let getDom52 = document.getElementById('2') as HTMLElement; | |
| 419 | + getDom52.style.display = 'none'; | |
| 420 | + let getDom53 = document.getElementById('3') as HTMLElement; | |
| 421 | + getDom53.style.display = 'none'; | |
| 422 | + let getDom54 = document.getElementById('4') as HTMLElement; | |
| 423 | + getDom54.style.display = 'none'; | |
| 424 | + }, 500); | |
| 425 | + } | |
| 426 | + if (addHideButton.value == 7) { | |
| 427 | + setTimeout(() => { | |
| 428 | + let getDom7 = document.getElementById('6') as HTMLElement; | |
| 429 | + getDom7.style.display = 'flex'; | |
| 430 | + let getDom71 = document.getElementById('1') as HTMLElement; | |
| 431 | + getDom71.style.display = 'none'; | |
| 432 | + let getDom72 = document.getElementById('2') as HTMLElement; | |
| 433 | + getDom72.style.display = 'none'; | |
| 434 | + let getDom73 = document.getElementById('3') as HTMLElement; | |
| 435 | + getDom73.style.display = 'none'; | |
| 436 | + let getDom74 = document.getElementById('4') as HTMLElement; | |
| 437 | + getDom74.style.display = 'none'; | |
| 438 | + let getDom75 = document.getElementById('5') as HTMLElement; | |
| 439 | + getDom75.style.display = 'none'; | |
| 440 | + }, 500); | |
| 441 | + } | |
| 315 | 442 | removeSchemaByFiled([ |
| 316 | 443 | `kong${field}`, |
| 317 | 444 | `status${field}`, |
| ... | ... | @@ -329,6 +456,7 @@ |
| 329 | 456 | n.value--; |
| 330 | 457 | } |
| 331 | 458 | return { |
| 459 | + addHideButton, | |
| 332 | 460 | editSelectDevice, |
| 333 | 461 | clearSelectDevice, |
| 334 | 462 | setFieldsFormValue, | ... | ... |
| ... | ... | @@ -12,6 +12,7 @@ |
| 12 | 12 | <Button |
| 13 | 13 | style="margin-left: -99px; margin-top: 5px; display: inline-block" |
| 14 | 14 | v-if="Number(field) === 0" |
| 15 | + :style="addHideButton > 1 ? 'display:none' : 'display:inline-block'" | |
| 15 | 16 | @click="add" |
| 16 | 17 | type="primary" |
| 17 | 18 | >+新增执行动作</Button |
| ... | ... | @@ -43,9 +44,13 @@ |
| 43 | 44 | |
| 44 | 45 | export default defineComponent({ |
| 45 | 46 | components: { CollapseContainer, BasicForm, [Input.name]: Input, Button }, |
| 47 | + // eslint-disable-next-line vue/require-prop-types | |
| 46 | 48 | props: ['deviceInfo2'], |
| 47 | - setup(props) { | |
| 48 | - const getValueData: any = ref({}); | |
| 49 | + emits: ['eDoactionGetAddPushValueData'], | |
| 50 | + setup(props, { emit }) { | |
| 51 | + const addHideButton = ref(1); | |
| 52 | + const getAddPushValueData: any = ref([]); | |
| 53 | + | |
| 49 | 54 | const [ |
| 50 | 55 | registerAction, |
| 51 | 56 | { |
| ... | ... | @@ -63,7 +68,9 @@ |
| 63 | 68 | }); |
| 64 | 69 | let isJudge = ref(1); |
| 65 | 70 | if (isJudge.value == 1) { |
| 66 | - resetFields(); | |
| 71 | + setTimeout(() => { | |
| 72 | + resetFields(); | |
| 73 | + }, 1000); | |
| 67 | 74 | } |
| 68 | 75 | watch( |
| 69 | 76 | () => props.deviceInfo2, |
| ... | ... | @@ -84,12 +91,13 @@ |
| 84 | 91 | const setFieldsFormValue = (v) => { |
| 85 | 92 | setFieldsValue(v); |
| 86 | 93 | }; |
| 87 | - function getAllFields(getV) { | |
| 88 | - const values = getFieldsValue(); | |
| 89 | - getValueData.value = values; | |
| 90 | - getV = getValueData.value; | |
| 94 | + const getAllFields = (getV: any) => { | |
| 95 | + getV = { | |
| 96 | + data: getFieldsValue(), | |
| 97 | + count: 1, | |
| 98 | + }; | |
| 91 | 99 | return getV; |
| 92 | - } | |
| 100 | + }; | |
| 93 | 101 | function funcResetFields() { |
| 94 | 102 | resetFields(); |
| 95 | 103 | } |
| ... | ... | @@ -112,6 +120,65 @@ |
| 112 | 120 | }; |
| 113 | 121 | const n = ref(1); |
| 114 | 122 | function add() { |
| 123 | + const pushValue = getFieldsValue(); | |
| 124 | + | |
| 125 | + getAddPushValueData.value.push(pushValue); | |
| 126 | + emit('eDoactionGetAddPushValueData', { | |
| 127 | + data: getAddPushValueData.value, | |
| 128 | + count: 2, | |
| 129 | + }); | |
| 130 | + addHideButton.value++; | |
| 131 | + if (addHideButton.value == 3) { | |
| 132 | + setTimeout(() => { | |
| 133 | + let getDom1 = document.getElementById('1') as HTMLElement; | |
| 134 | + getDom1.style.display = 'none'; | |
| 135 | + }, 500); | |
| 136 | + } | |
| 137 | + if (addHideButton.value == 4) { | |
| 138 | + setTimeout(() => { | |
| 139 | + let getDom2 = document.getElementById('2') as HTMLElement; | |
| 140 | + getDom2.style.display = 'none'; | |
| 141 | + let getDom41 = document.getElementById('1') as HTMLElement; | |
| 142 | + getDom41.style.display = 'none'; | |
| 143 | + }, 500); | |
| 144 | + } | |
| 145 | + if (addHideButton.value == 5) { | |
| 146 | + setTimeout(() => { | |
| 147 | + let getDom3 = document.getElementById('3') as HTMLElement; | |
| 148 | + getDom3.style.display = 'none'; | |
| 149 | + let getDom51 = document.getElementById('1') as HTMLElement; | |
| 150 | + getDom51.style.display = 'none'; | |
| 151 | + let getDom52 = document.getElementById('2') as HTMLElement; | |
| 152 | + getDom52.style.display = 'none'; | |
| 153 | + }, 500); | |
| 154 | + } | |
| 155 | + if (addHideButton.value == 6) { | |
| 156 | + setTimeout(() => { | |
| 157 | + let getDom4 = document.getElementById('4') as HTMLElement; | |
| 158 | + getDom4.style.display = 'none'; | |
| 159 | + let getDom61 = document.getElementById('1') as HTMLElement; | |
| 160 | + getDom61.style.display = 'none'; | |
| 161 | + let getDom62 = document.getElementById('2') as HTMLElement; | |
| 162 | + getDom62.style.display = 'none'; | |
| 163 | + let getDom63 = document.getElementById('3') as HTMLElement; | |
| 164 | + getDom63.style.display = 'none'; | |
| 165 | + }, 500); | |
| 166 | + } | |
| 167 | + if (addHideButton.value == 7) { | |
| 168 | + setTimeout(() => { | |
| 169 | + let getDom7 = document.getElementById('5') as HTMLElement; | |
| 170 | + getDom7.style.display = 'none'; | |
| 171 | + let getDom71 = document.getElementById('1') as HTMLElement; | |
| 172 | + getDom71.style.display = 'none'; | |
| 173 | + let getDom72 = document.getElementById('2') as HTMLElement; | |
| 174 | + getDom72.style.display = 'none'; | |
| 175 | + let getDom73 = document.getElementById('3') as HTMLElement; | |
| 176 | + getDom73.style.display = 'none'; | |
| 177 | + let getDom74 = document.getElementById('4') as HTMLElement; | |
| 178 | + getDom74.style.display = 'none'; | |
| 179 | + }, 500); | |
| 180 | + } | |
| 181 | + | |
| 115 | 182 | appendSchemaByField( |
| 116 | 183 | { |
| 117 | 184 | field: `kong${n.value}`, |
| ... | ... | @@ -272,6 +339,73 @@ |
| 272 | 339 | } |
| 273 | 340 | |
| 274 | 341 | function del(field) { |
| 342 | + addHideButton.value--; | |
| 343 | + if (addHideButton.value == 2) { | |
| 344 | + setTimeout(() => { | |
| 345 | + let getDom1 = document.getElementById('1') as HTMLElement; | |
| 346 | + getDom1.style.display = 'flex'; | |
| 347 | + }, 500); | |
| 348 | + } | |
| 349 | + if (addHideButton.value == 3) { | |
| 350 | + setTimeout(() => { | |
| 351 | + let getDom2 = document.getElementById('2') as HTMLElement; | |
| 352 | + getDom2.style.display = 'flex'; | |
| 353 | + let getDom21 = document.getElementById('1') as HTMLElement; | |
| 354 | + getDom21.style.display = 'none'; | |
| 355 | + }, 500); | |
| 356 | + } | |
| 357 | + if (addHideButton.value == 4) { | |
| 358 | + setTimeout(() => { | |
| 359 | + let getDom3 = document.getElementById('3') as HTMLElement; | |
| 360 | + getDom3.style.display = 'flex'; | |
| 361 | + let getDom31 = document.getElementById('1') as HTMLElement; | |
| 362 | + getDom31.style.display = 'none'; | |
| 363 | + let getDom32 = document.getElementById('2') as HTMLElement; | |
| 364 | + getDom32.style.display = 'none'; | |
| 365 | + }, 500); | |
| 366 | + } | |
| 367 | + if (addHideButton.value == 5) { | |
| 368 | + setTimeout(() => { | |
| 369 | + let getDom4 = document.getElementById('4') as HTMLElement; | |
| 370 | + getDom4.style.display = 'flex'; | |
| 371 | + let getDom41 = document.getElementById('1') as HTMLElement; | |
| 372 | + getDom41.style.display = 'none'; | |
| 373 | + let getDom42 = document.getElementById('2') as HTMLElement; | |
| 374 | + getDom42.style.display = 'none'; | |
| 375 | + let getDom43 = document.getElementById('3') as HTMLElement; | |
| 376 | + getDom43.style.display = 'none'; | |
| 377 | + }, 500); | |
| 378 | + } | |
| 379 | + if (addHideButton.value == 6) { | |
| 380 | + setTimeout(() => { | |
| 381 | + let getDom5 = document.getElementById('5') as HTMLElement; | |
| 382 | + getDom5.style.display = 'flex'; | |
| 383 | + let getDom51 = document.getElementById('1') as HTMLElement; | |
| 384 | + getDom51.style.display = 'none'; | |
| 385 | + let getDom52 = document.getElementById('2') as HTMLElement; | |
| 386 | + getDom52.style.display = 'none'; | |
| 387 | + let getDom53 = document.getElementById('3') as HTMLElement; | |
| 388 | + getDom53.style.display = 'none'; | |
| 389 | + let getDom54 = document.getElementById('4') as HTMLElement; | |
| 390 | + getDom54.style.display = 'none'; | |
| 391 | + }, 500); | |
| 392 | + } | |
| 393 | + if (addHideButton.value == 7) { | |
| 394 | + setTimeout(() => { | |
| 395 | + let getDom7 = document.getElementById('6') as HTMLElement; | |
| 396 | + getDom7.style.display = 'flex'; | |
| 397 | + let getDom71 = document.getElementById('1') as HTMLElement; | |
| 398 | + getDom71.style.display = 'none'; | |
| 399 | + let getDom72 = document.getElementById('2') as HTMLElement; | |
| 400 | + getDom72.style.display = 'none'; | |
| 401 | + let getDom73 = document.getElementById('3') as HTMLElement; | |
| 402 | + getDom73.style.display = 'none'; | |
| 403 | + let getDom74 = document.getElementById('4') as HTMLElement; | |
| 404 | + getDom74.style.display = 'none'; | |
| 405 | + let getDom75 = document.getElementById('5') as HTMLElement; | |
| 406 | + getDom75.style.display = 'none'; | |
| 407 | + }, 500); | |
| 408 | + } | |
| 275 | 409 | removeSchemaByFiled([ |
| 276 | 410 | `kong${field}`, |
| 277 | 411 | `outTarget${field}`, |
| ... | ... | @@ -288,6 +422,7 @@ |
| 288 | 422 | } |
| 289 | 423 | |
| 290 | 424 | return { |
| 425 | + addHideButton, | |
| 291 | 426 | editSelectDevice, |
| 292 | 427 | clearSelectDevice, |
| 293 | 428 | setFieldsFormValue, |
| ... | ... | @@ -309,5 +444,6 @@ |
| 309 | 444 | display: inline-block; |
| 310 | 445 | position: relative; |
| 311 | 446 | top: 33px; |
| 447 | + left: 5px; | |
| 312 | 448 | } |
| 313 | 449 | </style> | ... | ... |
| 1 | +/* eslint-disable vue/require-prop-types */ | |
| 1 | 2 | <template> |
| 2 | 3 | <div> |
| 3 | 4 | <CollapseContainer title="触发器" style="background-color: #eeeeee"> |
| ... | ... | @@ -19,17 +20,15 @@ |
| 19 | 20 | >+新增触发器</Button |
| 20 | 21 | > |
| 21 | 22 | <Button |
| 22 | - style="margin-left: 5px; margin-top: 35px" | |
| 23 | - :style="addHideButton >= 2 ? 'display:inline-block' : 'display:none'" | |
| 24 | 23 | v-if="Number(field) > 0" |
| 24 | + style="margin-left: 5px; margin-top: 35px" | |
| 25 | 25 | @click="add" |
| 26 | 26 | type="primary" |
| 27 | 27 | >+新增触发器</Button |
| 28 | 28 | > |
| 29 | 29 | <Button |
| 30 | - style="margin-left: 10px" | |
| 31 | - :style="addHideButton >= 2 ? 'display:inline-block' : 'display:none'" | |
| 32 | 30 | v-if="Number(field) > 0" |
| 31 | + style="margin-left: 10px" | |
| 33 | 32 | @click="del(field)" |
| 34 | 33 | type="primary" |
| 35 | 34 | >删除</Button |
| ... | ... | @@ -58,12 +57,14 @@ |
| 58 | 57 | |
| 59 | 58 | export default defineComponent({ |
| 60 | 59 | components: { CollapseContainer, BasicForm, [Input.name]: Input, Button }, |
| 60 | + // eslint-disable-next-line vue/require-prop-types | |
| 61 | 61 | props: ['deviceInfo'], |
| 62 | - setup(props) { | |
| 63 | - const getValueData: any = ref({}); | |
| 62 | + emits: ['eGetAddPushValueData'], | |
| 63 | + setup(props, { emit }) { | |
| 64 | 64 | const getPushValueData: any = ref([]); |
| 65 | 65 | const addHideButton = ref(1); |
| 66 | 66 | const addHideButtonTemp: any = ref(null); |
| 67 | + const getAddPushValueData: any = ref([]); | |
| 67 | 68 | const [ |
| 68 | 69 | registerTrigger, |
| 69 | 70 | { |
| ... | ... | @@ -81,7 +82,9 @@ |
| 81 | 82 | }); |
| 82 | 83 | let isJudge = ref(1); |
| 83 | 84 | if (isJudge.value == 1) { |
| 84 | - resetFields(); | |
| 85 | + setTimeout(() => { | |
| 86 | + resetFields(); | |
| 87 | + }, 1000); | |
| 85 | 88 | } |
| 86 | 89 | watch( |
| 87 | 90 | () => props.deviceInfo, |
| ... | ... | @@ -122,28 +125,102 @@ |
| 122 | 125 | const clearGetPushValueDataEmpty = () => { |
| 123 | 126 | getPushValueData.value.length = 0; |
| 124 | 127 | }; |
| 125 | - function getAllFields(getV) { | |
| 126 | - const values = getFieldsValue(); | |
| 127 | - getValueData.value = values; | |
| 128 | - getV = getValueData.value; | |
| 129 | - getPushValueData.value.push(getV); | |
| 130 | - console.log(getPushValueData.value); | |
| 128 | + | |
| 129 | + const getAllFields = (getV: any) => { | |
| 130 | + getV = { | |
| 131 | + data: getFieldsValue(), | |
| 132 | + count: 1, | |
| 133 | + }; | |
| 131 | 134 | return getV; |
| 132 | - } | |
| 135 | + }; | |
| 133 | 136 | async function funcResetFields() { |
| 134 | 137 | await resetFields(); |
| 135 | 138 | } |
| 136 | 139 | const addString: any = ref('tiggerEvent1') || ref('tiggerEvent2') || ref('tiggerEvent3'); |
| 137 | 140 | |
| 138 | 141 | const n = ref(1); |
| 142 | + const clearAddTriggerStatusFunc = () => { | |
| 143 | + // addHideButton.value = 1; | |
| 144 | + }; | |
| 145 | + const addClearGetAddPushValueDataArrayIsEmpty = () => { | |
| 146 | + getAddPushValueData.value = []; | |
| 147 | + }; | |
| 139 | 148 | function add() { |
| 149 | + const pushValue = getFieldsValue(); | |
| 150 | + getAddPushValueData.value.push(pushValue); | |
| 151 | + emit('eGetAddPushValueData', { | |
| 152 | + data: getAddPushValueData.value, | |
| 153 | + count: 2, | |
| 154 | + }); | |
| 140 | 155 | addHideButton.value++; |
| 141 | 156 | addHideButtonTemp.value = addHideButton.value; |
| 142 | - addHideButtonTemp.value--; | |
| 143 | - const getS = document.getElementById('1') as HTMLElement; | |
| 144 | - // getS.setAttribute('style', 'display:none'); | |
| 145 | - console.log(getS); | |
| 146 | - getS.hidden = true; | |
| 157 | + addHideButtonTemp.value -= 2; | |
| 158 | + if (addHideButton.value == 3) { | |
| 159 | + setTimeout(() => { | |
| 160 | + let getDom1 = document.getElementById('1') as HTMLElement; | |
| 161 | + getDom1.style.display = 'none'; | |
| 162 | + }, 500); | |
| 163 | + } | |
| 164 | + if (addHideButton.value == 4) { | |
| 165 | + setTimeout(() => { | |
| 166 | + let getDom2 = document.getElementById('2') as HTMLElement; | |
| 167 | + getDom2.style.display = 'none'; | |
| 168 | + let getDom41 = document.getElementById('1') as HTMLElement; | |
| 169 | + getDom41.style.display = 'none'; | |
| 170 | + }, 500); | |
| 171 | + } | |
| 172 | + if (addHideButton.value == 5) { | |
| 173 | + setTimeout(() => { | |
| 174 | + let getDom3 = document.getElementById('3') as HTMLElement; | |
| 175 | + getDom3.style.display = 'none'; | |
| 176 | + let getDom51 = document.getElementById('1') as HTMLElement; | |
| 177 | + getDom51.style.display = 'none'; | |
| 178 | + let getDom52 = document.getElementById('2') as HTMLElement; | |
| 179 | + getDom52.style.display = 'none'; | |
| 180 | + }, 500); | |
| 181 | + } | |
| 182 | + if (addHideButton.value == 6) { | |
| 183 | + setTimeout(() => { | |
| 184 | + let getDom4 = document.getElementById('4') as HTMLElement; | |
| 185 | + getDom4.style.display = 'none'; | |
| 186 | + let getDom61 = document.getElementById('1') as HTMLElement; | |
| 187 | + getDom61.style.display = 'none'; | |
| 188 | + let getDom62 = document.getElementById('2') as HTMLElement; | |
| 189 | + getDom62.style.display = 'none'; | |
| 190 | + let getDom63 = document.getElementById('3') as HTMLElement; | |
| 191 | + getDom63.style.display = 'none'; | |
| 192 | + }, 500); | |
| 193 | + } | |
| 194 | + if (addHideButton.value == 7) { | |
| 195 | + setTimeout(() => { | |
| 196 | + let getDom7 = document.getElementById('5') as HTMLElement; | |
| 197 | + getDom7.style.display = 'none'; | |
| 198 | + let getDom71 = document.getElementById('1') as HTMLElement; | |
| 199 | + getDom71.style.display = 'none'; | |
| 200 | + let getDom72 = document.getElementById('2') as HTMLElement; | |
| 201 | + getDom72.style.display = 'none'; | |
| 202 | + let getDom73 = document.getElementById('3') as HTMLElement; | |
| 203 | + getDom73.style.display = 'none'; | |
| 204 | + let getDom74 = document.getElementById('4') as HTMLElement; | |
| 205 | + getDom74.style.display = 'none'; | |
| 206 | + }, 500); | |
| 207 | + } | |
| 208 | + if (addHideButton.value == 8) { | |
| 209 | + setTimeout(() => { | |
| 210 | + let getDom8 = document.getElementById('6') as HTMLElement; | |
| 211 | + getDom8.style.display = 'none'; | |
| 212 | + let getDom81 = document.getElementById('1') as HTMLElement; | |
| 213 | + getDom81.style.display = 'none'; | |
| 214 | + let getDom82 = document.getElementById('2') as HTMLElement; | |
| 215 | + getDom82.style.display = 'none'; | |
| 216 | + let getDom83 = document.getElementById('3') as HTMLElement; | |
| 217 | + getDom83.style.display = 'none'; | |
| 218 | + let getDom84 = document.getElementById('4') as HTMLElement; | |
| 219 | + getDom84.style.display = 'none'; | |
| 220 | + let getDom85 = document.getElementById('5') as HTMLElement; | |
| 221 | + getDom85.style.display = 'none'; | |
| 222 | + }, 500); | |
| 223 | + } | |
| 147 | 224 | |
| 148 | 225 | appendSchemaByField( |
| 149 | 226 | { |
| ... | ... | @@ -365,6 +442,90 @@ |
| 365 | 442 | |
| 366 | 443 | function del(field) { |
| 367 | 444 | addHideButton.value--; |
| 445 | + if (addHideButton.value == 2) { | |
| 446 | + setTimeout(() => { | |
| 447 | + let getDom1 = document.getElementById('1') as HTMLElement; | |
| 448 | + getDom1.style.display = 'flex'; | |
| 449 | + }, 500); | |
| 450 | + } | |
| 451 | + if (addHideButton.value == 3) { | |
| 452 | + setTimeout(() => { | |
| 453 | + let getDom2 = document.getElementById('2') as HTMLElement; | |
| 454 | + getDom2.style.display = 'flex'; | |
| 455 | + let getDom21 = document.getElementById('1') as HTMLElement; | |
| 456 | + getDom21.style.display = 'none'; | |
| 457 | + }, 500); | |
| 458 | + } | |
| 459 | + if (addHideButton.value == 4) { | |
| 460 | + setTimeout(() => { | |
| 461 | + let getDom3 = document.getElementById('3') as HTMLElement; | |
| 462 | + getDom3.style.display = 'flex'; | |
| 463 | + let getDom31 = document.getElementById('1') as HTMLElement; | |
| 464 | + getDom31.style.display = 'none'; | |
| 465 | + let getDom32 = document.getElementById('2') as HTMLElement; | |
| 466 | + getDom32.style.display = 'none'; | |
| 467 | + }, 500); | |
| 468 | + } | |
| 469 | + if (addHideButton.value == 5) { | |
| 470 | + setTimeout(() => { | |
| 471 | + let getDom4 = document.getElementById('4') as HTMLElement; | |
| 472 | + getDom4.style.display = 'flex'; | |
| 473 | + let getDom41 = document.getElementById('1') as HTMLElement; | |
| 474 | + getDom41.style.display = 'none'; | |
| 475 | + let getDom42 = document.getElementById('2') as HTMLElement; | |
| 476 | + getDom42.style.display = 'none'; | |
| 477 | + let getDom43 = document.getElementById('3') as HTMLElement; | |
| 478 | + getDom43.style.display = 'none'; | |
| 479 | + }, 500); | |
| 480 | + } | |
| 481 | + if (addHideButton.value == 6) { | |
| 482 | + setTimeout(() => { | |
| 483 | + let getDom5 = document.getElementById('5') as HTMLElement; | |
| 484 | + getDom5.style.display = 'flex'; | |
| 485 | + let getDom51 = document.getElementById('1') as HTMLElement; | |
| 486 | + getDom51.style.display = 'none'; | |
| 487 | + let getDom52 = document.getElementById('2') as HTMLElement; | |
| 488 | + getDom52.style.display = 'none'; | |
| 489 | + let getDom53 = document.getElementById('3') as HTMLElement; | |
| 490 | + getDom53.style.display = 'none'; | |
| 491 | + let getDom54 = document.getElementById('4') as HTMLElement; | |
| 492 | + getDom54.style.display = 'none'; | |
| 493 | + }, 500); | |
| 494 | + } | |
| 495 | + if (addHideButton.value == 7) { | |
| 496 | + setTimeout(() => { | |
| 497 | + let getDom7 = document.getElementById('6') as HTMLElement; | |
| 498 | + getDom7.style.display = 'flex'; | |
| 499 | + let getDom71 = document.getElementById('1') as HTMLElement; | |
| 500 | + getDom71.style.display = 'none'; | |
| 501 | + let getDom72 = document.getElementById('2') as HTMLElement; | |
| 502 | + getDom72.style.display = 'none'; | |
| 503 | + let getDom73 = document.getElementById('3') as HTMLElement; | |
| 504 | + getDom73.style.display = 'none'; | |
| 505 | + let getDom74 = document.getElementById('4') as HTMLElement; | |
| 506 | + getDom74.style.display = 'none'; | |
| 507 | + let getDom75 = document.getElementById('5') as HTMLElement; | |
| 508 | + getDom75.style.display = 'none'; | |
| 509 | + }, 500); | |
| 510 | + } | |
| 511 | + if (addHideButton.value == 8) { | |
| 512 | + setTimeout(() => { | |
| 513 | + let getDom8 = document.getElementById('7') as HTMLElement; | |
| 514 | + getDom8.style.display = 'flex'; | |
| 515 | + let getDom81 = document.getElementById('1') as HTMLElement; | |
| 516 | + getDom81.style.display = 'none'; | |
| 517 | + let getDom82 = document.getElementById('2') as HTMLElement; | |
| 518 | + getDom82.style.display = 'none'; | |
| 519 | + let getDom83 = document.getElementById('3') as HTMLElement; | |
| 520 | + getDom83.style.display = 'none'; | |
| 521 | + let getDom84 = document.getElementById('4') as HTMLElement; | |
| 522 | + getDom84.style.display = 'none'; | |
| 523 | + let getDom85 = document.getElementById('5') as HTMLElement; | |
| 524 | + getDom85.style.display = 'none'; | |
| 525 | + let getDom86 = document.getElementById('6') as HTMLElement; | |
| 526 | + getDom86.style.display = 'none'; | |
| 527 | + }, 500); | |
| 528 | + } | |
| 368 | 529 | removeSchemaByFiled([ |
| 369 | 530 | `kong${field}`, |
| 370 | 531 | `tiggerEvent${field}`, |
| ... | ... | @@ -382,6 +543,8 @@ |
| 382 | 543 | n.value--; |
| 383 | 544 | } |
| 384 | 545 | return { |
| 546 | + addClearGetAddPushValueDataArrayIsEmpty, | |
| 547 | + clearAddTriggerStatusFunc, | |
| 385 | 548 | addHideButtonTemp, |
| 386 | 549 | addHideButton, |
| 387 | 550 | editSelectDevice, | ... | ... |
| 1 | 1 | <template> |
| 2 | 2 | <div> |
| 3 | 3 | <BasicTable |
| 4 | - :rowSelection="{ type: 'checkbox' }" | |
| 5 | - @selection-change="useSelectionChange" | |
| 6 | 4 | @register="registerTable" |
| 5 | + @selection-change="useSelectionChange" | |
| 6 | + :rowSelection="{ type: 'checkbox' }" | |
| 7 | 7 | > |
| 8 | 8 | <template #toolbar> |
| 9 | 9 | <a-button type="primary" @click="handleAdd"> 新增场景联动 </a-button> |
| 10 | - <a-button type="error" @click="handleToolbarDel"> 删除 </a-button> | |
| 10 | + <a-button | |
| 11 | + style="background-color: rgba(237, 111, 111, 1)" | |
| 12 | + type="default" | |
| 13 | + @click="handleToolbarDel" | |
| 14 | + > | |
| 15 | + <span style="color: white">删除</span> | |
| 16 | + </a-button> | |
| 11 | 17 | </template> |
| 12 | 18 | <template #action="{ record }"> |
| 13 | 19 | <TableAction |
| ... | ... | @@ -49,13 +55,14 @@ |
| 49 | 55 | export default defineComponent({ |
| 50 | 56 | name: 'Index', |
| 51 | 57 | components: { BasicTable, SceneLinkAgeDrawer, TableAction }, |
| 58 | + emits: ['default', 'registerTable', 'registerDrawer', 'register'], | |
| 52 | 59 | setup() { |
| 53 | 60 | let selectedRowKeys: Array<string> = []; |
| 54 | 61 | let echoEditData = reactive({}); |
| 55 | 62 | const [registerDrawer, { openDrawer }] = useDrawer(); |
| 56 | 63 | const { createMessage } = useMessage(); |
| 57 | 64 | const [registerTable, { reload, getSelectRowKeys }] = useTable({ |
| 58 | - title: '', | |
| 65 | + title: '场景联动列表', | |
| 59 | 66 | clickToRowSelect: false, |
| 60 | 67 | api: screenLinkPageGetApi, |
| 61 | 68 | columns, |
| ... | ... | @@ -63,9 +70,6 @@ |
| 63 | 70 | labelWidth: 120, |
| 64 | 71 | schemas: searchFormSchema, |
| 65 | 72 | }, |
| 66 | - filterFn: (registerTable) => { | |
| 67 | - return registerTable; | |
| 68 | - }, | |
| 69 | 73 | rowKey: 'id', |
| 70 | 74 | useSearchForm: true, |
| 71 | 75 | showTableSetting: true, |
| ... | ... | @@ -126,3 +130,5 @@ |
| 126 | 130 | }, |
| 127 | 131 | }); |
| 128 | 132 | </script> |
| 133 | + | |
| 134 | +<style lang="less" scoped></style> | ... | ... |
| ... | ... | @@ -8,9 +8,27 @@ |
| 8 | 8 | @ok="handleSubmit" |
| 9 | 9 | > |
| 10 | 10 | <BasicForm @register="registerForm" /> |
| 11 | - <AddTriggerForm ref="getTriggerChildData" :deviceInfo="getDeviceInfo" /> | |
| 12 | - <AddConditiForm ref="getConditionChildData" :deviceInfo1="getDeviceInfo1" /> | |
| 13 | - <AddActionForm ref="getChildData" :deviceInfo2="getDeviceInfo2" /> | |
| 11 | + <div> | |
| 12 | + <AddTriggerForm | |
| 13 | + @eGetAddPushValueData="getAddPushValueDataValueFunc" | |
| 14 | + ref="getTriggerChildData" | |
| 15 | + :deviceInfo="getDeviceInfo" | |
| 16 | + /> | |
| 17 | + </div> | |
| 18 | + <div> | |
| 19 | + <AddConditiForm | |
| 20 | + @eDoConditionGetAddPushValueData="getAddDoconditionPushValueDataValueFunc" | |
| 21 | + ref="getConditionChildData" | |
| 22 | + :deviceInfo1="getDeviceInfo1" | |
| 23 | + /> | |
| 24 | + </div> | |
| 25 | + <div> | |
| 26 | + <AddActionForm | |
| 27 | + @eDoactionGetAddPushValueData="getAddDoActionPushValueDataValueFunc" | |
| 28 | + ref="getChildData" | |
| 29 | + :deviceInfo2="getDeviceInfo2" | |
| 30 | + /> | |
| 31 | + </div> | |
| 14 | 32 | </BasicDrawer> |
| 15 | 33 | </template> |
| 16 | 34 | <script lang="ts"> |
| ... | ... | @@ -31,7 +49,7 @@ |
| 31 | 49 | export default defineComponent({ |
| 32 | 50 | name: 'ConfigDrawer', |
| 33 | 51 | components: { BasicDrawer, BasicForm, AddTriggerForm, AddActionForm, AddConditiForm }, |
| 34 | - emits: ['success', 'register'], | |
| 52 | + emits: ['success', 'register', 'registerForm'], | |
| 35 | 53 | setup(_, { emit }) { |
| 36 | 54 | const { proxy } = getCurrentInstance(); |
| 37 | 55 | const getChildData = ref(null); |
| ... | ... | @@ -45,18 +63,23 @@ |
| 45 | 63 | let getAllFormData: any = reactive({}); |
| 46 | 64 | let getValuesFormData: any = reactive({}); |
| 47 | 65 | let getId = ref(''); |
| 66 | + let getTenantId = ref(''); | |
| 48 | 67 | let getDeviceInfo = ref(null); |
| 49 | 68 | let getDeviceInfo1 = ref(null); |
| 50 | 69 | let getDeviceInfo2 = ref(null); |
| 70 | + const isCountT = ref(null); | |
| 71 | + const isAddTriggerT: any = ref([]); | |
| 72 | + const isCountD = ref(null); | |
| 73 | + const isAddActionD: any = ref([]); | |
| 74 | + const isCountC = ref(null); | |
| 75 | + const isAddConditionD: any = ref([]); | |
| 51 | 76 | |
| 52 | - const [ | |
| 53 | - registerForm, | |
| 54 | - { resetFields, setFieldsValue, validateFields, getFieldsValue, updateSchema }, | |
| 55 | - ] = useForm({ | |
| 56 | - labelWidth: 120, | |
| 57 | - schemas: formSchema, | |
| 58 | - showActionButtonGroup: false, | |
| 59 | - }); | |
| 77 | + const [registerForm, { resetFields, setFieldsValue, validateFields, getFieldsValue }] = | |
| 78 | + useForm({ | |
| 79 | + labelWidth: 120, | |
| 80 | + schemas: formSchema, | |
| 81 | + showActionButtonGroup: false, | |
| 82 | + }); | |
| 60 | 83 | |
| 61 | 84 | watch(getData, (newV) => { |
| 62 | 85 | getDeviceInfo.value = newV; |
| ... | ... | @@ -65,12 +88,21 @@ |
| 65 | 88 | }); |
| 66 | 89 | |
| 67 | 90 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { |
| 68 | - console.log(data); | |
| 69 | 91 | await resetFields(); |
| 70 | 92 | setDrawerProps({ confirmLoading: false }); |
| 71 | 93 | isUpdate.value = !!data?.isUpdate; |
| 72 | 94 | |
| 73 | 95 | if (!unref(isUpdate)) { |
| 96 | + triggersArray.length = 0; | |
| 97 | + doConditionsArray.length = 0; | |
| 98 | + doActionsArray.length = 0; | |
| 99 | + isAddTriggerT.value.length = 0; | |
| 100 | + | |
| 101 | + isAddActionD.value.length = 0; | |
| 102 | + | |
| 103 | + isAddConditionD.value.length = 0; | |
| 104 | + proxy.$refs.getTriggerChildData.addClearGetAddPushValueDataArrayIsEmpty(); | |
| 105 | + proxy.$refs.getTriggerChildData.clearAddTriggerStatusFunc(); | |
| 74 | 106 | proxy.$refs.getTriggerChildData.clearGetPushValueDataEmpty(); |
| 75 | 107 | proxy.$refs.getTriggerChildData.clearSelectDevice(); |
| 76 | 108 | proxy.$refs.getChildData.clearSelectDevice(); |
| ... | ... | @@ -81,7 +113,9 @@ |
| 81 | 113 | } |
| 82 | 114 | //编辑 |
| 83 | 115 | if (unref(isUpdate)) { |
| 116 | + console.log(data); | |
| 84 | 117 | getId.value = data.record.id; |
| 118 | + getTenantId.value = data.record.tenantId; | |
| 85 | 119 | await setFieldsValue({ |
| 86 | 120 | ...data.record, |
| 87 | 121 | }); |
| ... | ... | @@ -93,21 +127,23 @@ |
| 93 | 127 | organizationId: data.record.organizationId, |
| 94 | 128 | }); |
| 95 | 129 | newMap = options.items.map((m) => { |
| 96 | - newTwoFilterMap = data.record?.triggers.map((m1) => { | |
| 97 | - if (m.id == m1.deviceId) { | |
| 130 | + try { | |
| 131 | + newTwoFilterMap = data.record?.triggers.map((m1) => { | |
| 132 | + if (m.id == m1.deviceId) { | |
| 133 | + return { | |
| 134 | + value: m.id, | |
| 135 | + label: m.name, | |
| 136 | + }; | |
| 137 | + } | |
| 138 | + }); | |
| 139 | + | |
| 140 | + if (m.id == data.record?.triggers[0].deviceId) { | |
| 98 | 141 | return { |
| 99 | 142 | value: m.id, |
| 100 | 143 | label: m.name, |
| 101 | 144 | }; |
| 102 | 145 | } |
| 103 | - }); | |
| 104 | - | |
| 105 | - if (m.id == data.record?.triggers[0].deviceId) { | |
| 106 | - return { | |
| 107 | - value: m.id, | |
| 108 | - label: m.name, | |
| 109 | - }; | |
| 110 | - } | |
| 146 | + } catch (e) {} | |
| 111 | 147 | }); |
| 112 | 148 | newFilterMap = newMap.filter((f) => f !== undefined); |
| 113 | 149 | newFilterTwoFilterMap = newTwoFilterMap.filter((f) => f !== undefined); |
| ... | ... | @@ -148,22 +184,55 @@ |
| 148 | 184 | } |
| 149 | 185 | }); |
| 150 | 186 | const getTitle = computed(() => (!unref(isUpdate) ? '新增场景联动' : '编辑场景联动')); |
| 187 | + const getAddPushValueDataValueFunc = (v) => { | |
| 188 | + if (v.count == 2) { | |
| 189 | + isCountT.value = v.count; | |
| 190 | + isAddTriggerT.value = v.data; | |
| 191 | + } | |
| 192 | + }; | |
| 193 | + const getAddDoActionPushValueDataValueFunc = (v) => { | |
| 194 | + if (v.count == 2) { | |
| 195 | + isCountD.value = v.count; | |
| 196 | + isAddActionD.value = v.data; | |
| 197 | + } | |
| 198 | + }; | |
| 199 | + const getAddDoconditionPushValueDataValueFunc = (v) => { | |
| 200 | + if (v.count == 2) { | |
| 201 | + isCountC.value = v.count; | |
| 202 | + isAddConditionD.value = v.data; | |
| 203 | + } | |
| 204 | + }; | |
| 151 | 205 | |
| 152 | 206 | async function handleSubmit() { |
| 153 | 207 | if (!unref(isUpdate)) { |
| 208 | + triggersArray.length = 0; | |
| 209 | + doConditionsArray.length = 0; | |
| 210 | + doActionsArray.length = 0; | |
| 154 | 211 | let res = validateFields(); |
| 155 | 212 | if (!res) return; |
| 156 | - let getChildValues = proxy.$refs.getChildData.getAllFields(); | |
| 157 | 213 | let getTriggerChildValues = proxy.$refs.getTriggerChildData.getAllFields(); |
| 214 | + if (getTriggerChildValues.count === 1) { | |
| 215 | + triggersArray.push(getTriggerChildValues.data); | |
| 216 | + } | |
| 158 | 217 | let getconditionChildValues = proxy.$refs.getConditionChildData.getAllFields(); |
| 159 | - doActionsArray.push(getChildValues); | |
| 160 | - triggersArray.push(getTriggerChildValues); | |
| 161 | - doConditionsArray.push(getconditionChildValues); | |
| 218 | + if (getconditionChildValues.count === 1) { | |
| 219 | + doConditionsArray.push(getconditionChildValues.data); | |
| 220 | + } | |
| 221 | + let getChildValues = proxy.$refs.getChildData.getAllFields(); | |
| 222 | + if (getChildValues.count === 1) { | |
| 223 | + doActionsArray.push(getChildValues.data); | |
| 224 | + } | |
| 225 | + | |
| 162 | 226 | getValuesFormData = getFieldsValue(); |
| 163 | 227 | Object.assign(getAllFormData, getValuesFormData); |
| 164 | - getAllFormData.triggers = triggersArray; | |
| 165 | - getAllFormData.doConditions = doConditionsArray; | |
| 166 | - getAllFormData.doActions = doActionsArray; | |
| 228 | + getAllFormData.triggers = | |
| 229 | + isCountT.value == 2 ? isAddTriggerT.value.concat(triggersArray) : triggersArray; | |
| 230 | + getAllFormData.doConditions = | |
| 231 | + isCountC.value == 2 | |
| 232 | + ? isAddConditionD.value.concat(doConditionsArray) | |
| 233 | + : doConditionsArray; | |
| 234 | + getAllFormData.doActions = | |
| 235 | + isCountD.value == 2 ? isAddActionD.value.concat(doActionsArray) : doActionsArray; | |
| 167 | 236 | //所有的表单值 |
| 168 | 237 | await screenLinkPageAddApi(getAllFormData); |
| 169 | 238 | createMessage.success('场景联动新增成功'); |
| ... | ... | @@ -171,18 +240,34 @@ |
| 171 | 240 | emit('success'); |
| 172 | 241 | } |
| 173 | 242 | if (unref(isUpdate)) { |
| 174 | - getValuesFormData = getFieldsValue(); | |
| 175 | - let getChildValues = proxy.$refs.getChildData.getAllFields(); | |
| 243 | + triggersArray = []; | |
| 244 | + doConditionsArray = []; | |
| 245 | + doActionsArray = []; | |
| 176 | 246 | let getTriggerChildValues = proxy.$refs.getTriggerChildData.getAllFields(); |
| 247 | + if (getTriggerChildValues.count === 1) { | |
| 248 | + triggersArray.push(getTriggerChildValues.data); | |
| 249 | + } | |
| 177 | 250 | let getconditionChildValues = proxy.$refs.getConditionChildData.getAllFields(); |
| 178 | - doActionsArray.push(getChildValues); | |
| 179 | - triggersArray.push(getTriggerChildValues); | |
| 180 | - doConditionsArray.push(getconditionChildValues); | |
| 251 | + if (getconditionChildValues.count === 1) { | |
| 252 | + doConditionsArray.push(getconditionChildValues.data); | |
| 253 | + } | |
| 254 | + let getChildValues = proxy.$refs.getChildData.getAllFields(); | |
| 255 | + if (getChildValues.count === 1) { | |
| 256 | + doActionsArray.push(getChildValues.data); | |
| 257 | + } | |
| 258 | + getValuesFormData = getFieldsValue(); | |
| 259 | + | |
| 181 | 260 | getValuesFormData.id = getId.value; |
| 261 | + getValuesFormData.tenantId = getTenantId.value; | |
| 182 | 262 | Object.assign(getAllFormData, getValuesFormData); |
| 183 | - getAllFormData.triggers = triggersArray; | |
| 184 | - getAllFormData.doConditions = doConditionsArray; | |
| 185 | - getAllFormData.doActions = doActionsArray; | |
| 263 | + getAllFormData.triggers = | |
| 264 | + isCountT.value == 2 ? isAddTriggerT.value.concat(triggersArray) : triggersArray; | |
| 265 | + getAllFormData.doConditions = | |
| 266 | + isCountC.value == 2 | |
| 267 | + ? isAddConditionD.value.concat(doConditionsArray) | |
| 268 | + : doConditionsArray; | |
| 269 | + getAllFormData.doActions = | |
| 270 | + isCountD.value == 2 ? isAddActionD.value.concat(doActionsArray) : doActionsArray; | |
| 186 | 271 | await screenLinkPageUpdateApi(getAllFormData); |
| 187 | 272 | createMessage.success('场景联动编辑成功'); |
| 188 | 273 | closeDrawer(); |
| ... | ... | @@ -190,6 +275,9 @@ |
| 190 | 275 | } |
| 191 | 276 | } |
| 192 | 277 | return { |
| 278 | + getAddDoconditionPushValueDataValueFunc, | |
| 279 | + getAddDoActionPushValueDataValueFunc, | |
| 280 | + getAddPushValueDataValueFunc, | |
| 193 | 281 | getConditionChildData, |
| 194 | 282 | getTriggerChildData, |
| 195 | 283 | getChildData, | ... | ... |
| ... | ... | @@ -142,7 +142,7 @@ |
| 142 | 142 | document.createElement('link')) as HTMLLinkElement; |
| 143 | 143 | link.type = 'image/x-icon'; |
| 144 | 144 | link.rel = 'shortcut icon'; |
| 145 | - link.href = res.icon ?? '/public/favicon.ico'; | |
| 145 | + link.href = res.icon ?? '/favicon.ico'; | |
| 146 | 146 | document.getElementsByTagName('head')[0].appendChild(link); |
| 147 | 147 | } |
| 148 | 148 | } catch (error: any) { | ... | ... |
| ... | ... | @@ -68,23 +68,11 @@ export const searchFormSchema: FormSchema[] = [ |
| 68 | 68 | label: '姓名', |
| 69 | 69 | component: 'Input', |
| 70 | 70 | colProps: { span: 8 }, |
| 71 | + required: true, | |
| 71 | 72 | componentProps: { |
| 72 | 73 | maxLength: 255, |
| 73 | 74 | placeholder: '请输入姓名', |
| 74 | 75 | }, |
| 75 | - dynamicRules: () => { | |
| 76 | - return [ | |
| 77 | - { | |
| 78 | - required: false, | |
| 79 | - validator: (_, value) => { | |
| 80 | - if (String(value).length > 255) { | |
| 81 | - return Promise.reject('字数不超过255个字'); | |
| 82 | - } | |
| 83 | - return Promise.resolve(); | |
| 84 | - }, | |
| 85 | - }, | |
| 86 | - ]; | |
| 87 | - }, | |
| 88 | 76 | }, |
| 89 | 77 | ]; |
| 90 | 78 | ... | ... |
| ... | ... | @@ -107,7 +107,7 @@ |
| 107 | 107 | roleMenus.value = await getMenusIdsByRoleId(data.record.id); |
| 108 | 108 | treeData.value.map((m) => { |
| 109 | 109 | roleMenus.value.map((m1) => { |
| 110 | - if (m.key === m1) { | |
| 110 | + if (m.key === m1 && m.children.length !== 0) { | |
| 111 | 111 | proxy.useChildrenIdsRemoveParentId(m1, roleMenus.value); |
| 112 | 112 | } |
| 113 | 113 | }); | ... | ... |
| ... | ... | @@ -4,6 +4,7 @@ import { h } from 'vue'; |
| 4 | 4 | import { Switch } from 'ant-design-vue'; |
| 5 | 5 | import { setRoleStatus } from '/@/api/system/system'; |
| 6 | 6 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 7 | +import { getAllRoleList } from '/@/api/system/system'; | |
| 7 | 8 | |
| 8 | 9 | export const columns: BasicColumn[] = [ |
| 9 | 10 | { |
| ... | ... | @@ -29,10 +30,14 @@ export const columns: BasicColumn[] = [ |
| 29 | 30 | checkedChildren: '已启用', |
| 30 | 31 | unCheckedChildren: '已禁用', |
| 31 | 32 | loading: record.pendingStatus, |
| 32 | - onChange(checked: boolean) { | |
| 33 | + async onChange(checked: boolean) { | |
| 33 | 34 | record.pendingStatus = true; |
| 34 | 35 | const newStatus = checked ? 1 : 0; |
| 35 | 36 | const { createMessage } = useMessage(); |
| 37 | + const data = await getAllRoleList(); | |
| 38 | + const findById = data.find((f) => f.id == record.id); | |
| 39 | + if (findById?.id) return createMessage.error(`该租户下面有此用户,无法禁用`); | |
| 40 | + record.pendingStatus = true; | |
| 36 | 41 | setRoleStatus(record.id, newStatus) |
| 37 | 42 | .then(() => { |
| 38 | 43 | record.status = newStatus; | ... | ... |
| ... | ... | @@ -50,31 +50,33 @@ |
| 50 | 50 | placeholder: '请输入账号', |
| 51 | 51 | }, |
| 52 | 52 | dynamicRules: ({ values }) => { |
| 53 | - const findUserName = isJudgeUserNameExist.value.find((f) => { | |
| 54 | - if (f) { | |
| 55 | - return f.username == values.username; | |
| 56 | - } | |
| 57 | - }); | |
| 58 | - return [ | |
| 59 | - { | |
| 60 | - validator(_, value) { | |
| 61 | - return new Promise((resolve, reject) => { | |
| 62 | - if (value == '') { | |
| 63 | - reject('请输入账号'); | |
| 64 | - } else if (ChineseRegexp.test(value)) { | |
| 65 | - reject('账号不能含有中文'); | |
| 66 | - } else if (EmailRegexp.test(value)) { | |
| 67 | - reject('账号不能为电子邮箱格式'); | |
| 68 | - } else if (value == findUserName?.username) { | |
| 69 | - reject('账号已存在'); | |
| 70 | - return; | |
| 71 | - } else { | |
| 72 | - resolve(); | |
| 73 | - } | |
| 74 | - }); | |
| 53 | + try { | |
| 54 | + const findUserName = isJudgeUserNameExist.value.find((f) => { | |
| 55 | + if (f) { | |
| 56 | + return f.username == values.username; | |
| 57 | + } | |
| 58 | + }); | |
| 59 | + return [ | |
| 60 | + { | |
| 61 | + validator(_, value) { | |
| 62 | + return new Promise((resolve, reject) => { | |
| 63 | + if (value == '') { | |
| 64 | + reject('请输入账号'); | |
| 65 | + } else if (ChineseRegexp.test(value)) { | |
| 66 | + reject('账号不能含有中文'); | |
| 67 | + } else if (EmailRegexp.test(value)) { | |
| 68 | + reject('账号不能为电子邮箱格式'); | |
| 69 | + } else if (value == findUserName?.username) { | |
| 70 | + reject('账号已存在'); | |
| 71 | + return; | |
| 72 | + } else { | |
| 73 | + resolve(); | |
| 74 | + } | |
| 75 | + }); | |
| 76 | + }, | |
| 75 | 77 | }, |
| 76 | - }, | |
| 77 | - ]; | |
| 78 | + ]; | |
| 79 | + } catch (e) {} | |
| 78 | 80 | }, |
| 79 | 81 | }, |
| 80 | 82 | { | ... | ... |
| ... | ... | @@ -94,7 +94,6 @@ |
| 94 | 94 | await updateSchema({ field: 'title', componentProps: { disabled: false } }); |
| 95 | 95 | //如果是编辑操作,设置页面数据 |
| 96 | 96 | if (unref(isUpdate)) { |
| 97 | - // console.log(data.record); | |
| 98 | 97 | getTenantRoles(data.record.tenantId).then((result) => { |
| 99 | 98 | Reflect.set(data.record, 'roleIds', result); |
| 100 | 99 | //为表单赋值 | ... | ... |
| ... | ... | @@ -136,7 +136,6 @@ |
| 136 | 136 | previewVisible.value = false; |
| 137 | 137 | }; |
| 138 | 138 | const handlePreview = async (file: FileItem) => { |
| 139 | - console.log(file); | |
| 140 | 139 | if (!file.url && !file.preview) { |
| 141 | 140 | file.preview = (await getBase64(file.originFileObj)) as string; |
| 142 | 141 | } |
| ... | ... | @@ -209,7 +208,6 @@ |
| 209 | 208 | status: 'done', |
| 210 | 209 | url: response.fileStaticUri, |
| 211 | 210 | }); |
| 212 | - console.log('改变前', fileList.value); | |
| 213 | 211 | const fileArr = fileList.value.filter((item) => { |
| 214 | 212 | return item.percent !== 0; |
| 215 | 213 | }); |
| ... | ... | @@ -232,7 +230,6 @@ |
| 232 | 230 | |
| 233 | 231 | const handleUpdateInfo = async () => { |
| 234 | 232 | try { |
| 235 | - console.log(fileList.value); | |
| 236 | 233 | const fieldValue = getFieldsValue(); |
| 237 | 234 | // 做换字段 |
| 238 | 235 | const homeSwiper = fileList.value.map((item) => item.url); | ... | ... |