From 60751783c2015744b591d0b8baed7bbc9144ea86 Mon Sep 17 00:00:00 2001 From: 100011797 <2642441182@qq.com> Date: Thu, 16 Mar 2023 11:00:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=BE=B9=E7=BC=98=E7=AB=AF=E6=98=A0?= =?UTF-8?q?=E5=B0=84=E7=BB=84=E4=BB=B6=E6=9B=BF=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Instance/Detail/EdgeMap/MSelect.vue | 8 +- .../Instance/Detail/EdgeMap/PatchMapping.vue | 34 +-- .../device/Instance/Detail/EdgeMap/index.vue | 68 +++--- .../Save/action/Device/actions/EditTable.vue | 109 ++++----- .../action/Device/actions/FunctionItem.vue | 117 ++++++++++ .../action/Device/actions/WriteProperty.vue | 220 +++++++++++------- .../Scene/Save/action/Device/actions/index.ts | 10 + .../Save/action/Device/actions/index.vue | 90 ++++--- .../Save/action/Device/device/Device.vue | 7 +- .../action/Device/device/RelationSelect.vue | 56 +++++ .../Scene/Save/action/Device/device/index.vue | 36 +-- .../Scene/Save/action/Device/index.vue | 20 +- 12 files changed, 493 insertions(+), 282 deletions(-) create mode 100644 src/views/rule-engine/Scene/Save/action/Device/actions/FunctionItem.vue create mode 100644 src/views/rule-engine/Scene/Save/action/Device/actions/index.ts create mode 100644 src/views/rule-engine/Scene/Save/action/Device/device/RelationSelect.vue diff --git a/src/views/device/Instance/Detail/EdgeMap/MSelect.vue b/src/views/device/Instance/Detail/EdgeMap/MSelect.vue index 1b66df49..f465c18d 100644 --- a/src/views/device/Instance/Detail/EdgeMap/MSelect.vue +++ b/src/views/device/Instance/Detail/EdgeMap/MSelect.vue @@ -1,14 +1,14 @@ \ No newline at end of file diff --git a/src/views/rule-engine/Scene/Save/action/Device/actions/FunctionItem.vue b/src/views/rule-engine/Scene/Save/action/Device/actions/FunctionItem.vue new file mode 100644 index 00000000..4ac0e416 --- /dev/null +++ b/src/views/rule-engine/Scene/Save/action/Device/actions/FunctionItem.vue @@ -0,0 +1,117 @@ + + + \ No newline at end of file diff --git a/src/views/rule-engine/Scene/Save/action/Device/actions/WriteProperty.vue b/src/views/rule-engine/Scene/Save/action/Device/actions/WriteProperty.vue index d4ac0fba..b9765483 100644 --- a/src/views/rule-engine/Scene/Save/action/Device/actions/WriteProperty.vue +++ b/src/views/rule-engine/Scene/Save/action/Device/actions/WriteProperty.vue @@ -1,50 +1,59 @@ \ No newline at end of file diff --git a/src/views/rule-engine/Scene/Save/action/Device/actions/index.ts b/src/views/rule-engine/Scene/Save/action/Device/actions/index.ts new file mode 100644 index 00000000..4926b165 --- /dev/null +++ b/src/views/rule-engine/Scene/Save/action/Device/actions/index.ts @@ -0,0 +1,10 @@ +export const handleParamsData = (data: any[]): any[] => { + return data?.map(item => { + return { + ...item, + key: item.column, + disabled: !!item.children?.length, + children: handleParamsData(item.children) + } + }) || [] +} \ No newline at end of file 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 c4f27a45..aad5a4ae 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 @@ -22,7 +22,6 @@ showSearch placeholder="请选择功能" v-model:value="modelRef.message.functionId" - @change="(val) => onFunctionChange(val, [])" > - + - + \ No newline at end of file diff --git a/src/views/rule-engine/Scene/Save/action/Device/device/index.vue b/src/views/rule-engine/Scene/Save/action/Device/device/index.vue index 0bffa2b4..bc159f5f 100644 --- a/src/views/rule-engine/Scene/Save/action/Device/device/index.vue +++ b/src/views/rule-engine/Scene/Save/action/Device/device/index.vue @@ -30,13 +30,7 @@ name="selectorValues" :rules="[{ required: true, message: '请选择关系' }]" > - + ([]); const builtInList = ref([]); const tagList = ref([]); -const relationList = ref([]); const TypeList = [ { @@ -199,27 +193,10 @@ const sourceChangeEvent = async () => { const array = filterTree(resp.result as any[]); //判断相同产品才有按变量 // if (props.formProductId === DeviceModel.productId)// TODO - builtInList.value = array; + builtInList.value = [] // array; } }; -const queryRelationList = () => { - NoticeApi.getRelationUsers({ - paging: false, - sorts: [{ name: 'createTime', order: 'desc' }], - terms: [{ termType: 'eq', column: 'objectTypeName', value: '设备' }], - }).then((resp) => { - if (resp.status === 200) { - relationList.value = (resp.result as any[]).map((item) => { - return { - label: item.name, - value: item.relation, - }; - }); - } - }); -}; - const filterType = async () => { const _list = TypeList.filter((item) => item.value === 'fixed'); if (unref(data)?.trigger?.type === 'device') { @@ -266,11 +243,8 @@ const filterType = async () => { } }; -const onSelectorChange = (val: string) => { +const onSelectorChange = () => { modelRef.selectorValues = undefined; - if (val === 'relation') { - queryRelationList(); - } }; const onDeviceChange = (_detail: any) => { @@ -306,7 +280,7 @@ const onTagChange = (val: any[], arr: any[]) => { if (arr) { tagList.value = arr; } - emits('save', unref(modelRef), {}); + emits('save', unref(modelRef), {}, {tagList: tagList.value}); }; const onVariableChange = (val: any, node: 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 b5f87a40..698cab78 100644 --- a/src/views/rule-engine/Scene/Save/action/Device/index.vue +++ b/src/views/rule-engine/Scene/Save/action/Device/index.vue @@ -154,23 +154,23 @@ const onSave = (_data: any) => { productName: DeviceModel.productDetail.name, relationName: DeviceModel.relationName, triggerName: data.value.options?.trigger?.name || '触发设备', - taglist: [], + tagList: [], columns: [], otherColumns: [], }; - _options.name = DeviceModel.deviceDetail?.name; + _options.name = DeviceModel.deviceDetail?.name || DeviceModel.selectorValues?.[0]?.name; const _type = _data.message.messageType; if (_type === 'INVOKE_FUNCTION') { _options.type = '执行'; - _options.properties = DeviceModel.propertiesName; + _options.properties = _data.message.propertiesName; } if (_type === 'READ_PROPERTY') { _options.type = '读取'; - _options.properties = DeviceModel.propertiesName; + _options.properties = _data.message.propertiesName; } if (_type === 'WRITE_PROPERTY') { _options.type = '设置'; - _options.properties = DeviceModel.propertiesName; + _options.properties = _data.message.propertiesName; _options.propertiesValue = typeof DeviceModel.propertiesValue === 'object' ? JSON.stringify(DeviceModel.propertiesValue) @@ -183,7 +183,7 @@ const onSave = (_data: any) => { } } if (_options.selector === 'tag') { - _options.taglist = DeviceModel.tagList.map((it) => ({ + _options.tagList = DeviceModel.tagList.map((it) => ({ name: it.column || it.name, type: it.type ? (it.type === 'and' ? '并且' : '或者') : '', value: it.value, @@ -205,6 +205,10 @@ const save = async (step?: number) => { if (deviceRef.value) { await deviceRef.value?.onFormSave(); current.value = 2; + } else { + if(DeviceModel.selector === 'fixed' && DeviceModel.selectorValues?.length){ + current.value = 2; + } } } else { if (actionRef.value) { @@ -228,8 +232,8 @@ const prev = () => { const saveClick = () => save(); -const onDeviceSave = (_data: any, _detail: any) => { - Object.assign(DeviceModel, _data); +const onDeviceSave = (_data: any, _detail: any, obj?: any) => { + Object.assign(DeviceModel, {..._data, ...obj}); DeviceModel.deviceDetail = _detail; };