Commit dad10b13f2978a4c594861d1786ef42324fc14ed
Merge branch 'revert-128d206d' into 'main'
Revert "fix: 场景联动,数据流转,报表配置处于启用中,都不可以操作" See merge request yunteng/thingskit-front!929
Showing
8 changed files
with
21 additions
and
87 deletions
| ... | ... | @@ -41,6 +41,7 @@ |
| 41 | 41 | const [register, { setModalProps, closeModal }] = useModalInner(async (data) => { |
| 42 | 42 | setModalProps({ loading: true }); |
| 43 | 43 | const { text, record } = data || {}; |
| 44 | + console.log(data, 'data'); | |
| 44 | 45 | isUpdate.value = record ? true : false; |
| 45 | 46 | ruleTile.value = text; |
| 46 | 47 | const { name, additionalInfo, debugMode } = record || {}; | ... | ... |
| ... | ... | @@ -545,14 +545,7 @@ |
| 545 | 545 | unref(skipUnwrap.triggerItemRefs)?.forEach((item) => { |
| 546 | 546 | item.setDisabledProps({ disabled: true }); |
| 547 | 547 | }); |
| 548 | - | |
| 549 | - unref(skipUnwrap.conditionItemRefs)?.forEach((item) => { | |
| 550 | - item.setDisabledProps({ disabled: true }); | |
| 551 | - }); | |
| 552 | - | |
| 553 | - unref(skipUnwrap.actionItemRefs)?.forEach((item) => { | |
| 554 | - item.setDisabledProps({ disabled: true }); | |
| 555 | - }); | |
| 548 | + console.log(unref(skipUnwrap.triggerItemRefs), 'skipUnwrap.triggerItemRefs'); | |
| 556 | 549 | } else { |
| 557 | 550 | updateSchema({ |
| 558 | 551 | field: 'organizationId', |
| ... | ... | @@ -561,9 +554,6 @@ |
| 561 | 554 | unref(skipUnwrap.triggerItemRefs)?.forEach((item) => { |
| 562 | 555 | item.setCancelDisabled(); |
| 563 | 556 | }); |
| 564 | - unref(skipUnwrap.conditionItemRefs)?.forEach((item) => { | |
| 565 | - item.setCancelDisabled(); | |
| 566 | - }); | |
| 567 | 557 | } |
| 568 | 558 | }); |
| 569 | 559 | ... | ... |
| ... | ... | @@ -29,7 +29,6 @@ |
| 29 | 29 | <template #operationType="{ model, field }"> |
| 30 | 30 | <Select |
| 31 | 31 | :options="options" |
| 32 | - :disabled="disabled" | |
| 33 | 32 | v-model:value="model[field]" |
| 34 | 33 | @change="operationType = model[field]" |
| 35 | 34 | placeholder="请选择比较类型" |
| ... | ... | @@ -40,7 +39,6 @@ |
| 40 | 39 | <Input v-model:value="model[field]" placeholder="请输入持续时间"> |
| 41 | 40 | <template #addonAfter> |
| 42 | 41 | <Select |
| 43 | - :disabled="disabled" | |
| 44 | 42 | v-model:value="model[`timeUnit`]" |
| 45 | 43 | :options="timeUnitOptions" |
| 46 | 44 | style="width: 60px" |
| ... | ... | @@ -60,7 +58,7 @@ |
| 60 | 58 | </div> |
| 61 | 59 | </template> |
| 62 | 60 | <script lang="ts" setup> |
| 63 | - import { ref, provide, nextTick, unref } from 'vue'; | |
| 61 | + import { ref, provide, nextTick } from 'vue'; | |
| 64 | 62 | import { CollapseContainer } from '/@/components/Container/index'; |
| 65 | 63 | import { BasicForm, useForm } from '/@/components/Form/index'; |
| 66 | 64 | import { Card, Select, Input, Tooltip } from 'ant-design-vue'; |
| ... | ... | @@ -88,13 +86,12 @@ |
| 88 | 86 | const emit = defineEmits(['delete']); |
| 89 | 87 | const isUpdate = ref(false); |
| 90 | 88 | const conditionScreeningRef = ref(); |
| 91 | - const [registerForm, { resetFields, getFieldsValue, updateSchema, setFieldsValue, setProps }] = | |
| 92 | - useForm({ | |
| 93 | - //TODO-wenwei-修复 | |
| 94 | - schemas: cloneDeep(trigger_condition_schema), | |
| 95 | - //TODO-wenwei-修复 | |
| 96 | - showActionButtonGroup: false, | |
| 97 | - }); | |
| 89 | + const [registerForm, { resetFields, getFieldsValue, updateSchema, setFieldsValue }] = useForm({ | |
| 90 | + //TODO-wenwei-修复 | |
| 91 | + schemas: cloneDeep(trigger_condition_schema), | |
| 92 | + //TODO-wenwei-修复 | |
| 93 | + showActionButtonGroup: false, | |
| 94 | + }); | |
| 98 | 95 | |
| 99 | 96 | const alarmScheduleRef = ref<InstanceType<typeof AlarmSchedule>>(); |
| 100 | 97 | const getFieldsValueFunc = () => { |
| ... | ... | @@ -147,7 +144,6 @@ |
| 147 | 144 | const currentIndex = ref(0); |
| 148 | 145 | const [registerModal, { openModal }] = useModal(); |
| 149 | 146 | const handleScheduleChange = (value) => { |
| 150 | - if (unref(disabled)) return; | |
| 151 | 147 | const index = scheduleOptions.findIndex((item) => item.value === value); |
| 152 | 148 | // 报警日程弹窗 |
| 153 | 149 | if (index !== 0) { |
| ... | ... | @@ -168,16 +164,6 @@ |
| 168 | 164 | currentIndex.value = index; |
| 169 | 165 | }; |
| 170 | 166 | const scheduleData = ref(null); |
| 171 | - | |
| 172 | - const disabled = ref<boolean>(false); | |
| 173 | - const setDisabledProps = (value) => { | |
| 174 | - setProps(value); | |
| 175 | - disabled.value = true; | |
| 176 | - }; | |
| 177 | - | |
| 178 | - const setCancelDisabled = () => { | |
| 179 | - disabled.value = false; | |
| 180 | - }; | |
| 181 | 167 | defineExpose({ |
| 182 | 168 | getFieldsValue, |
| 183 | 169 | updateFieldDeviceId, |
| ... | ... | @@ -196,8 +182,6 @@ |
| 196 | 182 | isUpdate, |
| 197 | 183 | alarmScheduleRef, |
| 198 | 184 | updateFieldAttributeFunc, |
| 199 | - setDisabledProps, | |
| 200 | - setCancelDisabled, | |
| 201 | 185 | }); |
| 202 | 186 | </script> |
| 203 | 187 | <style> | ... | ... |
| ... | ... | @@ -31,11 +31,8 @@ |
| 31 | 31 | const emit = defineEmits(['deleteConditionForm']); |
| 32 | 32 | const operationType = inject('operationType'); |
| 33 | 33 | let schemas = ref([]); |
| 34 | - const isViewDisabledBtn = window.localStorage.getItem('isViewDisabledBtn'); | |
| 35 | 34 | onMounted(() => { |
| 36 | 35 | schemas.value = isType(operationType.value); |
| 37 | - | |
| 38 | - if (isViewDisabledBtn == 'isView') setProps({ disabled: true }); | |
| 39 | 36 | }); |
| 40 | 37 | watch(operationType, (newValue) => { |
| 41 | 38 | schemas.value = isType(newValue); |
| ... | ... | @@ -50,7 +47,6 @@ |
| 50 | 47 | getFieldsValue, |
| 51 | 48 | setFieldsValue, |
| 52 | 49 | validate, |
| 53 | - setProps, | |
| 54 | 50 | }, |
| 55 | 51 | ] = useForm({ |
| 56 | 52 | showActionButtonGroup: false, |
| ... | ... | @@ -59,7 +55,6 @@ |
| 59 | 55 | schemas, |
| 60 | 56 | }); |
| 61 | 57 | const deleteConditionForm = (index: number) => { |
| 62 | - if (isViewDisabledBtn == 'isView') return; | |
| 63 | 58 | emit('deleteConditionForm', index); |
| 64 | 59 | }; |
| 65 | 60 | // ft add | ... | ... |
| ... | ... | @@ -6,12 +6,13 @@ |
| 6 | 6 | <div class="flex"> |
| 7 | 7 | <span class="mr-2">启用规则:</span> |
| 8 | 8 | <template v-for="(item, scheduleIndex) in scheduleOptions" :key="item.label"> |
| 9 | - <div | |
| 9 | + <a-button | |
| 10 | + type="link" | |
| 10 | 11 | :class="{ 'ml-4': scheduleIndex >= 1, active: scheduleIndex === currentIndex }" |
| 11 | 12 | class="cursor-pointer !p-0" |
| 12 | 13 | :disabled="disabled" |
| 13 | 14 | @click="handleScheduleChange(item.value)" |
| 14 | - >{{ item.label }}</div | |
| 15 | + >{{ item.label }}</a-button | |
| 15 | 16 | > |
| 16 | 17 | </template> |
| 17 | 18 | </div> |
| ... | ... | @@ -74,7 +75,6 @@ |
| 74 | 75 | import { Icon } from '/@/components/Icon'; |
| 75 | 76 | import { useModal } from '/@/components/Modal'; |
| 76 | 77 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 77 | - import { unref } from 'vue'; | |
| 78 | 78 | |
| 79 | 79 | const { useByProductGetAttribute } = useCommonFun(); |
| 80 | 80 | defineProps({ |
| ... | ... | @@ -173,7 +173,6 @@ |
| 173 | 173 | }; |
| 174 | 174 | //TODO-fengtao |
| 175 | 175 | const handleDelete = (params: { index: number; title: string }) => { |
| 176 | - if (unref(disabled)) return; | |
| 177 | 176 | emit('delete', params); |
| 178 | 177 | }; |
| 179 | 178 | const operationType = ref<string>(''); |
| ... | ... | @@ -198,7 +197,6 @@ |
| 198 | 197 | const [registerModal, { openModal }] = useModal(); |
| 199 | 198 | const currentIndex = ref(0); |
| 200 | 199 | const handleScheduleChange = (value) => { |
| 201 | - if (unref(disabled)) return; | |
| 202 | 200 | const index = scheduleOptions.findIndex((item) => item.value === value); |
| 203 | 201 | // 报警日程弹窗 |
| 204 | 202 | if (index !== 0) { | ... | ... |
| ... | ... | @@ -13,7 +13,6 @@ |
| 13 | 13 | <BasicForm @register="registerAction"> |
| 14 | 14 | <template #outTarget="{ model, field }"> |
| 15 | 15 | <Select |
| 16 | - :disabled="disabled" | |
| 17 | 16 | :options="options" |
| 18 | 17 | v-model:value="model[field]" |
| 19 | 18 | @change="changeOutTarget" |
| ... | ... | @@ -25,7 +24,6 @@ |
| 25 | 24 | <template #alarmConfigSlot="{ model, field }"> |
| 26 | 25 | <a-select |
| 27 | 26 | allowClear |
| 28 | - :disabled="disabled" | |
| 29 | 27 | placeholder="请选择告警配置" |
| 30 | 28 | v-model:value="model[field]" |
| 31 | 29 | style="width: 205px; margin-left: 10px" |
| ... | ... | @@ -43,22 +41,14 @@ |
| 43 | 41 | </template> |
| 44 | 42 | <template #doContext="{ model, field }"> |
| 45 | 43 | <div v-if="model['transportType'] === TransportTypeEnum.TCP"> |
| 46 | - <Input v-model:value="model[field]" :disabled="disabled" placeholder="请输入自定义命令" /> | |
| 44 | + <Input v-model:value="model[field]" placeholder="请输入自定义命令" /> | |
| 47 | 45 | </div> |
| 48 | 46 | <div |
| 49 | 47 | v-show="model['transportType'] !== TransportTypeEnum.TCP" |
| 50 | 48 | class="flex" |
| 51 | 49 | style="align-items: center" |
| 52 | 50 | > |
| 53 | - <div v-show="!disabled" ref="jsoneditorRef" style="height: 100%; width: 100%"></div> | |
| 54 | - | |
| 55 | - <a-textarea | |
| 56 | - v-show="disabled" | |
| 57 | - :disabled="true" | |
| 58 | - :value="JSON.stringify(disabledValue)" | |
| 59 | - :rows="4" | |
| 60 | - /> | |
| 61 | - | |
| 51 | + <div ref="jsoneditorRef" style="height: 100%; width: 100%"></div> | |
| 62 | 52 | <a-button style="margin: -5px 0" type="text" @click="handlePremitter">格式化</a-button> |
| 63 | 53 | <Tooltip |
| 64 | 54 | :title=" |
| ... | ... | @@ -74,9 +64,7 @@ |
| 74 | 64 | </div> |
| 75 | 65 | </template> |
| 76 | 66 | <template #clearAlarm> |
| 77 | - <Checkbox v-model:checked="checked" :disabled="disabled" @change="handleCheckedChange"> | |
| 78 | - 清除告警 | |
| 79 | - </Checkbox> | |
| 67 | + <Checkbox v-model:checked="checked" @change="handleCheckedChange"> 清除告警 </Checkbox> | |
| 80 | 68 | <Tooltip title="清除告警与触发器一一对应"> |
| 81 | 69 | <QuestionCircleOutlined /> |
| 82 | 70 | </Tooltip> |
| ... | ... | @@ -204,11 +192,10 @@ |
| 204 | 192 | const changeOutTarget = () => { |
| 205 | 193 | emit('getActionFormArr'); |
| 206 | 194 | }; |
| 207 | - const [registerAction, { getFieldsValue, resetFields, setFieldsValue, validate, setProps }] = | |
| 208 | - useForm({ | |
| 209 | - schemas: actionSchema, | |
| 210 | - showActionButtonGroup: false, | |
| 211 | - }); | |
| 195 | + const [registerAction, { getFieldsValue, resetFields, setFieldsValue, validate }] = useForm({ | |
| 196 | + schemas: actionSchema, | |
| 197 | + showActionButtonGroup: false, | |
| 198 | + }); | |
| 212 | 199 | |
| 213 | 200 | // 获取整个执行动作表单值 |
| 214 | 201 | const getFieldsValueFunc = () => { |
| ... | ... | @@ -382,7 +369,6 @@ |
| 382 | 369 | }; |
| 383 | 370 | |
| 384 | 371 | const handleDelete = (actionIndex) => { |
| 385 | - if (unref(disabled)) return; | |
| 386 | 372 | emit('deleteAction', actionIndex); |
| 387 | 373 | }; |
| 388 | 374 | |
| ... | ... | @@ -418,8 +404,6 @@ |
| 418 | 404 | const jsoneditorRef = ref(); |
| 419 | 405 | const jsonValue = ref({}); |
| 420 | 406 | const jsonInstance = ref(); |
| 421 | - | |
| 422 | - const disabledValue = ref(); //查看时使用表单全部禁用使用这个来获取表单数据 | |
| 423 | 407 | onMounted(() => { |
| 424 | 408 | nextTick(() => { |
| 425 | 409 | let options = { |
| ... | ... | @@ -436,7 +420,6 @@ |
| 436 | 420 | const getJsonValue = () => unref(jsonInstance).get(); |
| 437 | 421 | const setJsonValue = (Json) => { |
| 438 | 422 | nextTick(() => { |
| 439 | - disabledValue.value = Json; | |
| 440 | 423 | unref(jsonInstance).set(Json); |
| 441 | 424 | }); |
| 442 | 425 | }; |
| ... | ... | @@ -464,23 +447,6 @@ |
| 464 | 447 | emit('getActionFormArr'); |
| 465 | 448 | }; |
| 466 | 449 | |
| 467 | - const disabled = ref<boolean>(false); | |
| 468 | - const setDisabledProps = async (value) => { | |
| 469 | - setProps(value); | |
| 470 | - disabled.value = true; | |
| 471 | - await nextTick(); | |
| 472 | - unref(refItem.clearRuleRefs)?.forEach((item) => { | |
| 473 | - item.setDisabledProps(value); | |
| 474 | - }); | |
| 475 | - }; | |
| 476 | - | |
| 477 | - const setCancelDisabled = () => { | |
| 478 | - disabled.value = false; | |
| 479 | - unref(refItem.clearRuleRefs)?.forEach((item) => { | |
| 480 | - item.setCancelDisabled(); | |
| 481 | - }); | |
| 482 | - }; | |
| 483 | - | |
| 484 | 450 | defineExpose({ |
| 485 | 451 | getFieldsValue, |
| 486 | 452 | getFieldsValueFunc, |
| ... | ... | @@ -501,8 +467,6 @@ |
| 501 | 467 | clearRuleList, |
| 502 | 468 | resetConditionForm, |
| 503 | 469 | handleDropdownVisibleChange, |
| 504 | - setDisabledProps, | |
| 505 | - setCancelDisabled, | |
| 506 | 470 | }); |
| 507 | 471 | </script> |
| 508 | 472 | ... | ... |