diff --git a/src/api/cabinet/mqttServer.ts b/src/api/cabinet/mqttServer.ts new file mode 100644 index 0000000..6009a29 --- /dev/null +++ b/src/api/cabinet/mqttServer.ts @@ -0,0 +1,52 @@ +import { http } from '@/utils/http'; + +export interface SearchMqttServerQuery extends BasePageQuery { + serverUrl?: string; + username?: string; +} + +export interface MqttServerDTO { + mqttServerId?: number; + serverUrl: string; + username: string; + password: string; + topicFilter: string; + publishTopic: string; +} + +export interface AddMqttServerCommand { + serverUrl: string; + username: string; + password: string; + topicFilter: string; + publishTopic: string; +} + +export interface UpdateMqttServerCommand extends AddMqttServerCommand { + mqttServerId: number; +} + +export const getMqttServerList = (params?: SearchMqttServerQuery) => { + return http.request>>('get', '/cabinet/mqttServer', { + params + }); +}; + +export const addMqttServer = (data: AddMqttServerCommand) => { + return http.request>('post', '/cabinet/mqttServer', { + data + }); +}; + +export const updateMqttServer = (serverId: number, data: UpdateMqttServerCommand) => { + return http.request>('put', `/cabinet/mqttServer/${serverId}`, { + data: { + ...data, + mqttServerId: serverId + } + }); +}; + +export const deleteMqttServer = (ids: string) => { + return http.request>('delete', `/cabinet/mqttServer/${ids}`); +}; \ No newline at end of file diff --git a/src/api/cabinet/smart-cabinet.ts b/src/api/cabinet/smart-cabinet.ts index d494d78..806cc1a 100644 --- a/src/api/cabinet/smart-cabinet.ts +++ b/src/api/cabinet/smart-cabinet.ts @@ -11,6 +11,7 @@ export interface SmartCabinetDTO { cabinetId?: number; cabinetName: string; cabinetType: number; + mqttServerId?: number; templateNo: string; lockControlNo: number; location: number; @@ -20,12 +21,20 @@ export interface SmartCabinetDTO { export interface AddSmartCabinetCommand { cabinetName: string; cabinetType: number; + mqttServerId?: number; templateNo: string; lockControlNo: number; location: number; } -export interface UpdateSmartCabinetCommand extends AddSmartCabinetCommand { +export interface UpdateSmartCabinetCommand { + cabinetId: number; + cabinetName?: string; + cabinetType?: number; + mqttServerId?: number; + templateNo?: string; + lockControlNo?: number; + location?: number; } export interface AllCabinetDataDTO { diff --git a/src/views/cabinet/mqtt-server/index.vue b/src/views/cabinet/mqtt-server/index.vue new file mode 100644 index 0000000..bc2f38f --- /dev/null +++ b/src/views/cabinet/mqtt-server/index.vue @@ -0,0 +1,181 @@ + + + \ No newline at end of file diff --git a/src/views/cabinet/mqtt-server/mqtt-server-form-modal.vue b/src/views/cabinet/mqtt-server/mqtt-server-form-modal.vue new file mode 100644 index 0000000..d65d6f4 --- /dev/null +++ b/src/views/cabinet/mqtt-server/mqtt-server-form-modal.vue @@ -0,0 +1,112 @@ + + + \ No newline at end of file diff --git a/src/views/cabinet/smart-cabinet/GatewayConfigModal.vue b/src/views/cabinet/smart-cabinet/GatewayConfigModal.vue new file mode 100644 index 0000000..8fbb8e6 --- /dev/null +++ b/src/views/cabinet/smart-cabinet/GatewayConfigModal.vue @@ -0,0 +1,90 @@ + + + \ No newline at end of file diff --git a/src/views/cabinet/smart-cabinet/index.vue b/src/views/cabinet/smart-cabinet/index.vue index 522aef7..1a35b81 100644 --- a/src/views/cabinet/smart-cabinet/index.vue +++ b/src/views/cabinet/smart-cabinet/index.vue @@ -14,6 +14,7 @@ import { ElMessage, ElMessageBox } from "element-plus"; import router from "@/router"; import { deleteSmartCabinet } from "@/api/cabinet/smart-cabinet"; import { useMultiTagsStoreHook } from "@/store/modules/multiTags"; +import GatewayConfigModal from "./GatewayConfigModal.vue"; defineOptions({ name: "SmartCabinet" @@ -39,6 +40,8 @@ const dataList = ref([]); const multipleSelection = ref([]); const editVisible = ref(false); const currentRow = ref(); +const gatewayConfigVisible = ref(false); +const currentCabinetId = ref(); const getList = async () => { try { @@ -130,6 +133,11 @@ const handleEdit = (row: SmartCabinetDTO) => { editVisible.value = true; }; +const handleGatewayConfig = (row: SmartCabinetDTO) => { + currentCabinetId.value = row.cabinetId; + gatewayConfigVisible.value = true; +}; + getList(); @@ -177,6 +185,7 @@ getList(); +