Commit 8fdbd03516357ed1a5fc5076fb810b2db6c7881b

Authored by loveumiko
1 parent 433e9383

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

@@ -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 [];