From 7ae9ca16244a0888a3bf6a47b7fcb5152aba620f Mon Sep 17 00:00:00 2001 From: K <1175047471@qq.com> Date: Tue, 12 Mar 2024 17:36:35 +0800 Subject: [PATCH] =?UTF-8?q?fix(device):=20=E6=B6=88=E6=81=AF=E4=B8=8B?= =?UTF-8?q?=E5=8F=91=E5=8F=82=E6=95=B0=E4=BC=A0=E9=80=92=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/device-manage/device/index.ts | 3 ++- src/api/product/topic.ts | 9 --------- src/api/product/types.ts | 2 +- .../device-manage/device/components/SendCommandModal.vue | 6 +++--- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/api/device-manage/device/index.ts b/src/api/device-manage/device/index.ts index ea786f5d..5682289e 100644 --- a/src/api/device-manage/device/index.ts +++ b/src/api/device-manage/device/index.ts @@ -1,4 +1,5 @@ import type { Device, DevicePropertie, GetDeviceListParams } from './types' +import type { Topic } from '@/api/product/types' import { defHttp } from '@/utils/http/axios' export function getDeviceList(params: GetDeviceListParams) { @@ -51,7 +52,7 @@ export function getDeviceProperties(modelId: string, deviceSn: string) { } export function getDeviceTopicList(params: PageParam & { deviceId: string }) { - return defHttp.get({ + return defHttp.get>({ url: '/device/topic/page', params, }) diff --git a/src/api/product/topic.ts b/src/api/product/topic.ts index 07c8bcff..893fc562 100644 --- a/src/api/product/topic.ts +++ b/src/api/product/topic.ts @@ -27,12 +27,3 @@ export function deleteTopic(id: string) { url: `/product/topic/remove?id=${id}`, }) } - -export function getAllTopics(productId: string) { - return defHttp.get({ - url: '/product/topic/list', - params: { - productId, - }, - }) -} diff --git a/src/api/product/types.ts b/src/api/product/types.ts index 6ad40e88..48cd6cd9 100644 --- a/src/api/product/types.ts +++ b/src/api/product/types.ts @@ -30,7 +30,7 @@ export enum TopicType { Custom = 2, } -export interface GetTopicListPrams { +export interface GetTopicListPrams extends PageParam { productId?: string topicCategory?: TopicType } diff --git a/src/views/device-manage/device/components/SendCommandModal.vue b/src/views/device-manage/device/components/SendCommandModal.vue index 7e4e764a..0b8a3dc4 100644 --- a/src/views/device-manage/device/components/SendCommandModal.vue +++ b/src/views/device-manage/device/components/SendCommandModal.vue @@ -3,10 +3,10 @@ import { BasicModal, useModalInner } from '@/components/Modal' import type { FormSchema, FormSchemaInner, Rule } from '@/components/Form' import { BasicForm, useForm } from '@/components/Form' import { CloudCommandType } from '@/api/device-manage/device/types' -import { getAllTopics } from '@/api/product/topic' import { sendCommandToDevice, sendMessageToDevice } from '@/api/device-manage/device/cloud-command' import CodeEditor from '@/components/CodeEditor/src/CodeEditor.vue' import { getAllModelAttributes } from '@/api/product/model' +import { getDeviceTopicList } from '@/api/device-manage/device' import { ModelAttributeDataTypesEnum, type SimpleAttribute } from '@/api/product/types' import { useMessage } from '@/hooks/web/useMessage' @@ -109,8 +109,8 @@ const MessageSchemas: FormSchema[] = [ required: true, component: 'ApiSelect', componentProps: { - api: () => getAllTopics(productId!), - valueField: 'id', + api: async () => (await getDeviceTopicList({ deviceId, current: 1, size: 500 })).records, + valueField: 'topic', labelField: 'topic', }, },