From da37f164836bcff880ea164f89d9973405e0717f Mon Sep 17 00:00:00 2001
From: wangyunfei <1224056307@qq,com>
Date: Wed, 26 Nov 2025 18:11:35 +0800
Subject: [PATCH] 1
---
.../BasicAttribute.js | 88 ++++++++++--
.../BasicAttribute.less | 129 ++++++++++++++++--
2 files changed, 196 insertions(+), 21 deletions(-)
diff --git a/src/pages/business_basic/components/second_datamodel_components/BasicAttribute.js b/src/pages/business_basic/components/second_datamodel_components/BasicAttribute.js
index e31b727..4010c02 100644
--- a/src/pages/business_basic/components/second_datamodel_components/BasicAttribute.js
+++ b/src/pages/business_basic/components/second_datamodel_components/BasicAttribute.js
@@ -1,4 +1,4 @@
-import React, { useState } from 'react';
+import React, { useMemo, useState } from 'react';
import { Select, Tree } from 'antd';
import styles from './BasicAttribute.less';
@@ -13,33 +13,69 @@ const factoryOptions = [
{ label: '南京油库', value: 'nanjing' },
];
-const treeData = [
+const rawTreeData = [
{
title: '上海油库',
key: 'shanghai',
+ tag: { label: '油库', type: 'depot' },
children: [
{
title: '汽油罐区',
key: 'gasoline-area',
+ tag: { label: '罐区', type: 'area' },
children: [
{
title: '汽油调合罐组',
key: 'blend-group',
+ tag: { label: '罐组', type: 'group' },
children: [
{
title: 'T-101 汽油储罐',
key: 't101',
+ tag: { label: '储罐', type: 'tank' },
children: [
- { title: 'LT-101 液位变送器', key: 'lt101' },
- { title: 'TT-101 温度变送器', key: 'tt101' },
- { title: 'PT-101 压力变送器', key: 'pt101' },
- { title: 'P-101A 输送泵', key: 'p101a' },
- { title: 'P-101B 输送泵', key: 'p101b' },
- { title: 'SP-101 密度计', key: 'sp101' },
+ {
+ title: 'LT-101 液位变送器',
+ key: 'lt101',
+ tag: { label: '测点', type: 'sensor' },
+ },
+ {
+ title: 'TT-101 温度变送器',
+ key: 'tt101',
+ tag: { label: '测点', type: 'sensor' },
+ },
+ {
+ title: 'PT-101 压力变送器',
+ key: 'pt101',
+ tag: { label: '测点', type: 'sensor' },
+ },
+ {
+ title: 'P-101A 输送泵',
+ key: 'p101a',
+ tag: { label: '设备', type: 'device' },
+ },
+ {
+ title: 'P-101B 输送泵',
+ key: 'p101b',
+ tag: { label: '设备', type: 'device' },
+ },
+ {
+ title: 'SP-101 密度计',
+ key: 'sp101',
+ tag: { label: '测点', type: 'sensor' },
+ },
],
},
- { title: 'T-102 汽油储罐', key: 't102' },
- { title: 'T-103 汽油储罐', key: 't103' },
+ {
+ title: 'T-102 汽油储罐',
+ key: 't102',
+ tag: { label: '储罐', type: 'tank' },
+ },
+ {
+ title: 'T-103 汽油储罐',
+ key: 't103',
+ tag: { label: '储罐', type: 'tank' },
+ },
],
},
],
@@ -47,15 +83,35 @@ const treeData = [
{
title: '柴油罐区',
key: 'diesel-area',
+ tag: { label: '罐区', type: 'area' },
},
{
title: '化危品库',
key: 'hazard',
+ tag: { label: '库区', type: 'depot' },
},
],
},
];
+const TreeNodeTitle = ({ text, tag }) => (
+
+ {text}
+ {tag ? (
+
+ {tag.label}
+
+ ) : null}
+
+);
+
+const formatTreeNodes = data =>
+ data.map(item => ({
+ key: item.key,
+ title: