diff --git a/src/api/system/department.ts b/src/api/system/department.ts
index 0a249ffe..e61b4de0 100644
--- a/src/api/system/department.ts
+++ b/src/api/system/department.ts
@@ -1,18 +1,27 @@
import server from '@/utils/request';
// 获取部门数据
-export const getTreeData_api = (data:object) => server.post(`/organization/_all/tree`, data);
+export const getTreeData_api = (data: object) => server.post(`/organization/_all/tree`, data);
// 新增部门
-export const addDepartment_api = (data:object) => server.post(`/organization`, data);
+export const addDepartment_api = (data: object) => server.post(`/organization`, data);
// 更新部门
-export const updateDepartment_api = (data:object) => server.patch(`/organization`, data);
+export const updateDepartment_api = (data: object) => server.patch(`/organization`, data);
// 删除部门
-export const delDepartment_api = (id:string) => server.remove(`/organization/${id}`);
+export const delDepartment_api = (id: string) => server.remove(`/organization/${id}`);
// 获取产品列表
-export const getDeviceOrProductList_api = (data:object) => server.post(`/device-product/_query`, data);
+export const getDeviceOrProductList_api = (data: object) => server.post(`/device-product/_query`, data);
+// 获取设备列表
+export const getDeviceList_api = (data: object) => server.post(`/device/instance/_query`, data);
// 根据产品的id获取产品的权限
-export const getPermission_api = (ids:object, id:string) => server.post(`/assets/bindings/product/org/${id}/_query`, ids);
+export const getPermission_api = (type:'device' | 'product',ids: object, id: string) => server.post(`/assets/bindings/${type}/org/${id}/_query`, ids);
// 获取产品的权限字典
-export const getPermissionDict_api = () => server.get(`/assets/bindings/product/permissions`);
\ No newline at end of file
+export const getPermissionDict_api = () => server.get(`/assets/bindings/product/permissions`);
+
+// 部门绑定产品
+export const bindDeviceOrProductList_api = (type: 'device' | 'product', data: object) => server.post(`/assets/bind/${type}`, data);
+// 批量解绑
+export const unBindDeviceOrProduct_api = (type: 'device' | 'product', data: object) => server.post(`/assets/unbind/${type}`, data);
+// 批量更新权限
+export const updatePermission_api = (type: 'device' | 'product', parentId: string, data: object) => server.put(`/assets/permission/${type}/org/${parentId}/_batch`, data);
\ No newline at end of file
diff --git a/src/views/device/DashBoard/components/Amap.vue b/src/views/device/DashBoard/components/Amap.vue
new file mode 100644
index 00000000..9042e51f
--- /dev/null
+++ b/src/views/device/DashBoard/components/Amap.vue
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/device/DashBoard/components/Guide.vue b/src/views/device/DashBoard/components/Guide.vue
new file mode 100644
index 00000000..510dcc10
--- /dev/null
+++ b/src/views/device/DashBoard/components/Guide.vue
@@ -0,0 +1,58 @@
+
+
+
{{ title }}
+
+
+
+
+
{{ english }}
+
+
+
+
+
+
diff --git a/src/views/device/DashBoard/components/MessageChart.vue b/src/views/device/DashBoard/components/MessageChart.vue
new file mode 100644
index 00000000..c088d53d
--- /dev/null
+++ b/src/views/device/DashBoard/components/MessageChart.vue
@@ -0,0 +1,112 @@
+
+
+
+
+
+
+
diff --git a/src/views/device/DashBoard/components/TimeSelect.vue b/src/views/device/DashBoard/components/TimeSelect.vue
new file mode 100644
index 00000000..eaa86387
--- /dev/null
+++ b/src/views/device/DashBoard/components/TimeSelect.vue
@@ -0,0 +1,117 @@
+
+
+
handleBtnChange(e.target.value)"
+ >
+
+ {{ item.label }}
+
+
+
+
+
+
+
+
diff --git a/src/views/device/DashBoard/index.vue b/src/views/device/DashBoard/index.vue
index 88779122..b916fef9 100644
--- a/src/views/device/DashBoard/index.vue
+++ b/src/views/device/DashBoard/index.vue
@@ -24,7 +24,10 @@
:footer="onlineFooter"
:value="onlineToday"
>
-
-
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/Department/components/AddDeviceOrProductDialog.vue b/src/views/system/Department/components/AddDeviceOrProductDialog.vue
index 41a9196e..512c387c 100644
--- a/src/views/system/Department/components/AddDeviceOrProductDialog.vue
+++ b/src/views/system/Department/components/AddDeviceOrProductDialog.vue
@@ -4,21 +4,29 @@
title="绑定"
width="1440px"
@ok="dialog.handleOk"
+ :confirmLoading="dialog.loading.value"
cancelText="取消"
okText="确定"
v-model:visible="dialog.visible.value"
+ destroyOnClose
>
-
- 只能分配有“共享”权限的资产数据
-
+
+
+ 只能分配有“共享”权限的资产数据
+
-
- 批量配置
-
-
-
+
+
@@ -79,12 +87,14 @@
e.stopPropagation()"
>
- {{
- table.getPermissLabel(
- slotProps.permission,
- )
- }}
+
@@ -98,10 +108,15 @@
-
\ No newline at end of file
+
diff --git a/src/views/system/Department/index.vue b/src/views/system/Department/index.vue
index 67982dbf..055331cf 100644
--- a/src/views/system/Department/index.vue
+++ b/src/views/system/Department/index.vue
@@ -2,7 +2,7 @@
- departmentId = id" />
+ (departmentId = id)" />
@@ -10,7 +10,7 @@
-
+
@@ -29,7 +29,7 @@ import User from './user/index.vue';
const activeKey = ref<'product' | 'device' | 'user'>('product');
-const departmentId = ref('')
+const departmentId = ref('');
diff --git a/src/views/system/Department/product/index.vue b/src/views/system/Department/product/index.vue
index 27d7d28d..5cc483ad 100644
--- a/src/views/system/Department/product/index.vue
+++ b/src/views/system/Department/product/index.vue
@@ -112,7 +112,7 @@
title="是否解除绑定"
ok-text="确定"
cancel-text="取消"
- @confirm="table.clickUnBind"
+ @confirm="table.clickUnBind(slotProps)"
>
@@ -128,8 +128,15 @@
:parent-id="props.parentId"
:all-permission="table.permissionList.value"
asset-type="product"
+ @confirm="table.refresh"
+ />
+
-
@@ -147,12 +154,15 @@ import {
getDeviceOrProductList_api,
getPermission_api,
getPermissionDict_api,
+ unBindDeviceOrProduct_api,
} from '@/api/system/department';
+import { intersection } from 'lodash-es';
-import {dictType} from '../typing.d.ts'
+import { dictType } from '../typing.d.ts';
+import { message } from 'ant-design-vue';
const props = defineProps<{
- parentId:string
+ parentId: string;
}>();
const query = {
columns: [
@@ -218,9 +228,7 @@ const table = {
watch(
() => props.parentId,
() => {
- nextTick(() => {
- tableRef.value.reload();
- });
+ table.refresh();
},
);
},
@@ -271,7 +279,7 @@ const table = {
const { pageIndex, pageSize, total, data } =
resp.result as resultType;
const ids = data.map((item) => item.id);
- getPermission_api(ids, parentId).then((perResp: any) => {
+ getPermission_api('product', ids, parentId).then((perResp: any) => {
const permissionObj = {};
perResp.result.forEach((item: any) => {
permissionObj[item.assetId] = item.grantedPermissions;
@@ -341,7 +349,7 @@ const table = {
addDialogRef.value && addDialogRef.value.openDialog();
},
clickEdit: (row?: any) => {
- const ids = row ? row.id : [...table._selectedRowKeys.value];
+ const ids = row ? [row.id] : [...table._selectedRowKeys.value];
if (row || table.selectedRows.length === 1) {
const permissionList =
row?.permission || table.selectedRows[0].permission;
@@ -353,29 +361,31 @@ const table = {
const permissionList = table.selectedRows.map(
(item) => item.permission,
);
- const mixPermissionList = table.getMixed(permissionList);
+ const mixPermissionList = intersection(...permissionList);
editDialogRef.value &&
editDialogRef.value.openDialog(ids, mixPermissionList);
},
- clickUnBind: (row?: any) => {},
-
- /**
- * 获取多个数组的交集
- * @param permissionList
- */
- getMixed: (permissionList: string[][]) => {
- if (permissionList.length === 1) return permissionList[0];
- const obj = {};
- const result: string[] = [];
- permissionList.forEach((items) => {
- items.forEach((item) => {
- if (obj[item]) obj[item]++;
- else obj[item] = 1;
- if (obj[item] === permissionList.length) result.push(item);
- });
+ clickUnBind: (row?: any) => {
+ const ids = row ? [row.id] : [...table._selectedRowKeys.value];
+ if (ids.length < 1) return message.warning('请勾选需要解绑的数据');
+ const params = [
+ {
+ targetType: 'org',
+ targetId: props.parentId,
+ assetType: 'product',
+ assetIdList: ids,
+ },
+ ];
+ unBindDeviceOrProduct_api('product', params).then(() => {
+ message.success('操作成功');
+ table.refresh();
+ });
+ },
+ refresh: () => {
+ nextTick(() => {
+ tableRef.value.reload();
});
- return result;
},
};
@@ -383,7 +393,6 @@ const addDialogRef = ref();
const editDialogRef = ref();
table.init();
-