Commit af66ac75 authored by 皮倩雯's avatar 皮倩雯

fix: '表字段合并单元格'

parent 137e1ffb
Pipeline #47257 passed with stages
in 7 minutes 11 seconds
...@@ -190,14 +190,14 @@ const LoadGroupNew = props => { ...@@ -190,14 +190,14 @@ const LoadGroupNew = props => {
text: form.getFieldsValue().groupName, text: form.getFieldsValue().groupName,
fieldData: [], fieldData: [],
}; };
if (form.getFieldsValue().groupName.length > 9) { // if (form.getFieldsValue().groupName.length > 9) {
notification.error({ // notification.error({
message: '提示', // message: '提示',
duration: 3, // duration: 3,
description: '组名请在10个字以内', // description: '组名请在10个字以内',
}); // });
return; // return;
} // }
// 判断是否有重复的组名 // 判断是否有重复的组名
let isRepeat = groupData.some(item => item.text === form.getFieldsValue().groupName); let isRepeat = groupData.some(item => item.text === form.getFieldsValue().groupName);
if (isRepeat) { if (isRepeat) {
......
/* eslint-disable indent */
/* eslint-disable prefer-destructuring */ /* eslint-disable prefer-destructuring */
/* eslint-disable import/order */ /* eslint-disable import/order */
/* eslint-disable default-case */ /* eslint-disable default-case */
...@@ -195,6 +196,7 @@ const AddModal = props => { ...@@ -195,6 +196,7 @@ const AddModal = props => {
}; };
useEffect(() => { useEffect(() => {
console.log(isVisible);
if (keepTreeFirst.indexOf(itemData.name) != -1) { if (keepTreeFirst.indexOf(itemData.name) != -1) {
setShow('none'); setShow('none');
} else { } else {
...@@ -246,10 +248,16 @@ const AddModal = props => { ...@@ -246,10 +248,16 @@ const AddModal = props => {
} }
setPramData({ ...res[0].data.root, coordinates, must, picture }); setPramData({ ...res[0].data.root, coordinates, must, picture });
console.log(pramData); console.log(pramData);
// 清空表单数据
if (isVisible == false) {
console.log(123);
setPramData([]);
form.resetFields();
}
let index = res[2].data.root.find(item => { let index = res[2].data.root.find(item => {
return item.Name == res[0].data.root.ExceptionEvent; return item.Name == res[0].data.root.ExceptionEvent;
}); });
console.log('index', index); console.log(index);
getFieldData(index.TableName); getFieldData(index.TableName);
} }
}); });
......
...@@ -57,7 +57,7 @@ const AddModal = props => { ...@@ -57,7 +57,7 @@ const AddModal = props => {
const [selectTreeData, setSelectTreeData] = useState([]); const [selectTreeData, setSelectTreeData] = useState([]);
const [selectDataFirst, setSelectDataFirst] = useState([]); const [selectDataFirst, setSelectDataFirst] = useState([]);
const [multiOperate, setMultiOperate] = useState(true); // 是否禁用用户批量操作 const [multiOperate, setMultiOperate] = useState(true); // 是否禁用用户批量操作
const [selectedRowKeys, setSelectedRowKeys] = useState([]); // 已选字段配置数,机构改变时重置 const [selectedRowKeys, setSelectedRowKeys] = useState(['13926', '13941']); // 已选字段配置数,机构改变时重置
const [deleteUserVisible, setDeleteUserVisible] = useState(false); // 批量删除 const [deleteUserVisible, setDeleteUserVisible] = useState(false); // 批量删除
const [checkStrictly, setCheckStrictly] = useState(false); const [checkStrictly, setCheckStrictly] = useState(false);
const [selectGroup, setSelectGroup] = useState([]); const [selectGroup, setSelectGroup] = useState([]);
...@@ -101,27 +101,22 @@ const AddModal = props => { ...@@ -101,27 +101,22 @@ const AddModal = props => {
key: 'name', key: 'name',
align: 'left', align: 'left',
width: 300, width: 300,
onCell: (_, index) => ({ render: (text, record) => {
colSpan: index < 1 ? 8 : 1, let aa = (
// if (index === 0) { <div style={{ fontWeight: 'bold' }}>
// // console.log(record); <span style={{ color: 'rgb(63 163 255)' }}>
// console.log(index); {text}(共{allData[text] ? allData[text].length : ''}条)
// return { colSpan: 3 }; </span>
// } </div>
}), );
render: (text, record) => ( let bb = <div style={{ color: styleConfig(record) }}>{text}</div>;
<Space> const obj = {
{record.children ? ( children: record.children ? aa : bb,
<div style={{ fontWeight: 'bold' }}> props: {},
<span style={{ color: 'rgb(63 163 255)' }}> };
{text}(共{allData[text] ? allData[text].length : ''}条) obj.props.colSpan = record.children ? 8 : 1;
</span> return obj;
</div> },
) : (
<div style={{ color: styleConfig(record) }}>{text}</div>
)}
</Space>
),
}, },
{ {
title: '别名', title: '别名',
...@@ -129,7 +124,14 @@ const AddModal = props => { ...@@ -129,7 +124,14 @@ const AddModal = props => {
key: 'alias', key: 'alias',
align: 'center', align: 'center',
width: 300, width: 300,
render: (text, record) => <span style={{ color: styleConfig(record) }}>{text} </span>, render: (text, record) => {
const obj = {
children: <span style={{ color: styleConfig(record) }}>{text} </span>,
props: {},
};
obj.props.colSpan = record.children ? 0 : 1;
return obj;
},
}, },
{ {
title: '字段类型', title: '字段类型',
...@@ -137,7 +139,14 @@ const AddModal = props => { ...@@ -137,7 +139,14 @@ const AddModal = props => {
key: 'storeType', key: 'storeType',
align: 'center', align: 'center',
width: 150, width: 150,
render: (text, record) => <span style={{ color: styleConfig(record) }}>{text} </span>, render: (text, record) => {
const obj = {
children: <span style={{ color: styleConfig(record) }}>{text} </span>,
props: {},
};
obj.props.colSpan = record.children ? 0 : 1;
return obj;
},
}, },
{ {
title: '形态', title: '形态',
...@@ -145,7 +154,14 @@ const AddModal = props => { ...@@ -145,7 +154,14 @@ const AddModal = props => {
key: 'shape', key: 'shape',
align: 'center', align: 'center',
width: 150, width: 150,
render: (text, record) => <span style={{ color: styleConfig(record) }}>{text} </span>, render: (text, record) => {
const obj = {
children: <span style={{ color: styleConfig(record) }}>{text} </span>,
props: {},
};
obj.props.colSpan = record.children ? 0 : 1;
return obj;
},
}, },
{ {
title: '配置', title: '配置',
...@@ -153,7 +169,14 @@ const AddModal = props => { ...@@ -153,7 +169,14 @@ const AddModal = props => {
key: 'config', key: 'config',
align: 'center', align: 'center',
width: 250, width: 250,
render: (text, record) => <span style={{ color: styleConfig(record) }}>{text} </span>, render: (text, record) => {
const obj = {
children: <span style={{ color: styleConfig(record) }}>{text} </span>,
props: {},
};
obj.props.colSpan = record.children ? 0 : 1;
return obj;
},
}, },
{ {
...@@ -162,7 +185,14 @@ const AddModal = props => { ...@@ -162,7 +185,14 @@ const AddModal = props => {
key: 'readOnly', key: 'readOnly',
align: 'center', align: 'center',
width: 100, width: 100,
render: (text, record) => <span style={{ color: styleConfig(record) }}>{text} </span>, render: (text, record) => {
const obj = {
children: <span style={{ color: styleConfig(record) }}>{text} </span>,
props: {},
};
obj.props.colSpan = record.children ? 0 : 1;
return obj;
},
}, },
{ {
title: '同步', title: '同步',
...@@ -170,48 +200,62 @@ const AddModal = props => { ...@@ -170,48 +200,62 @@ const AddModal = props => {
key: 'syncEvent', key: 'syncEvent',
align: 'center', align: 'center',
width: 100, width: 100,
render: (text, record) => <span style={{ color: styleConfig(record) }}>{text} </span>, render: (text, record) => {
const obj = {
children: <span style={{ color: styleConfig(record) }}>{text} </span>,
props: {},
};
obj.props.colSpan = record.children ? 0 : 1;
return obj;
},
}, },
{ {
title: '操作', title: '操作',
ellipsis: true, ellipsis: true,
align: 'center', align: 'center',
render: (text, record) => ( render: (text, record) => {
<Space> const obj = {
{record.children ? ( children: (
<span /> <Space>
) : ( {record.children ? (
<> <span />
<Tooltip title="修改"> ) : (
<EditOutlined <>
style={{ fontSize: '16px', color: '#1890FF' }} <Tooltip title="修改">
onClick={() => { <EditOutlined
editor(record); style={{ fontSize: '16px', color: '#1890FF' }}
}} onClick={() => {
> editor(record);
编辑 }}
</EditOutlined> >
</Tooltip> 编辑
<div onClick={e => e.stopPropagation()}> </EditOutlined>
<Popconfirm
title="是否删除该字段?"
okText="确认"
cancelText="取消"
onConfirm={() => {
deleteChart(record);
}}
>
<Tooltip title="删除">
<DeleteOutlined style={{ fontSize: '16px', color: '#e86060' }}>
删除
</DeleteOutlined>
</Tooltip> </Tooltip>
</Popconfirm> <div onClick={e => e.stopPropagation()}>
</div> <Popconfirm
</> title="是否删除该字段?"
)} okText="确认"
</Space> cancelText="取消"
), onConfirm={() => {
deleteChart(record);
}}
>
<Tooltip title="删除">
<DeleteOutlined style={{ fontSize: '16px', color: '#e86060' }}>
删除
</DeleteOutlined>
</Tooltip>
</Popconfirm>
</div>
</>
)}
</Space>
),
props: {},
};
obj.props.colSpan = record.children ? 0 : 1;
return obj;
},
}, },
]; ];
...@@ -380,15 +424,24 @@ const AddModal = props => { ...@@ -380,15 +424,24 @@ const AddModal = props => {
}); });
}; };
const onUnfold = (expanded, record) => { const onUnfold = (expanded, record) => {
const data = [...selectGroup]; if (record.children) {
let index = data.findIndex(i => i.type == record.name); const data = [...selectGroup];
// let index = data.indexOf(record); // let index = selectGroup.find(i => i.type || i.name == record.name);
if (expanded) { if (expanded) {
data.push(record); data.push(record);
} else { setSelectGroup(data);
data.splice(index, 1); } else {
let aa = [];
data.map(i => {
if (i.name && i.name != record.name) {
aa.push(i);
} else if (i.type && i.type != record.name) {
aa.push(i);
}
});
setSelectGroup(aa);
}
} }
setSelectGroup(data);
}; };
// 附加 // 附加
const add = record => { const add = record => {
...@@ -428,6 +481,7 @@ const AddModal = props => { ...@@ -428,6 +481,7 @@ const AddModal = props => {
}; };
const treeSelectOnchange = e => { const treeSelectOnchange = e => {
setTreeLoading(true);
console.log('切换'); console.log('切换');
setSelectedRowKeys([]); setSelectedRowKeys([]);
setMultiOperate(true); setMultiOperate(true);
......
...@@ -173,7 +173,7 @@ ...@@ -173,7 +173,7 @@
.userContainer { .userContainer {
height: calc(100vh - 74px) !important; height: calc(100vh - 74px) !important;
z-index: 999; z-index: 999;
// min-width: 800px; min-width: 800px;
background: white; background: white;
width: 100%; width: 100%;
position: relative; position: relative;
......
...@@ -1422,7 +1422,7 @@ const UserManage = () => { ...@@ -1422,7 +1422,7 @@ const UserManage = () => {
color: '#1890FF', color: '#1890FF',
fontSize: '25px', fontSize: '25px',
verticalAlign: 'middle', verticalAlign: 'middle',
marginLeft: '67%', marginLeft: '64%',
}} }}
/> />
</Tooltip> </Tooltip>
...@@ -1461,8 +1461,8 @@ const UserManage = () => { ...@@ -1461,8 +1461,8 @@ const UserManage = () => {
{/* 右侧用户表 */} {/* 右侧用户表 */}
<div <div
className={classnames({ className={classnames({
[styles.userContainerHide]: !treeVisible,
[styles.userContainer]: true, [styles.userContainer]: true,
[styles.userContainerHide]: !treeVisible,
})} })}
> >
<div style={{ height: '50px' }}> <div style={{ height: '50px' }}>
...@@ -1501,11 +1501,12 @@ const UserManage = () => { ...@@ -1501,11 +1501,12 @@ const UserManage = () => {
> >
<div <div
className={classnames({ className={classnames({
[styles.boxH]: treeVisible,
[styles.cardBoxR]: true, [styles.cardBoxR]: true,
[styles.boxH]: treeVisible,
})} })}
> */} > */}
<Table <Table
// style={{ width: treeVisible ? '81%' : '100%' }}
rowSelection={{ rowSelection={{
type: 'checkbox', type: 'checkbox',
...rowSelection, ...rowSelection,
......
...@@ -220,9 +220,9 @@ ...@@ -220,9 +220,9 @@
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
// .userContainerHide { .userContainerHide {
// width: 100%; width: 100%;
// } }
.userContainer { .userContainer {
height: calc(100vh - 74px) !important; height: calc(100vh - 74px) !important;
z-index: 999; z-index: 999;
...@@ -286,7 +286,7 @@ ...@@ -286,7 +286,7 @@
transition: width 2s; transition: width 2s;
} }
.cardBoxR { .cardBoxR {
min-width: 600px; min-width: 800px;
} }
.ant-modal-root { .ant-modal-root {
.ant-tree-switcher { .ant-tree-switcher {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment