Commit a282b517d883da21e40266d9605584ddeac863b1
1 parent
9e0402d8
fix:修复设备配置报警规则数据和详情数据回显问题,feat:新增日程表数据收集
Showing
13 changed files
with
625 additions
and
212 deletions
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | @cancel="handleCancel" | 8 | @cancel="handleCancel" |
| 9 | > | 9 | > |
| 10 | <div class="step-form-form"> | 10 | <div class="step-form-form"> |
| 11 | - <a-steps :current="current"> | 11 | + <a-steps :current="current" @change="handleChange"> |
| 12 | <a-step title="设备配置" /> | 12 | <a-step title="设备配置" /> |
| 13 | <a-step title="传输配置" /> | 13 | <a-step title="传输配置" /> |
| 14 | <a-step title="告警配置" /> | 14 | <a-step title="告警配置" /> |
| @@ -86,10 +86,15 @@ | @@ -86,10 +86,15 @@ | ||
| 86 | const current = ref(0); | 86 | const current = ref(0); |
| 87 | const isUpdate = ref(true); | 87 | const isUpdate = ref(true); |
| 88 | const getTitle = computed(() => (!unref(isUpdate) ? '新增设备配置' : '编辑设备配置')); | 88 | const getTitle = computed(() => (!unref(isUpdate) ? '新增设备配置' : '编辑设备配置')); |
| 89 | + const handleChange = (v) => { | ||
| 90 | + console.log(v); | ||
| 91 | + }; | ||
| 89 | const [register, { closeModal }] = useModalInner(async (data) => { | 92 | const [register, { closeModal }] = useModalInner(async (data) => { |
| 90 | isUpdate.value = !!data?.isUpdate; | 93 | isUpdate.value = !!data?.isUpdate; |
| 91 | if (!unref(isUpdate)) { | 94 | if (!unref(isUpdate)) { |
| 92 | current.value = 0; | 95 | current.value = 0; |
| 96 | + proxy.$refs.DeviceProfileStep3Ref.clearProfileDataFunc(); | ||
| 97 | + proxy.$refs.DeviceProfileStep3Ref.addAlarmRule(); | ||
| 93 | switch (current.value) { | 98 | switch (current.value) { |
| 94 | case 0: | 99 | case 0: |
| 95 | proxy.$refs.DeviceProfileStep1Ref.customResetFunc(); | 100 | proxy.$refs.DeviceProfileStep1Ref.customResetFunc(); |
| @@ -109,33 +114,15 @@ | @@ -109,33 +114,15 @@ | ||
| 109 | } | 114 | } |
| 110 | if (unref(isUpdate)) { | 115 | if (unref(isUpdate)) { |
| 111 | current.value = 0; | 116 | current.value = 0; |
| 117 | + proxy.$refs.DeviceProfileStep3Ref.clearProfileDataFunc(); | ||
| 118 | + proxy.$refs.DeviceProfileStep3Ref.addAlarmRule(); | ||
| 112 | postEditId.value = data.record.id; | 119 | postEditId.value = data.record.id; |
| 113 | const getBackendData = await deviceConfigGetDetail(postEditId.value); | 120 | const getBackendData = await deviceConfigGetDetail(postEditId.value); |
| 114 | editEchoData.value = { ...getBackendData }; | 121 | editEchoData.value = { ...getBackendData }; |
| 115 | - console.log(editEchoData.value); | ||
| 116 | switch (current.value) { | 122 | switch (current.value) { |
| 117 | case 0: | 123 | case 0: |
| 118 | proxy.$refs.DeviceProfileStep1Ref.resetFieldsFunc(editEchoData.value); | 124 | proxy.$refs.DeviceProfileStep1Ref.resetFieldsFunc(editEchoData.value); |
| 119 | break; | 125 | break; |
| 120 | - case 1: | ||
| 121 | - proxy.$refs.DeviceProfileStep2Ref.resetFieldsFunc({ | ||
| 122 | - transportType: editEchoData.value.profileData.transportConfiguration.type, | ||
| 123 | - }); | ||
| 124 | - break; | ||
| 125 | - case 2: | ||
| 126 | - proxy.$refs.DeviceProfileStep3Ref.retryRegisterFormFunc({ | ||
| 127 | - alarmType: editEchoData.value.profileData?.alarms[0].alarmType, | ||
| 128 | - }); | ||
| 129 | - proxy.$refs.DeviceProfileStep3Ref.retryRegisterFormHighSettingmFunc( | ||
| 130 | - editEchoData.value | ||
| 131 | - ); | ||
| 132 | - proxy.$refs.DeviceProfileStep3Ref.retryRegisterFormCreateAlarmFunc( | ||
| 133 | - editEchoData.value | ||
| 134 | - ); | ||
| 135 | - break; | ||
| 136 | - case 3: | ||
| 137 | - proxy.$refs.DeviceProfileStep4Ref.resetFieldsFunc(editEchoData.value); | ||
| 138 | - break; | ||
| 139 | } | 126 | } |
| 140 | } | 127 | } |
| 141 | }); | 128 | }); |
| @@ -145,15 +132,116 @@ | @@ -145,15 +132,116 @@ | ||
| 145 | function handleStepNext1(v) { | 132 | function handleStepNext1(v) { |
| 146 | current.value++; | 133 | current.value++; |
| 147 | getStepOneData.value = v; | 134 | getStepOneData.value = v; |
| 135 | + if (unref(isUpdate)) { | ||
| 136 | + proxy.$refs.DeviceProfileStep2Ref.resetFieldsFunc({ | ||
| 137 | + transportType: editEchoData.value.profileData.transportConfiguration.type, | ||
| 138 | + }); | ||
| 139 | + } else { | ||
| 140 | + // proxy.$refs.DeviceProfileStep2Ref.customResetAndFunc(); | ||
| 141 | + } | ||
| 148 | } | 142 | } |
| 149 | function handleStep2Next(v) { | 143 | function handleStep2Next(v) { |
| 150 | current.value++; | 144 | current.value++; |
| 151 | getStepTwoData.value = v; | 145 | getStepTwoData.value = v; |
| 152 | - proxy.$refs.DeviceProfileStep3Ref.addAlarmRule(); | 146 | + if (unref(isUpdate)) { |
| 147 | + proxy.$refs.DeviceProfileStep3Ref.retryRegisterFormFunc({ | ||
| 148 | + alarmType: editEchoData.value.profileData.alarms[0].alarmType, | ||
| 149 | + }); | ||
| 150 | + proxy.$refs.DeviceProfileStep3Ref.retryRegisterFormHighSettingmFunc({ | ||
| 151 | + propagate: editEchoData.value.profileData.alarms[0].propagate, | ||
| 152 | + propagateRelationTypes: | ||
| 153 | + editEchoData.value.profileData?.alarms[0].propagateRelationTypes, | ||
| 154 | + }); | ||
| 155 | + const getKey = Object.keys(editEchoData.value.profileData?.alarms[0].createRules); | ||
| 156 | + proxy.$refs.DeviceProfileStep3Ref.retryRegisterFormCreateAlarmFunc({ | ||
| 157 | + default: getKey[0], | ||
| 158 | + }); | ||
| 159 | + const findDay = [ | ||
| 160 | + { label: '等于', value: 'EQUAL' }, | ||
| 161 | + { label: '不等于', value: 'NOT_EQUAL' }, | ||
| 162 | + { label: '开始于', value: 'STARTS_WITH' }, | ||
| 163 | + { label: '结束于', value: 'ENDS_WITH' }, | ||
| 164 | + { label: '包含', value: 'CONTAINS' }, | ||
| 165 | + { label: '不包含', value: 'NOT_CONTAINS' }, | ||
| 166 | + { label: '等于', value: 'EQUAL' }, | ||
| 167 | + { label: '不等于', value: 'NOT_EQUAL' }, | ||
| 168 | + { label: '大于', value: 'GREATER' }, | ||
| 169 | + { label: '小于', value: 'LESS' }, | ||
| 170 | + { label: '大于或等于', value: 'GREATER_OR_EQUAL' }, | ||
| 171 | + { label: '小于或等于', value: 'LESS_OR_EQUAL' }, | ||
| 172 | + ]; | ||
| 173 | + const findRuleByValue = findDay.find((f) => { | ||
| 174 | + if ( | ||
| 175 | + f.value == | ||
| 176 | + editEchoData.value.profileData?.alarms[0].createRules[getKey[0]].condition | ||
| 177 | + .condition[0].predicate.operation | ||
| 178 | + ) { | ||
| 179 | + return f.label; | ||
| 180 | + } | ||
| 181 | + }); | ||
| 182 | + const findClearRuleByValue = findDay.find((f) => { | ||
| 183 | + if ( | ||
| 184 | + f.value == | ||
| 185 | + editEchoData.value.profileData?.alarms[0].clearRule.condition.condition[0].predicate | ||
| 186 | + .operation | ||
| 187 | + ) { | ||
| 188 | + return f.label; | ||
| 189 | + } | ||
| 190 | + }); | ||
| 191 | + proxy.$refs.DeviceProfileStep3Ref.retryRulesFormDataFunc( | ||
| 192 | + ` | ||
| 193 | + 键名:${ | ||
| 194 | + editEchoData.value.profileData?.alarms[0].createRules[getKey[0]].condition | ||
| 195 | + .condition[0].key.key | ||
| 196 | + }...操作:${findRuleByValue?.label}...值:${ | ||
| 197 | + editEchoData.value.profileData?.alarms[0].createRules[getKey[0]].condition | ||
| 198 | + .condition[0].predicate.value.defaultValue | ||
| 199 | + } | ||
| 200 | + ` | ||
| 201 | + ); | ||
| 202 | + proxy.$refs.DeviceProfileStep3Ref.retryEnableFormDataFunc(`始终启用`); | ||
| 203 | + proxy.$refs.DeviceProfileStep3Ref.retryTemplateFormDataFunc( | ||
| 204 | + ` | ||
| 205 | + 报警详细信息:${ | ||
| 206 | + editEchoData.value.profileData?.alarms[0].createRules[getKey[0]].alarmDetails | ||
| 207 | + } | ||
| 208 | + ` | ||
| 209 | + ); | ||
| 210 | + //清除报警 | ||
| 211 | + proxy.$refs.DeviceProfileStep3Ref.retryRulesClearFormDataFunc( | ||
| 212 | + ` | ||
| 213 | + 键名:${editEchoData.value.profileData?.alarms[0].clearRule.condition.condition[0].key.key}...操作:${findClearRuleByValue?.label}...值:${editEchoData.value.profileData?.alarms[0].clearRule.condition.condition[0].predicate.value.defaultValue} | ||
| 214 | + ` | ||
| 215 | + ); | ||
| 216 | + proxy.$refs.DeviceProfileStep3Ref.retryEnableClearFormDataFunc(`始终启用`); | ||
| 217 | + proxy.$refs.DeviceProfileStep3Ref.retryTemplateClearFormDataFunc( | ||
| 218 | + ` | ||
| 219 | + 报警详细信息:${editEchoData.value.profileData?.alarms[0].clearRule.alarmDetails} | ||
| 220 | + ` | ||
| 221 | + ); | ||
| 222 | + } else { | ||
| 223 | + proxy.$refs.DeviceProfileStep3Ref.resetRegisterFormFunc(); | ||
| 224 | + proxy.$refs.DeviceProfileStep3Ref.resetRegisterFormHighSettingmFunc(); | ||
| 225 | + proxy.$refs.DeviceProfileStep3Ref.resetRegisterFormCreateAlarmFunc(); | ||
| 226 | + proxy.$refs.DeviceProfileStep3Ref.resetRulesFormDataFunc(); | ||
| 227 | + proxy.$refs.DeviceProfileStep3Ref.resetEnableFormDataFunc(); | ||
| 228 | + proxy.$refs.DeviceProfileStep3Ref.resetTemplateFormDataFunc(); | ||
| 229 | + proxy.$refs.DeviceProfileStep3Ref.resetRulesClearFormDataFunc(); | ||
| 230 | + proxy.$refs.DeviceProfileStep3Ref.resetEnableClearFormDataFunc(); | ||
| 231 | + proxy.$refs.DeviceProfileStep3Ref.resetTemplateClearFormDataFunc(); | ||
| 232 | + } | ||
| 153 | } | 233 | } |
| 154 | function handleStep3Next(v) { | 234 | function handleStep3Next(v) { |
| 155 | current.value++; | 235 | current.value++; |
| 156 | getStepThreeData.value = v; | 236 | 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(); | ||
| 244 | + } | ||
| 157 | } | 245 | } |
| 158 | function handleRedo() { | 246 | function handleRedo() { |
| 159 | current.value = 0; | 247 | current.value = 0; |
| @@ -197,6 +285,7 @@ | @@ -197,6 +285,7 @@ | ||
| 197 | return; | 285 | return; |
| 198 | }; | 286 | }; |
| 199 | return { | 287 | return { |
| 288 | + handleChange, | ||
| 200 | DeviceProfileStep2Ref, | 289 | DeviceProfileStep2Ref, |
| 201 | DeviceProfileStep3Ref, | 290 | DeviceProfileStep3Ref, |
| 202 | DeviceProfileStep4Ref, | 291 | DeviceProfileStep4Ref, |
| @@ -21,41 +21,70 @@ | @@ -21,41 +21,70 @@ | ||
| 21 | /></TabPane> | 21 | /></TabPane> |
| 22 | <TabPane key="3" tab="报警规则"> | 22 | <TabPane key="3" tab="报警规则"> |
| 23 | <div style="padding-top: 10px"> | 23 | <div style="padding-top: 10px"> |
| 24 | - <BasicForm | ||
| 25 | - :showSubmitButton="false" | ||
| 26 | - :showResetButton="false" | ||
| 27 | - @register="registerStep3Schemas" | ||
| 28 | - /> | ||
| 29 | - <BasicForm | ||
| 30 | - :showSubmitButton="false" | ||
| 31 | - :showResetButton="false" | ||
| 32 | - @register="registerStep3HighSetting" | ||
| 33 | - /> | ||
| 34 | - <BasicForm | ||
| 35 | - :showSubmitButton="false" | ||
| 36 | - :showResetButton="false" | ||
| 37 | - @register="registerStep3CreateAlarm" | ||
| 38 | - /> | ||
| 39 | - <BasicForm | ||
| 40 | - :showSubmitButton="false" | ||
| 41 | - :showResetButton="false" | ||
| 42 | - @register="registerStep3RuleAlarm" | ||
| 43 | - /> | ||
| 44 | - <BasicForm | ||
| 45 | - :showSubmitButton="false" | ||
| 46 | - :showResetButton="false" | ||
| 47 | - @register="registerStep3Condition" | ||
| 48 | - /> | ||
| 49 | - <BasicForm | ||
| 50 | - :showSubmitButton="false" | ||
| 51 | - :showResetButton="false" | ||
| 52 | - @register="registerStep3Enable" | ||
| 53 | - /> | ||
| 54 | - <BasicForm | ||
| 55 | - :showSubmitButton="false" | ||
| 56 | - :showResetButton="false" | ||
| 57 | - @register="registerStep3TemplateDetail" | ||
| 58 | - /> | 24 | + <div style="border-radius: 10px; border: 1px solid #f0f0f0"> |
| 25 | + <div style="margin-left: 15px"> | ||
| 26 | + <BasicForm | ||
| 27 | + :showSubmitButton="false" | ||
| 28 | + :showResetButton="false" | ||
| 29 | + @register="registerStep3Schemas" | ||
| 30 | + /> | ||
| 31 | + <BasicForm | ||
| 32 | + :showSubmitButton="false" | ||
| 33 | + :showResetButton="false" | ||
| 34 | + @register="registerStep3HighSetting" | ||
| 35 | + /> | ||
| 36 | + <BasicForm | ||
| 37 | + :showSubmitButton="false" | ||
| 38 | + :showResetButton="false" | ||
| 39 | + @register="registerStep3CreateAlarm" | ||
| 40 | + /> | ||
| 41 | + <BasicForm | ||
| 42 | + :showSubmitButton="false" | ||
| 43 | + :showResetButton="false" | ||
| 44 | + @register="registerStep3RuleAlarm" | ||
| 45 | + /> | ||
| 46 | + <BasicForm | ||
| 47 | + :showSubmitButton="false" | ||
| 48 | + :showResetButton="false" | ||
| 49 | + @register="registerStep3Condition" | ||
| 50 | + /> | ||
| 51 | + <BasicForm | ||
| 52 | + :showSubmitButton="false" | ||
| 53 | + :showResetButton="false" | ||
| 54 | + @register="registerStep3Enable" | ||
| 55 | + /> | ||
| 56 | + <BasicForm | ||
| 57 | + :showSubmitButton="false" | ||
| 58 | + :showResetButton="false" | ||
| 59 | + @register="registerStep3TemplateDetail" | ||
| 60 | + /> | ||
| 61 | + </div> | ||
| 62 | + </div> | ||
| 63 | + <div style="border-radius: 10px; border: 1px solid #f0f0f0; margin-top: 15px"> | ||
| 64 | + <p>清除报警规则</p> | ||
| 65 | + <div style="margin-left: 15px"> | ||
| 66 | + <BasicForm | ||
| 67 | + :showSubmitButton="false" | ||
| 68 | + :showResetButton="false" | ||
| 69 | + @register="registerStep3ClearRuleAlarm" | ||
| 70 | + /> | ||
| 71 | + <BasicForm | ||
| 72 | + :showSubmitButton="false" | ||
| 73 | + :showResetButton="false" | ||
| 74 | + @register="registerStep3ClearCondition" | ||
| 75 | + /> | ||
| 76 | + <BasicForm | ||
| 77 | + :showSubmitButton="false" | ||
| 78 | + :showResetButton="false" | ||
| 79 | + @register="registerStep3ClearEnable" | ||
| 80 | + /> | ||
| 81 | + <BasicForm | ||
| 82 | + :showSubmitButton="false" | ||
| 83 | + :showResetButton="false" | ||
| 84 | + @register="registerStep3ClearTemplateDetail" | ||
| 85 | + /> | ||
| 86 | + </div> | ||
| 87 | + </div> | ||
| 59 | </div> | 88 | </div> |
| 60 | </TabPane> | 89 | </TabPane> |
| 61 | <TabPane key="4" tab="告警管理"> | 90 | <TabPane key="4" tab="告警管理"> |
| @@ -84,6 +113,10 @@ | @@ -84,6 +113,10 @@ | ||
| 84 | import { formSchema as enableSchema } from './step/cpns/enablerule/config'; | 113 | import { formSchema as enableSchema } from './step/cpns/enablerule/config'; |
| 85 | import { formSchema as detailSchema } from './step/cpns/detailtemplate/config'; | 114 | import { formSchema as detailSchema } from './step/cpns/detailtemplate/config'; |
| 86 | import { formSchema as echoFormSchema } from './step/cpns/alarmruleconditions/cpns/config'; | 115 | import { formSchema as echoFormSchema } from './step/cpns/alarmruleconditions/cpns/config'; |
| 116 | + import { formSchema as conditionFormClearschema } from './step/cpns/alarmruleconditions/config'; | ||
| 117 | + import { formSchema as enableClearSchema } from './step/cpns/enablerule/config'; | ||
| 118 | + import { formSchema as detailClearSchema } from './step/cpns/detailtemplate/config'; | ||
| 119 | + import { formSchema as echoFormClearSchema } from './step/cpns/alarmruleconditions/cpns/config'; | ||
| 87 | 120 | ||
| 88 | export default defineComponent({ | 121 | export default defineComponent({ |
| 89 | name: 'ConfigDrawer', | 122 | name: 'ConfigDrawer', |
| @@ -156,6 +189,37 @@ | @@ -156,6 +189,37 @@ | ||
| 156 | }, | 189 | }, |
| 157 | }); | 190 | }); |
| 158 | 191 | ||
| 192 | + //清除报警 | ||
| 193 | + const [registerStep3ClearRuleAlarm, { setFieldsValue: setRegisterStep3ClearRuleAlarm }] = | ||
| 194 | + useForm({ | ||
| 195 | + schemas: echoFormClearSchema, | ||
| 196 | + actionColOptions: { | ||
| 197 | + span: 24, | ||
| 198 | + }, | ||
| 199 | + }); | ||
| 200 | + const [registerStep3ClearCondition, { setFieldsValue: setRegisterStep3ClearCondition }] = | ||
| 201 | + useForm({ | ||
| 202 | + schemas: conditionFormClearschema, | ||
| 203 | + actionColOptions: { | ||
| 204 | + span: 24, | ||
| 205 | + }, | ||
| 206 | + }); | ||
| 207 | + const [registerStep3ClearEnable, { setFieldsValue: setRegisterStep3ClearEnable }] = useForm({ | ||
| 208 | + schemas: enableClearSchema, | ||
| 209 | + actionColOptions: { | ||
| 210 | + span: 24, | ||
| 211 | + }, | ||
| 212 | + }); | ||
| 213 | + const [ | ||
| 214 | + registerStep3ClearTemplateDetail, | ||
| 215 | + { setFieldsValue: setRegisterStep3ClearTemplateDetail }, | ||
| 216 | + ] = useForm({ | ||
| 217 | + schemas: detailClearSchema, | ||
| 218 | + actionColOptions: { | ||
| 219 | + span: 24, | ||
| 220 | + }, | ||
| 221 | + }); | ||
| 222 | + | ||
| 159 | const [register] = useModalInner(async (data) => { | 223 | const [register] = useModalInner(async (data) => { |
| 160 | activeKey.value = '1'; | 224 | activeKey.value = '1'; |
| 161 | isUpdate.value = !!data?.isUpdate; | 225 | isUpdate.value = !!data?.isUpdate; |
| @@ -178,45 +242,74 @@ | @@ -178,45 +242,74 @@ | ||
| 178 | }); | 242 | }); |
| 179 | break; | 243 | break; |
| 180 | case '3': | 244 | case '3': |
| 181 | - setRegisterStep3Schemas({ | ||
| 182 | - alarmType: descInfo.value.profileData?.alarms[0].alarmType, | ||
| 183 | - }); | ||
| 184 | - setRegisterStep3HighSetting({ | ||
| 185 | - propagate: descInfo.value.profileData?.alarms[0].propagate, | ||
| 186 | - propagateRelationTypes: | ||
| 187 | - descInfo.value.profileData?.alarms[0].propagateRelationTypes, | ||
| 188 | - }); | ||
| 189 | - const getKey = Object.keys(descInfo.value.profileData?.alarms[0].createRules); | ||
| 190 | - setRegisterStep3CreateAlarm({ | ||
| 191 | - default: getKey[0], | ||
| 192 | - }); | ||
| 193 | - setRegisterStep3RuleAlarm({ | ||
| 194 | - type: descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | ||
| 195 | - .condition[0].key.type, | ||
| 196 | - key: descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | ||
| 197 | - .condition[0].key.key, | ||
| 198 | - valueType: | ||
| 199 | - descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | ||
| 200 | - .condition[0].valueType, | ||
| 201 | - value: | ||
| 202 | - descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | ||
| 203 | - .condition[0].value, | ||
| 204 | - operation: | ||
| 205 | - descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | ||
| 206 | - .condition[0].predicate.operation, | ||
| 207 | - }); | ||
| 208 | - setRegisterStep3Condition({ | ||
| 209 | - conditionType: | ||
| 210 | - descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition.spec.type, | ||
| 211 | - }); | ||
| 212 | - setRegisterStep3Enable({ | ||
| 213 | - schedule: descInfo.value.profileData?.alarms[0].createRules[getKey[0]].schedule, | ||
| 214 | - }); | ||
| 215 | - setRegisterStep3TemplateDetail({ | ||
| 216 | - alarmDetails: | ||
| 217 | - descInfo.value.profileData?.alarms[0].createRules[getKey[0]].alarmDetails, | ||
| 218 | - }); | ||
| 219 | - break; | 245 | + setTimeout(() => { |
| 246 | + setRegisterStep3Schemas({ | ||
| 247 | + alarmType: descInfo.value.profileData?.alarms[0].alarmType, | ||
| 248 | + }); | ||
| 249 | + setRegisterStep3HighSetting({ | ||
| 250 | + propagate: descInfo.value.profileData?.alarms[0].propagate, | ||
| 251 | + propagateRelationTypes: | ||
| 252 | + descInfo.value.profileData?.alarms[0].propagateRelationTypes, | ||
| 253 | + }); | ||
| 254 | + const getKey = Object.keys(descInfo.value.profileData?.alarms[0].createRules); | ||
| 255 | + setRegisterStep3CreateAlarm({ | ||
| 256 | + default: getKey[0], | ||
| 257 | + }); | ||
| 258 | + setRegisterStep3RuleAlarm({ | ||
| 259 | + type: descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | ||
| 260 | + .condition[0].key.type, | ||
| 261 | + key1: descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | ||
| 262 | + .condition[0].key.key, | ||
| 263 | + type1: | ||
| 264 | + descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | ||
| 265 | + .condition[0].valueType, | ||
| 266 | + value1: | ||
| 267 | + descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | ||
| 268 | + .condition[0].predicate.value.defaultValue, | ||
| 269 | + operation: | ||
| 270 | + descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | ||
| 271 | + .condition[0].predicate.operation, | ||
| 272 | + }); | ||
| 273 | + setRegisterStep3Condition({ | ||
| 274 | + conditionType: | ||
| 275 | + descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition.spec | ||
| 276 | + .type, | ||
| 277 | + }); | ||
| 278 | + setRegisterStep3Enable({ | ||
| 279 | + schedule: | ||
| 280 | + descInfo.value.profileData?.alarms[0].createRules[getKey[0]].schedule.type, | ||
| 281 | + }); | ||
| 282 | + setRegisterStep3TemplateDetail({ | ||
| 283 | + alarmDetails: | ||
| 284 | + descInfo.value.profileData?.alarms[0].createRules[getKey[0]].alarmDetails, | ||
| 285 | + }); | ||
| 286 | + //清除报警 | ||
| 287 | + setRegisterStep3ClearRuleAlarm({ | ||
| 288 | + type: descInfo.value.profileData?.alarms[0].clearRule.condition.condition[0].key | ||
| 289 | + .type, | ||
| 290 | + key1: descInfo.value.profileData?.alarms[0].clearRule.condition.condition[0].key | ||
| 291 | + .key, | ||
| 292 | + type1: | ||
| 293 | + descInfo.value.profileData?.alarms[0].clearRule.condition.condition[0] | ||
| 294 | + .valueType, | ||
| 295 | + value1: | ||
| 296 | + descInfo.value.profileData?.alarms[0].clearRule.condition.condition[0].predicate | ||
| 297 | + .value.defaultValue, | ||
| 298 | + operation: | ||
| 299 | + descInfo.value.profileData?.alarms[0].clearRule.condition.condition[0].predicate | ||
| 300 | + .operation, | ||
| 301 | + }); | ||
| 302 | + setRegisterStep3ClearCondition({ | ||
| 303 | + conditionType: | ||
| 304 | + descInfo.value.profileData?.alarms[0].clearRule.condition.spec.type, | ||
| 305 | + }); | ||
| 306 | + setRegisterStep3ClearEnable({ | ||
| 307 | + schedule: descInfo.value.profileData?.alarms[0].clearRule.schedule.type, | ||
| 308 | + }); | ||
| 309 | + setRegisterStep3ClearTemplateDetail({ | ||
| 310 | + alarmDetails: descInfo.value.profileData?.alarms[0].clearRule.alarmDetails, | ||
| 311 | + }); | ||
| 312 | + }, 1000); | ||
| 220 | case '4': | 313 | case '4': |
| 221 | setRegisterContact({ | 314 | setRegisterContact({ |
| 222 | alarmContactId: descInfo.value.alarmProfile.alarmContactId, | 315 | alarmContactId: descInfo.value.alarmProfile.alarmContactId, |
| @@ -240,6 +333,10 @@ | @@ -240,6 +333,10 @@ | ||
| 240 | }); | 333 | }); |
| 241 | 334 | ||
| 242 | return { | 335 | return { |
| 336 | + registerStep3ClearTemplateDetail, | ||
| 337 | + registerStep3ClearEnable, | ||
| 338 | + registerStep3ClearCondition, | ||
| 339 | + registerStep3ClearRuleAlarm, | ||
| 243 | handleChange, | 340 | handleChange, |
| 244 | registerStep3TemplateDetail, | 341 | registerStep3TemplateDetail, |
| 245 | registerStep3Enable, | 342 | registerStep3Enable, |
| @@ -31,7 +31,7 @@ | @@ -31,7 +31,7 @@ | ||
| 31 | <template v-for="(childItem, createIndex) in item.alarms" :key="childItem.id"> | 31 | <template v-for="(childItem, createIndex) in item.alarms" :key="childItem.id"> |
| 32 | <div class="aic" style="border: 1px solid #bfbfbf"> | 32 | <div class="aic" style="border: 1px solid #bfbfbf"> |
| 33 | <div class="w-3/4"> | 33 | <div class="w-3/4"> |
| 34 | - <div style="margin-left: -30px; margin-top: 20px" | 34 | + <div style="margin-left: -33px; margin-top: 20px" |
| 35 | ><BasicForm @register="registerFormCreateAlarm" /> | 35 | ><BasicForm @register="registerFormCreateAlarm" /> |
| 36 | </div> | 36 | </div> |
| 37 | <div style="margin-left: 5px; margin-top: -50px"> | 37 | <div style="margin-left: 5px; margin-top: -50px"> |
| @@ -78,7 +78,7 @@ | @@ -78,7 +78,7 @@ | ||
| 78 | <div style="height: 20px"></div> | 78 | <div style="height: 20px"></div> |
| 79 | <p>清除报警规则</p> | 79 | <p>清除报警规则</p> |
| 80 | <template | 80 | <template |
| 81 | - v-for="(childClearItem, clearIndexItem) in item.alarms[clearIndex].clearRule" | 81 | + v-for="(childClearItem, clearIndexItem) in item.clearRule" |
| 82 | :key="childClearItem.id" | 82 | :key="childClearItem.id" |
| 83 | > | 83 | > |
| 84 | <div class="aic mb-1" style="border: 1px solid #bfbfbf"> | 84 | <div class="aic mb-1" style="border: 1px solid #bfbfbf"> |
| @@ -222,12 +222,18 @@ | @@ -222,12 +222,18 @@ | ||
| 222 | const ruleClearTemplateData: any = ref(null); | 222 | const ruleClearTemplateData: any = ref(null); |
| 223 | const enableClearTemplateData: any = ref(null); | 223 | const enableClearTemplateData: any = ref(null); |
| 224 | const detailClearTemplateData: any = ref(null); | 224 | const detailClearTemplateData: any = ref(null); |
| 225 | + const scheduleCustomValue: any = ref({}); | ||
| 225 | const clearIndex = ref(-1); | 226 | const clearIndex = ref(-1); |
| 227 | + const getSchduleCustomValue: any = ref([]); | ||
| 226 | //告警列表 | 228 | //告警列表 |
| 227 | let profileData = ref<IProfileData[]>([]); | 229 | let profileData = ref<IProfileData[]>([]); |
| 228 | const log = (e) => { | 230 | const log = (e) => { |
| 229 | console.log(e); | 231 | console.log(e); |
| 230 | }; | 232 | }; |
| 233 | + //编辑清空操作 | ||
| 234 | + const clearProfileDataFunc = () => { | ||
| 235 | + unref(profileData).splice(0, 1); | ||
| 236 | + }; | ||
| 231 | //删除告警配置 | 237 | //删除告警配置 |
| 232 | const deleteAlarmRule = (index: number) => { | 238 | const deleteAlarmRule = (index: number) => { |
| 233 | unref(profileData).splice(index, 1); | 239 | unref(profileData).splice(index, 1); |
| @@ -254,26 +260,27 @@ | @@ -254,26 +260,27 @@ | ||
| 254 | id: Date.now() + Math.random() + '', | 260 | id: Date.now() + Math.random() + '', |
| 255 | alarmType: '', | 261 | alarmType: '', |
| 256 | createRules: {}, | 262 | createRules: {}, |
| 257 | - clearRule: [ | ||
| 258 | - { | ||
| 259 | - id: Date.now() + Math.random() + '', | ||
| 260 | - alarmDetails: '', | ||
| 261 | - dashboardId: { | ||
| 262 | - id: '', | ||
| 263 | - entityType: '', | ||
| 264 | - }, | ||
| 265 | - propagate: '', | ||
| 266 | - propagateRelationTypes: [''], | ||
| 267 | - schedule: { | ||
| 268 | - type: 'string', | ||
| 269 | - }, | ||
| 270 | - condition: {}, | ||
| 271 | - }, | ||
| 272 | - ], | 263 | + |
| 273 | propagate: false, | 264 | propagate: false, |
| 274 | propagateRelationTypes: [''], | 265 | propagateRelationTypes: [''], |
| 275 | }, | 266 | }, |
| 276 | ], | 267 | ], |
| 268 | + clearRule: [ | ||
| 269 | + { | ||
| 270 | + id: Date.now() + Math.random() + '', | ||
| 271 | + alarmDetails: '', | ||
| 272 | + dashboardId: { | ||
| 273 | + id: '', | ||
| 274 | + entityType: '', | ||
| 275 | + }, | ||
| 276 | + propagate: '', | ||
| 277 | + propagateRelationTypes: [''], | ||
| 278 | + schedule: { | ||
| 279 | + type: 'string', | ||
| 280 | + }, | ||
| 281 | + condition: {}, | ||
| 282 | + }, | ||
| 283 | + ], | ||
| 277 | }); | 284 | }); |
| 278 | }; | 285 | }; |
| 279 | //TODO Mobile dashboard: | 286 | //TODO Mobile dashboard: |
| @@ -342,6 +349,25 @@ | @@ -342,6 +349,25 @@ | ||
| 342 | const resetRegisterFormCreateAlarmFunc = () => { | 349 | const resetRegisterFormCreateAlarmFunc = () => { |
| 343 | resetRegisterFormCreateAlarm(); | 350 | resetRegisterFormCreateAlarm(); |
| 344 | }; | 351 | }; |
| 352 | + const resetRulesFormDataFunc = () => { | ||
| 353 | + ruleTemplateData.value = ``; | ||
| 354 | + }; | ||
| 355 | + const resetEnableFormDataFunc = () => { | ||
| 356 | + enableTemplateData.value = ``; | ||
| 357 | + }; | ||
| 358 | + const resetTemplateFormDataFunc = () => { | ||
| 359 | + detailTemplateData.value = ``; | ||
| 360 | + }; | ||
| 361 | + const resetRulesClearFormDataFunc = () => { | ||
| 362 | + ruleClearTemplateData.value = ``; | ||
| 363 | + }; | ||
| 364 | + const resetEnableClearFormDataFunc = () => { | ||
| 365 | + enableClearTemplateData.value = ``; | ||
| 366 | + }; | ||
| 367 | + const resetTemplateClearFormDataFunc = () => { | ||
| 368 | + detailClearTemplateData.value = ``; | ||
| 369 | + }; | ||
| 370 | + | ||
| 345 | //回显表单数据 | 371 | //回显表单数据 |
| 346 | const retryRegisterFormFunc = (v) => { | 372 | const retryRegisterFormFunc = (v) => { |
| 347 | setRegisterForm(v); | 373 | setRegisterForm(v); |
| @@ -352,6 +378,25 @@ | @@ -352,6 +378,25 @@ | ||
| 352 | const retryRegisterFormCreateAlarmFunc = (v) => { | 378 | const retryRegisterFormCreateAlarmFunc = (v) => { |
| 353 | setRegisterFormCreateAlarm(v); | 379 | setRegisterFormCreateAlarm(v); |
| 354 | }; | 380 | }; |
| 381 | + const retryRulesFormDataFunc = (v) => { | ||
| 382 | + ruleTemplateData.value = v; | ||
| 383 | + }; | ||
| 384 | + const retryEnableFormDataFunc = (v) => { | ||
| 385 | + enableTemplateData.value = v; | ||
| 386 | + }; | ||
| 387 | + const retryTemplateFormDataFunc = (v) => { | ||
| 388 | + detailTemplateData.value = v; | ||
| 389 | + }; | ||
| 390 | + const retryRulesClearFormDataFunc = (v) => { | ||
| 391 | + ruleClearTemplateData.value = v; | ||
| 392 | + }; | ||
| 393 | + const retryEnableClearFormDataFunc = (v) => { | ||
| 394 | + enableClearTemplateData.value = v; | ||
| 395 | + }; | ||
| 396 | + const retryTemplateClearFormDataFunc = (v) => { | ||
| 397 | + detailClearTemplateData.value = v; | ||
| 398 | + }; | ||
| 399 | + | ||
| 355 | const tempValue1: string = ref<string>(''); | 400 | const tempValue1: string = ref<string>(''); |
| 356 | // 添加‘创建条件’ | 401 | // 添加‘创建条件’ |
| 357 | const addCreateRole = (index: number) => { | 402 | const addCreateRole = (index: number) => { |
| @@ -400,27 +445,26 @@ | @@ -400,27 +445,26 @@ | ||
| 400 | }; | 445 | }; |
| 401 | }, | 446 | }, |
| 402 | }); | 447 | }); |
| 403 | - | ||
| 404 | unref(profileData)[index].alarms.push({ | 448 | unref(profileData)[index].alarms.push({ |
| 405 | id: Date.now() + Math.random() + '', | 449 | id: Date.now() + Math.random() + '', |
| 406 | alarmType: '', | 450 | alarmType: '', |
| 407 | createRules: {}, | 451 | createRules: {}, |
| 408 | - clearRule: [ | ||
| 409 | - { | ||
| 410 | - id: Date.now() + Math.random() + '', | ||
| 411 | - alarmDetails: '', | ||
| 412 | - dashboardId: { | ||
| 413 | - id: '', | ||
| 414 | - entityType: '', | ||
| 415 | - }, | ||
| 416 | - propagate: '', | ||
| 417 | - propagateRelationTypes: [''], | ||
| 418 | - schedule: { | ||
| 419 | - type: 'string', | ||
| 420 | - }, | ||
| 421 | - condition: {}, | ||
| 422 | - }, | ||
| 423 | - ], | 452 | + // clearRule: [ |
| 453 | + // { | ||
| 454 | + // id: Date.now() + Math.random() + '', | ||
| 455 | + // alarmDetails: '', | ||
| 456 | + // dashboardId: { | ||
| 457 | + // id: '', | ||
| 458 | + // entityType: '', | ||
| 459 | + // }, | ||
| 460 | + // propagate: '', | ||
| 461 | + // propagateRelationTypes: [''], | ||
| 462 | + // schedule: { | ||
| 463 | + // type: 'string', | ||
| 464 | + // }, | ||
| 465 | + // condition: {}, | ||
| 466 | + // }, | ||
| 467 | + // ], | ||
| 424 | propagate: false, | 468 | propagate: false, |
| 425 | propagateRelationTypes: [''], | 469 | propagateRelationTypes: [''], |
| 426 | }); | 470 | }); |
| @@ -516,7 +560,7 @@ | @@ -516,7 +560,7 @@ | ||
| 516 | } | 560 | } |
| 517 | }); | 561 | }); |
| 518 | ruleTemplateData.value = ` | 562 | ruleTemplateData.value = ` |
| 519 | - 键名:${v.key1}...操作:${findRuleByValue?.label}...值:${v.value1} | 563 | + 键名:${v.key1} 操作:${findRuleByValue?.label} 值:${v.value1} |
| 520 | `; | 564 | `; |
| 521 | 565 | ||
| 522 | ruleLastObj.value = v1; | 566 | ruleLastObj.value = v1; |
| @@ -636,7 +680,7 @@ | @@ -636,7 +680,7 @@ | ||
| 636 | } | 680 | } |
| 637 | }); | 681 | }); |
| 638 | ruleClearTemplateData.value = ` | 682 | ruleClearTemplateData.value = ` |
| 639 | - 键名:${v.key1}...操作:${findRuleByValue?.label}...值:${v.value1} | 683 | + 键名:${v.key1} 操作:${findRuleByValue?.label} 值:${v.value1} |
| 640 | `; | 684 | `; |
| 641 | 685 | ||
| 642 | ruleLastObj.value = v1; | 686 | ruleLastObj.value = v1; |
| @@ -677,7 +721,7 @@ | @@ -677,7 +721,7 @@ | ||
| 677 | }; | 721 | }; |
| 678 | Object.assign(addClearitionalObj.value, getValueConditon); | 722 | Object.assign(addClearitionalObj.value, getValueConditon); |
| 679 | }; | 723 | }; |
| 680 | - //用于生成uuid | 724 | + //生成uuid |
| 681 | function generateUUID() { | 725 | function generateUUID() { |
| 682 | let d = new Date().getTime(); | 726 | let d = new Date().getTime(); |
| 683 | if (window.performance && typeof window.performance.now === 'function') { | 727 | if (window.performance && typeof window.performance.now === 'function') { |
| @@ -692,11 +736,45 @@ | @@ -692,11 +736,45 @@ | ||
| 692 | } | 736 | } |
| 693 | const handleFormStep3toStep4Next = async () => { | 737 | const handleFormStep3toStep4Next = async () => { |
| 694 | try { | 738 | try { |
| 739 | + if (enableObj.value.schedule == 'CUSTOM') { | ||
| 740 | + console.log(enableObj.value); | ||
| 741 | + switch (enableObj.value.daysOfWeek1[0]) { | ||
| 742 | + case '1': | ||
| 743 | + getSchduleCustomValue.value.push({ | ||
| 744 | + enabled: true, | ||
| 745 | + dayOfWeek: enableObj.value.daysOfWeek1[0], | ||
| 746 | + startsOn: enableObj.value.startsOn1, | ||
| 747 | + endsOn: enableObj.value.endsOn1, | ||
| 748 | + }); | ||
| 749 | + break; | ||
| 750 | + case '2': | ||
| 751 | + getSchduleCustomValue.value.push({ | ||
| 752 | + enabled: true, | ||
| 753 | + dayOfWeek: enableObj.value.daysOfWeek2[0], | ||
| 754 | + startsOn: enableObj.value.startsOn2, | ||
| 755 | + endsOn: enableObj.value.endsOn2, | ||
| 756 | + }); | ||
| 757 | + break; | ||
| 758 | + case '3': | ||
| 759 | + getSchduleCustomValue.value.push({ | ||
| 760 | + enabled: true, | ||
| 761 | + dayOfWeek: enableObj.value.daysOfWeek3[0], | ||
| 762 | + startsOn: enableObj.value.startsOn3, | ||
| 763 | + endsOn: enableObj.value.endsOn3, | ||
| 764 | + }); | ||
| 765 | + break; | ||
| 766 | + } | ||
| 767 | + scheduleCustomValue.value = { | ||
| 768 | + type: enableObj.value.schedule, | ||
| 769 | + timezone: enableObj.value.timezone, | ||
| 770 | + items: getSchduleCustomValue.value, | ||
| 771 | + }; | ||
| 772 | + } | ||
| 695 | const scheduleClearValue = { | 773 | const scheduleClearValue = { |
| 696 | type: enableClearObj.value.schedule, | 774 | type: enableClearObj.value.schedule, |
| 697 | daysOfWeek: enableClearObj.value.daysOfWeek, | 775 | daysOfWeek: enableClearObj.value.daysOfWeek, |
| 698 | - // endsOn: enableClearObj.value.endsOn, | ||
| 699 | - // startsOn: enableClearObj.value.startOn, | 776 | + endsOn: enableClearObj.value.endsOn, |
| 777 | + startsOn: enableClearObj.value.startOn, | ||
| 700 | timezone: enableClearObj.value.timezone, | 778 | timezone: enableClearObj.value.timezone, |
| 701 | }; | 779 | }; |
| 702 | const getClearSchedule = { | 780 | const getClearSchedule = { |
| @@ -706,13 +784,15 @@ | @@ -706,13 +784,15 @@ | ||
| 706 | const scheduleValue = { | 784 | const scheduleValue = { |
| 707 | type: enableObj.value.schedule, | 785 | type: enableObj.value.schedule, |
| 708 | daysOfWeek: enableObj.value.daysOfWeek, | 786 | daysOfWeek: enableObj.value.daysOfWeek, |
| 709 | - // endsOn: enableObj.value.endsOn, | ||
| 710 | - // startsOn: enableObj.value.startOn, | 787 | + endsOn: enableObj.value.endsOn, |
| 788 | + startsOn: enableObj.value.startOn, | ||
| 711 | timezone: enableObj.value.timezone, | 789 | timezone: enableObj.value.timezone, |
| 712 | }; | 790 | }; |
| 713 | const getSchedule = { | 791 | const getSchedule = { |
| 714 | - schedule: scheduleValue, | 792 | + schedule: |
| 793 | + enableObj.value.schedule == 'CUSTOM' ? scheduleCustomValue.value : scheduleValue, | ||
| 715 | }; | 794 | }; |
| 795 | + | ||
| 716 | const getAdditionalProp = Object.assign({}, detailObj.value, getSchedule); | 796 | const getAdditionalProp = Object.assign({}, detailObj.value, getSchedule); |
| 717 | const getScheduleAndAlarmDetails = Object.assign( | 797 | const getScheduleAndAlarmDetails = Object.assign( |
| 718 | {}, | 798 | {}, |
| @@ -756,7 +836,9 @@ | @@ -756,7 +836,9 @@ | ||
| 756 | getClearRulesAllObj, | 836 | getClearRulesAllObj, |
| 757 | objectId | 837 | objectId |
| 758 | ); | 838 | ); |
| 759 | - alarmss.value.push(emptyObj.value); | 839 | + if (alarmss.value.length == 0) { |
| 840 | + alarmss.value.push(emptyObj.value); | ||
| 841 | + } | ||
| 760 | const getAlarms = { | 842 | const getAlarms = { |
| 761 | alarms: alarmss.value, | 843 | alarms: alarmss.value, |
| 762 | }; | 844 | }; |
| @@ -814,6 +896,19 @@ | @@ -814,6 +896,19 @@ | ||
| 814 | }; | 896 | }; |
| 815 | 897 | ||
| 816 | return { | 898 | return { |
| 899 | + resetEnableClearFormDataFunc, | ||
| 900 | + resetTemplateClearFormDataFunc, | ||
| 901 | + resetRulesClearFormDataFunc, | ||
| 902 | + resetEnableFormDataFunc, | ||
| 903 | + resetTemplateFormDataFunc, | ||
| 904 | + resetRulesFormDataFunc, | ||
| 905 | + retryEnableClearFormDataFunc, | ||
| 906 | + retryTemplateClearFormDataFunc, | ||
| 907 | + retryRulesClearFormDataFunc, | ||
| 908 | + retryEnableFormDataFunc, | ||
| 909 | + retryTemplateFormDataFunc, | ||
| 910 | + retryRulesFormDataFunc, | ||
| 911 | + clearProfileDataFunc, | ||
| 817 | clearIndex, | 912 | clearIndex, |
| 818 | retryRegisterFormFunc, | 913 | retryRegisterFormFunc, |
| 819 | retryRegisterFormHighSettingmFunc, | 914 | retryRegisterFormHighSettingmFunc, |
| @@ -99,7 +99,7 @@ export const formSchema: FormSchema[] = [ | @@ -99,7 +99,7 @@ export const formSchema: FormSchema[] = [ | ||
| 99 | { | 99 | { |
| 100 | field: 'conditionType', | 100 | field: 'conditionType', |
| 101 | label: '条件类型', | 101 | label: '条件类型', |
| 102 | - colProps: { span: 24 }, | 102 | + colProps: { span: 13 }, |
| 103 | component: 'Select', | 103 | component: 'Select', |
| 104 | componentProps: { | 104 | componentProps: { |
| 105 | placeholder: '请选择报警日程表', | 105 | placeholder: '请选择报警日程表', |
| @@ -177,7 +177,7 @@ export const formSchema: FormSchema[] = [ | @@ -177,7 +177,7 @@ export const formSchema: FormSchema[] = [ | ||
| 177 | { | 177 | { |
| 178 | field: 'defaultValue', | 178 | field: 'defaultValue', |
| 179 | label: '持续时间值', | 179 | label: '持续时间值', |
| 180 | - colProps: { span: 24 }, | 180 | + colProps: { span: 13 }, |
| 181 | component: 'Input', | 181 | component: 'Input', |
| 182 | componentProps: { | 182 | componentProps: { |
| 183 | placeholder: '请输入持续时间值(请输入数字)', | 183 | placeholder: '请输入持续时间值(请输入数字)', |
| @@ -210,7 +210,7 @@ export const formSchema: FormSchema[] = [ | @@ -210,7 +210,7 @@ export const formSchema: FormSchema[] = [ | ||
| 210 | { | 210 | { |
| 211 | field: 'unit', | 211 | field: 'unit', |
| 212 | label: '时间单位', | 212 | label: '时间单位', |
| 213 | - colProps: { span: 24 }, | 213 | + colProps: { span: 13 }, |
| 214 | component: 'Select', | 214 | component: 'Select', |
| 215 | componentProps: { | 215 | componentProps: { |
| 216 | placeholder: '请选择时间单位', | 216 | placeholder: '请选择时间单位', |
| @@ -226,7 +226,7 @@ export const formSchema: FormSchema[] = [ | @@ -226,7 +226,7 @@ export const formSchema: FormSchema[] = [ | ||
| 226 | { | 226 | { |
| 227 | field: 'defaultValue', | 227 | field: 'defaultValue', |
| 228 | label: '事件计数值必填', | 228 | label: '事件计数值必填', |
| 229 | - colProps: { span: 24 }, | 229 | + colProps: { span: 13 }, |
| 230 | component: 'Input', | 230 | component: 'Input', |
| 231 | componentProps: { | 231 | componentProps: { |
| 232 | placeholder: '请输入事件计数值(应在1到2147483637之间)', | 232 | placeholder: '请输入事件计数值(应在1到2147483637之间)', |
| @@ -240,6 +240,7 @@ export const formSchema: FormSchema[] = [ | @@ -240,6 +240,7 @@ export const formSchema: FormSchema[] = [ | ||
| 240 | { | 240 | { |
| 241 | field: 'inherit', | 241 | field: 'inherit', |
| 242 | label: '', | 242 | label: '', |
| 243 | + colProps: { span: 13 }, | ||
| 243 | component: 'Checkbox', | 244 | component: 'Checkbox', |
| 244 | renderComponentContent: 'Inherit from owner', | 245 | renderComponentContent: 'Inherit from owner', |
| 245 | ifShow: ({ values }) => | 246 | ifShow: ({ values }) => |
| @@ -48,7 +48,7 @@ export const formSchema: FormSchema[] = [ | @@ -48,7 +48,7 @@ export const formSchema: FormSchema[] = [ | ||
| 48 | { | 48 | { |
| 49 | field: 'type', | 49 | field: 'type', |
| 50 | label: '键类型', | 50 | label: '键类型', |
| 51 | - colProps: { span: 24 }, | 51 | + colProps: { span: 13 }, |
| 52 | component: 'Select', | 52 | component: 'Select', |
| 53 | componentProps: { | 53 | componentProps: { |
| 54 | placeholder: '请选择键类型', | 54 | placeholder: '请选择键类型', |
| @@ -62,7 +62,7 @@ export const formSchema: FormSchema[] = [ | @@ -62,7 +62,7 @@ export const formSchema: FormSchema[] = [ | ||
| 62 | { | 62 | { |
| 63 | field: 'key1', | 63 | field: 'key1', |
| 64 | label: '键名', | 64 | label: '键名', |
| 65 | - colProps: { span: 24 }, | 65 | + colProps: { span: 13 }, |
| 66 | component: 'Input', | 66 | component: 'Input', |
| 67 | componentProps: { | 67 | componentProps: { |
| 68 | placeholder: '请输入键名', | 68 | placeholder: '请输入键名', |
| @@ -79,7 +79,7 @@ export const formSchema: FormSchema[] = [ | @@ -79,7 +79,7 @@ export const formSchema: FormSchema[] = [ | ||
| 79 | { | 79 | { |
| 80 | field: 'key1', | 80 | field: 'key1', |
| 81 | label: '键名', | 81 | label: '键名', |
| 82 | - colProps: { span: 24 }, | 82 | + colProps: { span: 13 }, |
| 83 | component: 'Input', | 83 | component: 'Input', |
| 84 | componentProps: { | 84 | componentProps: { |
| 85 | placeholder: '请输入键名', | 85 | placeholder: '请输入键名', |
| @@ -94,7 +94,7 @@ export const formSchema: FormSchema[] = [ | @@ -94,7 +94,7 @@ export const formSchema: FormSchema[] = [ | ||
| 94 | { | 94 | { |
| 95 | field: 'key1', | 95 | field: 'key1', |
| 96 | label: '键名', | 96 | label: '键名', |
| 97 | - colProps: { span: 24 }, | 97 | + colProps: { span: 13 }, |
| 98 | component: 'Input', | 98 | component: 'Input', |
| 99 | componentProps: { | 99 | componentProps: { |
| 100 | placeholder: '请输入键名', | 100 | placeholder: '请输入键名', |
| @@ -104,7 +104,7 @@ export const formSchema: FormSchema[] = [ | @@ -104,7 +104,7 @@ export const formSchema: FormSchema[] = [ | ||
| 104 | { | 104 | { |
| 105 | field: 'type1', | 105 | field: 'type1', |
| 106 | label: '值类型', | 106 | label: '值类型', |
| 107 | - colProps: { span: 24 }, | 107 | + colProps: { span: 13 }, |
| 108 | component: 'Select', | 108 | component: 'Select', |
| 109 | componentProps: { | 109 | componentProps: { |
| 110 | placeholder: '请选择值类型', | 110 | placeholder: '请选择值类型', |
| @@ -122,7 +122,7 @@ export const formSchema: FormSchema[] = [ | @@ -122,7 +122,7 @@ export const formSchema: FormSchema[] = [ | ||
| 122 | { | 122 | { |
| 123 | field: 'operation', | 123 | field: 'operation', |
| 124 | label: '操作', | 124 | label: '操作', |
| 125 | - colProps: { span: 24 }, | 125 | + colProps: { span: 13 }, |
| 126 | component: 'Select', | 126 | component: 'Select', |
| 127 | componentProps: { | 127 | componentProps: { |
| 128 | placeholder: '请选择操作', | 128 | placeholder: '请选择操作', |
| @@ -141,7 +141,7 @@ export const formSchema: FormSchema[] = [ | @@ -141,7 +141,7 @@ export const formSchema: FormSchema[] = [ | ||
| 141 | field: '', | 141 | field: '', |
| 142 | label: '大小写', | 142 | label: '大小写', |
| 143 | component: 'Checkbox', | 143 | component: 'Checkbox', |
| 144 | - colProps: { span: 24 }, | 144 | + colProps: { span: 13 }, |
| 145 | renderComponentContent: '忽略大小写', | 145 | renderComponentContent: '忽略大小写', |
| 146 | ifShow: ({ values }) => isString(Reflect.get(values, 'type1')), | 146 | ifShow: ({ values }) => isString(Reflect.get(values, 'type1')), |
| 147 | }, | 147 | }, |
| @@ -180,7 +180,7 @@ export const formSchema: FormSchema[] = [ | @@ -180,7 +180,7 @@ export const formSchema: FormSchema[] = [ | ||
| 180 | { | 180 | { |
| 181 | field: 'value1', | 181 | field: 'value1', |
| 182 | label: '默认值', | 182 | label: '默认值', |
| 183 | - colProps: { span: 24 }, | 183 | + colProps: { span: 13 }, |
| 184 | component: 'Input', | 184 | component: 'Input', |
| 185 | componentProps: { | 185 | componentProps: { |
| 186 | placeholder: '请输入默认值(数字)', | 186 | placeholder: '请输入默认值(数字)', |
| @@ -203,7 +203,7 @@ export const formSchema: FormSchema[] = [ | @@ -203,7 +203,7 @@ export const formSchema: FormSchema[] = [ | ||
| 203 | { | 203 | { |
| 204 | field: 'operation', | 204 | field: 'operation', |
| 205 | label: '操作', | 205 | label: '操作', |
| 206 | - colProps: { span: 24 }, | 206 | + colProps: { span: 13 }, |
| 207 | component: 'Select', | 207 | component: 'Select', |
| 208 | componentProps: { | 208 | componentProps: { |
| 209 | placeholder: '请选择操作', | 209 | placeholder: '请选择操作', |
| @@ -254,7 +254,7 @@ export const formSchema: FormSchema[] = [ | @@ -254,7 +254,7 @@ export const formSchema: FormSchema[] = [ | ||
| 254 | { | 254 | { |
| 255 | field: 'value1', | 255 | field: 'value1', |
| 256 | label: '值', | 256 | label: '值', |
| 257 | - colProps: { span: 24 }, | 257 | + colProps: { span: 13 }, |
| 258 | component: 'Input', | 258 | component: 'Input', |
| 259 | componentProps: { | 259 | componentProps: { |
| 260 | placeholder: '请输入值(数字)', | 260 | placeholder: '请输入值(数字)', |
| @@ -278,7 +278,7 @@ export const formSchema: FormSchema[] = [ | @@ -278,7 +278,7 @@ export const formSchema: FormSchema[] = [ | ||
| 278 | { | 278 | { |
| 279 | field: 'operation', | 279 | field: 'operation', |
| 280 | label: '操作', | 280 | label: '操作', |
| 281 | - colProps: { span: 24 }, | 281 | + colProps: { span: 13 }, |
| 282 | component: 'Select', | 282 | component: 'Select', |
| 283 | componentProps: { | 283 | componentProps: { |
| 284 | placeholder: '请选择操作', | 284 | placeholder: '请选择操作', |
| @@ -292,6 +292,7 @@ export const formSchema: FormSchema[] = [ | @@ -292,6 +292,7 @@ export const formSchema: FormSchema[] = [ | ||
| 292 | { | 292 | { |
| 293 | field: '', | 293 | field: '', |
| 294 | label: '默认值', | 294 | label: '默认值', |
| 295 | + colProps: { span: 13 }, | ||
| 295 | component: 'Checkbox', | 296 | component: 'Checkbox', |
| 296 | renderComponentContent: '真', | 297 | renderComponentContent: '真', |
| 297 | ifShow: ({ values }) => isBoolean(Reflect.get(values, 'type1')), | 298 | ifShow: ({ values }) => isBoolean(Reflect.get(values, 'type1')), |
| @@ -344,7 +345,7 @@ export const formSchema: FormSchema[] = [ | @@ -344,7 +345,7 @@ export const formSchema: FormSchema[] = [ | ||
| 344 | { | 345 | { |
| 345 | field: 'operation', | 346 | field: 'operation', |
| 346 | label: '操作', | 347 | label: '操作', |
| 347 | - colProps: { span: 24 }, | 348 | + colProps: { span: 13 }, |
| 348 | component: 'Select', | 349 | component: 'Select', |
| 349 | componentProps: { | 350 | componentProps: { |
| 350 | placeholder: '请选择操作', | 351 | placeholder: '请选择操作', |
| @@ -364,7 +365,7 @@ export const formSchema: FormSchema[] = [ | @@ -364,7 +365,7 @@ export const formSchema: FormSchema[] = [ | ||
| 364 | component: 'DatePicker', | 365 | component: 'DatePicker', |
| 365 | label: '请选择日期', | 366 | label: '请选择日期', |
| 366 | colProps: { | 367 | colProps: { |
| 367 | - span: 12, | 368 | + span: 13, |
| 368 | }, | 369 | }, |
| 369 | ifShow: ({ values }) => isComplex(Reflect.get(values, 'type1')), | 370 | ifShow: ({ values }) => isComplex(Reflect.get(values, 'type1')), |
| 370 | show: ({ values }) => { | 371 | show: ({ values }) => { |
| @@ -376,7 +377,7 @@ export const formSchema: FormSchema[] = [ | @@ -376,7 +377,7 @@ export const formSchema: FormSchema[] = [ | ||
| 376 | component: 'TimePicker', | 377 | component: 'TimePicker', |
| 377 | label: '请选择时间', | 378 | label: '请选择时间', |
| 378 | colProps: { | 379 | colProps: { |
| 379 | - span: 8, | 380 | + span: 13, |
| 380 | }, | 381 | }, |
| 381 | ifShow: ({ values }) => isComplex(Reflect.get(values, 'type1')), | 382 | ifShow: ({ values }) => isComplex(Reflect.get(values, 'type1')), |
| 382 | show: ({ values }) => { | 383 | show: ({ values }) => { |
| @@ -4,7 +4,7 @@ export const formSchema: FormSchema[] = [ | @@ -4,7 +4,7 @@ export const formSchema: FormSchema[] = [ | ||
| 4 | { | 4 | { |
| 5 | field: 'alarmDetails', | 5 | field: 'alarmDetails', |
| 6 | label: '报警详细信息', | 6 | label: '报警详细信息', |
| 7 | - colProps: { span: 12 }, | 7 | + colProps: { span: 13 }, |
| 8 | required: true, | 8 | required: true, |
| 9 | component: 'Input', | 9 | component: 'Input', |
| 10 | componentProps: { | 10 | componentProps: { |
| @@ -60,12 +60,19 @@ export const formSchema: FormSchema[] = [ | @@ -60,12 +60,19 @@ export const formSchema: FormSchema[] = [ | ||
| 60 | 60 | ||
| 61 | { | 61 | { |
| 62 | field: 'daysOfWeek1', | 62 | field: 'daysOfWeek1', |
| 63 | - component: 'Checkbox', | ||
| 64 | - label: '星期一', | 63 | + component: 'CheckboxGroup', |
| 64 | + label: '天', | ||
| 65 | colProps: { | 65 | colProps: { |
| 66 | span: 8, | 66 | span: 8, |
| 67 | }, | 67 | }, |
| 68 | - renderComponentContent: '', | 68 | + componentProps: { |
| 69 | + options: [ | ||
| 70 | + { | ||
| 71 | + label: '星期一', | ||
| 72 | + value: '1', | ||
| 73 | + }, | ||
| 74 | + ], | ||
| 75 | + }, | ||
| 69 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 76 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), |
| 70 | }, | 77 | }, |
| 71 | { | 78 | { |
| @@ -89,12 +96,19 @@ export const formSchema: FormSchema[] = [ | @@ -89,12 +96,19 @@ export const formSchema: FormSchema[] = [ | ||
| 89 | 96 | ||
| 90 | { | 97 | { |
| 91 | field: 'daysOfWeek2', | 98 | field: 'daysOfWeek2', |
| 92 | - component: 'Checkbox', | ||
| 93 | - label: '星期二', | 99 | + component: 'CheckboxGroup', |
| 100 | + label: '天', | ||
| 94 | colProps: { | 101 | colProps: { |
| 95 | span: 8, | 102 | span: 8, |
| 96 | }, | 103 | }, |
| 97 | - renderComponentContent: '', | 104 | + componentProps: { |
| 105 | + options: [ | ||
| 106 | + { | ||
| 107 | + label: '星期二', | ||
| 108 | + value: '2', | ||
| 109 | + }, | ||
| 110 | + ], | ||
| 111 | + }, | ||
| 98 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 112 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), |
| 99 | }, | 113 | }, |
| 100 | { | 114 | { |
| @@ -117,12 +131,19 @@ export const formSchema: FormSchema[] = [ | @@ -117,12 +131,19 @@ export const formSchema: FormSchema[] = [ | ||
| 117 | }, | 131 | }, |
| 118 | { | 132 | { |
| 119 | field: 'daysOfWeek3', | 133 | field: 'daysOfWeek3', |
| 120 | - component: 'Checkbox', | ||
| 121 | - label: '星期三', | 134 | + component: 'CheckboxGroup', |
| 135 | + label: '天', | ||
| 122 | colProps: { | 136 | colProps: { |
| 123 | span: 8, | 137 | span: 8, |
| 124 | }, | 138 | }, |
| 125 | - renderComponentContent: '', | 139 | + componentProps: { |
| 140 | + options: [ | ||
| 141 | + { | ||
| 142 | + label: '星期三', | ||
| 143 | + value: '3', | ||
| 144 | + }, | ||
| 145 | + ], | ||
| 146 | + }, | ||
| 126 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 147 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), |
| 127 | }, | 148 | }, |
| 128 | { | 149 | { |
| @@ -145,12 +166,19 @@ export const formSchema: FormSchema[] = [ | @@ -145,12 +166,19 @@ export const formSchema: FormSchema[] = [ | ||
| 145 | }, | 166 | }, |
| 146 | { | 167 | { |
| 147 | field: 'daysOfWeek4', | 168 | field: 'daysOfWeek4', |
| 148 | - component: 'Checkbox', | ||
| 149 | - label: '星期四', | 169 | + component: 'CheckboxGroup', |
| 170 | + label: '天', | ||
| 150 | colProps: { | 171 | colProps: { |
| 151 | span: 8, | 172 | span: 8, |
| 152 | }, | 173 | }, |
| 153 | - renderComponentContent: '', | 174 | + componentProps: { |
| 175 | + options: [ | ||
| 176 | + { | ||
| 177 | + label: '星期四', | ||
| 178 | + value: '4', | ||
| 179 | + }, | ||
| 180 | + ], | ||
| 181 | + }, | ||
| 154 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 182 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), |
| 155 | }, | 183 | }, |
| 156 | { | 184 | { |
| @@ -173,12 +201,19 @@ export const formSchema: FormSchema[] = [ | @@ -173,12 +201,19 @@ export const formSchema: FormSchema[] = [ | ||
| 173 | }, | 201 | }, |
| 174 | { | 202 | { |
| 175 | field: 'daysOfWeek5', | 203 | field: 'daysOfWeek5', |
| 176 | - component: 'Checkbox', | ||
| 177 | - label: '星期五', | 204 | + component: 'CheckboxGroup', |
| 205 | + label: '天', | ||
| 178 | colProps: { | 206 | colProps: { |
| 179 | span: 8, | 207 | span: 8, |
| 180 | }, | 208 | }, |
| 181 | - renderComponentContent: '', | 209 | + componentProps: { |
| 210 | + options: [ | ||
| 211 | + { | ||
| 212 | + label: '星期五', | ||
| 213 | + value: '5', | ||
| 214 | + }, | ||
| 215 | + ], | ||
| 216 | + }, | ||
| 182 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 217 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), |
| 183 | }, | 218 | }, |
| 184 | { | 219 | { |
| @@ -201,12 +236,19 @@ export const formSchema: FormSchema[] = [ | @@ -201,12 +236,19 @@ export const formSchema: FormSchema[] = [ | ||
| 201 | }, | 236 | }, |
| 202 | { | 237 | { |
| 203 | field: 'daysOfWeek6', | 238 | field: 'daysOfWeek6', |
| 204 | - component: 'Checkbox', | ||
| 205 | - label: '星期六', | 239 | + component: 'CheckboxGroup', |
| 240 | + label: '天', | ||
| 206 | colProps: { | 241 | colProps: { |
| 207 | span: 8, | 242 | span: 8, |
| 208 | }, | 243 | }, |
| 209 | - renderComponentContent: '', | 244 | + componentProps: { |
| 245 | + options: [ | ||
| 246 | + { | ||
| 247 | + label: '星期六', | ||
| 248 | + value: '6', | ||
| 249 | + }, | ||
| 250 | + ], | ||
| 251 | + }, | ||
| 210 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 252 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), |
| 211 | }, | 253 | }, |
| 212 | { | 254 | { |
| @@ -229,12 +271,19 @@ export const formSchema: FormSchema[] = [ | @@ -229,12 +271,19 @@ export const formSchema: FormSchema[] = [ | ||
| 229 | }, | 271 | }, |
| 230 | { | 272 | { |
| 231 | field: 'daysOfWeek7', | 273 | field: 'daysOfWeek7', |
| 232 | - component: 'Checkbox', | ||
| 233 | - label: '星期七', | 274 | + component: 'CheckboxGroup', |
| 275 | + label: '天', | ||
| 234 | colProps: { | 276 | colProps: { |
| 235 | span: 8, | 277 | span: 8, |
| 236 | }, | 278 | }, |
| 237 | - renderComponentContent: '', | 279 | + componentProps: { |
| 280 | + options: [ | ||
| 281 | + { | ||
| 282 | + label: '星期七', | ||
| 283 | + value: '7', | ||
| 284 | + }, | ||
| 285 | + ], | ||
| 286 | + }, | ||
| 238 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), | 287 | ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')), |
| 239 | }, | 288 | }, |
| 240 | { | 289 | { |
| @@ -26,7 +26,7 @@ interface IAlarms { | @@ -26,7 +26,7 @@ interface IAlarms { | ||
| 26 | id: string; | 26 | id: string; |
| 27 | alarmType: string; | 27 | alarmType: string; |
| 28 | createRules: ICreateRule; | 28 | createRules: ICreateRule; |
| 29 | - clearRule?: IClearRule[]; | 29 | + // clearRule?: IClearRule[]; |
| 30 | propagate: boolean; | 30 | propagate: boolean; |
| 31 | propagateRelationTypes: string[]; | 31 | propagateRelationTypes: string[]; |
| 32 | } | 32 | } |
| @@ -36,4 +36,5 @@ export interface IProfileData { | @@ -36,4 +36,5 @@ export interface IProfileData { | ||
| 36 | transportConfiguration?: ITansportConfiguration; | 36 | transportConfiguration?: ITansportConfiguration; |
| 37 | provisionConfiguration?: provisionConfigurationD; | 37 | provisionConfiguration?: provisionConfigurationD; |
| 38 | alarms?: IAlarms[]; | 38 | alarms?: IAlarms[]; |
| 39 | + clearRule?: IClearRule[]; | ||
| 39 | } | 40 | } |
| @@ -54,7 +54,14 @@ | @@ -54,7 +54,14 @@ | ||
| 54 | const getValueData: any = ref({}); | 54 | const getValueData: any = ref({}); |
| 55 | const [ | 55 | const [ |
| 56 | registerCondition, | 56 | registerCondition, |
| 57 | - { resetFields, updateSchema, appendSchemaByField, removeSchemaByFiled, getFieldsValue }, | 57 | + { |
| 58 | + setFieldsValue, | ||
| 59 | + resetFields, | ||
| 60 | + updateSchema, | ||
| 61 | + appendSchemaByField, | ||
| 62 | + removeSchemaByFiled, | ||
| 63 | + getFieldsValue, | ||
| 64 | + }, | ||
| 58 | ] = useForm({ | 65 | ] = useForm({ |
| 59 | labelWidth: 100, | 66 | labelWidth: 100, |
| 60 | schemas: useConditionDrawerSchema, | 67 | schemas: useConditionDrawerSchema, |
| @@ -79,7 +86,10 @@ | @@ -79,7 +86,10 @@ | ||
| 79 | }); | 86 | }); |
| 80 | } | 87 | } |
| 81 | ); | 88 | ); |
| 82 | - | 89 | + //回显数据 |
| 90 | + const setFieldsFormValue = (v) => { | ||
| 91 | + setFieldsValue(v); | ||
| 92 | + }; | ||
| 83 | function getAllFields(getV) { | 93 | function getAllFields(getV) { |
| 84 | const values = getFieldsValue(); | 94 | const values = getFieldsValue(); |
| 85 | getValueData.value = values; | 95 | getValueData.value = values; |
| @@ -301,7 +311,7 @@ | @@ -301,7 +311,7 @@ | ||
| 301 | ]); | 311 | ]); |
| 302 | n.value--; | 312 | n.value--; |
| 303 | } | 313 | } |
| 304 | - return { registerCondition, add, del, getAllFields, funcResetFields }; | 314 | + return { setFieldsFormValue, registerCondition, add, del, getAllFields, funcResetFields }; |
| 305 | }, | 315 | }, |
| 306 | }); | 316 | }); |
| 307 | </script> | 317 | </script> |
| @@ -48,7 +48,14 @@ | @@ -48,7 +48,14 @@ | ||
| 48 | const getValueData: any = ref({}); | 48 | const getValueData: any = ref({}); |
| 49 | const [ | 49 | const [ |
| 50 | registerAction, | 50 | registerAction, |
| 51 | - { resetFields, updateSchema, appendSchemaByField, getFieldsValue, removeSchemaByFiled }, | 51 | + { |
| 52 | + setFieldsValue, | ||
| 53 | + resetFields, | ||
| 54 | + updateSchema, | ||
| 55 | + appendSchemaByField, | ||
| 56 | + getFieldsValue, | ||
| 57 | + removeSchemaByFiled, | ||
| 58 | + }, | ||
| 52 | ] = useForm({ | 59 | ] = useForm({ |
| 53 | labelWidth: 100, | 60 | labelWidth: 100, |
| 54 | schemas: useActionDrawerSchema, | 61 | schemas: useActionDrawerSchema, |
| @@ -73,6 +80,10 @@ | @@ -73,6 +80,10 @@ | ||
| 73 | }); | 80 | }); |
| 74 | } | 81 | } |
| 75 | ); | 82 | ); |
| 83 | + //回显数据 | ||
| 84 | + const setFieldsFormValue = (v) => { | ||
| 85 | + setFieldsValue(v); | ||
| 86 | + }; | ||
| 76 | function getAllFields(getV) { | 87 | function getAllFields(getV) { |
| 77 | const values = getFieldsValue(); | 88 | const values = getFieldsValue(); |
| 78 | getValueData.value = values; | 89 | getValueData.value = values; |
| @@ -225,7 +236,7 @@ | @@ -225,7 +236,7 @@ | ||
| 225 | n.value--; | 236 | n.value--; |
| 226 | } | 237 | } |
| 227 | 238 | ||
| 228 | - return { registerAction, add, del, getAllFields, funcResetFields }; | 239 | + return { setFieldsFormValue, registerAction, add, del, getAllFields, funcResetFields }; |
| 229 | }, | 240 | }, |
| 230 | }); | 241 | }); |
| 231 | </script> | 242 | </script> |
| @@ -61,9 +61,18 @@ | @@ -61,9 +61,18 @@ | ||
| 61 | props: ['deviceInfo'], | 61 | props: ['deviceInfo'], |
| 62 | setup(props) { | 62 | setup(props) { |
| 63 | const getValueData: any = ref({}); | 63 | const getValueData: any = ref({}); |
| 64 | + const getPushValueData: any = ref([]); | ||
| 65 | + // const newMapGetPushValueData: any = ref([]); | ||
| 64 | const [ | 66 | const [ |
| 65 | registerTrigger, | 67 | registerTrigger, |
| 66 | - { resetFields, appendSchemaByField, removeSchemaByFiled, getFieldsValue, updateSchema }, | 68 | + { |
| 69 | + setFieldsValue, | ||
| 70 | + resetFields, | ||
| 71 | + appendSchemaByField, | ||
| 72 | + removeSchemaByFiled, | ||
| 73 | + getFieldsValue, | ||
| 74 | + updateSchema, | ||
| 75 | + }, | ||
| 67 | ] = useForm({ | 76 | ] = useForm({ |
| 68 | labelWidth: 100, | 77 | labelWidth: 100, |
| 69 | schemas: useTriggerDrawerSchema, | 78 | schemas: useTriggerDrawerSchema, |
| @@ -88,19 +97,42 @@ | @@ -88,19 +97,42 @@ | ||
| 88 | }); | 97 | }); |
| 89 | } | 98 | } |
| 90 | ); | 99 | ); |
| 100 | + //回显数据 | ||
| 101 | + const setFieldsFormValue = (v) => { | ||
| 102 | + setFieldsValue(v); | ||
| 103 | + }; | ||
| 104 | + // //去除字符串的数字 | ||
| 105 | + // function trimNumber(str) { | ||
| 106 | + // return str.replace(/\d+/g, ''); | ||
| 107 | + // } | ||
| 108 | + // function unique(arr) { | ||
| 109 | + // return Array.from(new Set(arr)); | ||
| 110 | + // } | ||
| 91 | function getAllFields(getV) { | 111 | function getAllFields(getV) { |
| 92 | const values = getFieldsValue(); | 112 | const values = getFieldsValue(); |
| 93 | getValueData.value = values; | 113 | getValueData.value = values; |
| 94 | - console.log(getValueData.value); | ||
| 95 | getV = getValueData.value; | 114 | getV = getValueData.value; |
| 115 | + getPushValueData.value.push(getV); | ||
| 116 | + console.log(getPushValueData.value); | ||
| 96 | return getV; | 117 | return getV; |
| 97 | } | 118 | } |
| 98 | function funcResetFields() { | 119 | function funcResetFields() { |
| 99 | resetFields(); | 120 | resetFields(); |
| 100 | } | 121 | } |
| 122 | + const addString: any = ref('tiggerEvent1') || ref('tiggerEvent2') || ref('tiggerEvent3'); | ||
| 101 | 123 | ||
| 102 | const n = ref(1); | 124 | const n = ref(1); |
| 103 | function add() { | 125 | function add() { |
| 126 | + const values = getFieldsValue(); | ||
| 127 | + getPushValueData.value.push(values); | ||
| 128 | + console.log(getPushValueData.value); | ||
| 129 | + // newMapGetPushValueData.value = getPushValueData.value.map((m) => { | ||
| 130 | + // const getKeys = Object.keys(m); | ||
| 131 | + // getKeys.map((f) => { | ||
| 132 | + // return unique(trimNumber(f)); | ||
| 133 | + // }); | ||
| 134 | + // }); | ||
| 135 | + // console.log(newMapGetPushValueData.value); | ||
| 104 | appendSchemaByField( | 136 | appendSchemaByField( |
| 105 | { | 137 | { |
| 106 | field: `kong${n.value}`, | 138 | field: `kong${n.value}`, |
| @@ -137,9 +169,9 @@ | @@ -137,9 +169,9 @@ | ||
| 137 | placeholder: '请选择设备', | 169 | placeholder: '请选择设备', |
| 138 | }, | 170 | }, |
| 139 | ifShow: ({ values }) => | 171 | ifShow: ({ values }) => |
| 140 | - !isTime(Reflect.get(values, `tiggerEvent${n.value}`)) && | ||
| 141 | - !isScene(Reflect.get(values, `tiggerEvent${n.value}`)) && | ||
| 142 | - !isHand(Reflect.get(values, `tiggerEvent${n.value}`)), | 172 | + !isTime(Reflect.get(values, addString.value)) && |
| 173 | + !isScene(Reflect.get(values, addString.value)) && | ||
| 174 | + !isHand(Reflect.get(values, addString.value)), | ||
| 143 | colProps: { | 175 | colProps: { |
| 144 | span: 12, | 176 | span: 12, |
| 145 | }, | 177 | }, |
| @@ -157,7 +189,7 @@ | @@ -157,7 +189,7 @@ | ||
| 157 | colProps: { | 189 | colProps: { |
| 158 | span: 12, | 190 | span: 12, |
| 159 | }, | 191 | }, |
| 160 | - ifShow: ({ values }) => isTime(Reflect.get(values, `tiggerEvent${n.value}`)), | 192 | + ifShow: ({ values }) => isTime(Reflect.get(values, addString.value)), |
| 161 | }, | 193 | }, |
| 162 | '' | 194 | '' |
| 163 | ); | 195 | ); |
| @@ -174,9 +206,9 @@ | @@ -174,9 +206,9 @@ | ||
| 174 | ], | 206 | ], |
| 175 | }, | 207 | }, |
| 176 | ifShow: ({ values }) => | 208 | ifShow: ({ values }) => |
| 177 | - !isTime(Reflect.get(values, `tiggerEvent${n.value}`)) && | ||
| 178 | - !isScene(Reflect.get(values, `tiggerEvent${n.value}`)) && | ||
| 179 | - !isHand(Reflect.get(values, `tiggerEvent${n.value}`)), | 209 | + !isTime(Reflect.get(values, addString.value)) && |
| 210 | + !isScene(Reflect.get(values, addString.value)) && | ||
| 211 | + !isHand(Reflect.get(values, addString.value)), | ||
| 180 | colProps: { span: 12 }, | 212 | colProps: { span: 12 }, |
| 181 | }, | 213 | }, |
| 182 | '' | 214 | '' |
| @@ -197,9 +229,9 @@ | @@ -197,9 +229,9 @@ | ||
| 197 | colProps: { span: 12 }, | 229 | colProps: { span: 12 }, |
| 198 | ifShow: ({ values }) => | 230 | ifShow: ({ values }) => |
| 199 | isUpAndDown(Reflect.get(values, `touchWay${n.value}`)) && | 231 | isUpAndDown(Reflect.get(values, `touchWay${n.value}`)) && |
| 200 | - !isTime(Reflect.get(values, `tiggerEvent${n.value}`)) && | ||
| 201 | - !isScene(Reflect.get(values, `tiggerEvent${n.value}`)) && | ||
| 202 | - !isHand(Reflect.get(values, `tiggerEvent${n.value}`)), | 232 | + !isTime(Reflect.get(values, addString.value)) && |
| 233 | + !isScene(Reflect.get(values, addString.value)) && | ||
| 234 | + !isHand(Reflect.get(values, addString.value)), | ||
| 203 | }, | 235 | }, |
| 204 | '' | 236 | '' |
| 205 | ); | 237 | ); |
| @@ -217,9 +249,9 @@ | @@ -217,9 +249,9 @@ | ||
| 217 | }, | 249 | }, |
| 218 | colProps: { span: 12 }, | 250 | colProps: { span: 12 }, |
| 219 | ifShow: ({ values }) => | 251 | ifShow: ({ values }) => |
| 220 | - !isTime(Reflect.get(values, `tiggerEvent${n.value}`)) && | ||
| 221 | - !isScene(Reflect.get(values, `tiggerEvent${n.value}`)) && | ||
| 222 | - !isHand(Reflect.get(values, `tiggerEvent${n.value}`)) && | 252 | + !isTime(Reflect.get(values, addString.value)) && |
| 253 | + !isScene(Reflect.get(values, addString.value)) && | ||
| 254 | + !isHand(Reflect.get(values, addString.value)) && | ||
| 223 | !isUpAndDown(Reflect.get(values, `touchWay${n.value}`)), | 255 | !isUpAndDown(Reflect.get(values, `touchWay${n.value}`)), |
| 224 | }, | 256 | }, |
| 225 | '' | 257 | '' |
| @@ -242,9 +274,9 @@ | @@ -242,9 +274,9 @@ | ||
| 242 | ifShow: ({ values }) => | 274 | ifShow: ({ values }) => |
| 243 | isWenDu(Reflect.get(values, 'attributeChoose')) && | 275 | isWenDu(Reflect.get(values, 'attributeChoose')) && |
| 244 | !isUpAndDown(Reflect.get(values, `touchWay${n.value}`)) && | 276 | !isUpAndDown(Reflect.get(values, `touchWay${n.value}`)) && |
| 245 | - !isTime(Reflect.get(values, `tiggerEvent${n.value}`)) && | ||
| 246 | - !isScene(Reflect.get(values, `tiggerEvent${n.value}`)) && | ||
| 247 | - !isHand(Reflect.get(values, `tiggerEvent${n.value}`)), | 277 | + !isTime(Reflect.get(values, addString.value)) && |
| 278 | + !isScene(Reflect.get(values, addString.value)) && | ||
| 279 | + !isHand(Reflect.get(values, addString.value)), | ||
| 248 | colProps: { span: 12 }, | 280 | colProps: { span: 12 }, |
| 249 | }, | 281 | }, |
| 250 | '' | 282 | '' |
| @@ -260,9 +292,9 @@ | @@ -260,9 +292,9 @@ | ||
| 260 | ifShow: ({ values }) => | 292 | ifShow: ({ values }) => |
| 261 | isWenDu(Reflect.get(values, 'attributeChoose')) && | 293 | isWenDu(Reflect.get(values, 'attributeChoose')) && |
| 262 | !isUpAndDown(Reflect.get(values, `touchWay${n.value}`)) && | 294 | !isUpAndDown(Reflect.get(values, `touchWay${n.value}`)) && |
| 263 | - !isTime(Reflect.get(values, `tiggerEvent${n.value}`)) && | ||
| 264 | - !isScene(Reflect.get(values, `tiggerEvent${n.value}`)) && | ||
| 265 | - !isHand(Reflect.get(values, `tiggerEvent${n.value}`)), | 295 | + !isTime(Reflect.get(values, addString.value)) && |
| 296 | + !isScene(Reflect.get(values, addString.value)) && | ||
| 297 | + !isHand(Reflect.get(values, addString.value)), | ||
| 266 | colProps: { | 298 | colProps: { |
| 267 | span: 12, | 299 | span: 12, |
| 268 | }, | 300 | }, |
| @@ -277,7 +309,7 @@ | @@ -277,7 +309,7 @@ | ||
| 277 | colProps: { | 309 | colProps: { |
| 278 | span: 12, | 310 | span: 12, |
| 279 | }, | 311 | }, |
| 280 | - ifShow: ({ values }) => isScene(Reflect.get(values, `tiggerEvent${n.value}`)), | 312 | + ifShow: ({ values }) => isScene(Reflect.get(values, addString.value)), |
| 281 | componentProps: { | 313 | componentProps: { |
| 282 | placeholder: '请输入场景触发器', | 314 | placeholder: '请输入场景触发器', |
| 283 | options: [ | 315 | options: [ |
| @@ -300,7 +332,7 @@ | @@ -300,7 +332,7 @@ | ||
| 300 | componentProps: { | 332 | componentProps: { |
| 301 | placeholder: '暂不实现', | 333 | placeholder: '暂不实现', |
| 302 | }, | 334 | }, |
| 303 | - ifShow: ({ values }) => isHand(Reflect.get(values, `tiggerEvent${n.value}`)), | 335 | + ifShow: ({ values }) => isHand(Reflect.get(values, addString.value)), |
| 304 | }, | 336 | }, |
| 305 | '' | 337 | '' |
| 306 | ); | 338 | ); |
| @@ -336,7 +368,7 @@ | @@ -336,7 +368,7 @@ | ||
| 336 | ]); | 368 | ]); |
| 337 | n.value--; | 369 | n.value--; |
| 338 | } | 370 | } |
| 339 | - return { registerTrigger, add, del, getAllFields, funcResetFields }; | 371 | + return { setFieldsFormValue, registerTrigger, add, del, getAllFields, funcResetFields }; |
| 340 | }, | 372 | }, |
| 341 | }); | 373 | }); |
| 342 | </script> | 374 | </script> |
| @@ -399,7 +399,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -399,7 +399,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
| 399 | }, | 399 | }, |
| 400 | 400 | ||
| 401 | { | 401 | { |
| 402 | - field: '', | 402 | + field: 'no3', |
| 403 | label: '', | 403 | label: '', |
| 404 | component: 'ApiSelect', | 404 | component: 'ApiSelect', |
| 405 | colProps: { | 405 | colProps: { |
| @@ -71,6 +71,34 @@ | @@ -71,6 +71,34 @@ | ||
| 71 | await setFieldsValue({ | 71 | await setFieldsValue({ |
| 72 | ...data.record, | 72 | ...data.record, |
| 73 | }); | 73 | }); |
| 74 | + try { | ||
| 75 | + proxy.$refs.getTriggerChildData.setFieldsFormValue({ | ||
| 76 | + triggerEvent: data.record.triggers[0].triggerEvent, | ||
| 77 | + attributeChoose: data.record?.triggers[0].attributeChoose, | ||
| 78 | + touchWay: data.record?.triggers[0].touchWay, | ||
| 79 | + deviceId: data.record?.triggers[0].deviceId, | ||
| 80 | + compare: data.record?.triggers[0].compare, | ||
| 81 | + value: data.record?.triggers[0].value, | ||
| 82 | + sceneLinkageId: data.record?.triggers[0].sceneLinkageId, | ||
| 83 | + }); | ||
| 84 | + proxy.$refs.getConditionChildData.setFieldsFormValue({ | ||
| 85 | + status: data.record?.doConditions[0].status, | ||
| 86 | + deviceId: data.record?.doConditions[0].deviceId, | ||
| 87 | + createTime: data.record?.doConditions[0].createTime, | ||
| 88 | + updateTime: data.record?.doConditions[0].updateTime, | ||
| 89 | + property: data.record?.doConditions[0].property, | ||
| 90 | + compare: data.record?.doConditions[0].compare, | ||
| 91 | + value: data.record?.doConditions[0].value, | ||
| 92 | + }); | ||
| 93 | + proxy.$refs.getChildData.setFieldsFormValue({ | ||
| 94 | + outTarget: data.record?.doActions[0].outTarget, | ||
| 95 | + deviceId: data.record?.doActions[0].deviceId, | ||
| 96 | + command: data.record?.doActions[0].command, | ||
| 97 | + sceneLinkageId: data.record?.doActions[0].sceneLinkageId, | ||
| 98 | + }); | ||
| 99 | + } catch (e) { | ||
| 100 | + return e; | ||
| 101 | + } | ||
| 74 | } else { | 102 | } else { |
| 75 | await resetFields(); | 103 | await resetFields(); |
| 76 | } | 104 | } |
| @@ -88,7 +116,6 @@ | @@ -88,7 +116,6 @@ | ||
| 88 | triggersArray.push(getTriggerChildValues); | 116 | triggersArray.push(getTriggerChildValues); |
| 89 | doConditionsArray.push(getconditionChildValues); | 117 | doConditionsArray.push(getconditionChildValues); |
| 90 | getValuesFormData = getFieldsValue(); | 118 | getValuesFormData = getFieldsValue(); |
| 91 | - console.log('触发器',triggersArray) | ||
| 92 | Object.assign(getAllFormData, getValuesFormData); | 119 | Object.assign(getAllFormData, getValuesFormData); |
| 93 | getAllFormData.triggers = triggersArray; | 120 | getAllFormData.triggers = triggersArray; |
| 94 | getAllFormData.doConditions = doConditionsArray; | 121 | getAllFormData.doConditions = doConditionsArray; |