diff --git a/src/views/rule-engine/Scene/Save/action/Device/actions/index.vue b/src/views/rule-engine/Scene/Save/action/Device/actions/index.vue index f48ed3d6..0ad79958 100644 --- a/src/views/rule-engine/Scene/Save/action/Device/actions/index.vue +++ b/src/views/rule-engine/Scene/Save/action/Device/actions/index.vue @@ -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); diff --git a/src/views/rule-engine/Scene/Save/action/Device/device/Tag.vue b/src/views/rule-engine/Scene/Save/action/Device/device/Tag.vue index da587184..3ff3a12b 100644 --- a/src/views/rule-engine/Scene/Save/action/Device/device/Tag.vue +++ b/src/views/rule-engine/Scene/Save/action/Device/device/Tag.vue @@ -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[] = [] diff --git a/src/views/rule-engine/Scene/Save/action/Device/index.vue b/src/views/rule-engine/Scene/Save/action/Device/index.vue index e456eb25..6ddf9adc 100644 --- a/src/views/rule-engine/Scene/Save/action/Device/index.vue +++ b/src/views/rule-engine/Scene/Save/action/Device/index.vue @@ -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, diff --git a/src/views/rule-engine/Scene/Save/action/ListItem/Item.vue b/src/views/rule-engine/Scene/Save/action/ListItem/Item.vue index fec18919..3db797eb 100644 --- a/src/views/rule-engine/Scene/Save/action/ListItem/Item.vue +++ b/src/views/rule-engine/Scene/Save/action/ListItem/Item.vue @@ -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 }