From 9d3814cbf0837920937e8c60a0cafbfb92423988 Mon Sep 17 00:00:00 2001 From: zjlnb666 <14659021+zhangjianlong666@user.noreply.gitee.com> Date: Fri, 14 Nov 2025 11:46:02 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E4=BA=A7=E5=88=86=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AssetGrouping.js | 283 ++++++++++++++++-- .../AssetGrouping.less | 31 ++ 2 files changed, 291 insertions(+), 23 deletions(-) create mode 100644 src/pages/assetmangement_assetgrouping/AssetGrouping.less diff --git a/src/pages/assetmangement_assetgrouping/AssetGrouping.js b/src/pages/assetmangement_assetgrouping/AssetGrouping.js index e1c598d..7ccdfaa 100644 --- a/src/pages/assetmangement_assetgrouping/AssetGrouping.js +++ b/src/pages/assetmangement_assetgrouping/AssetGrouping.js @@ -1,29 +1,242 @@ -import {Col, Row, Tree} from "antd"; +import {Col, Form, Row, Select, Tree, Input, Button, Pagination, Space, Table} from "antd"; import Title from '../homepage/compontent/title' +import styles from '../assetmangement_assetgrouping/AssetGrouping.less' +import {PlusOutlined, SearchOutlined, SyncOutlined} from "@ant-design/icons"; +import {useState} from "react"; +const {Search} = Input + +const mockData = [ + { + groupId: 'GRP-001', + groupName: '集团总部资产组', + groupLevel: '一级', + parentGroup: '--', + assetCount: 1200, + permissionStrategy: '管理员', + managementStrategy: '全权限管理+策略继承', + createTime: '2025-10-01', + }, + { + groupId: 'GRP-001-1', + groupName: '研发中心分部', + groupLevel: '二级', + parentGroup: '集团总部资产组', + assetCount: 500, + permissionStrategy: '编辑', + managementStrategy: '自定义维保策略', + createTime: '2025-10-02', + }, + { + groupId: 'GRP-001-2', + groupName: '生产车间分部', + groupLevel: '二级', + parentGroup: '集团总部资产组', + assetCount: 700, + permissionStrategy: '编辑', + managementStrategy: '设备巡检策略', + createTime: '2025-10-02', + }, + { + groupId: 'GRP-001-1-1', + groupName: '研发传感器组', + groupLevel: '三级', + parentGroup: '研发中心分部', + assetCount: 200, + permissionStrategy: '查看', + managementStrategy: '数据采集策略', + createTime: '2025-10-03', + }, + { + groupId: 'GRP-001-1-2', + groupName: '研发服务器组', + groupLevel: '三级', + parentGroup: '研发中心分部', + assetCount: 300, + permissionStrategy: '编辑', + managementStrategy: '集群管理策略', + createTime: '2025-10-03', + }, + { + groupId: 'GRP-001-2-1', + groupName: '车间产线设备组', + groupLevel: '三级', + parentGroup: '生产车间分部', + assetCount: 400, + permissionStrategy: '编辑', + managementStrategy: '产线联动策略', + createTime: '2025-10-04', + }, + { + groupId: 'GRP-001-2-2', + groupName: '车间环境监测组', + groupLevel: '三级', + parentGroup: '生产车间分部', + assetCount: 300, + permissionStrategy: '查看', + managementStrategy: '环境告警策略', + createTime: '2025-10-04', + }, +]; +const AssetGroupTable=()=>{ + const [selectedRowKeys, setSelectedRowKeys] = useState([]); + const [currentPage, setCurrentPage] = useState(1); + const [pageSize, setPageSize] = useState(10); // 可根据需求调整默认每页条数 + + // 表格列配置 + const columns = [ + { + title: '分组ID', + dataIndex: 'groupId', + key: 'groupId', + }, + { + title: '分组名称', + dataIndex: 'groupName', + key: 'groupName', + }, + { + title: '分组层级', + dataIndex: 'groupLevel', + key: 'groupLevel', + }, + { + title: '父分组', + dataIndex: 'parentGroup', + key: 'parentGroup', + }, + { + title: '资产数量', + dataIndex: 'assetCount', + key: 'assetCount', + }, + { + title: '权限策略', + dataIndex: 'permissionStrategy', + key: 'permissionStrategy', + }, + { + title: '管理策略', + dataIndex: 'managementStrategy', + key: 'managementStrategy', + }, + { + title: '创建时间', + dataIndex: 'createTime', + key: 'createTime', + }, + { + title: '操作', + key: 'action', + render: (_, record) => ( + + + + + + ), + align:'center' + }, + ]; + + // 行选择回调 + const onSelectChange = (selectedKeys) => { + setSelectedRowKeys(selectedKeys); + }; + + // 分页回调 + const onPageChange = (page) => { + setCurrentPage(page); + // 对接接口:请求第page页数据 + fetchAssetGroupData(page, pageSize); + }; + + const onPageSizeChange = (current, size) => { + setCurrentPage(current); + setPageSize(size); + // 对接接口:请求第current页、每页size条数据 + fetchAssetGroupData(current, size); + }; + + // 模拟接口请求函数(实际开发中替换为真实接口调用) + const fetchAssetGroupData = (page, size) => { + console.log(`请求第${page}页,每页${size}条数据`); + // 这里写axios/fetch等请求逻辑,例如: + // axios.get('/api/asset-group', { params: { page, size } }).then(res => { + // setTableData(res.data.list); + // setTotal(res.data.total); + // }); + }; + + // 编辑操作(预留逻辑) + const handleEdit = (record) => { + console.log('编辑', record); + }; + + // 权限配置操作(预留逻辑) + const handlePermissionConfig = (record) => { + console.log('权限配置', record); + }; + + // 查看资产操作(预留逻辑) + const handleViewAsset = (record) => { + console.log('查看资产', record); + }; + + const rowSelection = { + selectedRowKeys, + onChange: onSelectChange, + }; + return ( +
+ +
+ `共 ${total} 条记录`} + /> +
+ + ) +} + + const AssetGrouping = () => { const treeData = [ { - title: '集团总部资产组 (1200)', - key: '0-0', - children: [ - { - title: '研发中心分部 (500)', - key: '0-0-0', - children: [ - { - title: '研发传感器组 (200)', - key: '0-0-0-0', - }, - { - title: '研发服务器组 (300)', - key: '0-0-0-1', - }, - ] - }, - { + title: '集团总部资产组 (1200)', + key: '0-0', + children: [ + { + title: '研发中心分部 (500)', + key: '0-0-0', + children: [ + { + title: '研发传感器组 (200)', + key: '0-0-0-0', + }, + { + title: '研发服务器组 (300)', + key: '0-0-0-1', + }, + ] + }, + { - title: '生产车间分部 (700)', - key: '0-0-1', + title: '生产车间分部 (700)', + key: '0-0-1', children:[ { title: '车间产线设备组 (400)', @@ -40,7 +253,7 @@ const AssetGrouping = () => { ]; return (
- +
@@ -58,7 +271,31 @@ const AssetGrouping = () => {
- + + + + + + + +
+ + +
+ + + + + + + + + + + + + + diff --git a/src/pages/assetmangement_assetgrouping/AssetGrouping.less b/src/pages/assetmangement_assetgrouping/AssetGrouping.less new file mode 100644 index 0000000..86b36d2 --- /dev/null +++ b/src/pages/assetmangement_assetgrouping/AssetGrouping.less @@ -0,0 +1,31 @@ +.search-button{ + background-image: url('../../assets/img/assetmangement1.png'); + background-repeat: no-repeat; + background-size: cover; + background-position:center; + color: #fff; + border-radius: 4px; + height: 36px; + border-color:#d9d9d9 ; +} +.reset-button{ + background-image: url('../../assets/img/assetmangement2.png'); + background-repeat: no-repeat; + background-size: cover; + background-position:center; + color: rgba(0, 102, 101, 1); + border-radius: 4px; + height: 36px; + border-color:#d9d9d9 ; +} +.del-button{ + background-image: url('../../assets/img/assetmangement3.png'); + background-repeat: no-repeat; + background-size: cover; + background-position:center; + color: #000; + border-radius: 4px; + height: 36px; + width:88px; + border-color:#d9d9d9 ; +}