Commit befac13fbe09e35fc617e4e85700c47c5db00af9
Merge branch 'ft-dev' into 'main'
fix:修改场景联动页面触发器和执行条件按钮,和选择设备问题,fix:修复设备配置编辑数据回显 See merge request huang/yun-teng-iot-front!128
Showing
8 changed files
with
365 additions
and
221 deletions
| @@ -120,6 +120,7 @@ | @@ -120,6 +120,7 @@ | ||
| 120 | const [register, { closeModal }] = useModalInner(async (data) => { | 120 | const [register, { closeModal }] = useModalInner(async (data) => { |
| 121 | isUpdate.value = data.isUpdate; | 121 | isUpdate.value = data.isUpdate; |
| 122 | if (isUpdate.value == 1) { | 122 | if (isUpdate.value == 1) { |
| 123 | + proxy.$refs.DeviceProfileStep3Ref.isAddRuleStatusFunc(true); | ||
| 123 | isShowRule.value = true; | 124 | isShowRule.value = true; |
| 124 | isShowOkBtnFalse.value = true; | 125 | isShowOkBtnFalse.value = true; |
| 125 | current.value = 0; | 126 | current.value = 0; |
| @@ -134,6 +135,7 @@ | @@ -134,6 +135,7 @@ | ||
| 134 | stepThreeData: {}, | 135 | stepThreeData: {}, |
| 135 | }); | 136 | }); |
| 136 | } else if (isUpdate.value == 2) { | 137 | } else if (isUpdate.value == 2) { |
| 138 | + proxy.$refs.DeviceProfileStep3Ref.isAddRuleStatusFunc(true); | ||
| 137 | isShowRule.value = true; | 139 | isShowRule.value = true; |
| 138 | isShowOkBtnFalse.value = true; | 140 | isShowOkBtnFalse.value = true; |
| 139 | current.value = 0; | 141 | current.value = 0; |
| @@ -153,6 +155,7 @@ | @@ -153,6 +155,7 @@ | ||
| 153 | getBackendData = await deviceConfigGetDetail(postEditId.value); | 155 | getBackendData = await deviceConfigGetDetail(postEditId.value); |
| 154 | editData.value = getBackendData; | 156 | editData.value = getBackendData; |
| 155 | } else if (isUpdate.value == 3) { | 157 | } else if (isUpdate.value == 3) { |
| 158 | + proxy.$refs.DeviceProfileStep3Ref.isAddRuleStatusFunc(false); | ||
| 156 | isShowRule.value = false; | 159 | isShowRule.value = false; |
| 157 | isShowOkBtnFalse.value = false; | 160 | isShowOkBtnFalse.value = false; |
| 158 | current.value = 0; | 161 | current.value = 0; |
| @@ -215,6 +218,9 @@ | @@ -215,6 +218,9 @@ | ||
| 215 | stepThreeData: editData.value?.profileData.alarms[0].createRules, | 218 | stepThreeData: editData.value?.profileData.alarms[0].createRules, |
| 216 | stepThreeClearData: editData.value?.profileData.alarms[0].clearRule, | 219 | stepThreeClearData: editData.value?.profileData.alarms[0].clearRule, |
| 217 | }); | 220 | }); |
| 221 | + proxy.$refs.DeviceProfileStep3Ref.setCreateRegisterFormChangeDetailFunc( | ||
| 222 | + editData.value?.profileData.alarms[0].createRules | ||
| 223 | + ); | ||
| 218 | proxy.$refs.DeviceProfileStep3Ref.setRegisterFormClearChangeDetailFunc({ | 224 | proxy.$refs.DeviceProfileStep3Ref.setRegisterFormClearChangeDetailFunc({ |
| 219 | alarmDetails: editData.value?.profileData.alarms[0].clearRule.alarmDetails, | 225 | alarmDetails: editData.value?.profileData.alarms[0].clearRule.alarmDetails, |
| 220 | }); | 226 | }); |
| @@ -233,6 +239,9 @@ | @@ -233,6 +239,9 @@ | ||
| 233 | stepThreeData: editData.value?.profileData.alarms[0].createRules, | 239 | stepThreeData: editData.value?.profileData.alarms[0].createRules, |
| 234 | stepThreeClearData: editData.value?.profileData.alarms[0].clearRule, | 240 | stepThreeClearData: editData.value?.profileData.alarms[0].clearRule, |
| 235 | }); | 241 | }); |
| 242 | + proxy.$refs.DeviceProfileStep3Ref.setCreateRegisterFormChangeDetailFunc( | ||
| 243 | + editData.value?.profileData.alarms[0].createRules | ||
| 244 | + ); | ||
| 236 | proxy.$refs.DeviceProfileStep3Ref.setRegisterFormClearChangeDetailFunc({ | 245 | proxy.$refs.DeviceProfileStep3Ref.setRegisterFormClearChangeDetailFunc({ |
| 237 | alarmDetails: editData.value?.profileData.alarms[0].clearRule.alarmDetails, | 246 | alarmDetails: editData.value?.profileData.alarms[0].clearRule.alarmDetails, |
| 238 | }); | 247 | }); |
| @@ -313,6 +322,11 @@ | @@ -313,6 +322,11 @@ | ||
| 313 | 322 | ||
| 314 | const handleCancel = () => { | 323 | const handleCancel = () => { |
| 315 | closeModal(); | 324 | closeModal(); |
| 325 | + try { | ||
| 326 | + proxy.$refs.DeviceProfileStep4Ref.clearAlaramContactAndNoticeMethodFunc(); | ||
| 327 | + } catch (e) { | ||
| 328 | + return e; | ||
| 329 | + } | ||
| 316 | }; | 330 | }; |
| 317 | return { | 331 | return { |
| 318 | isShowRule, | 332 | isShowRule, |
| @@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
| 7 | <template #action> | 7 | <template #action> |
| 8 | <div class="cursor-pointer"> | 8 | <div class="cursor-pointer"> |
| 9 | <img | 9 | <img |
| 10 | + v-if="isAddRuleStatus" | ||
| 10 | style="cursor: pointer" | 11 | style="cursor: pointer" |
| 11 | @click="deleteAlarmRule(index)" | 12 | @click="deleteAlarmRule(index)" |
| 12 | alt="移除" | 13 | alt="移除" |
| @@ -68,10 +69,20 @@ | @@ -68,10 +69,20 @@ | ||
| 68 | <!-- 报警严重程度 --> | 69 | <!-- 报警严重程度 --> |
| 69 | <div style="margin-left: 10px; margin-top: 20px" | 70 | <div style="margin-left: 10px; margin-top: 20px" |
| 70 | ><BasicForm @register="registerFormCreateAlarm" /> | 71 | ><BasicForm @register="registerFormCreateAlarm" /> |
| 72 | + <div | ||
| 73 | + v-for="(i8, index8) in getStepThreeEditStatus ? createAlarmArray : []" | ||
| 74 | + :key="index8" | ||
| 75 | + style="position: relative" | ||
| 76 | + > | ||
| 77 | + <p | ||
| 78 | + style="position: absolute; top: -6vh; left: 6.5vw" | ||
| 79 | + v-if="index8 == createIndex" | ||
| 80 | + >{{ formatAlarmFunc(i8) }}</p | ||
| 81 | + > | ||
| 82 | + </div> | ||
| 71 | </div> | 83 | </div> |
| 72 | <!-- 报警严重程度 --> | 84 | <!-- 报警严重程度 --> |
| 73 | - | ||
| 74 | - <div style="margin-left: 5px; margin-top: -50px"> | 85 | + <div style="margin-left: 5px; margin-top: -35px"> |
| 75 | <div style="color: #f5594e" class="ml-4" | 86 | <div style="color: #f5594e" class="ml-4" |
| 76 | >报警规则条件: | 87 | >报警规则条件: |
| 77 | <Button | 88 | <Button |
| @@ -131,6 +142,18 @@ | @@ -131,6 +142,18 @@ | ||
| 131 | <div style="position: absolute; top: -5px; left: 106px; width: 581px"> | 142 | <div style="position: absolute; top: -5px; left: 106px; width: 581px"> |
| 132 | <BasicForm @register="registerFormChangeDetail" /> | 143 | <BasicForm @register="registerFormChangeDetail" /> |
| 133 | </div> | 144 | </div> |
| 145 | + <div | ||
| 146 | + v-for="(i7, index7) in getStepThreeEditStatus | ||
| 147 | + ? detailDetailModelArray | ||
| 148 | + : []" | ||
| 149 | + :key="index7" | ||
| 150 | + > | ||
| 151 | + <p | ||
| 152 | + style="margin-top: 1.5vh; margin-left: 5.6vw" | ||
| 153 | + v-if="index7 == createIndex" | ||
| 154 | + >{{ i7 }}</p | ||
| 155 | + > | ||
| 156 | + </div> | ||
| 134 | </div> | 157 | </div> |
| 135 | <div style="margin-top: 25px; position: relative"> | 158 | <div style="margin-top: 25px; position: relative"> |
| 136 | <div style="margin-left: -14px"> | 159 | <div style="margin-left: -14px"> |
| @@ -144,6 +167,7 @@ | @@ -144,6 +167,7 @@ | ||
| 144 | style="display: inline-block; position: relative; top: -257px; left: 757px" | 167 | style="display: inline-block; position: relative; top: -257px; left: 757px" |
| 145 | > | 168 | > |
| 146 | <img | 169 | <img |
| 170 | + v-if="isAddRuleStatus" | ||
| 147 | style="cursor: pointer" | 171 | style="cursor: pointer" |
| 148 | @click="deleteCondition(index, createIndex)" | 172 | @click="deleteCondition(index, createIndex)" |
| 149 | alt="移除" | 173 | alt="移除" |
| @@ -155,7 +179,11 @@ | @@ -155,7 +179,11 @@ | ||
| 155 | </div> | 179 | </div> |
| 156 | </template> | 180 | </template> |
| 157 | <div> | 181 | <div> |
| 158 | - <a-button style="border-radius: 10px" class="mt-5" @click="addCreateRole(index)" | 182 | + <a-button |
| 183 | + v-if="isAddRuleStatus" | ||
| 184 | + style="border-radius: 10px" | ||
| 185 | + class="mt-5" | ||
| 186 | + @click="addCreateRole(index)" | ||
| 159 | ><PlusCircleOutlined />添加创建条件</a-button | 187 | ><PlusCircleOutlined />添加创建条件</a-button |
| 160 | > | 188 | > |
| 161 | </div> | 189 | </div> |
| @@ -209,25 +237,7 @@ | @@ -209,25 +237,7 @@ | ||
| 209 | <span style="display: none">{{ index4 }}</span> | 237 | <span style="display: none">{{ index4 }}</span> |
| 210 | 238 | ||
| 211 | <p v-if="!getStepThreeEditStatus" | 239 | <p v-if="!getStepThreeEditStatus" |
| 212 | - >报警规则条件:{{ | ||
| 213 | - v4.predicate.operation == 'EQUAL' | ||
| 214 | - ? v4.key.key + '等于' + v4.predicate.value.defaultValue | ||
| 215 | - : v4.predicate.operation == 'STARTS_WITH' | ||
| 216 | - ? v4.key.key + '开始于' + v4.predicate.value.defaultValue | ||
| 217 | - : v4.predicate.operation == 'ENDS_WITH' | ||
| 218 | - ? v4.key.key + '结束于' + v4.predicate.value.defaultValue | ||
| 219 | - : v4.predicate.operation == 'NOT_CONTAINS' | ||
| 220 | - ? v4.key.key + '不包含' + v4.predicate.value.defaultValue | ||
| 221 | - : v4.predicate.operation == 'NOT_EQUAL' | ||
| 222 | - ? v4.key.key + '不等于' + v4.predicate.value.defaultValue | ||
| 223 | - : v4.predicate.operation == 'GREATER' | ||
| 224 | - ? v4.key.key + '大于' + v4.predicate.value.defaultValue | ||
| 225 | - : v4.predicate.operation == 'LESS' | ||
| 226 | - ? v4.key.key + '小于' + v4.predicate.value.defaultValue | ||
| 227 | - : v4.predicate.operation == 'GREATER_OR_EQUAL' | ||
| 228 | - ? v4.key.key + '大于或等于' + v4.predicate.value.defaultValue | ||
| 229 | - : v4.key.key + '小于或等于' + v4.predicate.value.defaultValue | ||
| 230 | - }}</p | 240 | + >报警规则条件:{{ formatClearRuleFunc(v4) }}</p |
| 231 | > | 241 | > |
| 232 | <p v-if="getStepThreeEditStatus" | 242 | <p v-if="getStepThreeEditStatus" |
| 233 | >报警规则条件:{{ openClearRuleConditionComp(v4) }}</p | 243 | >报警规则条件:{{ openClearRuleConditionComp(v4) }}</p |
| @@ -295,7 +305,11 @@ | @@ -295,7 +305,11 @@ | ||
| 295 | <div class="flex justify-center" style="display: fixed; bottom: 100px"> | 305 | <div class="flex justify-center" style="display: fixed; bottom: 100px"> |
| 296 | <a-button class="mr-5" @click="prevStep">上一步</a-button> | 306 | <a-button class="mr-5" @click="prevStep">上一步</a-button> |
| 297 | <a-button @click="handleFormStep3toStep4Next">下一步</a-button> | 307 | <a-button @click="handleFormStep3toStep4Next">下一步</a-button> |
| 298 | - <a-button style="margin-left: 20px" type="primary" @click="addAlarmRule" | 308 | + <a-button |
| 309 | + v-if="isAddRuleStatus" | ||
| 310 | + style="margin-left: 20px" | ||
| 311 | + type="primary" | ||
| 312 | + @click="addAlarmRule" | ||
| 299 | >添加报警规则</a-button | 313 | >添加报警规则</a-button |
| 300 | > | 314 | > |
| 301 | </div> | 315 | </div> |
| @@ -336,6 +350,7 @@ | @@ -336,6 +350,7 @@ | ||
| 336 | emits: ['prev', 'next', 'redo', 'handleFormStep3toStep4Next'], | 350 | emits: ['prev', 'next', 'redo', 'handleFormStep3toStep4Next'], |
| 337 | props: ['getAllStepThreeData', 'isAddOrEdit', 'isShowAddRule'], | 351 | props: ['getAllStepThreeData', 'isAddOrEdit', 'isShowAddRule'], |
| 338 | setup(props, { emit }) { | 352 | setup(props, { emit }) { |
| 353 | + const isAddRuleStatus = ref(true); | ||
| 339 | const { proxy } = getCurrentInstance(); | 354 | const { proxy } = getCurrentInstance(); |
| 340 | const changeGetDetailValue = ref({}); | 355 | const changeGetDetailValue = ref({}); |
| 341 | const changeGetClearDetailValue = ref({}); | 356 | const changeGetClearDetailValue = ref({}); |
| @@ -456,6 +471,10 @@ | @@ -456,6 +471,10 @@ | ||
| 456 | const getFilterStepThreeEditClearArr = ref<[]>([]); | 471 | const getFilterStepThreeEditClearArr = ref<[]>([]); |
| 457 | const getFilterStepThreeClearDetailEditArr = ref<[]>([]); | 472 | const getFilterStepThreeClearDetailEditArr = ref<[]>([]); |
| 458 | let getIsShowAddRule = true; | 473 | let getIsShowAddRule = true; |
| 474 | + | ||
| 475 | + const detailDetailModelArray = ref<[]>([]); | ||
| 476 | + const createAlarmArray = ref<[]>([]); | ||
| 477 | + | ||
| 459 | // getIsShowAddRule.value = props.isShowAddRule; | 478 | // getIsShowAddRule.value = props.isShowAddRule; |
| 460 | // console.log(getIsShowAddRule.value); | 479 | // console.log(getIsShowAddRule.value); |
| 461 | setTimeout(() => { | 480 | setTimeout(() => { |
| @@ -465,6 +484,9 @@ | @@ -465,6 +484,9 @@ | ||
| 465 | const log = (e) => { | 484 | const log = (e) => { |
| 466 | console.log(e); | 485 | console.log(e); |
| 467 | }; | 486 | }; |
| 487 | + const isAddRuleStatusFunc = (v) => { | ||
| 488 | + isAddRuleStatus.value = v; | ||
| 489 | + }; | ||
| 468 | //编辑清空操作 | 490 | //编辑清空操作 |
| 469 | const clearProfileDataFunc = () => { | 491 | const clearProfileDataFunc = () => { |
| 470 | profileData.value.splice(0, 1); | 492 | profileData.value.splice(0, 1); |
| @@ -530,8 +552,8 @@ | @@ -530,8 +552,8 @@ | ||
| 530 | registerFormChangeDetail, | 552 | registerFormChangeDetail, |
| 531 | { | 553 | { |
| 532 | getFieldsValue: getRegisterFormChangeDetail, | 554 | getFieldsValue: getRegisterFormChangeDetail, |
| 533 | - setFieldsValue: setRegisterFormChangeDetail, | ||
| 534 | resetFields: resetRegisterFormChangeDetail, | 555 | resetFields: resetRegisterFormChangeDetail, |
| 556 | + // setFieldsValue: setCreateRegisterFormChangeDetail, | ||
| 535 | }, | 557 | }, |
| 536 | ] = useForm({ | 558 | ] = useForm({ |
| 537 | labelWidth: 120, | 559 | labelWidth: 120, |
| @@ -606,6 +628,8 @@ | @@ -606,6 +628,8 @@ | ||
| 606 | getFilterStepThreeEditArr.value = []; | 628 | getFilterStepThreeEditArr.value = []; |
| 607 | getFilterStepThreeEditClearArr.value = []; | 629 | getFilterStepThreeEditClearArr.value = []; |
| 608 | getStepThreeEditStatus.value = false; | 630 | getStepThreeEditStatus.value = false; |
| 631 | + detailDetailModelArray.value = []; | ||
| 632 | + createAlarmArray.value = []; | ||
| 609 | }; | 633 | }; |
| 610 | const initClearCreateRuleFunc = () => { | 634 | const initClearCreateRuleFunc = () => { |
| 611 | profileData.value.forEach((f) => { | 635 | profileData.value.forEach((f) => { |
| @@ -635,7 +659,7 @@ | @@ -635,7 +659,7 @@ | ||
| 635 | const setRegisterFormCreateAlarmFunc = (v) => { | 659 | const setRegisterFormCreateAlarmFunc = (v) => { |
| 636 | setRegisterFormCreateAlarm(v); | 660 | setRegisterFormCreateAlarm(v); |
| 637 | }; | 661 | }; |
| 638 | - // | 662 | + |
| 639 | const optionsAlaram = [ | 663 | const optionsAlaram = [ |
| 640 | { | 664 | { |
| 641 | value: 'CRITICAL', | 665 | value: 'CRITICAL', |
| @@ -682,40 +706,29 @@ | @@ -682,40 +706,29 @@ | ||
| 682 | ? '定时启用' | 706 | ? '定时启用' |
| 683 | : '自定义启用'; | 707 | : '自定义启用'; |
| 684 | }; | 708 | }; |
| 685 | - const optionsOperation = [ | ||
| 686 | - { label: '等于', value: 'EQUAL' }, | ||
| 687 | - { label: '不等于', value: 'NOT_EQUAL' }, | ||
| 688 | - { label: '开始于', value: 'STARTS_WITH' }, | ||
| 689 | - { label: '结束于', value: 'ENDS_WITH' }, | ||
| 690 | - { label: '包含', value: 'CONTAINS' }, | ||
| 691 | - { label: '不包含', value: 'NOT_CONTAINS' }, | ||
| 692 | - { label: '大于', value: 'GREATER' }, | ||
| 693 | - { label: '小于', value: 'LESS' }, | ||
| 694 | - { label: '大于或等于', value: 'GREATER_OR_EQUAL' }, | ||
| 695 | - { label: '小于或等于', value: 'LESS_OR_EQUAL' }, | ||
| 696 | - ]; | ||
| 697 | //清除报警规则 | 709 | //清除报警规则 |
| 698 | const openClearRuleConditionComp = (v4) => { | 710 | const openClearRuleConditionComp = (v4) => { |
| 699 | try { | 711 | try { |
| 700 | - let clearRuleObj = {}; | ||
| 701 | - v4.condition.condition?.forEach((f) => { | ||
| 702 | - clearRuleObj = f; | 712 | + let formatMap = v4.condition.condition.map((f) => { |
| 713 | + return f.predicate.operation == 'EQUAL' | ||
| 714 | + ? f.key.key + '等于' + f.predicate.value.defaultValue | ||
| 715 | + : f.predicate.operation == 'STARTS_WITH' | ||
| 716 | + ? f.key.key + '开始于' + f.predicate.value.defaultValue | ||
| 717 | + : f.predicate.operation == 'ENDS_WITH' | ||
| 718 | + ? f.key.key + '结束于' + f.predicate.value.defaultValue | ||
| 719 | + : f.predicate.operation == 'NOT_CONTAINS' | ||
| 720 | + ? f.key.key + '不包含' + f.predicate.value.defaultValue | ||
| 721 | + : f.predicate.operation == 'NOT_EQUAL' | ||
| 722 | + ? f.key.key + '不等于' + f.predicate.value.defaultValue | ||
| 723 | + : f.predicate.operation == 'GREATER' | ||
| 724 | + ? f.key.key + '大于' + f.predicate.value.defaultValue | ||
| 725 | + : f.predicate.operation == 'LESS' | ||
| 726 | + ? f.key.key + '小于' + f.predicate.value.defaultValue | ||
| 727 | + : f.predicate.operation == 'GREATER_OR_EQUAL' | ||
| 728 | + ? f.key.key + '大于或等于' + f.predicate.value.defaultValue | ||
| 729 | + : f.key.key + '小于或等于' + f.predicate.value.defaultValue; | ||
| 703 | }); | 730 | }); |
| 704 | - return clearRuleObj?.predicate?.operation == 'LESS_OR_EQUAL' | ||
| 705 | - ? clearRuleObj?.key?.key + '小于或等于' + clearRuleObj?.predicate?.value?.defaultValue | ||
| 706 | - : clearRuleObj?.predicate?.operation == 'EQUAL' | ||
| 707 | - ? clearRuleObj?.key?.key + '等于' + clearRuleObj?.predicate?.value?.defaultValue | ||
| 708 | - : clearRuleObj?.predicate?.operation == 'NOT_EQUAL' | ||
| 709 | - ? clearRuleObj?.key?.key + '不等于' + clearRuleObj?.predicate?.value?.defaultValue | ||
| 710 | - : clearRuleObj?.predicate?.operation == 'ENDS_WITH' | ||
| 711 | - ? clearRuleObj?.key?.key + '结束于' + clearRuleObj?.predicate?.value?.defaultValue | ||
| 712 | - : clearRuleObj?.predicate?.operation == 'CONTAINS' | ||
| 713 | - ? clearRuleObj?.key?.key + '包含' + clearRuleObj?.predicate?.value?.defaultValue | ||
| 714 | - : clearRuleObj?.predicate?.operation == 'GREATER' | ||
| 715 | - ? clearRuleObj?.key?.key + '大于' + clearRuleObj?.predicate?.value?.defaultValue | ||
| 716 | - : clearRuleObj?.predicate?.operation == 'LESS' | ||
| 717 | - ? clearRuleObj?.key?.key + '小于' + clearRuleObj?.predicate?.value?.defaultValue | ||
| 718 | - : clearRuleObj?.key?.key + '小于或等于' + clearRuleObj?.predicate?.value?.defaultValue; | 731 | + return formatMap; |
| 719 | } catch (e) { | 732 | } catch (e) { |
| 720 | return e; | 733 | return e; |
| 721 | } | 734 | } |
| @@ -737,27 +750,26 @@ | @@ -737,27 +750,26 @@ | ||
| 737 | openRuleConditObj = v2[i]; | 750 | openRuleConditObj = v2[i]; |
| 738 | } | 751 | } |
| 739 | } | 752 | } |
| 740 | - let createRuleObj = {}; | ||
| 741 | - openRuleConditObj?.condition?.condition?.forEach((f) => { | ||
| 742 | - createRuleObj = f; | 753 | + let formatMap = openRuleConditObj?.condition?.condition.map((f) => { |
| 754 | + return f.predicate.operation == 'EQUAL' | ||
| 755 | + ? f.key.key + '等于' + f.predicate.value.defaultValue | ||
| 756 | + : f.predicate.operation == 'STARTS_WITH' | ||
| 757 | + ? f.key.key + '开始于' + f.predicate.value.defaultValue | ||
| 758 | + : f.predicate.operation == 'ENDS_WITH' | ||
| 759 | + ? f.key.key + '结束于' + f.predicate.value.defaultValue | ||
| 760 | + : f.predicate.operation == 'NOT_CONTAINS' | ||
| 761 | + ? f.key.key + '不包含' + f.predicate.value.defaultValue | ||
| 762 | + : f.predicate.operation == 'NOT_EQUAL' | ||
| 763 | + ? f.key.key + '不等于' + f.predicate.value.defaultValue | ||
| 764 | + : f.predicate.operation == 'GREATER' | ||
| 765 | + ? f.key.key + '大于' + f.predicate.value.defaultValue | ||
| 766 | + : f.predicate.operation == 'LESS' | ||
| 767 | + ? f.key.key + '小于' + f.predicate.value.defaultValue | ||
| 768 | + : f.predicate.operation == 'GREATER_OR_EQUAL' | ||
| 769 | + ? f.key.key + '大于或等于' + f.predicate.value.defaultValue | ||
| 770 | + : f.key.key + '小于或等于' + f.predicate.value.defaultValue; | ||
| 743 | }); | 771 | }); |
| 744 | - return createRuleObj?.predicate?.operation == 'LESS_OR_EQUAL' | ||
| 745 | - ? createRuleObj?.key?.key + '小于或等于' + createRuleObj?.predicate?.value?.defaultValue | ||
| 746 | - : createRuleObj?.predicate?.operation == 'EQUAL' | ||
| 747 | - ? createRuleObj?.key?.key + '等于' + createRuleObj?.predicate?.value?.defaultValue | ||
| 748 | - : createRuleObj?.predicate?.operation == 'NOT_EQUAL' | ||
| 749 | - ? createRuleObj?.key?.key + '不等于' + createRuleObj?.predicate?.value?.defaultValue | ||
| 750 | - : createRuleObj?.predicate?.operation == 'ENDS_WITH' | ||
| 751 | - ? createRuleObj?.key?.key + '结束于' + createRuleObj?.predicate?.value?.defaultValue | ||
| 752 | - : createRuleObj?.predicate?.operation == 'CONTAINS' | ||
| 753 | - ? createRuleObj?.key?.key + '包含' + createRuleObj?.predicate?.value?.defaultValue | ||
| 754 | - : createRuleObj?.predicate?.operation == 'GREATER' | ||
| 755 | - ? createRuleObj?.key?.key + '大于' + createRuleObj?.predicate?.value?.defaultValue | ||
| 756 | - : createRuleObj?.predicate?.operation == 'LESS' | ||
| 757 | - ? createRuleObj?.key?.key + '小于' + createRuleObj?.predicate?.value?.defaultValue | ||
| 758 | - : createRuleObj?.key?.key + | ||
| 759 | - '小于或等于' + | ||
| 760 | - createRuleObj?.predicate?.value?.defaultValue; | 772 | + return formatMap; |
| 761 | } catch (e) { | 773 | } catch (e) { |
| 762 | return e; | 774 | return e; |
| 763 | } | 775 | } |
| @@ -778,13 +790,25 @@ | @@ -778,13 +790,25 @@ | ||
| 778 | o[v] = getStepThreeEditArr.value[v]; | 790 | o[v] = getStepThreeEditArr.value[v]; |
| 779 | getFilterStepThreeEditArr.value.push(o as never); | 791 | getFilterStepThreeEditArr.value.push(o as never); |
| 780 | }); | 792 | }); |
| 781 | - console.log(getFilterStepThreeEditArr.value); | ||
| 782 | - | ||
| 783 | - // setRegisterFormChangeDetail({ | ||
| 784 | - // alarmDetails: v.stepThreeData[0].createRules['MAJOR'].alarmDetails, | ||
| 785 | - // }); | ||
| 786 | } | 793 | } |
| 787 | }; | 794 | }; |
| 795 | + const setCreateRegisterFormChangeDetailFunc = (v) => { | ||
| 796 | + for (let i in v) { | ||
| 797 | + detailDetailModelArray.value.push(v[i].alarmDetails as never); | ||
| 798 | + createAlarmArray.value.push(i as never); | ||
| 799 | + } | ||
| 800 | + }; | ||
| 801 | + const formatAlarmFunc = (v) => { | ||
| 802 | + return v == 'CRITICAL' | ||
| 803 | + ? '危险' | ||
| 804 | + : v == 'MAJOR' | ||
| 805 | + ? '重要' | ||
| 806 | + : v == 'MINOR' | ||
| 807 | + ? '次要' | ||
| 808 | + : v == 'WARNING' | ||
| 809 | + ? '警告' | ||
| 810 | + : '不确定'; | ||
| 811 | + }; | ||
| 788 | 812 | ||
| 789 | //清除修改详情模板 | 813 | //清除修改详情模板 |
| 790 | const setRegisterFormClearChangeDetailFunc = (v) => { | 814 | const setRegisterFormClearChangeDetailFunc = (v) => { |
| @@ -812,7 +836,6 @@ | @@ -812,7 +836,6 @@ | ||
| 812 | tempRuleConditionTempArr.value.push({ | 836 | tempRuleConditionTempArr.value.push({ |
| 813 | condition: addNewRuleTem.condition.condition, | 837 | condition: addNewRuleTem.condition.condition, |
| 814 | }); | 838 | }); |
| 815 | - console.log(tempRuleConditionTempArr.value); | ||
| 816 | }; | 839 | }; |
| 817 | 840 | ||
| 818 | const getClearOpenRuleAndRuleCondition = () => { | 841 | const getClearOpenRuleAndRuleCondition = () => { |
| @@ -903,44 +926,33 @@ | @@ -903,44 +926,33 @@ | ||
| 903 | //规则条件 | 926 | //规则条件 |
| 904 | const getAllFieldsRuleFunc = (v) => { | 927 | const getAllFieldsRuleFunc = (v) => { |
| 905 | ruleObj.value = v; | 928 | ruleObj.value = v; |
| 906 | - // let splitRuleObj = {}; | ||
| 907 | - // ruleObj.value.forEach((f) => { | ||
| 908 | - // splitRuleObj = f; | ||
| 909 | - // }); | ||
| 910 | - // fliterTempRuleConditionTempArr.value.push(splitRuleObj as never); | ||
| 911 | - // fliterTempRuleConditionTempArr.value = ruleObj.value; | ||
| 912 | addNewRuleTem.condition.condition = ruleObj.value as never; | 929 | addNewRuleTem.condition.condition = ruleObj.value as never; |
| 913 | fliterTempRuleConditionTempArr.value.push({ | 930 | fliterTempRuleConditionTempArr.value.push({ |
| 914 | condition: addNewRuleTem.condition.condition, | 931 | condition: addNewRuleTem.condition.condition, |
| 915 | }); | 932 | }); |
| 916 | - console.log(fliterTempRuleConditionTempArr.value); | ||
| 917 | }; | 933 | }; |
| 918 | //格式化新增 | 934 | //格式化新增 |
| 919 | const formatAddRuleFunc = (v) => { | 935 | const formatAddRuleFunc = (v) => { |
| 920 | - console.log(v.condition); | ||
| 921 | - let kongFormatObj = {}; | ||
| 922 | - v.condition.forEach((f) => { | ||
| 923 | - kongFormatObj = | ||
| 924 | - f.predicate.operation == 'EQUAL' | ||
| 925 | - ? f.key.key + '等于' + f.predicate.value.defaultValue | ||
| 926 | - : f.predicate.operation == 'STARTS_WITH' | ||
| 927 | - ? f.key.key + '开始于' + f.predicate.value.defaultValue | ||
| 928 | - : f.predicate.operation == 'ENDS_WITH' | ||
| 929 | - ? f.key.key + '结束于' + f.predicate.value.defaultValue | ||
| 930 | - : f.predicate.operation == 'NOT_CONTAINS' | ||
| 931 | - ? f.key.key + '不包含' + f.predicate.value.defaultValue | ||
| 932 | - : f.predicate.operation == 'NOT_EQUAL' | ||
| 933 | - ? f.key.key + '不等于' + f.predicate.value.defaultValue | ||
| 934 | - : f.predicate.operation == 'GREATER' | ||
| 935 | - ? f.key.key + '大于' + f.predicate.value.defaultValue | ||
| 936 | - : f.predicate.operation == 'LESS' | ||
| 937 | - ? f.key.key + '小于' + f.predicate.value.defaultValue | ||
| 938 | - : f.predicate.operation == 'GREATER_OR_EQUAL' | ||
| 939 | - ? f.key.key + '大于或等于' + f.predicate.value.defaultValue | ||
| 940 | - : f.key.key + '小于或等于' + f.predicate.value.defaultValue; | 936 | + let formatMap = v.condition.map((f) => { |
| 937 | + return f.predicate.operation == 'EQUAL' | ||
| 938 | + ? f.key.key + '等于' + f.predicate.value.defaultValue | ||
| 939 | + : f.predicate.operation == 'STARTS_WITH' | ||
| 940 | + ? f.key.key + '开始于' + f.predicate.value.defaultValue | ||
| 941 | + : f.predicate.operation == 'ENDS_WITH' | ||
| 942 | + ? f.key.key + '结束于' + f.predicate.value.defaultValue | ||
| 943 | + : f.predicate.operation == 'NOT_CONTAINS' | ||
| 944 | + ? f.key.key + '不包含' + f.predicate.value.defaultValue | ||
| 945 | + : f.predicate.operation == 'NOT_EQUAL' | ||
| 946 | + ? f.key.key + '不等于' + f.predicate.value.defaultValue | ||
| 947 | + : f.predicate.operation == 'GREATER' | ||
| 948 | + ? f.key.key + '大于' + f.predicate.value.defaultValue | ||
| 949 | + : f.predicate.operation == 'LESS' | ||
| 950 | + ? f.key.key + '小于' + f.predicate.value.defaultValue | ||
| 951 | + : f.predicate.operation == 'GREATER_OR_EQUAL' | ||
| 952 | + ? f.key.key + '大于或等于' + f.predicate.value.defaultValue | ||
| 953 | + : f.key.key + '小于或等于' + f.predicate.value.defaultValue; | ||
| 941 | }); | 954 | }); |
| 942 | - console.log(kongFormatObj); | ||
| 943 | - return kongFormatObj; | 955 | + return formatMap; |
| 944 | }; | 956 | }; |
| 945 | //清除报警规则 | 957 | //清除报警规则 |
| 946 | //启用规则 | 958 | //启用规则 |
| @@ -951,14 +963,33 @@ | @@ -951,14 +963,33 @@ | ||
| 951 | //规则条件 | 963 | //规则条件 |
| 952 | const getAllClearFieldsRuleFunc = (v) => { | 964 | const getAllClearFieldsRuleFunc = (v) => { |
| 953 | ruleLastObj.value = v; | 965 | ruleLastObj.value = v; |
| 954 | - let splitRuleObj = {}; | ||
| 955 | - ruleLastObj.value.forEach((f) => { | ||
| 956 | - splitRuleObj = f; | 966 | + addNewRuleTem.condition.condition = ruleLastObj.value as never; |
| 967 | + fliterClearTempRuleConditionTempArr.value.push({ | ||
| 968 | + condition: addNewRuleTem.condition.condition, | ||
| 957 | }); | 969 | }); |
| 958 | - fliterClearTempRuleConditionTempArr.value.push(splitRuleObj as never); | ||
| 959 | - // if (fliterClearTempRuleConditionTempArr.value.length == 0) { | ||
| 960 | - // fliterClearTempRuleConditionTempArr.value = ruleLastObj.value; | ||
| 961 | - // } | 970 | + }; |
| 971 | + | ||
| 972 | + const formatClearRuleFunc = (v) => { | ||
| 973 | + let formatMap = v.condition.map((f) => { | ||
| 974 | + return f.predicate.operation == 'EQUAL' | ||
| 975 | + ? f.key.key + '等于' + f.predicate.value.defaultValue | ||
| 976 | + : f.predicate.operation == 'STARTS_WITH' | ||
| 977 | + ? f.key.key + '开始于' + f.predicate.value.defaultValue | ||
| 978 | + : f.predicate.operation == 'ENDS_WITH' | ||
| 979 | + ? f.key.key + '结束于' + f.predicate.value.defaultValue | ||
| 980 | + : f.predicate.operation == 'NOT_CONTAINS' | ||
| 981 | + ? f.key.key + '不包含' + f.predicate.value.defaultValue | ||
| 982 | + : f.predicate.operation == 'NOT_EQUAL' | ||
| 983 | + ? f.key.key + '不等于' + f.predicate.value.defaultValue | ||
| 984 | + : f.predicate.operation == 'GREATER' | ||
| 985 | + ? f.key.key + '大于' + f.predicate.value.defaultValue | ||
| 986 | + : f.predicate.operation == 'LESS' | ||
| 987 | + ? f.key.key + '小于' + f.predicate.value.defaultValue | ||
| 988 | + : f.predicate.operation == 'GREATER_OR_EQUAL' | ||
| 989 | + ? f.key.key + '大于或等于' + f.predicate.value.defaultValue | ||
| 990 | + : f.key.key + '小于或等于' + f.predicate.value.defaultValue; | ||
| 991 | + }); | ||
| 992 | + return formatMap; | ||
| 962 | }; | 993 | }; |
| 963 | 994 | ||
| 964 | //生成uuid | 995 | //生成uuid |
| @@ -1073,6 +1104,11 @@ | @@ -1073,6 +1104,11 @@ | ||
| 1073 | }; | 1104 | }; |
| 1074 | 1105 | ||
| 1075 | return { | 1106 | return { |
| 1107 | + isAddRuleStatusFunc, | ||
| 1108 | + isAddRuleStatus, | ||
| 1109 | + formatAlarmFunc, | ||
| 1110 | + createAlarmArray, | ||
| 1111 | + formatClearRuleFunc, | ||
| 1076 | formatAddRuleFunc, | 1112 | formatAddRuleFunc, |
| 1077 | getFilterStepThreeClearDetailEditArr, | 1113 | getFilterStepThreeClearDetailEditArr, |
| 1078 | getIsShowAddRule, | 1114 | getIsShowAddRule, |
| @@ -1144,6 +1180,8 @@ | @@ -1144,6 +1180,8 @@ | ||
| 1144 | registerFormCreateAlarm, | 1180 | registerFormCreateAlarm, |
| 1145 | addCreateRole, | 1181 | addCreateRole, |
| 1146 | deleteCondition, | 1182 | deleteCondition, |
| 1183 | + setCreateRegisterFormChangeDetailFunc, | ||
| 1184 | + detailDetailModelArray, | ||
| 1147 | }; | 1185 | }; |
| 1148 | }, | 1186 | }, |
| 1149 | }); | 1187 | }); |
| @@ -12,12 +12,12 @@ | @@ -12,12 +12,12 @@ | ||
| 12 | </CollapseContainer> | 12 | </CollapseContainer> |
| 13 | </template> | 13 | </template> |
| 14 | <script lang="ts"> | 14 | <script lang="ts"> |
| 15 | - import { defineComponent, ref, watch } from 'vue'; | 15 | + import { defineComponent, ref } from 'vue'; |
| 16 | import { CollapseContainer } from '/@/components/Container/index'; | 16 | import { CollapseContainer } from '/@/components/Container/index'; |
| 17 | import { BasicForm, useForm } from '/@/components/Form/index'; | 17 | import { BasicForm, useForm } from '/@/components/Form/index'; |
| 18 | import { Input } from 'ant-design-vue'; | 18 | import { Input } from 'ant-design-vue'; |
| 19 | import { useConditionDrawerSchema } from '../config'; | 19 | import { useConditionDrawerSchema } from '../config'; |
| 20 | - import { screenLinkPageByDeptIdGetDevice } from '/@/api/ruleengine/ruleengineApi'; | 20 | + // import { screenLinkPageByDeptIdGetDevice } from '/@/api/ruleengine/ruleengineApi'; |
| 21 | 21 | ||
| 22 | export default defineComponent({ | 22 | export default defineComponent({ |
| 23 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, | 23 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, |
| @@ -38,21 +38,31 @@ | @@ -38,21 +38,31 @@ | ||
| 38 | const resetFieldsValueFunc = () => { | 38 | const resetFieldsValueFunc = () => { |
| 39 | resetFields(); | 39 | resetFields(); |
| 40 | }; | 40 | }; |
| 41 | - watch( | ||
| 42 | - () => props.deviceInfo1, | ||
| 43 | - async (newV) => { | ||
| 44 | - const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); | ||
| 45 | - options.items.forEach((v) => { | ||
| 46 | - return (v.value = v.id), (v.label = v.name); | ||
| 47 | - }); | 41 | + // watch( |
| 42 | + // () => props.deviceInfo1, | ||
| 43 | + // async (newV) => { | ||
| 44 | + // const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); | ||
| 45 | + // options.items.forEach((v) => { | ||
| 46 | + // return (v.value = v.id), (v.label = v.name); | ||
| 47 | + // }); | ||
| 48 | + // updateSchema({ | ||
| 49 | + // field: 'entityId', | ||
| 50 | + // componentProps: { | ||
| 51 | + // options: options.items, | ||
| 52 | + // }, | ||
| 53 | + // }); | ||
| 54 | + // } | ||
| 55 | + // ); | ||
| 56 | + const updateFieldDeviceId = (v) => { | ||
| 57 | + setTimeout(() => { | ||
| 48 | updateSchema({ | 58 | updateSchema({ |
| 49 | - field: 'deviceId', | 59 | + field: 'entityId', |
| 50 | componentProps: { | 60 | componentProps: { |
| 51 | - options: options.items, | 61 | + options: v, |
| 52 | }, | 62 | }, |
| 53 | }); | 63 | }); |
| 54 | - } | ||
| 55 | - ); | 64 | + }, 10); |
| 65 | + }; | ||
| 56 | 66 | ||
| 57 | //回显数据 | 67 | //回显数据 |
| 58 | const setFieldsFormValueFun = () => { | 68 | const setFieldsFormValueFun = () => { |
| @@ -67,7 +77,7 @@ | @@ -67,7 +77,7 @@ | ||
| 67 | if (props.newConditionMapFather !== 1) { | 77 | if (props.newConditionMapFather !== 1) { |
| 68 | setTimeout(() => { | 78 | setTimeout(() => { |
| 69 | updateSchema({ | 79 | updateSchema({ |
| 70 | - field: 'deviceId', | 80 | + field: 'entityId', |
| 71 | componentProps: { | 81 | componentProps: { |
| 72 | options: props.newConditionMapFather, | 82 | options: props.newConditionMapFather, |
| 73 | }, | 83 | }, |
| @@ -79,7 +89,7 @@ | @@ -79,7 +89,7 @@ | ||
| 79 | //新增清空设备选择 | 89 | //新增清空设备选择 |
| 80 | const clearSelectDevice = () => { | 90 | const clearSelectDevice = () => { |
| 81 | updateSchema({ | 91 | updateSchema({ |
| 82 | - field: 'deviceId', | 92 | + field: 'entityId', |
| 83 | componentProps: { | 93 | componentProps: { |
| 84 | options: [], | 94 | options: [], |
| 85 | }, | 95 | }, |
| @@ -87,13 +97,14 @@ | @@ -87,13 +97,14 @@ | ||
| 87 | }; | 97 | }; |
| 88 | // const editSelectDevice = (v) => { | 98 | // const editSelectDevice = (v) => { |
| 89 | // updateSchema({ | 99 | // updateSchema({ |
| 90 | - // field: 'deviceId', | 100 | + // field: 'entityId', |
| 91 | // componentProps: { | 101 | // componentProps: { |
| 92 | // options: v, | 102 | // options: v, |
| 93 | // }, | 103 | // }, |
| 94 | // }); | 104 | // }); |
| 95 | // }; | 105 | // }; |
| 96 | return { | 106 | return { |
| 107 | + updateFieldDeviceId, | ||
| 97 | resetFieldsValueFunc, | 108 | resetFieldsValueFunc, |
| 98 | clearSelectDevice, | 109 | clearSelectDevice, |
| 99 | editSelectDevice, | 110 | editSelectDevice, |
| @@ -12,12 +12,12 @@ | @@ -12,12 +12,12 @@ | ||
| 12 | </CollapseContainer> | 12 | </CollapseContainer> |
| 13 | </template> | 13 | </template> |
| 14 | <script lang="ts"> | 14 | <script lang="ts"> |
| 15 | - import { defineComponent, ref, watch } from 'vue'; | 15 | + import { defineComponent, ref } from 'vue'; |
| 16 | import { CollapseContainer } from '/@/components/Container/index'; | 16 | import { CollapseContainer } from '/@/components/Container/index'; |
| 17 | import { BasicForm, useForm } from '/@/components/Form/index'; | 17 | import { BasicForm, useForm } from '/@/components/Form/index'; |
| 18 | import { Input } from 'ant-design-vue'; | 18 | import { Input } from 'ant-design-vue'; |
| 19 | import { useActionDrawerSchema } from '../config'; | 19 | import { useActionDrawerSchema } from '../config'; |
| 20 | - import { screenLinkPageByDeptIdGetDevice } from '/@/api/ruleengine/ruleengineApi'; | 20 | + // import { screenLinkPageByDeptIdGetDevice } from '/@/api/ruleengine/ruleengineApi'; |
| 21 | 21 | ||
| 22 | export default defineComponent({ | 22 | export default defineComponent({ |
| 23 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, | 23 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, |
| @@ -34,25 +34,38 @@ | @@ -34,25 +34,38 @@ | ||
| 34 | const getFieldsValueFunc = () => { | 34 | const getFieldsValueFunc = () => { |
| 35 | fieldValue.value = getFieldsValue(); | 35 | fieldValue.value = getFieldsValue(); |
| 36 | return fieldValue.value; | 36 | return fieldValue.value; |
| 37 | + // return new Promise((resolve) => { | ||
| 38 | + // resolve(fieldValue.value); | ||
| 39 | + // }); | ||
| 37 | }; | 40 | }; |
| 38 | const resetFieldsValueFunc = () => { | 41 | const resetFieldsValueFunc = () => { |
| 39 | resetFields(); | 42 | resetFields(); |
| 40 | }; | 43 | }; |
| 41 | - watch( | ||
| 42 | - () => props.deviceInfo2, | ||
| 43 | - async (newV) => { | ||
| 44 | - const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); | ||
| 45 | - options.items.forEach((v) => { | ||
| 46 | - return (v.value = v.id), (v.label = v.name); | ||
| 47 | - }); | 44 | + // watch( |
| 45 | + // () => props.deviceInfo2, | ||
| 46 | + // async (newV) => { | ||
| 47 | + // const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); | ||
| 48 | + // options.items.forEach((v) => { | ||
| 49 | + // return (v.value = v.id), (v.label = v.name); | ||
| 50 | + // }); | ||
| 51 | + // updateSchema({ | ||
| 52 | + // field: 'entityId', | ||
| 53 | + // componentProps: { | ||
| 54 | + // options: options.items, | ||
| 55 | + // }, | ||
| 56 | + // }); | ||
| 57 | + // } | ||
| 58 | + // ); | ||
| 59 | + const updateFieldDeviceId = (v) => { | ||
| 60 | + setTimeout(() => { | ||
| 48 | updateSchema({ | 61 | updateSchema({ |
| 49 | - field: 'deviceId', | 62 | + field: 'entityId', |
| 50 | componentProps: { | 63 | componentProps: { |
| 51 | - options: options.items, | 64 | + options: v, |
| 52 | }, | 65 | }, |
| 53 | }); | 66 | }); |
| 54 | - } | ||
| 55 | - ); | 67 | + }, 10); |
| 68 | + }; | ||
| 56 | 69 | ||
| 57 | //回显数据 | 70 | //回显数据 |
| 58 | const setFieldsFormValueFun = () => { | 71 | const setFieldsFormValueFun = () => { |
| @@ -67,7 +80,7 @@ | @@ -67,7 +80,7 @@ | ||
| 67 | if (props.newActionMapFather !== 1) { | 80 | if (props.newActionMapFather !== 1) { |
| 68 | setTimeout(() => { | 81 | setTimeout(() => { |
| 69 | updateSchema({ | 82 | updateSchema({ |
| 70 | - field: 'deviceId', | 83 | + field: 'entityId', |
| 71 | componentProps: { | 84 | componentProps: { |
| 72 | options: props.newActionMapFather, | 85 | options: props.newActionMapFather, |
| 73 | }, | 86 | }, |
| @@ -79,7 +92,7 @@ | @@ -79,7 +92,7 @@ | ||
| 79 | //新增清空设备选择 | 92 | //新增清空设备选择 |
| 80 | const clearSelectDevice = () => { | 93 | const clearSelectDevice = () => { |
| 81 | updateSchema({ | 94 | updateSchema({ |
| 82 | - field: 'deviceId', | 95 | + field: 'entityId', |
| 83 | componentProps: { | 96 | componentProps: { |
| 84 | options: [], | 97 | options: [], |
| 85 | }, | 98 | }, |
| @@ -87,13 +100,14 @@ | @@ -87,13 +100,14 @@ | ||
| 87 | }; | 100 | }; |
| 88 | // const editSelectDevice = (v) => { | 101 | // const editSelectDevice = (v) => { |
| 89 | // updateSchema({ | 102 | // updateSchema({ |
| 90 | - // field: 'deviceId', | 103 | + // field: 'entityId', |
| 91 | // componentProps: { | 104 | // componentProps: { |
| 92 | // options: v, | 105 | // options: v, |
| 93 | // }, | 106 | // }, |
| 94 | // }); | 107 | // }); |
| 95 | // }; | 108 | // }; |
| 96 | return { | 109 | return { |
| 110 | + updateFieldDeviceId, | ||
| 97 | clearSelectDevice, | 111 | clearSelectDevice, |
| 98 | editSelectDevice, | 112 | editSelectDevice, |
| 99 | resetFieldsValueFunc, | 113 | resetFieldsValueFunc, |
| @@ -14,12 +14,12 @@ | @@ -14,12 +14,12 @@ | ||
| 14 | </div> | 14 | </div> |
| 15 | </template> | 15 | </template> |
| 16 | <script lang="ts"> | 16 | <script lang="ts"> |
| 17 | - import { defineComponent, ref, watch } from 'vue'; | 17 | + import { defineComponent, ref } from 'vue'; |
| 18 | import { CollapseContainer } from '/@/components/Container/index'; | 18 | import { CollapseContainer } from '/@/components/Container/index'; |
| 19 | import { BasicForm, useForm } from '/@/components/Form/index'; | 19 | import { BasicForm, useForm } from '/@/components/Form/index'; |
| 20 | import { Input } from 'ant-design-vue'; | 20 | import { Input } from 'ant-design-vue'; |
| 21 | import { useTriggerDrawerSchema } from '../config'; | 21 | import { useTriggerDrawerSchema } from '../config'; |
| 22 | - import { screenLinkPageByDeptIdGetDevice } from '/@/api/ruleengine/ruleengineApi'; | 22 | + // import { screenLinkPageByDeptIdGetDevice } from '/@/api/ruleengine/ruleengineApi'; |
| 23 | 23 | ||
| 24 | export default defineComponent({ | 24 | export default defineComponent({ |
| 25 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, | 25 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, |
| @@ -36,20 +36,20 @@ | @@ -36,20 +36,20 @@ | ||
| 36 | fieldValue.value = getFieldsValue(); | 36 | fieldValue.value = getFieldsValue(); |
| 37 | return fieldValue.value; | 37 | return fieldValue.value; |
| 38 | }; | 38 | }; |
| 39 | - watch( | ||
| 40 | - () => props.deviceInfo, | ||
| 41 | - async (newV) => { | ||
| 42 | - const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); | ||
| 43 | - options.items.forEach((v) => { | ||
| 44 | - return (v.value = v.id), (v.label = v.name); | ||
| 45 | - }); | ||
| 46 | - updateFieldDeviceId(options.items); | ||
| 47 | - } | ||
| 48 | - ); | 39 | + // watch( |
| 40 | + // () => props.deviceInfo | ||
| 41 | + // // async (newV) => { | ||
| 42 | + // // const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); | ||
| 43 | + // // options.items.forEach((v) => { | ||
| 44 | + // // return (v.value = v.id), (v.label = v.name); | ||
| 45 | + // // }); | ||
| 46 | + // // updateFieldDeviceId(options.items); | ||
| 47 | + // // } | ||
| 48 | + // ); | ||
| 49 | const updateFieldDeviceId = (v) => { | 49 | const updateFieldDeviceId = (v) => { |
| 50 | setTimeout(() => { | 50 | setTimeout(() => { |
| 51 | updateSchema({ | 51 | updateSchema({ |
| 52 | - field: 'deviceId', | 52 | + field: 'entityId', |
| 53 | componentProps: { | 53 | componentProps: { |
| 54 | options: v, | 54 | options: v, |
| 55 | }, | 55 | }, |
| @@ -57,9 +57,7 @@ | @@ -57,9 +57,7 @@ | ||
| 57 | }, 10); | 57 | }, 10); |
| 58 | }; | 58 | }; |
| 59 | const resetFieldsValueFunc = () => { | 59 | const resetFieldsValueFunc = () => { |
| 60 | - setTimeout(() => { | ||
| 61 | - resetFields(); | ||
| 62 | - }, 100); | 60 | + resetFields(); |
| 63 | }; | 61 | }; |
| 64 | 62 | ||
| 65 | //回显数据 | 63 | //回显数据 |
| @@ -75,7 +73,7 @@ | @@ -75,7 +73,7 @@ | ||
| 75 | //新增清空设备选择 | 73 | //新增清空设备选择 |
| 76 | const clearSelectDevice = () => { | 74 | const clearSelectDevice = () => { |
| 77 | updateSchema({ | 75 | updateSchema({ |
| 78 | - field: 'deviceId', | 76 | + field: 'entityId', |
| 79 | componentProps: { | 77 | componentProps: { |
| 80 | options: [], | 78 | options: [], |
| 81 | }, | 79 | }, |
| @@ -85,7 +83,7 @@ | @@ -85,7 +83,7 @@ | ||
| 85 | if (props.newFilterMapFather != 1) { | 83 | if (props.newFilterMapFather != 1) { |
| 86 | setTimeout(() => { | 84 | setTimeout(() => { |
| 87 | updateSchema({ | 85 | updateSchema({ |
| 88 | - field: 'deviceId', | 86 | + field: 'entityId', |
| 89 | componentProps: { | 87 | componentProps: { |
| 90 | options: props.newFilterMapFather, | 88 | options: props.newFilterMapFather, |
| 91 | }, | 89 | }, |
| @@ -167,10 +167,10 @@ export const formSchema: FormSchema[] = [ | @@ -167,10 +167,10 @@ export const formSchema: FormSchema[] = [ | ||
| 167 | }, | 167 | }, |
| 168 | onChange: async (v) => { | 168 | onChange: async (v) => { |
| 169 | if (v == undefined) { | 169 | if (v == undefined) { |
| 170 | - formModel.deviceId = undefined; | 170 | + formModel.entityId = undefined; |
| 171 | const { updateSchema } = formActionType; | 171 | const { updateSchema } = formActionType; |
| 172 | updateSchema({ | 172 | updateSchema({ |
| 173 | - field: 'deviceId', | 173 | + field: 'entityId', |
| 174 | componentProps: { | 174 | componentProps: { |
| 175 | options: undefined, | 175 | options: undefined, |
| 176 | }, | 176 | }, |
| @@ -250,7 +250,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -250,7 +250,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
| 250 | colProps: { span: 12 }, | 250 | colProps: { span: 12 }, |
| 251 | }, | 251 | }, |
| 252 | { | 252 | { |
| 253 | - field: 'deviceId', | 253 | + field: 'entityId', |
| 254 | label: '', | 254 | label: '', |
| 255 | component: 'Select', | 255 | component: 'Select', |
| 256 | componentProps: { | 256 | componentProps: { |
| @@ -420,7 +420,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | @@ -420,7 +420,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | ||
| 420 | colProps: { span: 12 }, | 420 | colProps: { span: 12 }, |
| 421 | }, | 421 | }, |
| 422 | { | 422 | { |
| 423 | - field: 'deviceId', | 423 | + field: 'entityId', |
| 424 | label: '', | 424 | label: '', |
| 425 | component: 'Select', | 425 | component: 'Select', |
| 426 | componentProps: { | 426 | componentProps: { |
| @@ -542,6 +542,7 @@ export const useActionDrawerSchema: FormSchema[] = [ | @@ -542,6 +542,7 @@ export const useActionDrawerSchema: FormSchema[] = [ | ||
| 542 | field: 'outTarget', | 542 | field: 'outTarget', |
| 543 | label: '', | 543 | label: '', |
| 544 | component: 'Select', | 544 | component: 'Select', |
| 545 | + required: true, | ||
| 545 | componentProps: { | 546 | componentProps: { |
| 546 | placeholder: '请选择设备输出', | 547 | placeholder: '请选择设备输出', |
| 547 | options: [ | 548 | options: [ |
| @@ -553,7 +554,7 @@ export const useActionDrawerSchema: FormSchema[] = [ | @@ -553,7 +554,7 @@ export const useActionDrawerSchema: FormSchema[] = [ | ||
| 553 | colProps: { span: 12 }, | 554 | colProps: { span: 12 }, |
| 554 | }, | 555 | }, |
| 555 | { | 556 | { |
| 556 | - field: 'deviceId', | 557 | + field: 'entityId', |
| 557 | label: '', | 558 | label: '', |
| 558 | component: 'Select', | 559 | component: 'Select', |
| 559 | componentProps: { | 560 | componentProps: { |
| @@ -91,8 +91,8 @@ | @@ -91,8 +91,8 @@ | ||
| 91 | }); | 91 | }); |
| 92 | try { | 92 | try { |
| 93 | setTimeout(() => { | 93 | setTimeout(() => { |
| 94 | - proxy.$refs.sceneLinkAgeDrawerRef.defaultAddTrigger(); | ||
| 95 | - proxy.$refs.sceneLinkAgeDrawerRef.defaultAddCondition(); | 94 | + // proxy.$refs.sceneLinkAgeDrawerRef.defaultAddTrigger(); |
| 95 | + // proxy.$refs.sceneLinkAgeDrawerRef.defaultAddCondition(); | ||
| 96 | proxy.$refs.sceneLinkAgeDrawerRef.defaultAddAction(); | 96 | proxy.$refs.sceneLinkAgeDrawerRef.defaultAddAction(); |
| 97 | }, 50); | 97 | }, 50); |
| 98 | } catch (e) { | 98 | } catch (e) { |
| @@ -183,21 +183,18 @@ | @@ -183,21 +183,18 @@ | ||
| 183 | emits: ['success', 'register', 'registerForm'], | 183 | emits: ['success', 'register', 'registerForm'], |
| 184 | setup(_, { emit }) { | 184 | setup(_, { emit }) { |
| 185 | const { proxy } = getCurrentInstance(); | 185 | const { proxy } = getCurrentInstance(); |
| 186 | - const lastRefTriggerChildDataArray = ref<[]>([]); | ||
| 187 | const lastEditRefTriggerChildDataArray = ref<[]>([]); | 186 | const lastEditRefTriggerChildDataArray = ref<[]>([]); |
| 188 | const lastEditRefConditionChildDataArray = ref<[]>([]); | 187 | const lastEditRefConditionChildDataArray = ref<[]>([]); |
| 189 | const lastEditRefActionChildDataArray = ref<[]>([]); | 188 | const lastEditRefActionChildDataArray = ref<[]>([]); |
| 189 | + const lastRefTriggerChildDataArray = ref<[]>([]); | ||
| 190 | const lastRefConditionChildDataArray = ref<[]>([]); | 190 | const lastRefConditionChildDataArray = ref<[]>([]); |
| 191 | const lastRefActionChildDataArray = ref<[]>([]); | 191 | const lastRefActionChildDataArray = ref<[]>([]); |
| 192 | - const lastRefTriggerChildData: any = ref({}); | ||
| 193 | - const lastRefConditionChildData: any = ref({}); | ||
| 194 | - const lastRefActionChildData: any = ref({}); | ||
| 195 | - const refTriggerChildData: any = ref({}); | ||
| 196 | - const refConditionChildData: any = ref({}); | ||
| 197 | - const refActionChildData: any = ref({}); | 192 | + let refTriggerChildData: any = reactive({}); |
| 193 | + let refConditionChildData: any = reactive({}); | ||
| 194 | + let refActionChildData: any = reactive({}); | ||
| 198 | const addTriggerData = reactive<IAddTrigger>({ | 195 | const addTriggerData = reactive<IAddTrigger>({ |
| 199 | triggerType: '', | 196 | triggerType: '', |
| 200 | - deviceId: '', | 197 | + entityId: '', |
| 201 | touchWay: '', | 198 | touchWay: '', |
| 202 | attributeChoose: '', | 199 | attributeChoose: '', |
| 203 | compare: '', | 200 | compare: '', |
| @@ -205,7 +202,7 @@ | @@ -205,7 +202,7 @@ | ||
| 205 | }); | 202 | }); |
| 206 | const editTriggerData = reactive<IAddTrigger>({ | 203 | const editTriggerData = reactive<IAddTrigger>({ |
| 207 | triggerType: '', | 204 | triggerType: '', |
| 208 | - deviceId: '请选择设备', | 205 | + entityId: '请选择设备', |
| 209 | touchWay: '请选择触发方式', | 206 | touchWay: '请选择触发方式', |
| 210 | attributeChoose: '请选择属性', | 207 | attributeChoose: '请选择属性', |
| 211 | compare: '', | 208 | compare: '', |
| @@ -213,14 +210,14 @@ | @@ -213,14 +210,14 @@ | ||
| 213 | }); | 210 | }); |
| 214 | const addConditionData = reactive<IAddCondition>({ | 211 | const addConditionData = reactive<IAddCondition>({ |
| 215 | triggerType: '', | 212 | triggerType: '', |
| 216 | - deviceId: '', | 213 | + entityId: '', |
| 217 | createTime: '', | 214 | createTime: '', |
| 218 | updateTime: '', | 215 | updateTime: '', |
| 219 | compare: '', | 216 | compare: '', |
| 220 | value: '', | 217 | value: '', |
| 221 | }); | 218 | }); |
| 222 | const editConditionData = reactive<IAddCondition>({ | 219 | const editConditionData = reactive<IAddCondition>({ |
| 223 | - deviceId: '请选择设备', | 220 | + entityId: '请选择设备', |
| 224 | createTime: '', | 221 | createTime: '', |
| 225 | updateTime: '', | 222 | updateTime: '', |
| 226 | triggerType: '', | 223 | triggerType: '', |
| @@ -229,13 +226,13 @@ | @@ -229,13 +226,13 @@ | ||
| 229 | }); | 226 | }); |
| 230 | const addActionData = reactive<IAddAction>({ | 227 | const addActionData = reactive<IAddAction>({ |
| 231 | outTarget: '', | 228 | outTarget: '', |
| 232 | - deviceId: '', | 229 | + entityId: '', |
| 233 | command: '', | 230 | command: '', |
| 234 | sceneLinkageId: '', | 231 | sceneLinkageId: '', |
| 235 | }); | 232 | }); |
| 236 | const editActionData = reactive<IAddAction>({ | 233 | const editActionData = reactive<IAddAction>({ |
| 237 | outTarget: '', | 234 | outTarget: '', |
| 238 | - deviceId: '请选择设备', | 235 | + entityId: '请选择设备', |
| 239 | command: '请输入执行命令', | 236 | command: '请输入执行命令', |
| 240 | sceneLinkageId: '', | 237 | sceneLinkageId: '', |
| 241 | }); | 238 | }); |
| @@ -282,6 +279,7 @@ | @@ -282,6 +279,7 @@ | ||
| 282 | let actionsObj = { | 279 | let actionsObj = { |
| 283 | doActions: [], | 280 | doActions: [], |
| 284 | }; | 281 | }; |
| 282 | + let optionsItemArray = ref<[]>([]); | ||
| 285 | 283 | ||
| 286 | const [registerForm, { resetFields, setFieldsValue, validateFields }] = useForm({ | 284 | const [registerForm, { resetFields, setFieldsValue, validateFields }] = useForm({ |
| 287 | labelWidth: 120, | 285 | labelWidth: 120, |
| @@ -295,9 +293,19 @@ | @@ -295,9 +293,19 @@ | ||
| 295 | isUpdate.value = !!data?.isUpdate; | 293 | isUpdate.value = !!data?.isUpdate; |
| 296 | if (!unref(isUpdate)) { | 294 | if (!unref(isUpdate)) { |
| 297 | try { | 295 | try { |
| 296 | + refTriggerChildData = {}; | ||
| 297 | + refConditionChildData = {}; | ||
| 298 | + refActionChildData = {}; | ||
| 299 | + getAllFormData = {}; | ||
| 298 | triggersObj = { | 300 | triggersObj = { |
| 299 | triggers: [], | 301 | triggers: [], |
| 300 | }; | 302 | }; |
| 303 | + conditionsObj = { | ||
| 304 | + doConditions: [], | ||
| 305 | + }; | ||
| 306 | + actionsObj = { | ||
| 307 | + doActions: [], | ||
| 308 | + }; | ||
| 301 | filterNewTriggerArr.length = 0; | 309 | filterNewTriggerArr.length = 0; |
| 302 | filterNewConditionArr.length = 0; | 310 | filterNewConditionArr.length = 0; |
| 303 | lastRefTriggerChildDataArray.value.length = 0; | 311 | lastRefTriggerChildDataArray.value.length = 0; |
| @@ -310,9 +318,21 @@ | @@ -310,9 +318,21 @@ | ||
| 310 | addConditionPushData.value.length = 0; | 318 | addConditionPushData.value.length = 0; |
| 311 | addActionPushData.value.length = 0; | 319 | addActionPushData.value.length = 0; |
| 312 | handleClose(); | 320 | handleClose(); |
| 313 | - proxy.$refs.refTriggerChild.resetFieldsValueFunc(); | ||
| 314 | - proxy.$refs.refConditionChild.resetFieldsValueFunc(); | ||
| 315 | - proxy.$refs.refActionChild.resetFieldsValueFunc(); | 321 | + optionsItemArray.value.length = 0; |
| 322 | + try { | ||
| 323 | + setTimeout(() => { | ||
| 324 | + proxy.$refs.refTriggerChild.resetFieldsValueFunc(); | ||
| 325 | + proxy.$refs.refTriggerChild.clearSelectDevice(); | ||
| 326 | + proxy.$refs.refConditionChild.resetFieldsValueFunc(); | ||
| 327 | + proxy.$refs.refConditionChild.clearSelectDevice(); | ||
| 328 | + proxy.$refs.refActionChild.resetFieldsValueFunc(); | ||
| 329 | + proxy.$refs.refActionChild.clearSelectDevice(); | ||
| 330 | + clearActionsAllDevice(); | ||
| 331 | + resetActionsAllArrayFunc(); | ||
| 332 | + }, 200); | ||
| 333 | + } catch (e) { | ||
| 334 | + return e; | ||
| 335 | + } | ||
| 316 | } catch (e) { | 336 | } catch (e) { |
| 317 | return e; | 337 | return e; |
| 318 | } | 338 | } |
| @@ -342,7 +362,7 @@ | @@ -342,7 +362,7 @@ | ||
| 342 | try { | 362 | try { |
| 343 | data.record.triggers.forEach((f1) => { | 363 | data.record.triggers.forEach((f1) => { |
| 344 | options.items?.forEach((f2) => { | 364 | options.items?.forEach((f2) => { |
| 345 | - if (f2.id == f1.deviceId) { | 365 | + if (f2.id == f1.entityId) { |
| 346 | newFilterMap.value.push({ | 366 | newFilterMap.value.push({ |
| 347 | value: f2.id, | 367 | value: f2.id, |
| 348 | label: f2.name, | 368 | label: f2.name, |
| @@ -353,7 +373,7 @@ | @@ -353,7 +373,7 @@ | ||
| 353 | 373 | ||
| 354 | data.record.doConditions.forEach((f1) => { | 374 | data.record.doConditions.forEach((f1) => { |
| 355 | options.items?.forEach((f2) => { | 375 | options.items?.forEach((f2) => { |
| 356 | - if (f2.id == f1.deviceId) { | 376 | + if (f2.id == f1.entityId) { |
| 357 | newConditionFilterMap.value.push({ | 377 | newConditionFilterMap.value.push({ |
| 358 | value: f2.id, | 378 | value: f2.id, |
| 359 | label: f2.name, | 379 | label: f2.name, |
| @@ -363,7 +383,7 @@ | @@ -363,7 +383,7 @@ | ||
| 363 | }); | 383 | }); |
| 364 | data.record.doActions.forEach((f1) => { | 384 | data.record.doActions.forEach((f1) => { |
| 365 | options.items?.forEach((f2) => { | 385 | options.items?.forEach((f2) => { |
| 366 | - if (f2.id == f1.deviceId) { | 386 | + if (f2.id == f1.entityId) { |
| 367 | newActionFilterMap.value.push({ | 387 | newActionFilterMap.value.push({ |
| 368 | value: f2.id, | 388 | value: f2.id, |
| 369 | label: f2.name, | 389 | label: f2.name, |
| @@ -381,6 +401,7 @@ | @@ -381,6 +401,7 @@ | ||
| 381 | lastRefTriggerChildDataArray.value = []; | 401 | lastRefTriggerChildDataArray.value = []; |
| 382 | lastRefConditionChildDataArray.value.length = 0; | 402 | lastRefConditionChildDataArray.value.length = 0; |
| 383 | lastRefActionChildDataArray.value.length = 0; | 403 | lastRefActionChildDataArray.value.length = 0; |
| 404 | + lastRefActionChildDataArray.value = []; | ||
| 384 | filterArrayTrigger.length = 0; | 405 | filterArrayTrigger.length = 0; |
| 385 | filterArrayCondition.value.length = 0; | 406 | filterArrayCondition.value.length = 0; |
| 386 | filterArrayAction.value.length = 0; | 407 | filterArrayAction.value.length = 0; |
| @@ -409,16 +430,37 @@ | @@ -409,16 +430,37 @@ | ||
| 409 | return e; | 430 | return e; |
| 410 | } | 431 | } |
| 411 | }; | 432 | }; |
| 412 | - watch(getData, (newV) => { | ||
| 413 | - getDeviceInfo.value = newV; | ||
| 414 | - getDeviceInfo1.value = newV; | ||
| 415 | - getDeviceInfo2.value = newV; | 433 | + watch(getData, async (newV) => { |
| 434 | + // getDeviceInfo.value = newV; | ||
| 435 | + // getDeviceInfo1.value = newV; | ||
| 436 | + // getDeviceInfo2.value = newV; | ||
| 437 | + const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); | ||
| 438 | + options.items.forEach((v) => { | ||
| 439 | + return (v.value = v.id), (v.label = v.name); | ||
| 440 | + }); | ||
| 441 | + optionsItemArray.value = options.items; | ||
| 442 | + updateDeviceIdFunc(optionsItemArray.value); | ||
| 443 | + try { | ||
| 444 | + proxy.$refs.refActionChild.updateFieldDeviceId(optionsItemArray.value); | ||
| 445 | + } catch (e) { | ||
| 446 | + return e; | ||
| 447 | + } | ||
| 416 | }); | 448 | }); |
| 417 | 449 | ||
| 450 | + const updateDeviceIdFunc = (v) => { | ||
| 451 | + try { | ||
| 452 | + proxy.$refs.refTriggerChild.updateFieldDeviceId(v); | ||
| 453 | + proxy.$refs.refConditionChild.updateFieldDeviceId(v); | ||
| 454 | + proxy.$refs.refActionChild.updateFieldDeviceId(v); | ||
| 455 | + } catch (e) { | ||
| 456 | + return e; | ||
| 457 | + } | ||
| 458 | + }; | ||
| 459 | + | ||
| 418 | //触发器方法 | 460 | //触发器方法 |
| 419 | const refTriggerChildDataFunc = () => { | 461 | const refTriggerChildDataFunc = () => { |
| 420 | try { | 462 | try { |
| 421 | - refTriggerChildData.value = proxy.$refs.refTriggerChild.getFieldsValueFunc(); | 463 | + refTriggerChildData = proxy.$refs.refTriggerChild.getFieldsValueFunc(); |
| 422 | } catch (e) { | 464 | } catch (e) { |
| 423 | return e; | 465 | return e; |
| 424 | } | 466 | } |
| @@ -426,7 +468,7 @@ | @@ -426,7 +468,7 @@ | ||
| 426 | //执行条件方法 | 468 | //执行条件方法 |
| 427 | const refConditionChildDataFunc = () => { | 469 | const refConditionChildDataFunc = () => { |
| 428 | try { | 470 | try { |
| 429 | - refConditionChildData.value = proxy.$refs.refConditionChild.getFieldsValueFunc(); | 471 | + refConditionChildData = proxy.$refs.refConditionChild.getFieldsValueFunc(); |
| 430 | } catch (e) { | 472 | } catch (e) { |
| 431 | return e; | 473 | return e; |
| 432 | } | 474 | } |
| @@ -434,7 +476,7 @@ | @@ -434,7 +476,7 @@ | ||
| 434 | //执行动作方法 | 476 | //执行动作方法 |
| 435 | const refActionChildDataFunc = () => { | 477 | const refActionChildDataFunc = () => { |
| 436 | try { | 478 | try { |
| 437 | - refActionChildData.value = proxy.$refs.refActionChild.getFieldsValueFunc(); | 479 | + refActionChildData = proxy.$refs.refActionChild.getFieldsValueFunc(); |
| 438 | } catch (e) { | 480 | } catch (e) { |
| 439 | return e; | 481 | return e; |
| 440 | } | 482 | } |
| @@ -447,9 +489,9 @@ | @@ -447,9 +489,9 @@ | ||
| 447 | refTriggerChildDataFunc(); | 489 | refTriggerChildDataFunc(); |
| 448 | refConditionChildDataFunc(); | 490 | refConditionChildDataFunc(); |
| 449 | refActionChildDataFunc(); | 491 | refActionChildDataFunc(); |
| 450 | - lastRefTriggerChildDataArray.value.push(refTriggerChildData.value as never); | ||
| 451 | - lastRefConditionChildDataArray.value.push(refConditionChildData.value as never); | ||
| 452 | - lastRefActionChildDataArray.value.push(refActionChildData.value as never); | 492 | + lastRefTriggerChildDataArray.value.push(refTriggerChildData as never); |
| 493 | + lastRefConditionChildDataArray.value.push(refConditionChildData as never); | ||
| 494 | + lastRefActionChildDataArray.value.push(refActionChildData as never); | ||
| 453 | triggersObj = { | 495 | triggersObj = { |
| 454 | triggers: lastRefTriggerChildDataArray.value, | 496 | triggers: lastRefTriggerChildDataArray.value, |
| 455 | }; | 497 | }; |
| @@ -459,15 +501,14 @@ | @@ -459,15 +501,14 @@ | ||
| 459 | actionsObj = { | 501 | actionsObj = { |
| 460 | doActions: lastRefActionChildDataArray.value, | 502 | doActions: lastRefActionChildDataArray.value, |
| 461 | }; | 503 | }; |
| 462 | - | ||
| 463 | Object.assign(getAllFormData, triggersObj, conditionsObj, actionsObj); | 504 | Object.assign(getAllFormData, triggersObj, conditionsObj, actionsObj); |
| 464 | } else { | 505 | } else { |
| 465 | refTriggerChildDataFunc(); | 506 | refTriggerChildDataFunc(); |
| 466 | refConditionChildDataFunc(); | 507 | refConditionChildDataFunc(); |
| 467 | refActionChildDataFunc(); | 508 | refActionChildDataFunc(); |
| 468 | - pushEditArray.push(refTriggerChildData.value as never); | ||
| 469 | - pushEditConditionArray.push(refConditionChildData.value as never); | ||
| 470 | - pushEditActionArray.push(refActionChildData.value as never); | 509 | + pushEditArray.push(refTriggerChildData as never); |
| 510 | + pushEditConditionArray.push(refConditionChildData as never); | ||
| 511 | + pushEditActionArray.push(refActionChildData as never); | ||
| 471 | pushEditArray.forEach((f) => { | 512 | pushEditArray.forEach((f) => { |
| 472 | editTriggerPushData.value.push(f as never); | 513 | editTriggerPushData.value.push(f as never); |
| 473 | }); | 514 | }); |
| @@ -490,12 +531,12 @@ | @@ -490,12 +531,12 @@ | ||
| 490 | ); | 531 | ); |
| 491 | 532 | ||
| 492 | const filterThreeArrayTrigger = editTriggerPushData.value.filter( | 533 | const filterThreeArrayTrigger = editTriggerPushData.value.filter( |
| 493 | - (f) => f?.deviceId == '' | 534 | + (f) => f?.entityId == '' |
| 494 | ); | 535 | ); |
| 495 | const filterThreeArrayCondition = editConditionPushData.value.filter( | 536 | const filterThreeArrayCondition = editConditionPushData.value.filter( |
| 496 | - (f) => f?.deviceId == '' | 537 | + (f) => f?.entityId == '' |
| 497 | ); | 538 | ); |
| 498 | - const filterThreeArrayAction = editActionPushData.value.filter((f) => f?.deviceId == ''); | 539 | + const filterThreeArrayAction = editActionPushData.value.filter((f) => f?.entityId == ''); |
| 499 | const filterFourArrayTrigger = filterThreeArrayTrigger.filter( | 540 | const filterFourArrayTrigger = filterThreeArrayTrigger.filter( |
| 500 | (f) => f?.triggerType !== '' | 541 | (f) => f?.triggerType !== '' |
| 501 | ); | 542 | ); |
| @@ -530,10 +571,17 @@ | @@ -530,10 +571,17 @@ | ||
| 530 | 571 | ||
| 531 | const handleSubmit = async () => { | 572 | const handleSubmit = async () => { |
| 532 | if (!unref(isUpdate)) { | 573 | if (!unref(isUpdate)) { |
| 574 | + let kongObj = true; | ||
| 533 | getDefaultValue(); | 575 | getDefaultValue(); |
| 534 | getValuesFormData = await validateFields(); | 576 | getValuesFormData = await validateFields(); |
| 535 | if (!getValuesFormData) return; | 577 | if (!getValuesFormData) return; |
| 536 | Object.assign(getAllFormData, getValuesFormData); | 578 | Object.assign(getAllFormData, getValuesFormData); |
| 579 | + lastRefActionChildDataArray.value.forEach((f) => { | ||
| 580 | + if (Object.keys(f).length == 0) { | ||
| 581 | + kongObj = false; | ||
| 582 | + } | ||
| 583 | + }); | ||
| 584 | + if (!kongObj) return createMessage.error('请填写执行动作'); | ||
| 537 | await screenLinkPageAddApi(getAllFormData); | 585 | await screenLinkPageAddApi(getAllFormData); |
| 538 | createMessage.success('场景联动新增成功'); | 586 | createMessage.success('场景联动新增成功'); |
| 539 | closeDrawer(); | 587 | closeDrawer(); |
| @@ -564,14 +612,21 @@ | @@ -564,14 +612,21 @@ | ||
| 564 | if (!unref(isUpdate)) { | 612 | if (!unref(isUpdate)) { |
| 565 | unref(addTriggerPushData).push(addTriggerData as never); | 613 | unref(addTriggerPushData).push(addTriggerData as never); |
| 566 | refTriggerChildDataFunc(); | 614 | refTriggerChildDataFunc(); |
| 567 | - lastRefTriggerChildData.value = refTriggerChildData.value; | ||
| 568 | - filterNewTriggerArr.push(lastRefTriggerChildData.value as never); | 615 | + // refTriggerChildData; |
| 616 | + filterNewTriggerArr.push(refTriggerChildData as never); | ||
| 569 | (lastRefTriggerChildDataArray.value as never[]) = filterNewTriggerArr.filter( | 617 | (lastRefTriggerChildDataArray.value as never[]) = filterNewTriggerArr.filter( |
| 570 | (v) => Object.keys(v).length !== 0 | 618 | (v) => Object.keys(v).length !== 0 |
| 571 | ); | 619 | ); |
| 620 | + try { | ||
| 621 | + setTimeout(() => { | ||
| 622 | + proxy.$refs.refTriggerChild.updateFieldDeviceId(optionsItemArray.value); | ||
| 623 | + }, 150); | ||
| 624 | + } catch (e) { | ||
| 625 | + return e; | ||
| 626 | + } | ||
| 572 | } else { | 627 | } else { |
| 573 | refTriggerChildDataFunc(); | 628 | refTriggerChildDataFunc(); |
| 574 | - pushEditArray.push(refTriggerChildData.value as never); | 629 | + pushEditArray.push(refTriggerChildData as never); |
| 575 | unref(editTriggerPushData).push(addTriggerData as never); | 630 | unref(editTriggerPushData).push(addTriggerData as never); |
| 576 | } | 631 | } |
| 577 | }; | 632 | }; |
| @@ -579,7 +634,7 @@ | @@ -579,7 +634,7 @@ | ||
| 579 | if (!unref(isUpdate)) { | 634 | if (!unref(isUpdate)) { |
| 580 | try { | 635 | try { |
| 581 | unref(addTriggerPushData).splice(0, 1); | 636 | unref(addTriggerPushData).splice(0, 1); |
| 582 | - lastRefTriggerChildDataArray.value.pop(); | 637 | + lastRefTriggerChildDataArray.value.splice(0, 1); |
| 583 | } catch (e) { | 638 | } catch (e) { |
| 584 | return e; | 639 | return e; |
| 585 | } | 640 | } |
| @@ -604,14 +659,20 @@ | @@ -604,14 +659,20 @@ | ||
| 604 | if (!unref(isUpdate)) { | 659 | if (!unref(isUpdate)) { |
| 605 | unref(addConditionPushData).push(addConditionData as never); | 660 | unref(addConditionPushData).push(addConditionData as never); |
| 606 | refConditionChildDataFunc(); | 661 | refConditionChildDataFunc(); |
| 607 | - lastRefConditionChildData.value = refConditionChildData.value; | ||
| 608 | - filterNewConditionArr.push(lastRefConditionChildData.value as never); | 662 | + filterNewConditionArr.push(refConditionChildData as never); |
| 609 | (lastRefConditionChildDataArray.value as never[]) = filterNewConditionArr.filter( | 663 | (lastRefConditionChildDataArray.value as never[]) = filterNewConditionArr.filter( |
| 610 | (v) => Object.keys(v).length !== 0 | 664 | (v) => Object.keys(v).length !== 0 |
| 611 | ); | 665 | ); |
| 666 | + try { | ||
| 667 | + setTimeout(() => { | ||
| 668 | + proxy.$refs.refConditionChild.updateFieldDeviceId(optionsItemArray.value); | ||
| 669 | + }, 150); | ||
| 670 | + } catch (e) { | ||
| 671 | + return e; | ||
| 672 | + } | ||
| 612 | } else { | 673 | } else { |
| 613 | refConditionChildDataFunc(); | 674 | refConditionChildDataFunc(); |
| 614 | - pushEditConditionArray.push(refConditionChildData.value as never); | 675 | + pushEditConditionArray.push(refConditionChildData as never); |
| 615 | unref(editConditionPushData).push(addConditionData as never); | 676 | unref(editConditionPushData).push(addConditionData as never); |
| 616 | } | 677 | } |
| 617 | }; | 678 | }; |
| @@ -644,14 +705,20 @@ | @@ -644,14 +705,20 @@ | ||
| 644 | if (!unref(isUpdate)) { | 705 | if (!unref(isUpdate)) { |
| 645 | unref(addActionPushData).push(addActionData as never); | 706 | unref(addActionPushData).push(addActionData as never); |
| 646 | refActionChildDataFunc(); | 707 | refActionChildDataFunc(); |
| 647 | - lastRefActionChildData.value = refActionChildData.value; | ||
| 648 | - filterNewActionArr.push(lastRefActionChildData.value as never); | 708 | + filterNewActionArr.push(refActionChildData as never); |
| 649 | (lastRefActionChildDataArray.value as never[]) = filterNewActionArr.filter( | 709 | (lastRefActionChildDataArray.value as never[]) = filterNewActionArr.filter( |
| 650 | (v) => Object.keys(v).length !== 0 | 710 | (v) => Object.keys(v).length !== 0 |
| 651 | ); | 711 | ); |
| 712 | + try { | ||
| 713 | + setTimeout(() => { | ||
| 714 | + proxy.$refs.refActionChild.updateFieldDeviceId(optionsItemArray.value); | ||
| 715 | + }, 150); | ||
| 716 | + } catch (e) { | ||
| 717 | + return e; | ||
| 718 | + } | ||
| 652 | } else { | 719 | } else { |
| 653 | refActionChildDataFunc(); | 720 | refActionChildDataFunc(); |
| 654 | - pushEditActionArray.push(refActionChildData.value as never); | 721 | + pushEditActionArray.push(refActionChildData as never); |
| 655 | unref(editActionPushData).push(addActionData as never); | 722 | unref(editActionPushData).push(addActionData as never); |
| 656 | } | 723 | } |
| 657 | }; | 724 | }; |
| @@ -674,6 +741,7 @@ | @@ -674,6 +741,7 @@ | ||
| 674 | }; | 741 | }; |
| 675 | 742 | ||
| 676 | return { | 743 | return { |
| 744 | + updateDeviceIdFunc, | ||
| 677 | handleClose, | 745 | handleClose, |
| 678 | defaultAddTrigger, | 746 | defaultAddTrigger, |
| 679 | defaultAddCondition, | 747 | defaultAddCondition, |