diff --git a/src/api/media/device.ts b/src/api/media/device.ts index 4634bfbd..6854d9e4 100644 --- a/src/api/media/device.ts +++ b/src/api/media/device.ts @@ -13,8 +13,10 @@ export default { del: (id: string) => server.remove(`/media/device/${id}`), // 更新通道 updateChannels: (id: string) => server.post(`/media/device/${id}/channels/_sync`), - // 查询产品列表 + // post查询产品列表 queryProductList: (data: any) => server.post(`/device/product/_query/no-paging`, data), + // get获取产品 + getProductList: (data: any) => server.get(`/device/product/_query/no-paging?paging=false`, data), // 快速添加产品 saveProduct: (data: any) => server.post(`/device/product`, data), // 产品发布 diff --git a/src/components/Search/Search.vue b/src/components/Search/Search.vue index 7cd240dc..ccb0e405 100644 --- a/src/components/Search/Search.vue +++ b/src/components/Search/Search.vue @@ -4,6 +4,7 @@ :type='type' :request='saveSearchHistory' :historyRequest='getSearchHistory' + :deleteRequest='deleteSearchHistory' :columns='columns' :class='props.class' @search='searchSubmit' @@ -13,7 +14,7 @@ \ 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; }; diff --git a/src/views/rule-engine/Scene/Save/action/ListItem/FilterCondition.vue b/src/views/rule-engine/Scene/Save/action/ListItem/FilterCondition.vue index 9ca8fc29..a8b798c9 100644 --- a/src/views/rule-engine/Scene/Save/action/ListItem/FilterCondition.vue +++ b/src/views/rule-engine/Scene/Save/action/ListItem/FilterCondition.vue @@ -19,7 +19,7 @@ :options='columnOptions' icon='icon-zhihangdongzuoxie-1' type='column' - value-name='column' + value-name='id' label-name='fullName' placeholder='请选择参数' v-model:value='paramsValue.column' @@ -144,7 +144,7 @@ const paramsValue = reactive({ }) const showDelete = ref(false) -const columnOptions: any = inject(ContextKey) // +const columnOptions: any = inject('filter-params') // const termTypeOptions = ref>([]) // 条件值 const valueOptions = ref([]) // 默认手动输入下拉 const metricOption = ref([]) // @@ -183,7 +183,8 @@ const handOptionByColumn = (option: any) => { } watchEffect(() => { - const option = getOption(columnOptions.value, paramsValue.column, 'column') + const option = getOption(columnOptions.value, paramsValue.column, 'id') + console.log(option) handOptionByColumn(option) }) diff --git a/src/views/rule-engine/Scene/Save/action/ListItem/FilterGroup.vue b/src/views/rule-engine/Scene/Save/action/ListItem/FilterGroup.vue index d62a5062..9542aecc 100644 --- a/src/views/rule-engine/Scene/Save/action/ListItem/FilterGroup.vue +++ b/src/views/rule-engine/Scene/Save/action/ListItem/FilterGroup.vue @@ -1,11 +1,180 @@