Commit de6465fb6de3b7889fc8ab33207c2c8ff2caf098
1 parent
398ecbe0
fix: DEFECT-1278 修复产品配置的转换函数禁用后,编辑产品,脚本回显为ID问题
Showing
3 changed files
with
13 additions
and
4 deletions
| @@ -167,9 +167,8 @@ | @@ -167,9 +167,8 @@ | ||
| 167 | }, | 167 | }, |
| 168 | }); | 168 | }); |
| 169 | }; | 169 | }; |
| 170 | - const updateDisabled = async (e) => { | 170 | + const updateDisabled = async () => { |
| 171 | await nextTick(); | 171 | await nextTick(); |
| 172 | - tcpRef.value?.updateDisabled(e); | ||
| 173 | }; | 172 | }; |
| 174 | defineExpose({ | 173 | defineExpose({ |
| 175 | getFormData, | 174 | getFormData, |
| @@ -106,10 +106,18 @@ | @@ -106,10 +106,18 @@ | ||
| 106 | emits('change', value); | 106 | emits('change', value); |
| 107 | }; | 107 | }; |
| 108 | 108 | ||
| 109 | - const setValue = (value) => { | ||
| 110 | - scriptId.value = value; | 109 | + const getValue = () => { |
| 110 | + return scriptId.value; | ||
| 111 | + }; | ||
| 112 | + | ||
| 113 | + const setValue = async (value) => { | ||
| 114 | + const scriptOption = await getAllScriptType(props.scriptType); | ||
| 115 | + if (!scriptOption.map((item) => item.value).includes(value)) { | ||
| 116 | + scriptId.value = null; | ||
| 117 | + } else scriptId.value = value; | ||
| 111 | }; | 118 | }; |
| 112 | defineExpose({ | 119 | defineExpose({ |
| 113 | setValue, | 120 | setValue, |
| 121 | + getValue, | ||
| 114 | }); | 122 | }); |
| 115 | </script> | 123 | </script> |
| @@ -58,6 +58,8 @@ | @@ -58,6 +58,8 @@ | ||
| 58 | const scriptSelectItemUpRef = ref<InstanceType<typeof ScriptSelectItem>>(); | 58 | const scriptSelectItemUpRef = ref<InstanceType<typeof ScriptSelectItem>>(); |
| 59 | 59 | ||
| 60 | const getFormData = async () => { | 60 | const getFormData = async () => { |
| 61 | + scriptForm.authScriptId = scriptSelectItemAuthRef.value?.getValue(); | ||
| 62 | + scriptForm.upScriptId = scriptSelectItemUpRef.value?.getValue(); | ||
| 61 | //业务 网关子设备没有鉴权脚本 | 63 | //业务 网关子设备没有鉴权脚本 |
| 62 | if (props.deviceTypeStr === TypeEnum.SENSOR) Reflect.deleteProperty(scriptForm, 'authScriptId'); | 64 | if (props.deviceTypeStr === TypeEnum.SENSOR) Reflect.deleteProperty(scriptForm, 'authScriptId'); |
| 63 | if (Object.values(scriptForm).some((item) => !item)) { | 65 | if (Object.values(scriptForm).some((item) => !item)) { |