Showing
1 changed file
with
4 additions
and
0 deletions
... | ... | @@ -44,12 +44,14 @@ |
44 | 44 | const aceEditor = ref(); |
45 | 45 | const aceRef = ref(); |
46 | 46 | const getTitle = computed(() => (isUpdate.value ? '编辑转换脚本' : '新增转换脚本')); |
47 | + const editId = ref(''); | |
47 | 48 | const [register, { setDrawerProps, closeDrawer }] = useDrawerInner((data) => { |
48 | 49 | resetFields(); |
49 | 50 | setDrawerProps({ confirmLoading: false }); |
50 | 51 | isUpdate.value = data.isUpdate; |
51 | 52 | initEditor(data.record?.configuration.jsScript); |
52 | 53 | if (isUpdate.value) { |
54 | + editId.value = data.record.id; | |
53 | 55 | setFieldsValue(data.record); |
54 | 56 | } |
55 | 57 | }); |
... | ... | @@ -84,6 +86,7 @@ |
84 | 86 | emit('isStatus', { status: 1, jsCode }); |
85 | 87 | }; |
86 | 88 | const handleSubmit = async () => { |
89 | + const editIdPost = isUpdate.value ? { id: editId.value } : {}; | |
87 | 90 | try { |
88 | 91 | setDrawerProps({ confirmLoading: true }); |
89 | 92 | const fieldsValue = await validate(); |
... | ... | @@ -94,6 +97,7 @@ |
94 | 97 | }, |
95 | 98 | type: 'org.thingsboard.rule.engine.transform.TbTransformMsgNode', |
96 | 99 | ...fieldsValue, |
100 | + ...editIdPost, | |
97 | 101 | }); |
98 | 102 | closeDrawer(); |
99 | 103 | emit('success'); | ... | ... |