Commit f357bfc2 by zhaochengxiang

字段搜索大小写不敏感

parent 58ffab2d
...@@ -135,11 +135,13 @@ const AssetAction = (props) => { ...@@ -135,11 +135,13 @@ const AssetAction = (props) => {
render: (text, record, _) => { render: (text, record, _) => {
return ( return (
<Tooltip title={text||''}> <Tooltip title={text||''}>
<a onClick={() => { <Typography.Text ellipsis={true}>
window.open(`/center-home/metadetail?mid=${record._id}&action=metadetail&type=detail&manager=false&activekey=1`); <a onClick={() => {
}}> window.open(`/center-home/metadetail?mid=${record._id}&action=metadetail&type=detail&manager=false&activekey=1`);
{highlightSearchContentByTerms(text||'', terms)} }}>
</a> {highlightSearchContentByTerms(text||'', terms)}
</a>
</Typography.Text>
</Tooltip> </Tooltip>
); );
} }
...@@ -149,7 +151,11 @@ const AssetAction = (props) => { ...@@ -149,7 +151,11 @@ const AssetAction = (props) => {
dataIndex: 'cnName', dataIndex: 'cnName',
// width: 200, // width: 200,
ellipsis: true, ellipsis: true,
render: (text, _, index) => highlightSearchContentByTerms(text||'', terms) render: (text, _, index) => <Tooltip title={text||''}>
<Typography.Text ellipsis={true}>
{highlightSearchContentByTerms(text||'', terms)}
</Typography.Text>
</Tooltip>
}, },
{ {
title: '是否有权限', title: '是否有权限',
...@@ -170,12 +176,12 @@ const AssetAction = (props) => { ...@@ -170,12 +176,12 @@ const AssetAction = (props) => {
dataIndex: 'businessRules', dataIndex: 'businessRules',
width: 240, width: 240,
ellipsis: true, ellipsis: true,
render: (text, _, index) => <MetadataColumnEditableItem render: (text, record, index) => <MetadataColumnEditableItem
value={text} value={text}
isEdit={isMetadataEdit} isEdit={isMetadataEdit}
terms={terms} terms={terms}
onChange={(e) => { onChange={(e) => {
onMetadataColumnEditableItemChange(e.target.value, 'businessRules', index) onMetadataColumnEditableItemChange(e.target.value, 'businessRules', record._id)
}} }}
/> />
}, },
...@@ -183,12 +189,12 @@ const AssetAction = (props) => { ...@@ -183,12 +189,12 @@ const AssetAction = (props) => {
title: '计量单位', title: '计量单位',
dataIndex: 'unitOfMeasurement', dataIndex: 'unitOfMeasurement',
ellipsis: true, ellipsis: true,
render: (text, _, index) => <MetadataColumnEditableItem render: (text, record, index) => <MetadataColumnEditableItem
value={text} value={text}
isEdit={isMetadataEdit} isEdit={isMetadataEdit}
terms={terms} terms={terms}
onChange={(e) => { onChange={(e) => {
onMetadataColumnEditableItemChange(e.target.value, 'unitOfMeasurement', index) onMetadataColumnEditableItemChange(e.target.value, 'unitOfMeasurement', record._id)
}} }}
/> />
}, },
...@@ -196,12 +202,12 @@ const AssetAction = (props) => { ...@@ -196,12 +202,12 @@ const AssetAction = (props) => {
title: '备注信息', title: '备注信息',
dataIndex: 'remarks', dataIndex: 'remarks',
ellipsis: true, ellipsis: true,
render: (text, _, index) => <MetadataColumnEditableItem render: (text, record, index) => <MetadataColumnEditableItem
value={text} value={text}
isEdit={isMetadataEdit} isEdit={isMetadataEdit}
terms={terms} terms={terms}
onChange={(e) => { onChange={(e) => {
onMetadataColumnEditableItemChange(e.target.value, 'remarks', index) onMetadataColumnEditableItemChange(e.target.value, 'remarks', record._id)
}} }}
/> />
}, },
...@@ -225,14 +231,18 @@ const AssetAction = (props) => { ...@@ -225,14 +231,18 @@ const AssetAction = (props) => {
render: (_, record) => { render: (_, record) => {
return <AppContext.Consumer> return <AppContext.Consumer>
{ {
appValue => <a onClick={() => { appValue => <Tooltip title={record.standard?.standardName??''}>
appValue?.setGlobalState && appValue?.setGlobalState({ <Typography.Text ellipsis={true}>
message: 'data-govern-show-index-detail-message', <a onClick={() => {
data: { id: record.standard?.standardId } appValue?.setGlobalState && appValue?.setGlobalState({
}) message: 'data-govern-show-index-detail-message',
}}> data: { id: record.standard?.standardId }
<span>{record.standard?.standardName}</span> })
</a> }}>
<span>{record.standard?.standardName}</span>
</a>
</Typography.Text>
</Tooltip>
} }
</AppContext.Consumer> </AppContext.Consumer>
} }
...@@ -248,11 +258,13 @@ const AssetAction = (props) => { ...@@ -248,11 +258,13 @@ const AssetAction = (props) => {
render: (text, record, _) => { render: (text, record, _) => {
return ( return (
<Tooltip title={text||''}> <Tooltip title={text||''}>
<a onClick={() => { <Typography.Text ellipsis={true}>
window.open(`/center-home/metadetail?mid=${record._id}&action=metadetail&type=detail&manager=false&activekey=1`); <a onClick={() => {
}}> window.open(`/center-home/metadetail?mid=${record._id}&action=metadetail&type=detail&manager=false&activekey=1`);
{highlightSearchContentByTerms(text||'', terms)} }}>
</a> {highlightSearchContentByTerms(text||'', terms)}
</a>
</Typography.Text>
</Tooltip> </Tooltip>
); );
} }
...@@ -262,7 +274,11 @@ const AssetAction = (props) => { ...@@ -262,7 +274,11 @@ const AssetAction = (props) => {
dataIndex: 'cnName', dataIndex: 'cnName',
// width: 200, // width: 200,
ellipsis: true, ellipsis: true,
render: (text, _, index) => highlightSearchContentByTerms(text||'', terms) render: (text, _, index) => <Tooltip title={text||''}>
<Typography.Text ellipsis={true}>
{highlightSearchContentByTerms(text||'', terms)}
</Typography.Text>
</Tooltip>
}, },
{ {
title: '是否有权限', title: '是否有权限',
...@@ -283,12 +299,12 @@ const AssetAction = (props) => { ...@@ -283,12 +299,12 @@ const AssetAction = (props) => {
dataIndex: 'businessDefinition', dataIndex: 'businessDefinition',
width: 240, width: 240,
ellipsis: true, ellipsis: true,
render: (text, _, index) => <MetadataColumnEditableItem render: (text, record, index) => <MetadataColumnEditableItem
value={text} value={text}
isEdit={isMetadataEdit} isEdit={isMetadataEdit}
terms={terms} terms={terms}
onChange={(e) => { onChange={(e) => {
onMetadataColumnEditableItemChange(e.target.value, 'businessDefinition', index) onMetadataColumnEditableItemChange(e.target.value, 'businessDefinition', record._id)
}} }}
/> />
}, },
...@@ -296,12 +312,12 @@ const AssetAction = (props) => { ...@@ -296,12 +312,12 @@ const AssetAction = (props) => {
title: '备注信息', title: '备注信息',
dataIndex: 'remarks', dataIndex: 'remarks',
ellipsis: true, ellipsis: true,
render: (text, _, index) => <MetadataColumnEditableItem render: (text, record, index) => <MetadataColumnEditableItem
value={text} value={text}
isEdit={isMetadataEdit} isEdit={isMetadataEdit}
terms={terms} terms={terms}
onChange={(e) => { onChange={(e) => {
onMetadataColumnEditableItemChange(e.target.value, 'remarks', index) onMetadataColumnEditableItemChange(e.target.value, 'remarks', record._id)
}} }}
/> />
}, },
...@@ -309,12 +325,12 @@ const AssetAction = (props) => { ...@@ -309,12 +325,12 @@ const AssetAction = (props) => {
title: '数据owner', title: '数据owner',
dataIndex: 'dataOwner', dataIndex: 'dataOwner',
ellipsis: true, ellipsis: true,
render: (text, _, index) => <MetadataColumnEditableItem render: (text, record, index) => <MetadataColumnEditableItem
value={text} value={text}
isEdit={isMetadataEdit} isEdit={isMetadataEdit}
terms={terms} terms={terms}
onChange={(e) => { onChange={(e) => {
onMetadataColumnEditableItemChange(e.target.value, 'dataOwner', index) onMetadataColumnEditableItemChange(e.target.value, 'dataOwner', record._id)
}} }}
/> />
}, },
...@@ -323,12 +339,12 @@ const AssetAction = (props) => { ...@@ -323,12 +339,12 @@ const AssetAction = (props) => {
dataIndex: 'confidentialityLevel', dataIndex: 'confidentialityLevel',
width: 100, width: 100,
ellipsis: true, ellipsis: true,
render: (text, _, index) => <MetadataColumnEditableItem render: (text, record, index) => <MetadataColumnEditableItem
value={text} value={text}
isEdit={isMetadataEdit} isEdit={isMetadataEdit}
terms={terms} terms={terms}
onChange={(e) => { onChange={(e) => {
onMetadataColumnEditableItemChange(e.target.value, 'confidentialityLevel', index) onMetadataColumnEditableItemChange(e.target.value, 'confidentialityLevel', record._id)
}} }}
/> />
}, },
...@@ -339,14 +355,18 @@ const AssetAction = (props) => { ...@@ -339,14 +355,18 @@ const AssetAction = (props) => {
render: (_, record) => { render: (_, record) => {
return <AppContext.Consumer> return <AppContext.Consumer>
{ {
appValue => <a onClick={() => { appValue => <Tooltip title={record.standard?.standardName??''}>
appValue?.setGlobalState && appValue?.setGlobalState({ <Typography.Text ellipsis={true}>
message: 'data-govern-show-index-detail-message', <a onClick={() => {
data: { id: record.standard?.standardId } appValue?.setGlobalState && appValue?.setGlobalState({
}) message: 'data-govern-show-index-detail-message',
}}> data: { id: record.standard?.standardId }
<span>{record.standard?.standardName}</span> })
</a> }}>
<span>{record.standard?.standardName}</span>
</a>
</Typography.Text>
</Tooltip>
} }
</AppContext.Consumer> </AppContext.Consumer>
} }
...@@ -368,7 +388,11 @@ const AssetAction = (props) => { ...@@ -368,7 +388,11 @@ const AssetAction = (props) => {
dataIndex: 'code', dataIndex: 'code',
width: 100, width: 100,
ellipsis: true, ellipsis: true,
render: (text, _) => highlightSearchContentByTerms(text||'', terms) render: (text, _) => <Tooltip title={text||''}>
<Typography.Text ellipsis={true}>
{highlightSearchContentByTerms(text||'', terms)}
</Typography.Text>
</Tooltip>
}); });
} }
...@@ -443,28 +467,30 @@ const AssetAction = (props) => { ...@@ -443,28 +467,30 @@ const AssetAction = (props) => {
return []; return [];
}, [currentDomainGroup, currentBussinessDomain, treeDataMap]) }, [currentDomainGroup, currentBussinessDomain, treeDataMap])
const tableData = useMemo(() => { const [tableData, total] = useMemo(() => {
let currentMetadataColumnList = isMetadataEdit ? [...modifyMetadataColumnList||[]] : [...metadataColumnList||[]] let currentMetadataColumnList = isMetadataEdit ? [...modifyMetadataColumnList||[]] : [...metadataColumnList||[]]
if ((currentMetadataColumnList??[]).length>0 && standardList && assets?.templateType) { if ((currentMetadataColumnList??[]).length>0 && standardList && assets?.templateType) {
const newMetadataColumnList = []; let newMetadataColumnList = [];
currentMetadataColumnList = (assets?.templateType==='mdg') ? currentMetadataColumnList.filter(item => { const filterMetadataColumnList = (assets?.templateType==='mdg') ? (metadataColumnList??[]).filter(item => {
return ( return (
!keyword !keyword
|| (item.name??'').indexOf(keyword)!==-1 || (item.name??'').toLowerCase().indexOf(keyword.toLowerCase())!==-1
|| (item.cnName??'').indexOf(keyword)!==-1 || (item.cnName??'').toLowerCase().indexOf(keyword.toLowerCase())!==-1
|| (item.businessDefinition??'').indexOf(keyword)!==-1 || (item.businessDefinition??'').toLowerCase().indexOf(keyword.toLowerCase())!==-1
) )
}) : currentMetadataColumnList.filter(item => { }) : (metadataColumnList??[]).filter(item => {
return ( return (
!keyword !keyword
|| (item.name??'').indexOf(keyword)!==-1 || (item.name??'').toLowerCase().indexOf(keyword.toLowerCase())!==-1
|| (item.cnName??'').indexOf(keyword)!==-1 || (item.cnName??'').toLowerCase().indexOf(keyword.toLowerCase())!==-1
|| (item.businessRules??'').indexOf(keyword)!==-1 || (item.businessRules??'').toLowerCase().indexOf(keyword.toLowerCase())!==-1
) )
}); });
currentMetadataColumnList = currentMetadataColumnList.filter(item => filterMetadataColumnList.map(_item=>_item._id).indexOf(item._id)!==-1);
currentMetadataColumnList.forEach(item => { currentMetadataColumnList.forEach(item => {
const index = standardList?.findIndex(_item => _item.metadataId === item._id); const index = standardList?.findIndex(_item => _item.metadataId === item._id);
let newItem = {...item}; let newItem = {...item};
...@@ -475,10 +501,10 @@ const AssetAction = (props) => { ...@@ -475,10 +501,10 @@ const AssetAction = (props) => {
newMetadataColumnList.push(newItem); newMetadataColumnList.push(newItem);
}); });
return paginate(newMetadataColumnList, pageNum, pageSize); return [paginate(newMetadataColumnList, pageNum, pageSize), newMetadataColumnList.length];
} }
return []; return [[], 0];
}, [metadataColumnList, modifyMetadataColumnList, standardList, pagination, keyword, isMetadataEdit, assets]) }, [metadataColumnList, modifyMetadataColumnList, standardList, pagination, keyword, isMetadataEdit, assets])
const getPermission = () => { const getPermission = () => {
...@@ -792,7 +818,7 @@ const AssetAction = (props) => { ...@@ -792,7 +818,7 @@ const AssetAction = (props) => {
} }
}, },
callback: data => { callback: data => {
setStandardList(data?.content); setStandardList(data?.content??[]);
}, },
}); });
} }
...@@ -801,12 +827,12 @@ const AssetAction = (props) => { ...@@ -801,12 +827,12 @@ const AssetAction = (props) => {
}) })
} }
const onMetadataColumnEditableItemChange = (val, dataIndex, index) => { const onMetadataColumnEditableItemChange = (val, dataIndex, id) => {
const _index = (pageNum-1)*pageSize + index;
setModifyMetadataColumnList( setModifyMetadataColumnList(
produce(modifyMetadataColumnList, (draft) => { produce(modifyMetadataColumnList, (draft) => {
if ((draft??[]).length > _index) { const index = (draft??[]).findIndex(item => item._id === id)
draft[_index][`${dataIndex}`] = val if (index !== -1) {
draft[index][dataIndex] = val
} }
}) })
) )
...@@ -1520,7 +1546,7 @@ const AssetAction = (props) => { ...@@ -1520,7 +1546,7 @@ const AssetAction = (props) => {
pagination={{ pagination={{
position: ['bottomLeft'], position: ['bottomLeft'],
size: 'small', size: 'small',
total: (metadataColumnList||[]).length, total,
showTotal: (total) => `${total}`, showTotal: (total) => `${total}`,
showSizeChanger: true, showSizeChanger: true,
current: pageNum, current: pageNum,
...@@ -1608,9 +1634,11 @@ const MetadataColumnEditableItem = ({ value, isEdit, terms, onChange }) => { ...@@ -1608,9 +1634,11 @@ const MetadataColumnEditableItem = ({ value, isEdit, terms, onChange }) => {
isEdit ? <Input size='small' isEdit ? <Input size='small'
value={value} value={value}
onChange={(e) => { onChange?.(e) }} onChange={(e) => { onChange?.(e) }}
/> : <span> /> : <Tooltip title={value??''}>
<Typography.Text ellipsis={true}>
{highlightSearchContentByTerms(value, terms)} {highlightSearchContentByTerms(value, terms)}
</span> </Typography.Text>
</Tooltip>
} }
</React.Fragment> </React.Fragment>
) )
......
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