diff --git a/.env.development b/.env.development index a7c671d..41af242 100644 --- a/.env.development +++ b/.env.development @@ -4,5 +4,5 @@ ENV_WEBSOCKET_BASE=/ws ENV_STORAGE_WEBSOCKET_BASE=/vwedWs # 开发环境token配置 - 可以手动设置或从另一个项目获取后填入 -ENV_DEV_TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3NjQxNjM2MzIsInVzZXJuYW1lIjoiYWRtaW4ifQ.IC24_YwD10DPM6PYyB-aBHoN4BMmDnQYe_8ZGI-Cyzg +ENV_DEV_TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3NjQ3MDExNDcsInVzZXJuYW1lIjoiYWRtaW4ifQ.NHLOjXm9JblCXXaDmc8PRvqB-uIpjwltrFh2EH4usIc ENV_DEV_TENANT_ID=1000 diff --git a/src/apis/device/api.ts b/src/apis/device/api.ts new file mode 100644 index 0000000..9a8c984 --- /dev/null +++ b/src/apis/device/api.ts @@ -0,0 +1,48 @@ +import http from '@core/http'; + +const enum API { + 根据设备类型查询 = '/device/mapping/queryByType', +} + +/** + * 设备映射数据传输对象 + */ +export interface DeviceMappingDTO { + id: string; + deviceUniqueName: string; + protocolType: string; + mappingType: string; + brandName: string | null; + ipAddress: string | null; + port: number; + slaveId: number; + enabled: number; + sceneId: string | null; +} + +/** + * 设备类型映射 + */ +export const DeviceTypeMapping = { + '0': '非保持呼叫器', + '4': '保持呼叫器', + '1': '门', + '2': '电梯', + '3': '光电传感器' +} as const; + +/** + * 根据设备类型查询所有映射关系 + * @param type 设备类型(必填) + * @returns DeviceMappingDTO[] 设备映射列表 + */ +export async function queryDeviceMappingByType(type: string): Promise { + type ResponseType = DeviceMappingDTO[]; + try { + const response = await http.get(`${API.根据设备类型查询}?type=${type}`); + return response || []; + } catch (error) { + console.error('根据设备类型查询映射关系失败:', error); + return []; + } +} \ No newline at end of file diff --git a/src/apis/device/index.ts b/src/apis/device/index.ts new file mode 100644 index 0000000..308f5ae --- /dev/null +++ b/src/apis/device/index.ts @@ -0,0 +1 @@ +export * from './api'; \ No newline at end of file diff --git a/src/components/card/area-edit-card.vue b/src/components/card/area-edit-card.vue index 185764c..065b28b 100644 --- a/src/components/card/area-edit-card.vue +++ b/src/components/card/area-edit-card.vue @@ -1,10 +1,11 @@