Commit 2ac743be7a9197c5020d928ae3b8384651905983

Authored by xp.Huang
2 parents 89a0ad8e 0b6a554e

Merge branch 'ww' into 'main'

fix: 修复数据流转RabbitMQ ClientProperties字段为空时,需要保存为空对象

See merge request yunteng/thingskit-front!501
@@ -14,7 +14,7 @@ VITE_GLOB_PUBLIC_PATH = / @@ -14,7 +14,7 @@ VITE_GLOB_PUBLIC_PATH = /
14 # VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]] 14 # VITE_PROXY = [["/api","http://101.133.234.90:8080/api"]]
15 # 线上测试环境 15 # 线上测试环境
16 # VITE_PROXY = [["/api","http://localhost:8080/api"],["/thingskit-drawio","http://localhost:3000/"]] 16 # VITE_PROXY = [["/api","http://localhost:8080/api"],["/thingskit-drawio","http://localhost:3000/"]]
17 -VITE_PROXY = [["/api","http://222.180.200.114:48080/api"],["/thingskit-drawio","http://localhost:3000/"]] 17 +VITE_PROXY = [["/api","http://222.180.200.114:48080/api"],["/thingskit-drawio","http://localhost:3000/"],["/large-designer", "http://localhost:5555/large-designer/"]]
18 # VITE_PROXY = [["/api","http://121.37.251.8:8080/api"],["/thingskit-drawio","http://localhost:3000/"]] 18 # VITE_PROXY = [["/api","http://121.37.251.8:8080/api"],["/thingskit-drawio","http://localhost:3000/"]]
19 # VITE_PROXY = [["/api","http://192.168.10.103:8080/api"],["/thingskit-drawio","http://192.168.10.136:8080/api"]] 19 # VITE_PROXY = [["/api","http://192.168.10.103:8080/api"],["/thingskit-drawio","http://192.168.10.136:8080/api"]]
20 20
@@ -259,6 +259,12 @@ @@ -259,6 +259,12 @@
259 delete allPostForm.id; 259 delete allPostForm.id;
260 } 260 }
261 }; 261 };
  262 + const setClientProperties = (record: Recordable) => {
  263 + const configuration = Reflect.get(record, 'configuration');
  264 + const clientProperties = Reflect.get(configuration, 'clientProperties');
  265 + !clientProperties && record.configuration && (record.configuration.clientProperties = {});
  266 + };
  267 +
262 const handleSubmit = async (closeModalAfterSuccess = true) => { 268 const handleSubmit = async (closeModalAfterSuccess = true) => {
263 try { 269 try {
264 closeModalAfterSuccess && setModalProps({ confirmLoading: true }); 270 closeModalAfterSuccess && setModalProps({ confirmLoading: true });
@@ -278,7 +284,7 @@ @@ -278,7 +284,7 @@
278 if (isApiHeaders && Object.values(isApiHeaders).includes('')) { 284 if (isApiHeaders && Object.values(isApiHeaders).includes('')) {
279 return createMessage.error('请填写属性'); 285 return createMessage.error('请填写属性');
280 } 286 }
281 - Object.assign(allPostForm, { clientProperties: {} }); 287 + setClientProperties(allPostForm);
282 const res = await postAddConvertApi(allPostForm); 288 const res = await postAddConvertApi(allPostForm);
283 if (res) { 289 if (res) {
284 closeModalAfterSuccess && closeModal(); 290 closeModalAfterSuccess && closeModal();
@@ -304,10 +310,11 @@ @@ -304,10 +310,11 @@
304 } 310 }
305 } 311 }
306 Object.assign(noEditObj, getTypeObj, { 312 Object.assign(noEditObj, getTypeObj, {
307 - clientProperties: {},  
308 datasourceType: allPostForm.datasourceType, 313 datasourceType: allPostForm.datasourceType,
309 datasourceContent: allPostForm.datasourceContent, 314 datasourceContent: allPostForm.datasourceContent,
310 }); 315 });
  316 + setClientProperties(allPostForm);
  317 + setClientProperties(noEditObj);
311 const res = await postAddConvertApi(isEdit.value ? noEditObj : allPostForm); 318 const res = await postAddConvertApi(isEdit.value ? noEditObj : allPostForm);
312 if (res) { 319 if (res) {
313 closeModalAfterSuccess && closeModal(); 320 closeModalAfterSuccess && closeModal();
@@ -587,7 +587,9 @@ export const actionSchema: FormSchema[] = [ @@ -587,7 +587,9 @@ export const actionSchema: FormSchema[] = [
587 placeholder: '请选择服务', 587 placeholder: '请选择服务',
588 api: async (params: Recordable) => { 588 api: async (params: Recordable) => {
589 try { 589 try {
590 - const record = await getModelServices(params as Record<'deviceProfileId', string>); 590 + if (!Reflect.get(params, 'deviceProfileId')) return [];
  591 + const record =
  592 + (await getModelServices(params as Record<'deviceProfileId', string>)) || [];
591 const selected = record.find((item) => item.id === thingsModelId); 593 const selected = record.find((item) => item.id === thingsModelId);
592 selected && 594 selected &&
593 updateSchema({ 595 updateSchema({