Commit 7c81744f authored by shaoan123's avatar shaoan123

解决表字段搜索bug

parent 3739e38c
Pipeline #31553 skipped with stages
......@@ -301,7 +301,7 @@ const TableManager = () => {
{
title: '类型', dataIndex: 'type', key: 'type',
render: text => {
return (<div style={{ color: '#3764a0' }}>{text}({allData[text].length}个)</div>)
return (<div style={{ color: '#3764a0' }}>{text}({allData?[text].length:0}个)</div>)
}
},
......
import React, { useState, useEffect } from 'react';
import {
Form,
Modal,
Card,
Space,
Table,
Button,
Popconfirm,
Spin,
Tooltip,
notification,
} from 'antd';
import { reloadTableFields, removeFields } from '@/services/platform/bs';
import {
UserOutlined,
UserAddOutlined,
UsergroupAddOutlined,
EditOutlined,
EditTwoTone,
DeleteOutlined,
IdcardOutlined,
UnlockOutlined,
ApartmentOutlined,
StopOutlined,
DoubleLeftOutlined,
DoubleRightOutlined,
DownOutlined,
BorderlessTableOutlined,
LockOutlined,
PlusSquareFilled,
EllipsisOutlined,
PlusOutlined,
SyncOutlined,
} from '@ant-design/icons';
import classnames from 'classnames';
import PageContainer from '@/components/BasePageContainer';
import { GetCM_Ledger_LoadLedgers,reloadTableFields, removeFields } from '@/services/standingBook/api';
import styles from './standingBook.less';
const AddModal = props => {
const [allData, setAllData] = useState([]);
const [tableData, setTableData] = useState([]);
const [loading, setLoading] = useState(false);
const [tableData, setTableData] =useState([]);
const [treeLoading, setTreeLoading] = useState(false);
const [treeVisible, setTreeVisible] = useState(true); // 树是否可见
const [formObj, setFormObj] = useState('');
const [flag, setFlag] = useState(0); // 弹窗类型
const [isVisible, setIsVisible] = useState(false); // 弹窗
......@@ -37,58 +60,72 @@ const AddModal = props => {
const expandedRowRender = (item) => {
const columns = [
{
title: '字段名',
title: '台账类型',
dataIndex: 'type',
key: 'type',
width: 100,
},
{
title: '台账名称',
dataIndex: 'name',
key: 'name',
width: 150,
render: text => <a>{text}</a>,
align: 'center',
width: 200,
},
{
title: '名',
dataIndex: 'alias',
key: 'alias',
title: '台账表名',
dataIndex: 'tableName',
key: 'tableName',
align: 'center',
width: 200,
},
{
title: '字段类型',
dataIndex: 'storeType',
key: 'storeType',
title: '台账字段',
dataIndex: 'fields',
key: 'fields',
align: 'center',
width: 200,
width: 150,
},
{
title: '形态',
dataIndex: 'shape',
key: 'shape',
title: '检索字段',
dataIndex: 'searchFields',
key: 'searchFields',
align: 'center',
width: 200,
width: 150,
},
{
title: '配置',
dataIndex: 'config',
key: 'config',
title: '添加字段',
dataIndex: 'addFields',
key: 'addFields',
align: 'center',
width: 200,
width: 150,
},
{
title: '只读',
dataIndex: 'readOnly',
key: 'readOnly',
title: '编辑字段',
dataIndex: 'editFields',
key: 'editFields',
align: 'center',
width: 200,
width: 150,
},
{
title: '同步',
dataIndex: 'syncEvent',
key: 'syncEvent',
title: '前端字段',
dataIndex: 'webFields',
key: 'webFields',
align: 'center',
width: 200,
width: 150,
},
{
title: '手持字段',
dataIndex: 'mobileFields',
key: 'mobileFields',
align: 'center',
width: 150,
},
{
title: '操作',
width: 250,
width: 200,
ellipsis: true,
align: 'center',
render: (text, record) => (
......@@ -134,15 +171,12 @@ const AddModal = props => {
];
useEffect(() => {
if (props.match.params.id) {
setFormObj(props.match.params.id)
setTreeLoading(true);
reloadTableFields({
tableName: props.match.params.id,
}).then(res => {
GetCM_Ledger_LoadLedgers().then(res => {
console.log('res',res);
setTreeLoading(false);
if (res.msg === 'Ok') {
let arr =formateArrDataA(res.data.root,'group')
let arr =formateArrDataA(res.data.root,'type')
let newArr = []
Object.keys(arr).map((item, index) => {
newArr.push({ type: item, key: index })
......@@ -151,7 +185,7 @@ const AddModal = props => {
setTableData(newArr);
}
});
}
}, [flag]);
const formateArrDataA = (initialArr, name) => {
// 判定传参是否符合规则
......@@ -211,29 +245,52 @@ const AddModal = props => {
};
return (
<div style={{ width: '100vm', height: 'calc(100vh - 100px) ', background: '#ffffff' }}>
<Spin tip="loading..." spinning={treeLoading}>
<Table
columns={columns}
dataSource={tableData}
expandable={{ expandedRowRender }}
showHeader={false}
// pagination={{ pageSize: 10 }}
scroll={{ y: '45rem' }}
size="small"
rowKey={(record, index) => `complete${record.tableID}${index}`}
pagination={{
showTotal: (total, range) =>
`第${range[0]}-${range[1]} 条/共 ${total} 条`,
pageSizeOptions: [10, 20, 50, 100],
defaultPageSize: 20,
showQuickJumper: true,
showSizeChanger: true,
<PageContainer className={styles.userManageContainer}>
<div className={styles.contentContainer}></div>
<Card
className={classnames({
[styles.orgContainer]: true,
[styles.orgContainerHide]: !treeVisible,
})}
>
<div>
<span
style={{
fontSize: '15px ',
fontWeight: 'bold',
}}
>
机构列表
</span>
<Tooltip title="添加顶级机构">
<PlusSquareFilled
style={{
color: '#1890FF',
fontSize: '25px',
verticalAlign: 'middle',
float:'right'
}}
/>
</Spin>
</Tooltip>
<hr style={{ width: '100%', color: '#eeecec' }} />
</div>
<div className={styles.switcher}>
{treeVisible && (
<Tooltip title="隐藏机构列表">
<DoubleLeftOutlined onClick={() => setTreeVisible(false)} />
</Tooltip>
)}
{!treeVisible && (
<Tooltip title="显示机构列表">
<DoubleRightOutlined onClick={() => setTreeVisible(true)} />
</Tooltip>
)}
</div>
</Card>
</PageContainer>
);
};
export default AddModal;
.orgContainerHide{
// transform: translateX(-230px);
left: 0px;
top: 0;
width: 26px;
}
\ No newline at end of file
import { CITY_SERVICE, get, PUBLISH_SERVICE, post, postForm } from '../index';
// 加载台账
export const GetCM_Ledger_LoadLedgers = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/GetCM_Ledger_LoadLedgers`, query);
\ No newline at end of file
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