Commit 7c81744f authored by shaoan123's avatar shaoan123

解决表字段搜索bug

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