diff --git a/src/api/device/instance.ts b/src/api/device/instance.ts index cac9e9c2..35907a23 100644 --- a/src/api/device/instance.ts +++ b/src/api/device/instance.ts @@ -83,22 +83,22 @@ export const batchDeleteDevice = (data: string[]) => server.put(`/device-instanc * @param type 文件类型 * @returns */ - export const deviceTemplateDownload = (productId: string, type: string) => `${BASE_API_PATH}/device-instance/${productId}/template.${type}` +export const deviceTemplateDownload = (productId: string, type: string) => `${BASE_API_PATH}/device-instance/${productId}/template.${type}` - /** - * 设备导入 - * @param productId 产品id - * @param type 文件类型 - * @returns - */ - export const deviceImport = (productId: string, fileUrl: string, autoDeploy: boolean) => `${BASE_API_PATH}/device-instance/${productId}/import?fileUrl=${fileUrl}&autoDeploy=${autoDeploy}&:X_Access_Token=${LocalStore.get(TOKEN_KEY)}` - - /** - * 设备导出 - * @param productId 产品id - * @param type 文件类型 - * @returns - */ +/** + * 设备导入 + * @param productId 产品id + * @param type 文件类型 + * @returns + */ +export const deviceImport = (productId: string, fileUrl: string, autoDeploy: boolean) => `${BASE_API_PATH}/device-instance/${productId}/import?fileUrl=${fileUrl}&autoDeploy=${autoDeploy}&:X_Access_Token=${LocalStore.get(TOKEN_KEY)}` + +/** + * 设备导出 + * @param productId 产品id + * @param type 文件类型 + * @returns + */ export const deviceExport = (productId: string, type: string) => `${BASE_API_PATH}/device-instance${!!productId ? '/' + productId : ''}/export.${type}` /** @@ -143,7 +143,7 @@ export const _disconnect = (id: string) => server.post(`/device-instance/${id}/d */ export const queryUserListNoPaging = () => server.post(`/user/_query/no-paging`, { paging: false, - sorts: [{name: 'name', order: "asc"}] + sorts: [{ name: 'name', order: "asc" }] }) /** @@ -347,4 +347,59 @@ export const settingProperties = (deviceId: string, data: any) => server.put(`/d * @param data * @returns */ - export const execute = (id: string, action: string, data: any) => server.post(`/device/invoked/${id}/function/${action}`, data) +export const execute = (id: string, action: string, data: any) => server.post(`/device/invoked/${id}/function/${action}`, data) + +/** + * 查询通道列表不分页 + * @param data + * @returns + */ +export const queryChannelNoPaging = (data: any) => server.post(`data-collect/channel/_query/no-paging`, data) + +/** + * 查询采集器列表不分页 + * @param data + * @returns + */ +export const queryCollectorNoPaging = (data: any) => server.post(`/data-collect/collector/_query/no-paging`, data) + +/** + * 查询点位列表不分页 + * @param data + * @returns + */ +export const queryPointNoPaging = (data: any) => server.post(`/data-collect/point/_query/no-paging`, data) + +/** + * 查询映射列表 + * @param thingType + * @param thingId + * @param params + * @returns + */ +export const queryMapping = (thingType: string, thingId: any, params?: any) => server.get(`/things/collector/${thingType}/${thingId}/_query`, params) + +/** + * 删除映射 + * @param thingType + * @param thingId + * @param data + * @returns + */ +export const removeMapping = (thingType: string, thingId: any, data?: any) => server.post(`/things/collector/${thingType}/${thingId}/_delete`, data) + +/** + * 映射树 + * @param data + * @returns + */ +export const treeMapping = (data?: any) => server.post(`/data-collect/channel/_all/tree`, data) + +/** + * 保存映射 + * @param thingId + * @param provider + * @param data + * @returns + */ +export const saveMapping = (thingId: any, provider: string, data?: any) => server.patch(`/things/collector/device/${thingId}/${provider}`, data) \ No newline at end of file diff --git a/src/components/AIcon/index.tsx b/src/components/AIcon/index.tsx index b5257f23..4790d76a 100644 --- a/src/components/AIcon/index.tsx +++ b/src/components/AIcon/index.tsx @@ -49,6 +49,7 @@ const iconKeys = [ 'PartitionOutlined', 'ShareAltOutlined', 'playCircleOutlined', + 'RightOutlined' 'FileTextOutlined', 'UploadOutlined' ] diff --git a/src/components/Search/Item.vue b/src/components/Search/Item.vue index aa82e42f..0e96f020 100644 --- a/src/components/Search/Item.vue +++ b/src/components/Search/Item.vue @@ -110,12 +110,19 @@ import { PropType } from 'vue' import type { SearchItemData, SearchProps, Terms } from './types' import { cloneDeep, get, isArray, isFunction } from 'lodash-es' import { filterTreeSelectNode, filterSelectNode } from '@/utils/comm' +import { useUrlSearchParams } from '@vueuse/core' type ItemType = SearchProps['type'] interface Emit { (e: 'change', data: SearchItemData): void } +type UrlParam = { + q: string | null + target: string | null +} + +const urlParams = useUrlSearchParams('hash') const props = defineProps({ columns: { @@ -134,6 +141,10 @@ const props = defineProps({ termsItem: { type: Object as PropType, default: {} + }, + reset: { + type: Number, + default: 1 } }) @@ -278,28 +289,35 @@ const valueChange = () => { }) } +const handleQuery = (_params: UrlParam) => { + if (_params.q) { + const path = props.index < 4 ? [0, 'terms', props.index - 1] : [1, 'terms', props.index - 4] + const itemData: SearchItemData = get(props.termsItem.terms, path) + if (itemData) { + termsModel.type = itemData.type + termsModel.column = itemData.column + termsModel.termType = itemData.termType + termsModel.value = itemData.value + const item = columnOptionMap.get(itemData.column) + getComponent(item.type) // 处理Item的组件类型 + + // 处理options 以及 request + if ('options' in item) { + handleItemOptions(item.options) + } + } + } +} + handleItem() -watch( props.termsItem, (newValue) => { +nextTick(() => { + handleQuery(urlParams) +}) - const path = props.index < 4 ? [0, 'terms', props.index - 1] : [1, 'terms', props.index - 4] - const itemData: SearchItemData = get(newValue.terms, path) - if (itemData) { - termsModel.type = itemData.type - termsModel.column = itemData.column - termsModel.termType = itemData.termType - termsModel.value = itemData.value - const item = columnOptionMap.get(itemData.column) - getComponent(item.type) // 处理Item的组件类型 - - // 处理options 以及 request - if ('options' in item) { - handleItemOptions(item.options) - } - } else { - handleItem() - } -}, { immediate: true, deep: true }) +watch(() => props.reset, () => { + handleItem() +}) diff --git a/src/components/Search/Search.vue b/src/components/Search/Search.vue index 4abeb789..47a75a26 100644 --- a/src/components/Search/Search.vue +++ b/src/components/Search/Search.vue @@ -4,9 +4,9 @@
- - - + + +
- - - + + +
@@ -40,7 +40,7 @@
- +