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();