fix: 修改场景联动数据显示
This commit is contained in:
parent
7ab063a790
commit
048d8508a6
|
@ -326,13 +326,13 @@ const onFormSave = () => {
|
|||
..._data.message,
|
||||
},
|
||||
});
|
||||
emit('change', {
|
||||
propertiesName:
|
||||
deviceMessageType.value === 'INVOKE_FUNCTION'
|
||||
? _function.value?.name
|
||||
: _property.value?.name,
|
||||
propertiesValue: modelRef.propertiesValue,
|
||||
});
|
||||
// emit('change', {
|
||||
// propertiesName:
|
||||
// deviceMessageType.value === 'INVOKE_FUNCTION'
|
||||
// ? _function.value?.name
|
||||
// : _property.value?.name,
|
||||
// propertiesValue: modelRef.propertiesValue,
|
||||
// });
|
||||
})
|
||||
.catch((err: any) => {
|
||||
reject(err);
|
||||
|
|
|
@ -120,15 +120,31 @@ const onTypeSelect = (key: any, _index: number) => {
|
|||
};
|
||||
|
||||
const onTagSelect = (_data: any, _index: number) => {
|
||||
const newList = [...unref(tagList)];
|
||||
const indexType = newList[_index].type;
|
||||
newList.splice(
|
||||
_index,
|
||||
1,
|
||||
handleItem({ ..._data, value: undefined, type: indexType }),
|
||||
);
|
||||
tagList.value = newList;
|
||||
onValueChange()
|
||||
const indexType = tagList.value[_index].type;
|
||||
const _item = handleItem({ ..._data, value: undefined, type: indexType })
|
||||
tagList.value[_index] = _item
|
||||
const newValue = tagList.value.map((item: any) => {
|
||||
return {
|
||||
column: item.id,
|
||||
type: item?.type,
|
||||
value: item?.value,
|
||||
};
|
||||
});
|
||||
emits('update:value', [{ value: newValue, name: '标签' }]);
|
||||
emits('change', [{ value: newValue, name: '标签' }], tagList.value);
|
||||
};
|
||||
|
||||
const onValueChange = () => {
|
||||
const _data = tagList.value.filter((item) => item?.value !== undefined);
|
||||
const newValue = _data.map((item: any) => {
|
||||
return {
|
||||
column: item.id,
|
||||
type: item?.type,
|
||||
value: item?.value,
|
||||
};
|
||||
});
|
||||
emits('update:value', [{ value: newValue, name: '标签' }]);
|
||||
emits('change', [{ value: newValue, name: '标签' }], _data);
|
||||
};
|
||||
|
||||
watch(
|
||||
|
@ -170,19 +186,6 @@ watch(
|
|||
},
|
||||
);
|
||||
|
||||
const onValueChange = () => {
|
||||
const _data = tagList.value.filter((item) => !!item?.value);
|
||||
const newValue = _data.map((item: any) => {
|
||||
return {
|
||||
column: item.id,
|
||||
type: item?.type,
|
||||
value: item?.value,
|
||||
};
|
||||
});
|
||||
emits('update:value', [{ value: newValue, name: '标签' }]);
|
||||
emits('change', [{ value: newValue, name: '标签' }], _data);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
if(props.value?.[0]?.value){
|
||||
const arr: any[] = []
|
||||
|
|
|
@ -145,10 +145,10 @@ const onSave = (_data: any) => {
|
|||
item.upperKey = 'scene.deviceId';
|
||||
}
|
||||
const _options: any = {
|
||||
name: '-', //设备名称
|
||||
type: '', //类型
|
||||
properties: '', //属性功能
|
||||
propertiesValue: '', //设置功能
|
||||
// name: '-', //设备名称
|
||||
// type: '', //类型
|
||||
// properties: '', //属性功能
|
||||
// propertiesValue: '', //设置功能
|
||||
selector: DeviceModel.selector, //选择器标识
|
||||
triggerName: data.value.options?.trigger?.name || '触发设备',
|
||||
...DeviceOptions.value,
|
||||
|
@ -165,15 +165,18 @@ const onSave = (_data: any) => {
|
|||
_options.propertiesValue =
|
||||
(typeof _options?.propertiesValue === 'object'
|
||||
? JSON.stringify(_options?.propertiesValue)
|
||||
: `${_options?.propertiesValue}`) ||
|
||||
DeviceModel?.selectorValues?.[0]?.value;
|
||||
: _options?.propertiesValue)
|
||||
}
|
||||
emit('save', item, _options);
|
||||
emit('save', item, JSON.parse(JSON.stringify(_options)));
|
||||
};
|
||||
|
||||
const onProductChange = (_val: any, bol: boolean) => {
|
||||
if (!bol) {
|
||||
DeviceModel.selectorValues = undefined;
|
||||
DeviceModel.deviceId = ''
|
||||
DeviceModel.selector = 'fixed',
|
||||
DeviceModel.upperKey = ''
|
||||
DeviceModel.source = 'fixed'
|
||||
const flag = isActionChange(
|
||||
JSON.parse(_val.metadata || '{}'),
|
||||
DeviceModel?.message,
|
||||
|
|
|
@ -519,9 +519,10 @@ const onType = (_type: string) => {
|
|||
*/
|
||||
const onSave = (data: ActionsType, options: any) => {
|
||||
const { key, terms } = _data.value.branches![props.branchesName].then?.[props.thenName].actions?.[props.name]
|
||||
console.log({...props.options, ...options})
|
||||
const actionItem: ActionsType = {
|
||||
...data,
|
||||
options,
|
||||
options: {...props.options, ...options},
|
||||
key,
|
||||
terms
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue