Showing
20 changed files
with
238 additions
and
62 deletions
@@ -15,7 +15,11 @@ | @@ -15,7 +15,11 @@ | ||
15 | <!-- 设备选择 --> | 15 | <!-- 设备选择 --> |
16 | <template #devices="{ model }"> | 16 | <template #devices="{ model }"> |
17 | <span class="hidden">{{ handleChangeOrg(model['organizationId']) }}</span> | 17 | <span class="hidden">{{ handleChangeOrg(model['organizationId']) }}</span> |
18 | - <SelectDevice ref="selectDeviceRef" :selectOptions="selectOptions" /> | 18 | + <SelectDevice |
19 | + ref="selectDeviceRef" | ||
20 | + :selectOptions="selectOptions" | ||
21 | + v-model:disabled="deviceDisabled" | ||
22 | + /> | ||
19 | </template> | 23 | </template> |
20 | </BasicForm> | 24 | </BasicForm> |
21 | </BasicDrawer> | 25 | </BasicDrawer> |
@@ -83,12 +87,14 @@ | @@ -83,12 +87,14 @@ | ||
83 | } | 87 | } |
84 | ); | 88 | ); |
85 | 89 | ||
86 | - const [registerForm, { validate, resetFields, setFieldsValue, updateSchema }] = useForm({ | ||
87 | - labelWidth: 120, | ||
88 | - schemas: formSchema, | ||
89 | - showActionButtonGroup: false, | ||
90 | - fieldMapToTime: [[SchemaFiled.DATE_RANGE, [SchemaFiled.START_TS, SchemaFiled.END_TS]]], | ||
91 | - }); | 90 | + const [registerForm, { validate, resetFields, setFieldsValue, updateSchema, setProps }] = useForm( |
91 | + { | ||
92 | + labelWidth: 120, | ||
93 | + schemas: formSchema, | ||
94 | + showActionButtonGroup: false, | ||
95 | + fieldMapToTime: [[SchemaFiled.DATE_RANGE, [SchemaFiled.START_TS, SchemaFiled.END_TS]]], | ||
96 | + } | ||
97 | + ); | ||
92 | 98 | ||
93 | const businessText = ref(''); | 99 | const businessText = ref(''); |
94 | 100 | ||
@@ -96,11 +102,27 @@ | @@ -96,11 +102,27 @@ | ||
96 | data: {}, | 102 | data: {}, |
97 | }); | 103 | }); |
98 | 104 | ||
105 | + const deviceDisabled = ref<boolean>(false); | ||
106 | + | ||
99 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { | 107 | const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { |
100 | try { | 108 | try { |
101 | await nextTick(); | 109 | await nextTick(); |
102 | handleClose(); | 110 | handleClose(); |
103 | businessText.value = data.text; | 111 | businessText.value = data.text; |
112 | + if (businessText.value == BusinessReportConfigTextEnum.BUSINESS_VIEW_TEXT) { | ||
113 | + deviceDisabled.value = true; | ||
114 | + setProps({ disabled: true }); | ||
115 | + updateSchema({ | ||
116 | + field: 'organizationId', | ||
117 | + componentProps: { apiTreeSelectProps: { disabled: true } }, | ||
118 | + }); | ||
119 | + } else { | ||
120 | + deviceDisabled.value = false; | ||
121 | + updateSchema({ | ||
122 | + field: 'organizationId', | ||
123 | + componentProps: { apiTreeSelectProps: { disabled: false } }, | ||
124 | + }); | ||
125 | + } | ||
104 | setFieldsValue(setDefaultTime()); | 126 | setFieldsValue(setDefaultTime()); |
105 | updateSchema(disableCustomWeekly(BusinessExecutewayEnum.BUSINESS_EXECUTEWAY_IMMEDIATE)); | 127 | updateSchema(disableCustomWeekly(BusinessExecutewayEnum.BUSINESS_EXECUTEWAY_IMMEDIATE)); |
106 | setDrawerProps(setPropsForModal(businessText.value)); | 128 | setDrawerProps(setPropsForModal(businessText.value)); |
@@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
6 | v-model:value="param.attributes" | 6 | v-model:value="param.attributes" |
7 | class="!w-1/2" | 7 | class="!w-1/2" |
8 | :options="selectOptions" | 8 | :options="selectOptions" |
9 | + :disabled="disabled" | ||
9 | @change="emitChange" | 10 | @change="emitChange" |
10 | mode="multiple" | 11 | mode="multiple" |
11 | allowClear | 12 | allowClear |
@@ -26,6 +27,10 @@ | @@ -26,6 +27,10 @@ | ||
26 | 27 | ||
27 | const props = defineProps({ | 28 | const props = defineProps({ |
28 | value: propTypes.object.def({}), | 29 | value: propTypes.object.def({}), |
30 | + disabled: { | ||
31 | + type: Boolean, | ||
32 | + required: false, | ||
33 | + }, | ||
29 | }); | 34 | }); |
30 | 35 | ||
31 | const selectOptions: any = ref([]); | 36 | const selectOptions: any = ref([]); |
@@ -6,11 +6,17 @@ | @@ -6,11 +6,17 @@ | ||
6 | :options="selectOptions" | 6 | :options="selectOptions" |
7 | v-bind="createPickerSearch()" | 7 | v-bind="createPickerSearch()" |
8 | @change="handleDeviceChange" | 8 | @change="handleDeviceChange" |
9 | + :disabled="disabled" | ||
9 | mode="multiple" | 10 | mode="multiple" |
10 | labelInValue | 11 | labelInValue |
11 | /> | 12 | /> |
12 | <template v-for="(item, index) in deviceList" :key="item.value"> | 13 | <template v-for="(item, index) in deviceList" :key="item.value"> |
13 | - <SelectAttributes :ref="bindDeviceRef.deviceAttrRef" :value="item" :index="index" /> | 14 | + <SelectAttributes |
15 | + :ref="bindDeviceRef.deviceAttrRef" | ||
16 | + :value="item" | ||
17 | + :index="index" | ||
18 | + :disabled="disabled" | ||
19 | + /> | ||
14 | </template> | 20 | </template> |
15 | </template> | 21 | </template> |
16 | <script lang="ts" setup name="SelectDevice"> | 22 | <script lang="ts" setup name="SelectDevice"> |
@@ -25,6 +31,10 @@ | @@ -25,6 +31,10 @@ | ||
25 | type: Array as PropType<TSelectOption[]>, | 31 | type: Array as PropType<TSelectOption[]>, |
26 | required: true, | 32 | required: true, |
27 | }, | 33 | }, |
34 | + disabled: { | ||
35 | + type: Boolean, | ||
36 | + required: false, | ||
37 | + }, | ||
28 | }); | 38 | }); |
29 | 39 | ||
30 | const selectValue = ref([]); | 40 | const selectValue = ref([]); |
@@ -41,7 +41,6 @@ | @@ -41,7 +41,6 @@ | ||
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'); | ||
45 | isUpdate.value = record ? true : false; | 44 | isUpdate.value = record ? true : false; |
46 | ruleTile.value = text; | 45 | ruleTile.value = text; |
47 | const { name, additionalInfo, debugMode } = record || {}; | 46 | const { name, additionalInfo, debugMode } = record || {}; |
@@ -4,18 +4,21 @@ | @@ -4,18 +4,21 @@ | ||
4 | <template #uploadFilesSlot="{ model }"> | 4 | <template #uploadFilesSlot="{ model }"> |
5 | <UploadFile | 5 | <UploadFile |
6 | :url="credentialsFile.caCertFileName" | 6 | :url="credentialsFile.caCertFileName" |
7 | + :disabled="disabled" | ||
7 | @fileUrlEmit="handleFileUrlEmitH" | 8 | @fileUrlEmit="handleFileUrlEmitH" |
8 | v-show="model['type'] === CredentialsEnum.IS_PEM" | 9 | v-show="model['type'] === CredentialsEnum.IS_PEM" |
9 | /> | 10 | /> |
10 | <div class="h-4"></div> | 11 | <div class="h-4"></div> |
11 | <UploadFile | 12 | <UploadFile |
12 | :url="credentialsFile.certFileName" | 13 | :url="credentialsFile.certFileName" |
14 | + :disabled="disabled" | ||
13 | @fileUrlEmit="handleFileUrlEmitC" | 15 | @fileUrlEmit="handleFileUrlEmitC" |
14 | v-show="model['type'] === CredentialsEnum.IS_PEM" | 16 | v-show="model['type'] === CredentialsEnum.IS_PEM" |
15 | /> | 17 | /> |
16 | <div class="h-4"></div> | 18 | <div class="h-4"></div> |
17 | <UploadFile | 19 | <UploadFile |
18 | :url="credentialsFile.privateKeyFileName" | 20 | :url="credentialsFile.privateKeyFileName" |
21 | + :disabled="disabled" | ||
19 | @fileUrlEmit="handleFileUrlEmitB" | 22 | @fileUrlEmit="handleFileUrlEmitB" |
20 | v-show="model['type'] === CredentialsEnum.IS_PEM" | 23 | v-show="model['type'] === CredentialsEnum.IS_PEM" |
21 | /> </template | 24 | /> </template |
@@ -23,7 +26,7 @@ | @@ -23,7 +26,7 @@ | ||
23 | </div> | 26 | </div> |
24 | </template> | 27 | </template> |
25 | <script lang="ts" setup name="DataFlowMethodIsApi"> | 28 | <script lang="ts" setup name="DataFlowMethodIsApi"> |
26 | - import { reactive } from 'vue'; | 29 | + import { reactive, ref } from 'vue'; |
27 | import { BasicForm, useForm } from '/@/components/Form'; | 30 | import { BasicForm, useForm } from '/@/components/Form'; |
28 | import { modeApiForm } from './config'; | 31 | import { modeApiForm } from './config'; |
29 | import { modelFormPublicConfig } from '../../../dataflowmodal/config'; | 32 | import { modelFormPublicConfig } from '../../../dataflowmodal/config'; |
@@ -36,10 +39,11 @@ | @@ -36,10 +39,11 @@ | ||
36 | privateKeyFileName: undefined, | 39 | privateKeyFileName: undefined, |
37 | }); | 40 | }); |
38 | 41 | ||
39 | - const [register, { validateFields, setFieldsValue, resetFields }] = useForm({ | ||
40 | - schemas: modeApiForm, | ||
41 | - ...modelFormPublicConfig, | ||
42 | - }); | 42 | + const [register, { validateFields, setFieldsValue, resetFields, setProps, updateSchema }] = |
43 | + useForm({ | ||
44 | + schemas: modeApiForm, | ||
45 | + ...modelFormPublicConfig, | ||
46 | + }); | ||
43 | 47 | ||
44 | const handleFileUrlEmitH = (fileUrl) => (credentialsFile.caCertFileName = fileUrl); | 48 | const handleFileUrlEmitH = (fileUrl) => (credentialsFile.caCertFileName = fileUrl); |
45 | 49 | ||
@@ -78,10 +82,24 @@ | @@ -78,10 +82,24 @@ | ||
78 | }; | 82 | }; |
79 | 83 | ||
80 | const resetValue = () => resetFields(); | 84 | const resetValue = () => resetFields(); |
85 | + | ||
86 | + const disabled = ref<boolean>(false); | ||
87 | + const setDisabledProps = (value) => { | ||
88 | + setProps(value); | ||
89 | + disabled.value = true; | ||
90 | + updateSchema({ field: 'headers', componentProps: { disabled: false } }); | ||
91 | + }; | ||
92 | + | ||
93 | + const setCancelDisabled = () => { | ||
94 | + updateSchema({ field: 'headers', componentProps: { disabled: false } }); | ||
95 | + }; | ||
96 | + | ||
81 | defineExpose({ | 97 | defineExpose({ |
82 | getValue, | 98 | getValue, |
83 | setValue, | 99 | setValue, |
84 | resetValue, | 100 | resetValue, |
101 | + setDisabledProps, | ||
102 | + setCancelDisabled, | ||
85 | }); | 103 | }); |
86 | </script> | 104 | </script> |
87 | 105 |
@@ -29,7 +29,7 @@ class ApiFormPartialConfig { | @@ -29,7 +29,7 @@ class ApiFormPartialConfig { | ||
29 | return [ | 29 | return [ |
30 | { label: 'Anonymous', value: 'anonymous' }, | 30 | { label: 'Anonymous', value: 'anonymous' }, |
31 | { label: 'Basic', value: 'basic' }, | 31 | { label: 'Basic', value: 'basic' }, |
32 | - { label: 'PEM', value: 'pem' }, | 32 | + { label: 'PEM', value: 'cert.PEM' }, |
33 | ]; | 33 | ]; |
34 | } | 34 | } |
35 | } | 35 | } |
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | import { modelKafkaForm } from './config'; | 8 | import { modelKafkaForm } from './config'; |
9 | import { modelFormPublicConfig } from '../../../dataflowmodal/config'; | 9 | import { modelFormPublicConfig } from '../../../dataflowmodal/config'; |
10 | 10 | ||
11 | - const [register, { validate, setFieldsValue, resetFields }] = useForm({ | 11 | + const [register, { validate, setFieldsValue, resetFields, setProps, updateSchema }] = useForm({ |
12 | schemas: modelKafkaForm, | 12 | schemas: modelKafkaForm, |
13 | ...modelFormPublicConfig, | 13 | ...modelFormPublicConfig, |
14 | }); | 14 | }); |
@@ -19,13 +19,28 @@ | @@ -19,13 +19,28 @@ | ||
19 | return values; | 19 | return values; |
20 | }; | 20 | }; |
21 | 21 | ||
22 | - const setValue = (value) => setFieldsValue(value); | 22 | + const setValue = (value) => { |
23 | + setFieldsValue(value); | ||
24 | + }; | ||
25 | + | ||
26 | + // ½ûÓÃ±íµ¥ | ||
27 | + const setDisabledProps = (value) => { | ||
28 | + setProps(value); | ||
29 | + updateSchema({ field: 'otherProperties', componentProps: { disabled: true } }); | ||
30 | + }; | ||
31 | + | ||
32 | + // È¡Ïû½ûÓà | ||
33 | + const setCancelDisabled = () => { | ||
34 | + updateSchema({ field: 'otherProperties', componentProps: { disabled: false } }); | ||
35 | + }; | ||
23 | 36 | ||
24 | const resetValue = () => resetFields(); | 37 | const resetValue = () => resetFields(); |
25 | defineExpose({ | 38 | defineExpose({ |
26 | getValue, | 39 | getValue, |
27 | setValue, | 40 | setValue, |
28 | resetValue, | 41 | resetValue, |
42 | + setDisabledProps, | ||
43 | + setCancelDisabled, | ||
29 | }); | 44 | }); |
30 | </script> | 45 | </script> |
31 | 46 |
@@ -4,18 +4,21 @@ | @@ -4,18 +4,21 @@ | ||
4 | <template #uploadFilesSlot="{ model }"> | 4 | <template #uploadFilesSlot="{ model }"> |
5 | <UploadFile | 5 | <UploadFile |
6 | :url="credentialsFile.caCertFileName" | 6 | :url="credentialsFile.caCertFileName" |
7 | + :disabled="disabled" | ||
7 | @fileUrlEmit="handleFileUrlEmitH" | 8 | @fileUrlEmit="handleFileUrlEmitH" |
8 | v-show="model['type'] === CredentialsEnum.IS_PEM" | 9 | v-show="model['type'] === CredentialsEnum.IS_PEM" |
9 | /> | 10 | /> |
10 | <div class="h-4"></div> | 11 | <div class="h-4"></div> |
11 | <UploadFile | 12 | <UploadFile |
12 | :url="credentialsFile.certFileName" | 13 | :url="credentialsFile.certFileName" |
14 | + :disabled="disabled" | ||
13 | @fileUrlEmit="handleFileUrlEmitC" | 15 | @fileUrlEmit="handleFileUrlEmitC" |
14 | v-show="model['type'] === CredentialsEnum.IS_PEM" | 16 | v-show="model['type'] === CredentialsEnum.IS_PEM" |
15 | /> | 17 | /> |
16 | <div class="h-4"></div> | 18 | <div class="h-4"></div> |
17 | <UploadFile | 19 | <UploadFile |
18 | :url="credentialsFile.privateKeyFileName" | 20 | :url="credentialsFile.privateKeyFileName" |
21 | + :disabled="disabled" | ||
19 | @fileUrlEmit="handleFileUrlEmitB" | 22 | @fileUrlEmit="handleFileUrlEmitB" |
20 | v-show="model['type'] === CredentialsEnum.IS_PEM" | 23 | v-show="model['type'] === CredentialsEnum.IS_PEM" |
21 | /> | 24 | /> |
@@ -24,7 +27,7 @@ | @@ -24,7 +27,7 @@ | ||
24 | </div> | 27 | </div> |
25 | </template> | 28 | </template> |
26 | <script lang="ts" setup name="DataFlowMethodIsMqtt"> | 29 | <script lang="ts" setup name="DataFlowMethodIsMqtt"> |
27 | - import { reactive } from 'vue'; | 30 | + import { reactive, ref } from 'vue'; |
28 | import { BasicForm, useForm } from '/@/components/Form'; | 31 | import { BasicForm, useForm } from '/@/components/Form'; |
29 | import { modeMqttForm } from './config'; | 32 | import { modeMqttForm } from './config'; |
30 | import { UploadFile } from '../../../uploadfile'; | 33 | import { UploadFile } from '../../../uploadfile'; |
@@ -37,7 +40,7 @@ | @@ -37,7 +40,7 @@ | ||
37 | privateKeyFileName: undefined, | 40 | privateKeyFileName: undefined, |
38 | }); | 41 | }); |
39 | 42 | ||
40 | - const [register, { validateFields, setFieldsValue, resetFields }] = useForm({ | 43 | + const [register, { validateFields, setFieldsValue, resetFields, setProps }] = useForm({ |
41 | schemas: modeMqttForm, | 44 | schemas: modeMqttForm, |
42 | ...modelFormPublicConfig, | 45 | ...modelFormPublicConfig, |
43 | }); | 46 | }); |
@@ -81,11 +84,18 @@ | @@ -81,11 +84,18 @@ | ||
81 | }); | 84 | }); |
82 | }; | 85 | }; |
83 | 86 | ||
87 | + const disabled = ref<boolean>(false); | ||
88 | + const setDisabledProps = (value) => { | ||
89 | + setProps(value); | ||
90 | + disabled.value = true; | ||
91 | + }; | ||
92 | + | ||
84 | const resetValue = () => resetFields(); | 93 | const resetValue = () => resetFields(); |
85 | defineExpose({ | 94 | defineExpose({ |
86 | getValue, | 95 | getValue, |
87 | setValue, | 96 | setValue, |
88 | resetValue, | 97 | resetValue, |
98 | + setDisabledProps, | ||
89 | }); | 99 | }); |
90 | </script> | 100 | </script> |
91 | 101 |
@@ -145,7 +145,6 @@ export const modeMqttForm: FormSchema[] = [ | @@ -145,7 +145,6 @@ 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('执行'); | ||
149 | setFieldsValue({ | 148 | setFieldsValue({ |
150 | password: undefined, | 149 | password: undefined, |
151 | username: undefined, | 150 | username: undefined, |
@@ -8,10 +8,11 @@ | @@ -8,10 +8,11 @@ | ||
8 | import { modeRabbitMqForm } from './config'; | 8 | import { modeRabbitMqForm } from './config'; |
9 | import { modelFormPublicConfig } from '../../../dataflowmodal/config'; | 9 | import { modelFormPublicConfig } from '../../../dataflowmodal/config'; |
10 | 10 | ||
11 | - const [register, { validateFields, setFieldsValue, resetFields }] = useForm({ | ||
12 | - schemas: modeRabbitMqForm, | ||
13 | - ...modelFormPublicConfig, | ||
14 | - }); | 11 | + const [register, { validateFields, setFieldsValue, resetFields, setProps, updateSchema }] = |
12 | + useForm({ | ||
13 | + schemas: modeRabbitMqForm, | ||
14 | + ...modelFormPublicConfig, | ||
15 | + }); | ||
15 | 16 | ||
16 | const getValue = async () => { | 17 | const getValue = async () => { |
17 | const values = await validateFields(); | 18 | const values = await validateFields(); |
@@ -22,10 +23,22 @@ | @@ -22,10 +23,22 @@ | ||
22 | const setValue = (value) => setFieldsValue(value); | 23 | const setValue = (value) => setFieldsValue(value); |
23 | 24 | ||
24 | const resetValue = () => resetFields(); | 25 | const resetValue = () => resetFields(); |
26 | + | ||
27 | + const setDisabledProps = (value) => { | ||
28 | + setProps(value); | ||
29 | + updateSchema({ field: 'clientProperties', componentProps: { disabled: true } }); | ||
30 | + }; | ||
31 | + | ||
32 | + const setCancelDisabled = () => { | ||
33 | + updateSchema({ field: 'clientProperties', componentProps: { disabled: false } }); | ||
34 | + }; | ||
35 | + | ||
25 | defineExpose({ | 36 | defineExpose({ |
26 | getValue, | 37 | getValue, |
27 | setValue, | 38 | setValue, |
28 | resetValue, | 39 | resetValue, |
40 | + setDisabledProps, | ||
41 | + setCancelDisabled, | ||
29 | }); | 42 | }); |
30 | </script> | 43 | </script> |
31 | <style lang="less" scoped></style> | 44 | <style lang="less" scoped></style> |
@@ -104,10 +104,35 @@ | @@ -104,10 +104,35 @@ | ||
104 | if (!findDateFlow) return; | 104 | if (!findDateFlow) return; |
105 | findDateFlow[3](0); | 105 | findDateFlow[3](0); |
106 | }; | 106 | }; |
107 | + | ||
108 | + const setProps = async () => { | ||
109 | + await nextTick(); | ||
110 | + props.dataFlowType === BusinessDataFlowMethodEnum.DATAFLOW_METHOD_KAFKA && | ||
111 | + dataFlowMethodIsKafkaRef.value?.setDisabledProps({ disabled: true }); | ||
112 | + props.dataFlowType === BusinessDataFlowMethodEnum.DATAFLOW_METHOD_MQTT && | ||
113 | + dataFlowMethodIsMqttRef.value?.setDisabledProps({ disabled: true }); | ||
114 | + props.dataFlowType === BusinessDataFlowMethodEnum.DATAFLOW_METHOD_RABBITMQ && | ||
115 | + dataFlowMethodIsRabbitMqRef.value?.setDisabledProps({ disabled: true }); | ||
116 | + props.dataFlowType === BusinessDataFlowMethodEnum.DATAFLOW_METHOD_REST_API && | ||
117 | + dataFlowMethodIsApiRef.value?.setDisabledProps({ disabled: true }); | ||
118 | + }; | ||
119 | + | ||
120 | + const setCancelDisabled = async () => { | ||
121 | + await nextTick(); | ||
122 | + props.dataFlowType === BusinessDataFlowMethodEnum.DATAFLOW_METHOD_KAFKA && | ||
123 | + dataFlowMethodIsKafkaRef.value?.setCancelDisabled(); | ||
124 | + props.dataFlowType === BusinessDataFlowMethodEnum.DATAFLOW_METHOD_RABBITMQ && | ||
125 | + dataFlowMethodIsRabbitMqRef.value?.setCancelDisabled(); | ||
126 | + props.dataFlowType === BusinessDataFlowMethodEnum.DATAFLOW_METHOD_REST_API && | ||
127 | + dataFlowMethodIsApiRef.value?.setCancelDisabled(); | ||
128 | + }; | ||
129 | + | ||
107 | defineExpose({ | 130 | defineExpose({ |
108 | getValue, | 131 | getValue, |
109 | setValue, | 132 | setValue, |
110 | resetValue, | 133 | resetValue, |
134 | + setCancelDisabled, | ||
135 | + setProps, | ||
111 | }); | 136 | }); |
112 | </script> | 137 | </script> |
113 | <style lang="less" scoped> | 138 | <style lang="less" scoped> |
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | <a-upload-dragger | 3 | <a-upload-dragger |
4 | v-model:fileList="fileList.list" | 4 | v-model:fileList="fileList.list" |
5 | name="file" | 5 | name="file" |
6 | + :disabled="disabled" | ||
6 | :multiple="false" | 7 | :multiple="false" |
7 | @change="handleChange($event)" | 8 | @change="handleChange($event)" |
8 | :before-upload="() => false" | 9 | :before-upload="() => false" |
@@ -37,6 +38,10 @@ | @@ -37,6 +38,10 @@ | ||
37 | type: String, | 38 | type: String, |
38 | default: '', | 39 | default: '', |
39 | }, | 40 | }, |
41 | + disabled: { | ||
42 | + type: Boolean, | ||
43 | + default: false, | ||
44 | + }, | ||
40 | }); | 45 | }); |
41 | 46 | ||
42 | const emit = defineEmits(['fileUrlEmit']); | 47 | const emit = defineEmits(['fileUrlEmit']); |
@@ -153,11 +153,14 @@ | @@ -153,11 +153,14 @@ | ||
153 | let getActionFormValue = ref([]); | 153 | let getActionFormValue = ref([]); |
154 | const editEntryIdData = ref([]); | 154 | const editEntryIdData = ref([]); |
155 | const editAlarmConfigData = ref([]); | 155 | const editAlarmConfigData = ref([]); |
156 | - const isUpdate = ref(false); | 156 | + const isUpdate = ref<boolean | number>(false); |
157 | const id = ref(undefined); | 157 | const id = ref(undefined); |
158 | const tenantId = ref(undefined); | 158 | const tenantId = ref(undefined); |
159 | const isView = ref(true); | 159 | const isView = ref(true); |
160 | - const [registerForm, { resetFields, validate, setFieldsValue, getFieldsValue }] = useForm({ | 160 | + const [ |
161 | + registerForm, | ||
162 | + { resetFields, validate, setFieldsValue, getFieldsValue, setProps, updateSchema }, | ||
163 | + ] = useForm({ | ||
161 | labelWidth: 120, | 164 | labelWidth: 120, |
162 | schemas: formSchema, | 165 | schemas: formSchema, |
163 | showActionButtonGroup: false, | 166 | showActionButtonGroup: false, |
@@ -532,6 +535,37 @@ | @@ -532,6 +535,37 @@ | ||
532 | showFooter: unref(isView), | 535 | showFooter: unref(isView), |
533 | loading: false, | 536 | loading: false, |
534 | }); | 537 | }); |
538 | + | ||
539 | + if (isUpdate.value == 3) { | ||
540 | + setProps({ disabled: true }); | ||
541 | + updateSchema({ | ||
542 | + field: 'organizationId', | ||
543 | + componentProps: { apiTreeSelectProps: { disabled: true } }, | ||
544 | + }); | ||
545 | + await nextTick(); | ||
546 | + unref(skipUnwrap.triggerItemRefs)?.forEach((item) => { | ||
547 | + item.setDisabledProps({ disabled: true }); | ||
548 | + }); | ||
549 | + | ||
550 | + unref(skipUnwrap.conditionItemRefs)?.forEach((item) => { | ||
551 | + item.setDisabledProps({ disabled: true }); | ||
552 | + }); | ||
553 | + | ||
554 | + unref(skipUnwrap.actionItemRefs)?.forEach((item) => { | ||
555 | + item.setDisabledProps({ disabled: true }); | ||
556 | + }); | ||
557 | + } else { | ||
558 | + updateSchema({ | ||
559 | + field: 'organizationId', | ||
560 | + componentProps: { apiTreeSelectProps: { disabled: false } }, | ||
561 | + }); | ||
562 | + unref(skipUnwrap.triggerItemRefs)?.forEach((item) => { | ||
563 | + item.setCancelDisabled(); | ||
564 | + }); | ||
565 | + unref(skipUnwrap.conditionItemRefs)?.forEach((item) => { | ||
566 | + item.setCancelDisabled(); | ||
567 | + }); | ||
568 | + } | ||
535 | }); | 569 | }); |
536 | 570 | ||
537 | // 设置设备的options | 571 | // 设置设备的options |
@@ -29,6 +29,7 @@ | @@ -29,6 +29,7 @@ | ||
29 | <template #operationType="{ model, field }"> | 29 | <template #operationType="{ model, field }"> |
30 | <Select | 30 | <Select |
31 | :options="options" | 31 | :options="options" |
32 | + :disabled="disabled" | ||
32 | v-model:value="model[field]" | 33 | v-model:value="model[field]" |
33 | @change="operationType = model[field]" | 34 | @change="operationType = model[field]" |
34 | placeholder="请选择比较类型" | 35 | placeholder="请选择比较类型" |
@@ -39,6 +40,7 @@ | @@ -39,6 +40,7 @@ | ||
39 | <Input v-model:value="model[field]" placeholder="请输入持续时间"> | 40 | <Input v-model:value="model[field]" placeholder="请输入持续时间"> |
40 | <template #addonAfter> | 41 | <template #addonAfter> |
41 | <Select | 42 | <Select |
43 | + :disabled="disabled" | ||
42 | v-model:value="model[`timeUnit`]" | 44 | v-model:value="model[`timeUnit`]" |
43 | :options="timeUnitOptions" | 45 | :options="timeUnitOptions" |
44 | style="width: 60px" | 46 | style="width: 60px" |
@@ -58,7 +60,7 @@ | @@ -58,7 +60,7 @@ | ||
58 | </div> | 60 | </div> |
59 | </template> | 61 | </template> |
60 | <script lang="ts" setup> | 62 | <script lang="ts" setup> |
61 | - import { ref, provide, nextTick } from 'vue'; | 63 | + import { ref, provide, nextTick, unref } from 'vue'; |
62 | import { CollapseContainer } from '/@/components/Container/index'; | 64 | import { CollapseContainer } from '/@/components/Container/index'; |
63 | import { BasicForm, useForm } from '/@/components/Form/index'; | 65 | import { BasicForm, useForm } from '/@/components/Form/index'; |
64 | import { Card, Select, Input, Tooltip } from 'ant-design-vue'; | 66 | import { Card, Select, Input, Tooltip } from 'ant-design-vue'; |
@@ -86,12 +88,13 @@ | @@ -86,12 +88,13 @@ | ||
86 | const emit = defineEmits(['delete']); | 88 | const emit = defineEmits(['delete']); |
87 | const isUpdate = ref(false); | 89 | const isUpdate = ref(false); |
88 | const conditionScreeningRef = ref(); | 90 | const conditionScreeningRef = ref(); |
89 | - const [registerForm, { resetFields, getFieldsValue, updateSchema, setFieldsValue }] = useForm({ | ||
90 | - //TODO-wenwei-修复 | ||
91 | - schemas: cloneDeep(trigger_condition_schema), | ||
92 | - //TODO-wenwei-修复 | ||
93 | - showActionButtonGroup: false, | ||
94 | - }); | 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 | + }); | ||
95 | 98 | ||
96 | const alarmScheduleRef = ref<InstanceType<typeof AlarmSchedule>>(); | 99 | const alarmScheduleRef = ref<InstanceType<typeof AlarmSchedule>>(); |
97 | const getFieldsValueFunc = () => { | 100 | const getFieldsValueFunc = () => { |
@@ -144,6 +147,7 @@ | @@ -144,6 +147,7 @@ | ||
144 | const currentIndex = ref(0); | 147 | const currentIndex = ref(0); |
145 | const [registerModal, { openModal }] = useModal(); | 148 | const [registerModal, { openModal }] = useModal(); |
146 | const handleScheduleChange = (value) => { | 149 | const handleScheduleChange = (value) => { |
150 | + if (unref(disabled)) return; | ||
147 | const index = scheduleOptions.findIndex((item) => item.value === value); | 151 | const index = scheduleOptions.findIndex((item) => item.value === value); |
148 | // 报警日程弹窗 | 152 | // 报警日程弹窗 |
149 | if (index !== 0) { | 153 | if (index !== 0) { |
@@ -164,6 +168,16 @@ | @@ -164,6 +168,16 @@ | ||
164 | currentIndex.value = index; | 168 | currentIndex.value = index; |
165 | }; | 169 | }; |
166 | const scheduleData = ref(null); | 170 | 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 | + }; | ||
167 | defineExpose({ | 181 | defineExpose({ |
168 | getFieldsValue, | 182 | getFieldsValue, |
169 | updateFieldDeviceId, | 183 | updateFieldDeviceId, |
@@ -182,6 +196,8 @@ | @@ -182,6 +196,8 @@ | ||
182 | isUpdate, | 196 | isUpdate, |
183 | alarmScheduleRef, | 197 | alarmScheduleRef, |
184 | updateFieldAttributeFunc, | 198 | updateFieldAttributeFunc, |
199 | + setDisabledProps, | ||
200 | + setCancelDisabled, | ||
185 | }); | 201 | }); |
186 | </script> | 202 | </script> |
187 | <style> | 203 | <style> |
@@ -31,8 +31,11 @@ | @@ -31,8 +31,11 @@ | ||
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'); | ||
34 | onMounted(() => { | 35 | onMounted(() => { |
35 | schemas.value = isType(operationType.value); | 36 | schemas.value = isType(operationType.value); |
37 | + | ||
38 | + if (isViewDisabledBtn == 'isView') setProps({ disabled: true }); | ||
36 | }); | 39 | }); |
37 | watch(operationType, (newValue) => { | 40 | watch(operationType, (newValue) => { |
38 | schemas.value = isType(newValue); | 41 | schemas.value = isType(newValue); |
@@ -47,6 +50,7 @@ | @@ -47,6 +50,7 @@ | ||
47 | getFieldsValue, | 50 | getFieldsValue, |
48 | setFieldsValue, | 51 | setFieldsValue, |
49 | validate, | 52 | validate, |
53 | + setProps, | ||
50 | }, | 54 | }, |
51 | ] = useForm({ | 55 | ] = useForm({ |
52 | showActionButtonGroup: false, | 56 | showActionButtonGroup: false, |
@@ -55,6 +59,7 @@ | @@ -55,6 +59,7 @@ | ||
55 | schemas, | 59 | schemas, |
56 | }); | 60 | }); |
57 | const deleteConditionForm = (index: number) => { | 61 | const deleteConditionForm = (index: number) => { |
62 | + if (isViewDisabledBtn == 'isView') return; | ||
58 | emit('deleteConditionForm', index); | 63 | emit('deleteConditionForm', index); |
59 | }; | 64 | }; |
60 | // ft add | 65 | // ft add |
@@ -8,7 +8,8 @@ | @@ -8,7 +8,8 @@ | ||
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 | <div |
10 | :class="{ 'ml-4': scheduleIndex >= 1, active: scheduleIndex === currentIndex }" | 10 | :class="{ 'ml-4': scheduleIndex >= 1, active: scheduleIndex === currentIndex }" |
11 | - class="cursor-pointer" | 11 | + class="cursor-pointer !p-0" |
12 | + :disabled="disabled" | ||
12 | @click="handleScheduleChange(item.value)" | 13 | @click="handleScheduleChange(item.value)" |
13 | >{{ item.label }}</div | 14 | >{{ item.label }}</div |
14 | > | 15 | > |
@@ -28,6 +29,7 @@ | @@ -28,6 +29,7 @@ | ||
28 | <template #operationType="{ model, field }"> | 29 | <template #operationType="{ model, field }"> |
29 | <Select | 30 | <Select |
30 | :options="options" | 31 | :options="options" |
32 | + :disabled="disabled" | ||
31 | v-model:value="model[field]" | 33 | v-model:value="model[field]" |
32 | @change="operationType = model[field]" | 34 | @change="operationType = model[field]" |
33 | placeholder="请选择比较类型" | 35 | placeholder="请选择比较类型" |
@@ -38,6 +40,7 @@ | @@ -38,6 +40,7 @@ | ||
38 | <Input v-model:value="model[field]" placeholder="请输入持续时间"> | 40 | <Input v-model:value="model[field]" placeholder="请输入持续时间"> |
39 | <template #addonAfter> | 41 | <template #addonAfter> |
40 | <Select | 42 | <Select |
43 | + :disabled="disabled" | ||
41 | v-model:value="model[`timeUnit`]" | 44 | v-model:value="model[`timeUnit`]" |
42 | :options="timeUnitOptions" | 45 | :options="timeUnitOptions" |
43 | style="width: 60px" | 46 | style="width: 60px" |
@@ -71,6 +74,7 @@ | @@ -71,6 +74,7 @@ | ||
71 | import { Icon } from '/@/components/Icon'; | 74 | import { Icon } from '/@/components/Icon'; |
72 | import { useModal } from '/@/components/Modal'; | 75 | import { useModal } from '/@/components/Modal'; |
73 | import { useMessage } from '/@/hooks/web/useMessage'; | 76 | import { useMessage } from '/@/hooks/web/useMessage'; |
77 | + import { unref } from 'vue'; | ||
74 | 78 | ||
75 | const { useByProductGetAttribute } = useCommonFun(); | 79 | const { useByProductGetAttribute } = useCommonFun(); |
76 | defineProps({ | 80 | defineProps({ |
@@ -92,12 +96,13 @@ | @@ -92,12 +96,13 @@ | ||
92 | 96 | ||
93 | const isUpdate = ref(false); | 97 | const isUpdate = ref(false); |
94 | const conditionScreeningRef = ref(); | 98 | const conditionScreeningRef = ref(); |
95 | - const [registerForm, { resetFields, getFieldsValue, updateSchema, setFieldsValue }] = useForm({ | ||
96 | - //TODO-wenwei-修复 | ||
97 | - schemas: cloneDeep(trigger_condition_schema), | ||
98 | - //TODO-wenwei-修复 | ||
99 | - showActionButtonGroup: false, | ||
100 | - }); | 99 | + const [registerForm, { resetFields, getFieldsValue, updateSchema, setFieldsValue, setProps }] = |
100 | + useForm({ | ||
101 | + //TODO-wenwei-修复 | ||
102 | + schemas: cloneDeep(trigger_condition_schema), | ||
103 | + //TODO-wenwei-修复 | ||
104 | + showActionButtonGroup: false, | ||
105 | + }); | ||
101 | 106 | ||
102 | const alarmScheduleRef = ref<InstanceType<typeof AlarmSchedule>>(); | 107 | const alarmScheduleRef = ref<InstanceType<typeof AlarmSchedule>>(); |
103 | 108 | ||
@@ -168,6 +173,7 @@ | @@ -168,6 +173,7 @@ | ||
168 | }; | 173 | }; |
169 | //TODO-fengtao | 174 | //TODO-fengtao |
170 | const handleDelete = (params: { index: number; title: string }) => { | 175 | const handleDelete = (params: { index: number; title: string }) => { |
176 | + if (unref(disabled)) return; | ||
171 | emit('delete', params); | 177 | emit('delete', params); |
172 | }; | 178 | }; |
173 | const operationType = ref<string>(''); | 179 | const operationType = ref<string>(''); |
@@ -192,6 +198,7 @@ | @@ -192,6 +198,7 @@ | ||
192 | const [registerModal, { openModal }] = useModal(); | 198 | const [registerModal, { openModal }] = useModal(); |
193 | const currentIndex = ref(0); | 199 | const currentIndex = ref(0); |
194 | const handleScheduleChange = (value) => { | 200 | const handleScheduleChange = (value) => { |
201 | + if (unref(disabled)) return; | ||
195 | const index = scheduleOptions.findIndex((item) => item.value === value); | 202 | const index = scheduleOptions.findIndex((item) => item.value === value); |
196 | // 报警日程弹窗 | 203 | // 报警日程弹窗 |
197 | if (index !== 0) { | 204 | if (index !== 0) { |
@@ -223,6 +230,16 @@ | @@ -223,6 +230,16 @@ | ||
223 | // console.log(alarmConfigList); | 230 | // console.log(alarmConfigList); |
224 | }; | 231 | }; |
225 | 232 | ||
233 | + const disabled = ref<boolean>(false); | ||
234 | + const setDisabledProps = (value) => { | ||
235 | + setProps(value); | ||
236 | + disabled.value = true; | ||
237 | + }; | ||
238 | + | ||
239 | + const setCancelDisabled = () => { | ||
240 | + disabled.value = false; | ||
241 | + }; | ||
242 | + | ||
226 | defineExpose({ | 243 | defineExpose({ |
227 | getFieldsValueFunc, | 244 | getFieldsValueFunc, |
228 | updateFieldDeviceId, | 245 | updateFieldDeviceId, |
@@ -240,6 +257,8 @@ | @@ -240,6 +257,8 @@ | ||
240 | updateFieldAttributeFunc, | 257 | updateFieldAttributeFunc, |
241 | updateFieldAlarmConfig, | 258 | updateFieldAlarmConfig, |
242 | updateEditFieldAlarmConfig, | 259 | updateEditFieldAlarmConfig, |
260 | + setDisabledProps, | ||
261 | + setCancelDisabled, | ||
243 | }); | 262 | }); |
244 | </script> | 263 | </script> |
245 | 264 |
@@ -24,27 +24,7 @@ | @@ -24,27 +24,7 @@ | ||
24 | defaultValue: option.backgroundColor, | 24 | defaultValue: option.backgroundColor, |
25 | }, | 25 | }, |
26 | }, | 26 | }, |
27 | - { | ||
28 | - field: ComponentConfigFieldEnum.MAX_NUMBER, | ||
29 | - label: '最大值', | ||
30 | - component: 'InputNumber', | ||
31 | - defaultValue: 100, | ||
32 | - componentProps: ({ formActionType }) => { | ||
33 | - const { setFieldsValue } = formActionType; | ||
34 | - return { | ||
35 | - placeholder: '请输入最大值', | ||
36 | - min: 100, | ||
37 | - onChange: async (e) => { | ||
38 | - if (!e) { | ||
39 | - await nextTick(); | ||
40 | - setFieldsValue({ | ||
41 | - [ComponentConfigFieldEnum.MAX_NUMBER]: 100, | ||
42 | - }); | ||
43 | - } | ||
44 | - }, | ||
45 | - }; | ||
46 | - }, | ||
47 | - }, | 27 | + |
48 | { | 28 | { |
49 | field: ComponentConfigFieldEnum.VALUE_SIZE, | 29 | field: ComponentConfigFieldEnum.VALUE_SIZE, |
50 | label: '数值字体大小', | 30 | label: '数值字体大小', |
@@ -90,6 +90,7 @@ export const commonDataSourceSchemas = (): FormSchema[] => { | @@ -90,6 +90,7 @@ export const commonDataSourceSchemas = (): FormSchema[] => { | ||
90 | const isUpdate = unref(mode) === DataActionModeEnum.UPDATE; | 90 | const isUpdate = unref(mode) === DataActionModeEnum.UPDATE; |
91 | const selectWidgetKeys = useSelectWidgetKeys(); | 91 | const selectWidgetKeys = useSelectWidgetKeys(); |
92 | const category = unref(selectWidgetKeys).categoryKey; | 92 | const category = unref(selectWidgetKeys).categoryKey; |
93 | + | ||
93 | return [ | 94 | return [ |
94 | { | 95 | { |
95 | field: DataSourceField.IS_GATEWAY_DEVICE, | 96 | field: DataSourceField.IS_GATEWAY_DEVICE, |
@@ -286,6 +286,7 @@ export const useSocket = (dataSourceRef: Ref<WidgetDataType[]>) => { | @@ -286,6 +286,7 @@ export const useSocket = (dataSourceRef: Ref<WidgetDataType[]>) => { | ||
286 | throw Error(error as string); | 286 | throw Error(error as string); |
287 | } | 287 | } |
288 | }, | 288 | }, |
289 | + autoReconnect: true, | ||
289 | }); | 290 | }); |
290 | 291 | ||
291 | const initSubscribe = () => { | 292 | const initSubscribe = () => { |