Commit a0d716d5ac1cef97537e21e9d61d1180350efbf0

Authored by xp.Huang
2 parents 5d312776 8fdbd035

Merge branch 'fix/DEFECT-1458' into 'main_dev'

fix: 修改看板管理复制组件后直接编辑选择控制组件时出现的问题

See merge request yunteng/thingskit-front!774
@@ -256,7 +256,7 @@ export const commonDataSourceSchemas = (): FormSchema[] => { @@ -256,7 +256,7 @@ export const commonDataSourceSchemas = (): FormSchema[] => {
256 api: async () => { 256 api: async () => {
257 try { 257 try {
258 if (deviceProfileId) { 258 if (deviceProfileId) {
259 - return await getDeviceAttribute({ 259 + const option = await getDeviceAttribute({
260 deviceProfileId, 260 deviceProfileId,
261 dataType: 261 dataType:
262 (isControlComponent(category!) && 262 (isControlComponent(category!) &&
@@ -265,6 +265,19 @@ export const commonDataSourceSchemas = (): FormSchema[] => { @@ -265,6 +265,19 @@ export const commonDataSourceSchemas = (): FormSchema[] => {
265 ? DataTypeEnum.IS_BOOL 265 ? DataTypeEnum.IS_BOOL
266 : undefined, 266 : undefined,
267 }); 267 });
  268 +
  269 + // 当我们通过复制组件在进行编辑的时候选择控制组件会使不是bool属性的值进行赋值
  270 + if (
  271 + (!option?.length &&
  272 + isControlComponent(category!) &&
  273 + unref(selectWidgetKeys).componentKey !== 'LateralNumericalControl') ||
  274 + isBooleanComponent(unref(selectWidgetKeys))
  275 + ) {
  276 + setFieldsValue({
  277 + [DataSourceField.ATTRIBUTE]: null,
  278 + });
  279 + }
  280 + return option;
268 } 281 }
269 } catch (error) {} 282 } catch (error) {}
270 return []; 283 return [];