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,6 +41,7 @@ | ||
| 41 | const [register, { setModalProps, closeModal }] = useModalInner(async (data) => { | 41 | const [register, { setModalProps, closeModal }] = useModalInner(async (data) => { |
| 42 | setModalProps({ loading: true }); | 42 | setModalProps({ loading: true }); |
| 43 | const { text, record } = data || {}; | 43 | const { text, record } = data || {}; |
| 44 | + console.log(data, 'data'); | ||
| 44 | isUpdate.value = record ? true : false; | 45 | isUpdate.value = record ? true : false; |
| 45 | ruleTile.value = text; | 46 | ruleTile.value = text; |
| 46 | const { name, additionalInfo, debugMode } = record || {}; | 47 | const { name, additionalInfo, debugMode } = record || {}; |
| @@ -145,6 +145,7 @@ export const modeMqttForm: FormSchema[] = [ | @@ -145,6 +145,7 @@ export const modeMqttForm: FormSchema[] = [ | ||
| 145 | options: MqttFormPartialConfig.getType(), | 145 | options: MqttFormPartialConfig.getType(), |
| 146 | onChange(e) { | 146 | onChange(e) { |
| 147 | if (e) { | 147 | if (e) { |
| 148 | + console.log('执行'); | ||
| 148 | setFieldsValue({ | 149 | setFieldsValue({ |
| 149 | password: undefined, | 150 | password: undefined, |
| 150 | username: undefined, | 151 | username: undefined, |
| @@ -545,14 +545,7 @@ | @@ -545,14 +545,7 @@ | ||
| 545 | unref(skipUnwrap.triggerItemRefs)?.forEach((item) => { | 545 | unref(skipUnwrap.triggerItemRefs)?.forEach((item) => { |
| 546 | item.setDisabledProps({ disabled: true }); | 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 | } else { | 549 | } else { |
| 557 | updateSchema({ | 550 | updateSchema({ |
| 558 | field: 'organizationId', | 551 | field: 'organizationId', |
| @@ -561,9 +554,6 @@ | @@ -561,9 +554,6 @@ | ||
| 561 | unref(skipUnwrap.triggerItemRefs)?.forEach((item) => { | 554 | unref(skipUnwrap.triggerItemRefs)?.forEach((item) => { |
| 562 | item.setCancelDisabled(); | 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,7 +29,6 @@ | ||
| 29 | <template #operationType="{ model, field }"> | 29 | <template #operationType="{ model, field }"> |
| 30 | <Select | 30 | <Select |
| 31 | :options="options" | 31 | :options="options" |
| 32 | - :disabled="disabled" | ||
| 33 | v-model:value="model[field]" | 32 | v-model:value="model[field]" |
| 34 | @change="operationType = model[field]" | 33 | @change="operationType = model[field]" |
| 35 | placeholder="请选择比较类型" | 34 | placeholder="请选择比较类型" |
| @@ -40,7 +39,6 @@ | @@ -40,7 +39,6 @@ | ||
| 40 | <Input v-model:value="model[field]" placeholder="请输入持续时间"> | 39 | <Input v-model:value="model[field]" placeholder="请输入持续时间"> |
| 41 | <template #addonAfter> | 40 | <template #addonAfter> |
| 42 | <Select | 41 | <Select |
| 43 | - :disabled="disabled" | ||
| 44 | v-model:value="model[`timeUnit`]" | 42 | v-model:value="model[`timeUnit`]" |
| 45 | :options="timeUnitOptions" | 43 | :options="timeUnitOptions" |
| 46 | style="width: 60px" | 44 | style="width: 60px" |
| @@ -60,7 +58,7 @@ | @@ -60,7 +58,7 @@ | ||
| 60 | </div> | 58 | </div> |
| 61 | </template> | 59 | </template> |
| 62 | <script lang="ts" setup> | 60 | <script lang="ts" setup> |
| 63 | - import { ref, provide, nextTick, unref } from 'vue'; | 61 | + import { ref, provide, nextTick } from 'vue'; |
| 64 | import { CollapseContainer } from '/@/components/Container/index'; | 62 | import { CollapseContainer } from '/@/components/Container/index'; |
| 65 | import { BasicForm, useForm } from '/@/components/Form/index'; | 63 | import { BasicForm, useForm } from '/@/components/Form/index'; |
| 66 | import { Card, Select, Input, Tooltip } from 'ant-design-vue'; | 64 | import { Card, Select, Input, Tooltip } from 'ant-design-vue'; |
| @@ -88,13 +86,12 @@ | @@ -88,13 +86,12 @@ | ||
| 88 | const emit = defineEmits(['delete']); | 86 | const emit = defineEmits(['delete']); |
| 89 | const isUpdate = ref(false); | 87 | const isUpdate = ref(false); |
| 90 | const conditionScreeningRef = ref(); | 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 | const alarmScheduleRef = ref<InstanceType<typeof AlarmSchedule>>(); | 96 | const alarmScheduleRef = ref<InstanceType<typeof AlarmSchedule>>(); |
| 100 | const getFieldsValueFunc = () => { | 97 | const getFieldsValueFunc = () => { |
| @@ -147,7 +144,6 @@ | @@ -147,7 +144,6 @@ | ||
| 147 | const currentIndex = ref(0); | 144 | const currentIndex = ref(0); |
| 148 | const [registerModal, { openModal }] = useModal(); | 145 | const [registerModal, { openModal }] = useModal(); |
| 149 | const handleScheduleChange = (value) => { | 146 | const handleScheduleChange = (value) => { |
| 150 | - if (unref(disabled)) return; | ||
| 151 | const index = scheduleOptions.findIndex((item) => item.value === value); | 147 | const index = scheduleOptions.findIndex((item) => item.value === value); |
| 152 | // 报警日程弹窗 | 148 | // 报警日程弹窗 |
| 153 | if (index !== 0) { | 149 | if (index !== 0) { |
| @@ -168,16 +164,6 @@ | @@ -168,16 +164,6 @@ | ||
| 168 | currentIndex.value = index; | 164 | currentIndex.value = index; |
| 169 | }; | 165 | }; |
| 170 | const scheduleData = ref(null); | 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 | defineExpose({ | 167 | defineExpose({ |
| 182 | getFieldsValue, | 168 | getFieldsValue, |
| 183 | updateFieldDeviceId, | 169 | updateFieldDeviceId, |
| @@ -196,8 +182,6 @@ | @@ -196,8 +182,6 @@ | ||
| 196 | isUpdate, | 182 | isUpdate, |
| 197 | alarmScheduleRef, | 183 | alarmScheduleRef, |
| 198 | updateFieldAttributeFunc, | 184 | updateFieldAttributeFunc, |
| 199 | - setDisabledProps, | ||
| 200 | - setCancelDisabled, | ||
| 201 | }); | 185 | }); |
| 202 | </script> | 186 | </script> |
| 203 | <style> | 187 | <style> |
| @@ -31,11 +31,8 @@ | @@ -31,11 +31,8 @@ | ||
| 31 | const emit = defineEmits(['deleteConditionForm']); | 31 | const emit = defineEmits(['deleteConditionForm']); |
| 32 | const operationType = inject('operationType'); | 32 | const operationType = inject('operationType'); |
| 33 | let schemas = ref([]); | 33 | let schemas = ref([]); |
| 34 | - const isViewDisabledBtn = window.localStorage.getItem('isViewDisabledBtn'); | ||
| 35 | onMounted(() => { | 34 | onMounted(() => { |
| 36 | schemas.value = isType(operationType.value); | 35 | schemas.value = isType(operationType.value); |
| 37 | - | ||
| 38 | - if (isViewDisabledBtn == 'isView') setProps({ disabled: true }); | ||
| 39 | }); | 36 | }); |
| 40 | watch(operationType, (newValue) => { | 37 | watch(operationType, (newValue) => { |
| 41 | schemas.value = isType(newValue); | 38 | schemas.value = isType(newValue); |
| @@ -50,7 +47,6 @@ | @@ -50,7 +47,6 @@ | ||
| 50 | getFieldsValue, | 47 | getFieldsValue, |
| 51 | setFieldsValue, | 48 | setFieldsValue, |
| 52 | validate, | 49 | validate, |
| 53 | - setProps, | ||
| 54 | }, | 50 | }, |
| 55 | ] = useForm({ | 51 | ] = useForm({ |
| 56 | showActionButtonGroup: false, | 52 | showActionButtonGroup: false, |
| @@ -59,7 +55,6 @@ | @@ -59,7 +55,6 @@ | ||
| 59 | schemas, | 55 | schemas, |
| 60 | }); | 56 | }); |
| 61 | const deleteConditionForm = (index: number) => { | 57 | const deleteConditionForm = (index: number) => { |
| 62 | - if (isViewDisabledBtn == 'isView') return; | ||
| 63 | emit('deleteConditionForm', index); | 58 | emit('deleteConditionForm', index); |
| 64 | }; | 59 | }; |
| 65 | // ft add | 60 | // ft add |
| @@ -6,12 +6,13 @@ | @@ -6,12 +6,13 @@ | ||
| 6 | <div class="flex"> | 6 | <div class="flex"> |
| 7 | <span class="mr-2">启用规则:</span> | 7 | <span class="mr-2">启用规则:</span> |
| 8 | <template v-for="(item, scheduleIndex) in scheduleOptions" :key="item.label"> | 8 | <template v-for="(item, scheduleIndex) in scheduleOptions" :key="item.label"> |
| 9 | - <div | 9 | + <a-button |
| 10 | + type="link" | ||
| 10 | :class="{ 'ml-4': scheduleIndex >= 1, active: scheduleIndex === currentIndex }" | 11 | :class="{ 'ml-4': scheduleIndex >= 1, active: scheduleIndex === currentIndex }" |
| 11 | class="cursor-pointer !p-0" | 12 | class="cursor-pointer !p-0" |
| 12 | :disabled="disabled" | 13 | :disabled="disabled" |
| 13 | @click="handleScheduleChange(item.value)" | 14 | @click="handleScheduleChange(item.value)" |
| 14 | - >{{ item.label }}</div | 15 | + >{{ item.label }}</a-button |
| 15 | > | 16 | > |
| 16 | </template> | 17 | </template> |
| 17 | </div> | 18 | </div> |
| @@ -74,7 +75,6 @@ | @@ -74,7 +75,6 @@ | ||
| 74 | import { Icon } from '/@/components/Icon'; | 75 | import { Icon } from '/@/components/Icon'; |
| 75 | import { useModal } from '/@/components/Modal'; | 76 | import { useModal } from '/@/components/Modal'; |
| 76 | import { useMessage } from '/@/hooks/web/useMessage'; | 77 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 77 | - import { unref } from 'vue'; | ||
| 78 | 78 | ||
| 79 | const { useByProductGetAttribute } = useCommonFun(); | 79 | const { useByProductGetAttribute } = useCommonFun(); |
| 80 | defineProps({ | 80 | defineProps({ |
| @@ -173,7 +173,6 @@ | @@ -173,7 +173,6 @@ | ||
| 173 | }; | 173 | }; |
| 174 | //TODO-fengtao | 174 | //TODO-fengtao |
| 175 | const handleDelete = (params: { index: number; title: string }) => { | 175 | const handleDelete = (params: { index: number; title: string }) => { |
| 176 | - if (unref(disabled)) return; | ||
| 177 | emit('delete', params); | 176 | emit('delete', params); |
| 178 | }; | 177 | }; |
| 179 | const operationType = ref<string>(''); | 178 | const operationType = ref<string>(''); |
| @@ -198,7 +197,6 @@ | @@ -198,7 +197,6 @@ | ||
| 198 | const [registerModal, { openModal }] = useModal(); | 197 | const [registerModal, { openModal }] = useModal(); |
| 199 | const currentIndex = ref(0); | 198 | const currentIndex = ref(0); |
| 200 | const handleScheduleChange = (value) => { | 199 | const handleScheduleChange = (value) => { |
| 201 | - if (unref(disabled)) return; | ||
| 202 | const index = scheduleOptions.findIndex((item) => item.value === value); | 200 | const index = scheduleOptions.findIndex((item) => item.value === value); |
| 203 | // 报警日程弹窗 | 201 | // 报警日程弹窗 |
| 204 | if (index !== 0) { | 202 | if (index !== 0) { |
| @@ -13,7 +13,6 @@ | @@ -13,7 +13,6 @@ | ||
| 13 | <BasicForm @register="registerAction"> | 13 | <BasicForm @register="registerAction"> |
| 14 | <template #outTarget="{ model, field }"> | 14 | <template #outTarget="{ model, field }"> |
| 15 | <Select | 15 | <Select |
| 16 | - :disabled="disabled" | ||
| 17 | :options="options" | 16 | :options="options" |
| 18 | v-model:value="model[field]" | 17 | v-model:value="model[field]" |
| 19 | @change="changeOutTarget" | 18 | @change="changeOutTarget" |
| @@ -25,7 +24,6 @@ | @@ -25,7 +24,6 @@ | ||
| 25 | <template #alarmConfigSlot="{ model, field }"> | 24 | <template #alarmConfigSlot="{ model, field }"> |
| 26 | <a-select | 25 | <a-select |
| 27 | allowClear | 26 | allowClear |
| 28 | - :disabled="disabled" | ||
| 29 | placeholder="请选择告警配置" | 27 | placeholder="请选择告警配置" |
| 30 | v-model:value="model[field]" | 28 | v-model:value="model[field]" |
| 31 | style="width: 205px; margin-left: 10px" | 29 | style="width: 205px; margin-left: 10px" |
| @@ -43,22 +41,14 @@ | @@ -43,22 +41,14 @@ | ||
| 43 | </template> | 41 | </template> |
| 44 | <template #doContext="{ model, field }"> | 42 | <template #doContext="{ model, field }"> |
| 45 | <div v-if="model['transportType'] === TransportTypeEnum.TCP"> | 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 | </div> | 45 | </div> |
| 48 | <div | 46 | <div |
| 49 | v-show="model['transportType'] !== TransportTypeEnum.TCP" | 47 | v-show="model['transportType'] !== TransportTypeEnum.TCP" |
| 50 | class="flex" | 48 | class="flex" |
| 51 | style="align-items: center" | 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 | <a-button style="margin: -5px 0" type="text" @click="handlePremitter">格式化</a-button> | 52 | <a-button style="margin: -5px 0" type="text" @click="handlePremitter">格式化</a-button> |
| 63 | <Tooltip | 53 | <Tooltip |
| 64 | :title=" | 54 | :title=" |
| @@ -74,9 +64,7 @@ | @@ -74,9 +64,7 @@ | ||
| 74 | </div> | 64 | </div> |
| 75 | </template> | 65 | </template> |
| 76 | <template #clearAlarm> | 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 | <Tooltip title="清除告警与触发器一一对应"> | 68 | <Tooltip title="清除告警与触发器一一对应"> |
| 81 | <QuestionCircleOutlined /> | 69 | <QuestionCircleOutlined /> |
| 82 | </Tooltip> | 70 | </Tooltip> |
| @@ -204,11 +192,10 @@ | @@ -204,11 +192,10 @@ | ||
| 204 | const changeOutTarget = () => { | 192 | const changeOutTarget = () => { |
| 205 | emit('getActionFormArr'); | 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 | const getFieldsValueFunc = () => { | 201 | const getFieldsValueFunc = () => { |
| @@ -382,7 +369,6 @@ | @@ -382,7 +369,6 @@ | ||
| 382 | }; | 369 | }; |
| 383 | 370 | ||
| 384 | const handleDelete = (actionIndex) => { | 371 | const handleDelete = (actionIndex) => { |
| 385 | - if (unref(disabled)) return; | ||
| 386 | emit('deleteAction', actionIndex); | 372 | emit('deleteAction', actionIndex); |
| 387 | }; | 373 | }; |
| 388 | 374 | ||
| @@ -418,8 +404,6 @@ | @@ -418,8 +404,6 @@ | ||
| 418 | const jsoneditorRef = ref(); | 404 | const jsoneditorRef = ref(); |
| 419 | const jsonValue = ref({}); | 405 | const jsonValue = ref({}); |
| 420 | const jsonInstance = ref(); | 406 | const jsonInstance = ref(); |
| 421 | - | ||
| 422 | - const disabledValue = ref(); //查看时使用表单全部禁用使用这个来获取表单数据 | ||
| 423 | onMounted(() => { | 407 | onMounted(() => { |
| 424 | nextTick(() => { | 408 | nextTick(() => { |
| 425 | let options = { | 409 | let options = { |
| @@ -436,7 +420,6 @@ | @@ -436,7 +420,6 @@ | ||
| 436 | const getJsonValue = () => unref(jsonInstance).get(); | 420 | const getJsonValue = () => unref(jsonInstance).get(); |
| 437 | const setJsonValue = (Json) => { | 421 | const setJsonValue = (Json) => { |
| 438 | nextTick(() => { | 422 | nextTick(() => { |
| 439 | - disabledValue.value = Json; | ||
| 440 | unref(jsonInstance).set(Json); | 423 | unref(jsonInstance).set(Json); |
| 441 | }); | 424 | }); |
| 442 | }; | 425 | }; |
| @@ -464,23 +447,6 @@ | @@ -464,23 +447,6 @@ | ||
| 464 | emit('getActionFormArr'); | 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 | defineExpose({ | 450 | defineExpose({ |
| 485 | getFieldsValue, | 451 | getFieldsValue, |
| 486 | getFieldsValueFunc, | 452 | getFieldsValueFunc, |
| @@ -501,8 +467,6 @@ | @@ -501,8 +467,6 @@ | ||
| 501 | clearRuleList, | 467 | clearRuleList, |
| 502 | resetConditionForm, | 468 | resetConditionForm, |
| 503 | handleDropdownVisibleChange, | 469 | handleDropdownVisibleChange, |
| 504 | - setDisabledProps, | ||
| 505 | - setCancelDisabled, | ||
| 506 | }); | 470 | }); |
| 507 | </script> | 471 | </script> |
| 508 | 472 |