From 7118999910d1d199ce272c6b704db5922ea122d5 Mon Sep 17 00:00:00 2001 From: hx <190679152@qq.com> Date: Mon, 9 Mar 2026 20:29:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/device/device.js | 16 ++++ src/views/device/device/index.vue | 123 ++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+) diff --git a/src/api/device/device.js b/src/api/device/device.js index 8233c84..bf2ce68 100644 --- a/src/api/device/device.js +++ b/src/api/device/device.js @@ -96,3 +96,19 @@ export function batchActivateDevice(ids) { } }) } + +export function claimDeviceBatch(data) { + return request({ + url: '/device/device/claim/batch', + method: 'post', + data: data + }) +} + +export function listAllDevice(query) { + return request({ + url: '/device/device/AllDeviceList', + method: 'get', + params: query + }) +} \ No newline at end of file diff --git a/src/views/device/device/index.vue b/src/views/device/device/index.vue index fc3d5f0..9458777 100644 --- a/src/views/device/device/index.vue +++ b/src/views/device/device/index.vue @@ -61,6 +61,25 @@ >导入 + + 认领设备 + + + 批量激活 + @@ -406,6 +473,7 @@ import { delDevice, addDevice, updateDevice, + batchActivateDevice, exportDevice, getBatchNo, } from "@/api/device/device"; @@ -413,11 +481,13 @@ import { import { importDeviceSync } from "@/api/device/device"; // 导入企业选择组件 import BusinessSelect from "@/components/business/BusinessSelect"; // 替换为实际组件路径 +import DeviceClaimDialog from "@/components/device"; export default { name: "Device", components: { BusinessSelect, + DeviceClaimDialog, }, data() { return { @@ -440,6 +510,14 @@ export default { title: "", // 是否显示新增/修改弹窗 open: false, + // 是否显示详情弹窗 + detailOpen: false, + // 详情加载状态 + detailLoading: false, + // 详情数据 + detailForm: null, + // 是否显示认领设备弹窗 + claimDeviceOpen: false, // 是否显示导入弹窗 importOpen: false, // 导入加载状态 @@ -574,6 +652,51 @@ export default { this.single = selection.length !== 1; this.multiple = !selection.length; }, + /** 打开认领设备弹窗 */ + handleClaimDevice() { + this.claimDeviceOpen = true; + }, + /** 批量激活设备 */ + handleBatchActivate() { + if (!this.ids.length) { + this.$message.warning("请先勾选需要激活的设备"); + return; + } + this.$confirm(`确认激活选中的 ${this.ids.length} 台设备吗?`, "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }) + .then(() => { + return batchActivateDevice(this.ids); + }) + .then(() => { + this.$message.success("批量激活成功"); + this.getList(); + }) + .catch(() => {}); + }, + /** 查看详情 */ + handleDetail(row) { + if (!row || !row.id) { + return; + } + this.detailOpen = true; + this.detailLoading = true; + this.detailForm = { ...row }; + getDevice(row.id) + .then((response) => { + this.detailForm = response.data || { ...row }; + }) + .finally(() => { + this.detailLoading = false; + }); + }, + /** 认领成功回调 */ + handleClaimSuccess() { + this.claimDeviceOpen = false; + this.getList(); + }, /** 新增按钮操作 */ handleAdd() { this.reset();