Showing
9 changed files
with
260 additions
and
34 deletions
| @@ -60,3 +60,182 @@ export const EmailRegexp = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a | @@ -60,3 +60,182 @@ export const EmailRegexp = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a | ||
| 60 | 60 | ||
| 61 | // 手机号正则 | 61 | // 手机号正则 |
| 62 | export const PhoneRegexp = /^[1][3,4,5,6,7,8,9][0-9]{9}$/; | 62 | export const PhoneRegexp = /^[1][3,4,5,6,7,8,9][0-9]{9}$/; |
| 63 | + | ||
| 64 | +//站内通知 | ||
| 65 | +export const NotificationTitleMaxLength: Rule[] = [ | ||
| 66 | + { | ||
| 67 | + required: true, | ||
| 68 | + validator: (_, value: string) => { | ||
| 69 | + if (String(value).length > 50) { | ||
| 70 | + return Promise.reject('标题长度不超过200字'); | ||
| 71 | + } | ||
| 72 | + }, | ||
| 73 | + validateTrigger: 'blur', | ||
| 74 | + }, | ||
| 75 | +]; | ||
| 76 | + | ||
| 77 | +export const NotificationContentMaxLength: Rule[] = [ | ||
| 78 | + { | ||
| 79 | + required: true, | ||
| 80 | + validator: (_, value: string) => { | ||
| 81 | + if (String(value).length > 50) { | ||
| 82 | + return Promise.reject('内容长度不超过50字'); | ||
| 83 | + } | ||
| 84 | + return Promise.resolve(); | ||
| 85 | + }, | ||
| 86 | + validateTrigger: 'blur', | ||
| 87 | + }, | ||
| 88 | +]; | ||
| 89 | +export const NotificationTypeMaxLength: Rule[] = [ | ||
| 90 | + { | ||
| 91 | + required: true, | ||
| 92 | + validator: (_, value: string) => { | ||
| 93 | + if (!value) { | ||
| 94 | + return Promise.reject('请选择类型'); | ||
| 95 | + } | ||
| 96 | + return Promise.resolve(); | ||
| 97 | + }, | ||
| 98 | + validateTrigger: 'blur', | ||
| 99 | + }, | ||
| 100 | +]; | ||
| 101 | + | ||
| 102 | +export const DeviceNameMaxLength: Rule[] = [ | ||
| 103 | + { | ||
| 104 | + required: true, | ||
| 105 | + validator: (_, value: string) => { | ||
| 106 | + if (String(value).length > 30) { | ||
| 107 | + return Promise.reject('设备名称长度不超过30字'); | ||
| 108 | + } | ||
| 109 | + return Promise.resolve(); | ||
| 110 | + }, | ||
| 111 | + validateTrigger: 'blur', | ||
| 112 | + }, | ||
| 113 | +]; | ||
| 114 | + | ||
| 115 | +export const DeviceProfileIdMaxLength: Rule[] = [ | ||
| 116 | + { | ||
| 117 | + required: true, | ||
| 118 | + validator: (_, value: string) => { | ||
| 119 | + if (String(value).length > 36) { | ||
| 120 | + return Promise.reject('设备配置长度不超过36字'); | ||
| 121 | + } | ||
| 122 | + return Promise.resolve(); | ||
| 123 | + }, | ||
| 124 | + validateTrigger: 'blur', | ||
| 125 | + }, | ||
| 126 | +]; | ||
| 127 | + | ||
| 128 | +export const DeviceOrgIdMaxLength: Rule[] = [ | ||
| 129 | + { | ||
| 130 | + required: true, | ||
| 131 | + validator: (_, value: string) => { | ||
| 132 | + if (String(value).length > 36) { | ||
| 133 | + return Promise.reject('组织长度不超过36字'); | ||
| 134 | + } | ||
| 135 | + return Promise.resolve(); | ||
| 136 | + }, | ||
| 137 | + validateTrigger: 'blur', | ||
| 138 | + }, | ||
| 139 | +]; | ||
| 140 | + | ||
| 141 | +export const DeviceLabelMaxLength: Rule[] = [ | ||
| 142 | + { | ||
| 143 | + required: true, | ||
| 144 | + validator: (_, value: string) => { | ||
| 145 | + if (String(value).length > 255) { | ||
| 146 | + return Promise.reject('设备标签不超过255字'); | ||
| 147 | + } | ||
| 148 | + return Promise.resolve(); | ||
| 149 | + }, | ||
| 150 | + validateTrigger: 'blur', | ||
| 151 | + }, | ||
| 152 | +]; | ||
| 153 | +export const DeviceDescriptionlMaxLength: Rule[] = [ | ||
| 154 | + { | ||
| 155 | + required: true, | ||
| 156 | + validator: (_, value: string) => { | ||
| 157 | + if (String(value).length > 500) { | ||
| 158 | + return Promise.reject('备注不超过500字'); | ||
| 159 | + } | ||
| 160 | + return Promise.resolve(); | ||
| 161 | + }, | ||
| 162 | + validateTrigger: 'blur', | ||
| 163 | + }, | ||
| 164 | +]; | ||
| 165 | +export const DeviceIdMaxLength: Rule[] = [ | ||
| 166 | + { | ||
| 167 | + required: true, | ||
| 168 | + validator: (_, value: string) => { | ||
| 169 | + if (String(value).length > 36) { | ||
| 170 | + return Promise.reject('id不超过36字'); | ||
| 171 | + } | ||
| 172 | + return Promise.resolve(); | ||
| 173 | + }, | ||
| 174 | + validateTrigger: 'blur', | ||
| 175 | + }, | ||
| 176 | +]; | ||
| 177 | + | ||
| 178 | +export const DeviceTenantIdMaxLength: Rule[] = [ | ||
| 179 | + { | ||
| 180 | + required: true, | ||
| 181 | + validator: (_, value: string) => { | ||
| 182 | + if (String(value).length > 36) { | ||
| 183 | + return Promise.reject('租户Code不超过36字'); | ||
| 184 | + } | ||
| 185 | + return Promise.resolve(); | ||
| 186 | + }, | ||
| 187 | + validateTrigger: 'blur', | ||
| 188 | + }, | ||
| 189 | +]; | ||
| 190 | + | ||
| 191 | +export const DeviceTbDeviceIdMaxLength: Rule[] = [ | ||
| 192 | + { | ||
| 193 | + required: true, | ||
| 194 | + validator: (_, value: string) => { | ||
| 195 | + if (String(value).length > 36) { | ||
| 196 | + return Promise.reject('tbDeviceId不超过36字'); | ||
| 197 | + } | ||
| 198 | + return Promise.resolve(); | ||
| 199 | + }, | ||
| 200 | + validateTrigger: 'blur', | ||
| 201 | + }, | ||
| 202 | +]; | ||
| 203 | + | ||
| 204 | +export const DeviceUserNameMaxLength: Rule[] = [ | ||
| 205 | + { | ||
| 206 | + required: true, | ||
| 207 | + validator: (_, value: string) => { | ||
| 208 | + if (String(value).length > 50) { | ||
| 209 | + return Promise.reject('用户名长度不超过50字'); | ||
| 210 | + } | ||
| 211 | + return Promise.resolve(); | ||
| 212 | + }, | ||
| 213 | + validateTrigger: 'blur', | ||
| 214 | + }, | ||
| 215 | +]; | ||
| 216 | + | ||
| 217 | +export const DeviceQueryUserNameMaxLength: Rule[] = [ | ||
| 218 | + { | ||
| 219 | + required: true, | ||
| 220 | + validator: (_, value: string) => { | ||
| 221 | + if (String(value).length > 50) { | ||
| 222 | + return Promise.reject('设备名称长度不超过50字'); | ||
| 223 | + } | ||
| 224 | + return Promise.resolve(); | ||
| 225 | + }, | ||
| 226 | + validateTrigger: 'blur', | ||
| 227 | + }, | ||
| 228 | +]; | ||
| 229 | + | ||
| 230 | +export const DeviceProfileQueryUserNameMaxLength: Rule[] = [ | ||
| 231 | + { | ||
| 232 | + required: true, | ||
| 233 | + validator: (_, value: string) => { | ||
| 234 | + if (String(value).length > 50) { | ||
| 235 | + return Promise.reject('配置名称长度不超过50字'); | ||
| 236 | + } | ||
| 237 | + return Promise.resolve(); | ||
| 238 | + }, | ||
| 239 | + validateTrigger: 'blur', | ||
| 240 | + }, | ||
| 241 | +]; |
| @@ -3,6 +3,18 @@ import { findDictItemByCode } from '/@/api/system/dict'; | @@ -3,6 +3,18 @@ import { findDictItemByCode } from '/@/api/system/dict'; | ||
| 3 | import { deviceProfile } from '/@/api/device/deviceManager'; | 3 | import { deviceProfile } from '/@/api/device/deviceManager'; |
| 4 | import { getOrganizationList } from '/@/api/system/system'; | 4 | import { getOrganizationList } from '/@/api/system/system'; |
| 5 | import { copyTransFun } from '/@/utils/fnUtils'; | 5 | import { copyTransFun } from '/@/utils/fnUtils'; |
| 6 | +import { | ||
| 7 | + DeviceNameMaxLength, | ||
| 8 | + DeviceUserNameMaxLength, | ||
| 9 | + DeviceProfileIdMaxLength, | ||
| 10 | + DeviceOrgIdMaxLength, | ||
| 11 | + DeviceLabelMaxLength, | ||
| 12 | + DeviceDescriptionlMaxLength, | ||
| 13 | + DeviceIdMaxLength, | ||
| 14 | + DeviceTenantIdMaxLength, | ||
| 15 | + DeviceTbDeviceIdMaxLength, | ||
| 16 | +} from '/@/utils/rules'; | ||
| 17 | + | ||
| 6 | // 第一步的表单 | 18 | // 第一步的表单 |
| 7 | export const step1Schemas: FormSchema[] = [ | 19 | export const step1Schemas: FormSchema[] = [ |
| 8 | { | 20 | { |
| @@ -17,8 +29,9 @@ export const step1Schemas: FormSchema[] = [ | @@ -17,8 +29,9 @@ export const step1Schemas: FormSchema[] = [ | ||
| 17 | required: true, | 29 | required: true, |
| 18 | component: 'Input', | 30 | component: 'Input', |
| 19 | componentProps: { | 31 | componentProps: { |
| 20 | - maxLength: 30, | 32 | + placeholder: '设备名称', |
| 21 | }, | 33 | }, |
| 34 | + rules: DeviceNameMaxLength, | ||
| 22 | }, | 35 | }, |
| 23 | { | 36 | { |
| 24 | field: 'deviceType', | 37 | field: 'deviceType', |
| @@ -26,6 +39,7 @@ export const step1Schemas: FormSchema[] = [ | @@ -26,6 +39,7 @@ export const step1Schemas: FormSchema[] = [ | ||
| 26 | required: true, | 39 | required: true, |
| 27 | component: 'ApiSelect', | 40 | component: 'ApiSelect', |
| 28 | componentProps: { | 41 | componentProps: { |
| 42 | + placeholder: '设备类型', | ||
| 29 | api: findDictItemByCode, | 43 | api: findDictItemByCode, |
| 30 | params: { | 44 | params: { |
| 31 | dictCode: 'device_type', | 45 | dictCode: 'device_type', |
| @@ -44,6 +58,7 @@ export const step1Schemas: FormSchema[] = [ | @@ -44,6 +58,7 @@ export const step1Schemas: FormSchema[] = [ | ||
| 44 | labelField: 'name', | 58 | labelField: 'name', |
| 45 | valueField: 'id', | 59 | valueField: 'id', |
| 46 | }, | 60 | }, |
| 61 | + rules: DeviceProfileIdMaxLength, | ||
| 47 | }, | 62 | }, |
| 48 | { | 63 | { |
| 49 | field: 'organizationId', | 64 | field: 'organizationId', |
| @@ -57,6 +72,7 @@ export const step1Schemas: FormSchema[] = [ | @@ -57,6 +72,7 @@ export const step1Schemas: FormSchema[] = [ | ||
| 57 | return data; | 72 | return data; |
| 58 | }, | 73 | }, |
| 59 | }, | 74 | }, |
| 75 | + rules: DeviceOrgIdMaxLength, | ||
| 60 | }, | 76 | }, |
| 61 | { | 77 | { |
| 62 | field: 'label', | 78 | field: 'label', |
| @@ -65,6 +81,7 @@ export const step1Schemas: FormSchema[] = [ | @@ -65,6 +81,7 @@ export const step1Schemas: FormSchema[] = [ | ||
| 65 | componentProps: { | 81 | componentProps: { |
| 66 | maxLength: 255, | 82 | maxLength: 255, |
| 67 | }, | 83 | }, |
| 84 | + rules: DeviceLabelMaxLength, | ||
| 68 | }, | 85 | }, |
| 69 | { | 86 | { |
| 70 | field: 'deviceAddress', | 87 | field: 'deviceAddress', |
| @@ -76,24 +93,28 @@ export const step1Schemas: FormSchema[] = [ | @@ -76,24 +93,28 @@ export const step1Schemas: FormSchema[] = [ | ||
| 76 | field: 'description', | 93 | field: 'description', |
| 77 | label: '备注', | 94 | label: '备注', |
| 78 | component: 'InputTextArea', | 95 | component: 'InputTextArea', |
| 96 | + rules: DeviceDescriptionlMaxLength, | ||
| 79 | }, | 97 | }, |
| 80 | { | 98 | { |
| 81 | field: 'id', | 99 | field: 'id', |
| 82 | label: 'id', | 100 | label: 'id', |
| 83 | component: 'Input', | 101 | component: 'Input', |
| 84 | show: false, | 102 | show: false, |
| 103 | + rules: DeviceIdMaxLength, | ||
| 85 | }, | 104 | }, |
| 86 | { | 105 | { |
| 87 | field: 'tenantId', | 106 | field: 'tenantId', |
| 88 | label: '租户Code', | 107 | label: '租户Code', |
| 89 | component: 'Input', | 108 | component: 'Input', |
| 90 | show: false, | 109 | show: false, |
| 110 | + rules: DeviceTenantIdMaxLength, | ||
| 91 | }, | 111 | }, |
| 92 | { | 112 | { |
| 93 | field: 'tbDeviceId', | 113 | field: 'tbDeviceId', |
| 94 | label: 'tbDeviceId', | 114 | label: 'tbDeviceId', |
| 95 | component: 'Input', | 115 | component: 'Input', |
| 96 | show: false, | 116 | show: false, |
| 117 | + rules: DeviceTbDeviceIdMaxLength, | ||
| 97 | }, | 118 | }, |
| 98 | ]; | 119 | ]; |
| 99 | 120 | ||
| @@ -264,6 +285,7 @@ export const step2Schemas: FormSchema[] = [ | @@ -264,6 +285,7 @@ export const step2Schemas: FormSchema[] = [ | ||
| 264 | component: 'Input', | 285 | component: 'Input', |
| 265 | field: 'username', | 286 | field: 'username', |
| 266 | required: true, | 287 | required: true, |
| 288 | + rules: DeviceUserNameMaxLength, | ||
| 267 | ifShow: false, | 289 | ifShow: false, |
| 268 | }, | 290 | }, |
| 269 | { | 291 | { |
| @@ -430,6 +452,7 @@ export const TokenSchemas: FormSchema[] = [ | @@ -430,6 +452,7 @@ export const TokenSchemas: FormSchema[] = [ | ||
| 430 | field: 'username', | 452 | field: 'username', |
| 431 | required: true, | 453 | required: true, |
| 432 | ifShow: false, | 454 | ifShow: false, |
| 455 | + rules: DeviceUserNameMaxLength, | ||
| 433 | }, | 456 | }, |
| 434 | { | 457 | { |
| 435 | label: '密码', | 458 | label: '密码', |
| @@ -2,6 +2,8 @@ import { formatToDate } from '/@/utils/dateUtil'; | @@ -2,6 +2,8 @@ import { formatToDate } from '/@/utils/dateUtil'; | ||
| 2 | import { BasicColumn } from '/@/components/Table'; | 2 | import { BasicColumn } from '/@/components/Table'; |
| 3 | import { FormSchema } from '/@/components/Table'; | 3 | import { FormSchema } from '/@/components/Table'; |
| 4 | import { DeviceTypeEnum, DeviceState } from '/@/api/device/model/deviceModel'; | 4 | import { DeviceTypeEnum, DeviceState } from '/@/api/device/model/deviceModel'; |
| 5 | +import { DeviceQueryUserNameMaxLength } from '/@/utils/rules'; | ||
| 6 | + | ||
| 5 | // 表格列数据 | 7 | // 表格列数据 |
| 6 | export const columns: BasicColumn[] = [ | 8 | export const columns: BasicColumn[] = [ |
| 7 | { | 9 | { |
| @@ -84,6 +86,7 @@ export const searchFormSchema: FormSchema[] = [ | @@ -84,6 +86,7 @@ export const searchFormSchema: FormSchema[] = [ | ||
| 84 | field: 'name', | 86 | field: 'name', |
| 85 | label: '设备名称', | 87 | label: '设备名称', |
| 86 | component: 'Input', | 88 | component: 'Input', |
| 87 | - colProps: { span: 6 }, | 89 | + colProps: { span: 7 }, |
| 90 | + rules: DeviceQueryUserNameMaxLength, | ||
| 88 | }, | 91 | }, |
| 89 | ]; | 92 | ]; |
| @@ -34,10 +34,9 @@ | @@ -34,10 +34,9 @@ | ||
| 34 | @next="handleStep3Next" | 34 | @next="handleStep3Next" |
| 35 | @redo="handleRedo" | 35 | @redo="handleRedo" |
| 36 | /></div> | 36 | /></div> |
| 37 | - | ||
| 38 | <div v-show="current === 3"> | 37 | <div v-show="current === 3"> |
| 39 | - <DeviceProfileStep4 ref="DeviceProfileStep4Ref" @prev="handleStepPrev" | ||
| 40 | - /></div> | 38 | + <DeviceProfileStep4 ref="DeviceProfileStep4Ref" @prev="handleStepPrev" /> |
| 39 | + </div> | ||
| 41 | </div> | 40 | </div> |
| 42 | </BasicModal> | 41 | </BasicModal> |
| 43 | </template> | 42 | </template> |
| @@ -95,6 +94,8 @@ | @@ -95,6 +94,8 @@ | ||
| 95 | current.value = 0; | 94 | current.value = 0; |
| 96 | proxy.$refs.DeviceProfileStep3Ref.clearProfileDataFunc(); | 95 | proxy.$refs.DeviceProfileStep3Ref.clearProfileDataFunc(); |
| 97 | proxy.$refs.DeviceProfileStep3Ref.addAlarmRule(); | 96 | proxy.$refs.DeviceProfileStep3Ref.addAlarmRule(); |
| 97 | + // proxy.$refs.DeviceProfileStep4Ref.customResetAndFunc(); | ||
| 98 | + | ||
| 98 | switch (current.value) { | 99 | switch (current.value) { |
| 99 | case 0: | 100 | case 0: |
| 100 | proxy.$refs.DeviceProfileStep1Ref.customResetFunc(); | 101 | proxy.$refs.DeviceProfileStep1Ref.customResetFunc(); |
| @@ -142,6 +143,7 @@ | @@ -142,6 +143,7 @@ | ||
| 142 | } | 143 | } |
| 143 | function handleStep2Next(v) { | 144 | function handleStep2Next(v) { |
| 144 | current.value++; | 145 | current.value++; |
| 146 | + | ||
| 145 | getStepTwoData.value = v; | 147 | getStepTwoData.value = v; |
| 146 | if (unref(isUpdate)) { | 148 | if (unref(isUpdate)) { |
| 147 | proxy.$refs.DeviceProfileStep3Ref.retryRegisterFormFunc({ | 149 | proxy.$refs.DeviceProfileStep3Ref.retryRegisterFormFunc({ |
| @@ -234,13 +236,22 @@ | @@ -234,13 +236,22 @@ | ||
| 234 | function handleStep3Next(v) { | 236 | function handleStep3Next(v) { |
| 235 | current.value++; | 237 | current.value++; |
| 236 | getStepThreeData.value = v; | 238 | getStepThreeData.value = v; |
| 237 | - if (unref(isUpdate)) { | ||
| 238 | - proxy.$refs.DeviceProfileStep4Ref.resetFieldsFunc({ | ||
| 239 | - alarmContactId: editEchoData.value.alarmProfile.alarmContactId, | ||
| 240 | - messageMode: editEchoData.value.alarmProfile.messageMode, | ||
| 241 | - }); | ||
| 242 | - } else { | ||
| 243 | - proxy.$refs.DeviceProfileStep4Ref.customResetAndFunc(); | 239 | + try { |
| 240 | + if (unref(isUpdate)) { | ||
| 241 | + setTimeout(() => { | ||
| 242 | + proxy.$refs.DeviceProfileStep4Ref.resetFieldsFunc({ | ||
| 243 | + alarmContactId: editEchoData.value.alarmProfile.alarmContactId, | ||
| 244 | + messageMode: editEchoData.value.alarmProfile.messageMode, | ||
| 245 | + }); | ||
| 246 | + }, 1000); | ||
| 247 | + } | ||
| 248 | + // if (!unref(isUpdate)) { | ||
| 249 | + // setTimeout(() => { | ||
| 250 | + // proxy.$refs.DeviceProfileStep4Ref.customResetAndFunc(); | ||
| 251 | + // }, 1000); | ||
| 252 | + // } | ||
| 253 | + } catch (e) { | ||
| 254 | + return e; | ||
| 244 | } | 255 | } |
| 245 | } | 256 | } |
| 246 | function handleRedo() { | 257 | function handleRedo() { |
| @@ -2,8 +2,9 @@ import { BasicColumn } from '/@/components/Table'; | @@ -2,8 +2,9 @@ import { BasicColumn } from '/@/components/Table'; | ||
| 2 | import { FormSchema } from '/@/components/Table'; | 2 | import { FormSchema } from '/@/components/Table'; |
| 3 | import { findDictItemByCode } from '/@/api/system/dict'; | 3 | import { findDictItemByCode } from '/@/api/system/dict'; |
| 4 | import { MessageEnum } from '/@/enums/messageEnum'; | 4 | import { MessageEnum } from '/@/enums/messageEnum'; |
| 5 | -import { getOrganizationList } from '/@/api/system/system'; | ||
| 6 | -import { copyTransFun } from '/@/utils/fnUtils'; | 5 | +// import { getOrganizationList } from '/@/api/system/system'; |
| 6 | +// import { copyTransFun } from '/@/utils/fnUtils'; | ||
| 7 | +import { DeviceProfileQueryUserNameMaxLength } from '/@/utils/rules'; | ||
| 7 | 8 | ||
| 8 | export const columns: BasicColumn[] = [ | 9 | export const columns: BasicColumn[] = [ |
| 9 | { | 10 | { |
| @@ -30,23 +31,13 @@ export const columns: BasicColumn[] = [ | @@ -30,23 +31,13 @@ export const columns: BasicColumn[] = [ | ||
| 30 | 31 | ||
| 31 | export const searchFormSchema: FormSchema[] = [ | 32 | export const searchFormSchema: FormSchema[] = [ |
| 32 | { | 33 | { |
| 33 | - field: 'organizationId', | ||
| 34 | - label: '请选择组织', | ||
| 35 | - component: 'ApiTreeSelect', | ||
| 36 | - colProps: { span: 6 }, | ||
| 37 | - componentProps: { | ||
| 38 | - api: async () => { | ||
| 39 | - const data = await getOrganizationList(); | ||
| 40 | - copyTransFun(data as any as any[]); | ||
| 41 | - return data; | ||
| 42 | - }, | ||
| 43 | - }, | ||
| 44 | - }, | ||
| 45 | - { | ||
| 46 | field: 'name', | 34 | field: 'name', |
| 47 | label: '配置名称', | 35 | label: '配置名称', |
| 48 | component: 'Input', | 36 | component: 'Input', |
| 49 | colProps: { span: 8 }, | 37 | colProps: { span: 8 }, |
| 38 | + componentProps: { | ||
| 39 | + placeholder: '请输入配置名称', | ||
| 40 | + }, | ||
| 50 | }, | 41 | }, |
| 51 | ]; | 42 | ]; |
| 52 | 43 | ||
| @@ -63,6 +54,10 @@ export const formSchema: FormSchema[] = [ | @@ -63,6 +54,10 @@ export const formSchema: FormSchema[] = [ | ||
| 63 | label: '配置名称', | 54 | label: '配置名称', |
| 64 | required: true, | 55 | required: true, |
| 65 | component: 'Input', | 56 | component: 'Input', |
| 57 | + componentProps: { | ||
| 58 | + placeholder: '请输入配置名称', | ||
| 59 | + }, | ||
| 60 | + rules: DeviceProfileQueryUserNameMaxLength, | ||
| 66 | }, | 61 | }, |
| 67 | { | 62 | { |
| 68 | field: 'messageType', | 63 | field: 'messageType', |
| @@ -223,7 +223,8 @@ | @@ -223,7 +223,8 @@ | ||
| 223 | const [register] = useModalInner(async (data) => { | 223 | const [register] = useModalInner(async (data) => { |
| 224 | activeKey.value = '1'; | 224 | activeKey.value = '1'; |
| 225 | isUpdate.value = !!data?.isUpdate; | 225 | isUpdate.value = !!data?.isUpdate; |
| 226 | - descInfo.value = await deviceConfigGetDetail(data.record.id); | 226 | + const getV = await deviceConfigGetDetail(data.record.id); |
| 227 | + descInfo.value = getV; | ||
| 227 | try { | 228 | try { |
| 228 | resetFields(); | 229 | resetFields(); |
| 229 | await setRegisterDetail({ ...descInfo.value }); | 230 | await setRegisterDetail({ ...descInfo.value }); |
| @@ -312,10 +313,12 @@ | @@ -312,10 +313,12 @@ | ||
| 312 | }); | 313 | }); |
| 313 | }, 1000); | 314 | }, 1000); |
| 314 | case '4': | 315 | case '4': |
| 315 | - setRegisterContact({ | ||
| 316 | - alarmContactId: descInfo.value.alarmProfile.alarmContactId, | ||
| 317 | - messageMode: descInfo.value.alarmProfile.messageMode, | ||
| 318 | - }); | 316 | + setTimeout(() => { |
| 317 | + setRegisterContact({ | ||
| 318 | + alarmContactId: descInfo.value.alarmProfile.alarmContactId, | ||
| 319 | + messageMode: descInfo.value.alarmProfile.messageMode, | ||
| 320 | + }); | ||
| 321 | + }, 1000); | ||
| 319 | break; | 322 | break; |
| 320 | } | 323 | } |
| 321 | } catch (e) { | 324 | } catch (e) { |
| @@ -949,7 +949,11 @@ | @@ -949,7 +949,11 @@ | ||
| 949 | isRuleAlarmRuleConditions.value = 4; | 949 | isRuleAlarmRuleConditions.value = 4; |
| 950 | setTimeout(() => { | 950 | setTimeout(() => { |
| 951 | openModal4(true); | 951 | openModal4(true); |
| 952 | - proxy.$refs.getChildData1.resetDataFunc(); | 952 | + try { |
| 953 | + proxy.$refs.getChildData1.resetDataFunc(); | ||
| 954 | + } catch (e) { | ||
| 955 | + return e; | ||
| 956 | + } | ||
| 953 | }, 50); | 957 | }, 50); |
| 954 | }; | 958 | }; |
| 955 | const handleOpenClearEnableRule = () => { | 959 | const handleOpenClearEnableRule = () => { |
| @@ -5,6 +5,7 @@ import { deviceConfigGetRuleChain } from '/@/api/device/deviceConfigApi'; | @@ -5,6 +5,7 @@ import { deviceConfigGetRuleChain } from '/@/api/device/deviceConfigApi'; | ||
| 5 | import { ref } from 'vue'; | 5 | import { ref } from 'vue'; |
| 6 | import { findDictItemByCode } from '/@/api/system/dict'; | 6 | import { findDictItemByCode } from '/@/api/system/dict'; |
| 7 | import { alarmContactGetPage } from '/@/api/device/deviceConfigApi'; | 7 | import { alarmContactGetPage } from '/@/api/device/deviceConfigApi'; |
| 8 | +import { DeviceProfileQueryUserNameMaxLength } from '/@/utils/rules'; | ||
| 8 | 9 | ||
| 9 | export const step1Schemas: FormSchema[] = [ | 10 | export const step1Schemas: FormSchema[] = [ |
| 10 | { | 11 | { |
| @@ -13,8 +14,9 @@ export const step1Schemas: FormSchema[] = [ | @@ -13,8 +14,9 @@ export const step1Schemas: FormSchema[] = [ | ||
| 13 | required: true, | 14 | required: true, |
| 14 | component: 'Input', | 15 | component: 'Input', |
| 15 | componentProps: { | 16 | componentProps: { |
| 16 | - maxLength: 30, | 17 | + placeholder: '请输入配置名称', |
| 17 | }, | 18 | }, |
| 19 | + rules: DeviceProfileQueryUserNameMaxLength, | ||
| 18 | }, | 20 | }, |
| 19 | //规则链(string) | 21 | //规则链(string) |
| 20 | { | 22 | { |
| @@ -216,7 +218,9 @@ export const alertContactsSchemas: FormSchema[] = [ | @@ -216,7 +218,9 @@ export const alertContactsSchemas: FormSchema[] = [ | ||
| 216 | field: 'alarmContactId', | 218 | field: 'alarmContactId', |
| 217 | label: '告警通知联系人', | 219 | label: '告警通知联系人', |
| 218 | component: 'ApiSelect', | 220 | component: 'ApiSelect', |
| 221 | + required: true, | ||
| 219 | componentProps: { | 222 | componentProps: { |
| 223 | + placeholder: '请选择告警通知联系人', | ||
| 220 | api: alarmContactGetPage, | 224 | api: alarmContactGetPage, |
| 221 | labelField: 'username', | 225 | labelField: 'username', |
| 222 | valueField: 'id', | 226 | valueField: 'id', |
| @@ -229,6 +233,7 @@ export const alertContactsSchemas: FormSchema[] = [ | @@ -229,6 +233,7 @@ export const alertContactsSchemas: FormSchema[] = [ | ||
| 229 | required: true, | 233 | required: true, |
| 230 | component: 'ApiSelect', | 234 | component: 'ApiSelect', |
| 231 | componentProps: { | 235 | componentProps: { |
| 236 | + placeholder: '请选择告警通知方式', | ||
| 232 | api: findDictItemByCode, | 237 | api: findDictItemByCode, |
| 233 | params: { | 238 | params: { |
| 234 | dictCode: 'message_type', | 239 | dictCode: 'message_type', |
| @@ -5,6 +5,7 @@ import { Tinymce } from '/@/components/Tinymce/index'; | @@ -5,6 +5,7 @@ import { Tinymce } from '/@/components/Tinymce/index'; | ||
| 5 | import { getOrganizationList } from '/@/api/system/system'; | 5 | import { getOrganizationList } from '/@/api/system/system'; |
| 6 | import { copyTransFun } from '/@/utils/fnUtils'; | 6 | import { copyTransFun } from '/@/utils/fnUtils'; |
| 7 | import { Tag } from 'ant-design-vue'; | 7 | import { Tag } from 'ant-design-vue'; |
| 8 | +import { NotificationTitleMaxLength, NotificationTypeMaxLength } from '/@/utils/rules'; | ||
| 8 | 9 | ||
| 9 | export enum IsOrgEnum { | 10 | export enum IsOrgEnum { |
| 10 | IS_ORG_ENUM = '1', | 11 | IS_ORG_ENUM = '1', |
| @@ -86,6 +87,7 @@ export const formSchema: FormSchema[] = [ | @@ -86,6 +87,7 @@ export const formSchema: FormSchema[] = [ | ||
| 86 | }, | 87 | }, |
| 87 | ], | 88 | ], |
| 88 | }, | 89 | }, |
| 90 | + rules: NotificationTypeMaxLength, | ||
| 89 | }, | 91 | }, |
| 90 | { | 92 | { |
| 91 | field: 'title', | 93 | field: 'title', |
| @@ -96,6 +98,7 @@ export const formSchema: FormSchema[] = [ | @@ -96,6 +98,7 @@ export const formSchema: FormSchema[] = [ | ||
| 96 | componentProps: { | 98 | componentProps: { |
| 97 | placeholder: '请输入标题', | 99 | placeholder: '请输入标题', |
| 98 | }, | 100 | }, |
| 101 | + rules: NotificationTitleMaxLength, | ||
| 99 | }, | 102 | }, |
| 100 | { | 103 | { |
| 101 | field: 'content', | 104 | field: 'content', |