diff --git a/src/api/device/group.js b/src/api/device/group.js
new file mode 100644
index 0000000..a82107f
--- /dev/null
+++ b/src/api/device/group.js
@@ -0,0 +1,60 @@
+import request from "@/utils/request";
+
+// 查询设备分组列表
+export function listGroup(query) {
+ return request({
+ url: "/device/group/list",
+ method: "get",
+ params: query,
+ });
+}
+
+// 查询设备分组详细
+export function getGroup(groupId) {
+ return request({
+ url: "/device/group/" + groupId,
+ method: "get",
+ });
+}
+
+// 新增设备分组
+export function addGroup(data) {
+ return request({
+ url: "/device/group",
+ method: "post",
+ data: data,
+ });
+}
+
+// 修改设备分组
+export function updateGroup(data) {
+ return request({
+ url: "/device/group",
+ method: "put",
+ data: data,
+ });
+}
+
+// 删除设备分组
+export function delGroup(groupId) {
+ return request({
+ url: "/device/group/" + groupId,
+ method: "delete",
+ });
+}
+
+// 分配设备
+export function assignDevice(groupId, deviceIds) {
+ return request({
+ url: `/device/group/allot/${groupId}/${deviceIds}`,
+ method: "post",
+ });
+}
+
+// 分配设备
+export function unAssignDevice(deviceIds) {
+ return request({
+ url: `/device/group/deleteAllot/${deviceIds}`,
+ method: "delete",
+ });
+}
diff --git a/src/assets/icons/svg/group.svg b/src/assets/icons/svg/group.svg
new file mode 100644
index 0000000..0c145b6
--- /dev/null
+++ b/src/assets/icons/svg/group.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/components/TableSelect/index.vue b/src/components/TableSelect/index.vue
index 20ca3a2..7b6a0e6 100644
--- a/src/components/TableSelect/index.vue
+++ b/src/components/TableSelect/index.vue
@@ -1,10 +1,45 @@
-
+
-
-
-
-
+
+
+
+
+
+ {{ button.label }}
+
+
+
-
-
- 确认
-
-
+
+
+
+
-
-
+
diff --git a/src/constant/dict.js b/src/constant/dict.js
index c5c8809..e5c2365 100644
--- a/src/constant/dict.js
+++ b/src/constant/dict.js
@@ -86,13 +86,11 @@ export const firmwareLatestTypeOptions = [
{
label: "否",
value: 0,
- tag: "danger",
elTagType: "danger",
},
{
label: "是",
value: 1,
- tag: "success",
elTagType: "success",
},
];
@@ -117,25 +115,21 @@ export const deviceStatusMap = [
{
label: "未激活",
value: 1,
- tag: "info",
elTagType: "info",
},
{
label: "禁用",
value: 2,
- tag: "danger",
elTagType: "danger",
},
{
label: "在线",
value: 3,
- tag: "success",
elTagType: "success",
},
{
label: "离线",
value: 4,
- tag: "warning",
elTagType: "warning",
},
];
@@ -178,17 +172,28 @@ export const isShadowDict = [
elTagType: "success",
},
];
-export const statusOptions = [
+export const tenantStatusOptions = [
+ {
+ label: "正常",
+ value: "0",
+ elTagType: "success",
+ },
+ {
+ label: "禁用",
+ value: "1",
+ elTagType: "danger",
+ },
+];
+
+export const deviceGroupStatusDict = [
{
label: "正常",
value: "0",
- tag: "success",
elTagType: "success",
},
{
label: "禁用",
value: "1",
- tag: "danger",
elTagType: "danger",
},
];
diff --git a/src/views/device/group/index.vue b/src/views/device/group/index.vue
new file mode 100644
index 0000000..e2caaac
--- /dev/null
+++ b/src/views/device/group/index.vue
@@ -0,0 +1,462 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 搜索
+
+ 重置
+
+
+
+
+
+ 新增
+
+
+
+ 修改
+
+
+
+ 删除
+
+
+
+ 导出
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 修改
+
+ 删除
+
+ {
+ activeGroupId = row.groupId;
+ showSelectDevice = true;
+ }
+ "
+ >分配设备
+
+ {
+ activeGroupId = row.groupId;
+ showAssignedDevice = true;
+ }
+ "
+ >
+ 已分配设备
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/iot/device/index.vue b/src/views/iot/device/index.vue
index 16bfeff..dba50b2 100644
--- a/src/views/iot/device/index.vue
+++ b/src/views/iot/device/index.vue
@@ -33,13 +33,13 @@
/>
-
-
-
+
+
+
+
+
+
+
@@ -146,8 +146,8 @@
搜索
+ >搜索
+
重置
@@ -256,7 +256,14 @@
-
+
+
+
+ {{ row.groupName }}
+
+
+
+
删除
+ >删除
+
@@ -578,13 +578,7 @@
- 添加执行动作
@@ -592,8 +586,8 @@
diff --git a/src/views/system/tenant/index.vue b/src/views/system/tenant/index.vue
index cfdfc38..64378d7 100644
--- a/src/views/system/tenant/index.vue
+++ b/src/views/system/tenant/index.vue
@@ -127,7 +127,7 @@
@@ -331,7 +331,7 @@ import {
updateTenant,
} from "@/api/system/tenant";
import { resetUserPwd } from "@/api/system/user";
-import { statusOptions } from "@/constant/dict";
+import { tenantStatusOptions } from "@/constant/dict";
import DictTag from "@/components/DictTag/index.vue";
const { proxy } = getCurrentInstance();