Commit 5fb5fef37678bc02c24674d6570829e3b6ef20ab
Merge branch 'ft' into 'main_dev'
fix: 修复Teambition上的问题 See merge request yunteng/thingskit-front!633
Showing
6 changed files
with
28 additions
and
9 deletions
... | ... | @@ -6,6 +6,7 @@ |
6 | 6 | <div style="display: flex; align-items: center"> |
7 | 7 | <div style="width: 245px"> |
8 | 8 | <a-tree-select |
9 | + @change="handleTreeOrg" | |
9 | 10 | v-model:value="model[field]" |
10 | 11 | show-search |
11 | 12 | style="width: 100%" |
... | ... | @@ -417,6 +418,13 @@ |
417 | 418 | }); |
418 | 419 | } |
419 | 420 | |
421 | + const handleTreeOrg = () => { | |
422 | + const clearGatewayId = { | |
423 | + gatewayId: '', | |
424 | + }; | |
425 | + setFieldsValue(clearGatewayId); | |
426 | + }; | |
427 | + | |
420 | 428 | return { |
421 | 429 | resetFields, |
422 | 430 | positionState, |
... | ... | @@ -449,6 +457,7 @@ |
449 | 457 | registerModal, |
450 | 458 | handleOpenOrgDrawer, |
451 | 459 | handleSuccess, |
460 | + handleTreeOrg, | |
452 | 461 | }; |
453 | 462 | }, |
454 | 463 | }); | ... | ... |
... | ... | @@ -95,10 +95,11 @@ |
95 | 95 | openModal(true, modalParams); |
96 | 96 | }; |
97 | 97 | |
98 | - const handleSuccess = ({ rest }) => { | |
98 | + const handleSuccess = () => { | |
99 | 99 | getSelectOptions(); |
100 | - const { id } = rest; | |
101 | - scriptId.value = id; | |
100 | + // 默认禁用 | |
101 | + // const { id } = rest; | |
102 | + // scriptId.value = id; | |
102 | 103 | }; |
103 | 104 | |
104 | 105 | const handleChange = (value) => { |
... | ... | @@ -106,10 +107,18 @@ |
106 | 107 | emits('change', value); |
107 | 108 | }; |
108 | 109 | |
109 | - const setValue = (value) => { | |
110 | - scriptId.value = value; | |
110 | + const getValue = () => { | |
111 | + return scriptId.value; | |
112 | + }; | |
113 | + | |
114 | + const setValue = async (value) => { | |
115 | + const scriptOption = await getAllScriptType(props.scriptType); | |
116 | + if (!scriptOption.map((item) => item.value).includes(value)) { | |
117 | + scriptId.value = null; | |
118 | + } else scriptId.value = value; | |
111 | 119 | }; |
112 | 120 | defineExpose({ |
113 | 121 | setValue, |
122 | + getValue, | |
114 | 123 | }); |
115 | 124 | </script> | ... | ... |
... | ... | @@ -58,6 +58,8 @@ |
58 | 58 | const scriptSelectItemUpRef = ref<InstanceType<typeof ScriptSelectItem>>(); |
59 | 59 | |
60 | 60 | const getFormData = async () => { |
61 | + scriptForm.authScriptId = scriptSelectItemAuthRef.value?.getValue(); | |
62 | + scriptForm.upScriptId = scriptSelectItemUpRef.value?.getValue(); | |
61 | 63 | //业务 网关子设备没有鉴权脚本 |
62 | 64 | if (props.deviceTypeStr === TypeEnum.SENSOR) Reflect.deleteProperty(scriptForm, 'authScriptId'); |
63 | 65 | if (Object.values(scriptForm).some((item) => !item)) { | ... | ... |