Commit 14b78fe3 by zhaochengxiang

表级搜索

parent 0d39c503
...@@ -109,6 +109,7 @@ export class App extends React.Component { ...@@ -109,6 +109,7 @@ export class App extends React.Component {
<AssetTree <AssetTree
reference={AssetMountReference} reference={AssetMountReference}
checkable={true} checkable={true}
metadataIds={hostParams.data}
onCheck={(values) => { onCheck={(values) => {
hostParams.callback&&hostParams.callback(values); hostParams.callback&&hostParams.callback(values);
}} }}
......
...@@ -110,6 +110,9 @@ export function* existDataAsset(payload) { ...@@ -110,6 +110,9 @@ export function* existDataAsset(payload) {
export function* queryAllDirectoryAsTree() { export function* queryAllDirectoryAsTree() {
return yield call(service.queryAllDirectoryAsTree); return yield call(service.queryAllDirectoryAsTree);
} }
export function* queryDirectoryTreeByMetadataId(payload) {
return yield call(service.queryDirectoryTreeByMetadataId, payload);
}
export function* queryResourceDirectoryAsTree() { export function* queryResourceDirectoryAsTree() {
return yield call(service.queryResourceDirectoryAsTree); return yield call(service.queryResourceDirectoryAsTree);
} }
......
...@@ -140,6 +140,10 @@ export function queryAllDirectoryAsTree() { ...@@ -140,6 +140,10 @@ export function queryAllDirectoryAsTree() {
return GetJSON("/dataassetmanager/directoryApi/queryAllDirectoryAsTree"); return GetJSON("/dataassetmanager/directoryApi/queryAllDirectoryAsTree");
} }
export function queryDirectoryTreeByMetadataId(payload) {
return GetJSON("/dataassetmanager/directoryApi/queryDirectoryTreeByMetadataIdPath", payload)
}
export function queryResourceDirectoryAsTree() { export function queryResourceDirectoryAsTree() {
return PostJSON("/dataassetmanager/directoryApi/querySourceTypeAsTree"); return PostJSON("/dataassetmanager/directoryApi/querySourceTypeAsTree");
} }
......
...@@ -65,6 +65,7 @@ const AssetAction = (props) => { ...@@ -65,6 +65,7 @@ const AssetAction = (props) => {
const { pageNum, pageSize } = pagination; const { pageNum, pageSize } = pagination;
const [modal, contextHolder] = Modal.useModal(); const [modal, contextHolder] = Modal.useModal();
const [permissions, setPermissions] = useState(undefined); const [permissions, setPermissions] = useState(undefined);
const [keyword, setKeyword] = useState('');
const app = useContext(AppContext); const app = useContext(AppContext);
const uploadRef = useRef(undefined); const uploadRef = useRef(undefined);
...@@ -262,7 +263,14 @@ const AssetAction = (props) => { ...@@ -262,7 +263,14 @@ const AssetAction = (props) => {
if (metadataColumnList && standardList) { if (metadataColumnList && standardList) {
const newMetadataColumnList = []; const newMetadataColumnList = [];
metadataColumnList.forEach(item => { metadataColumnList.filter(item => {
return (
!keyword
|| (item.name??'').indexOf(keyword)!==-1
|| (item.cnName??'').indexOf(keyword)!==-1
|| (item.businessRules??'').indexOf(keyword)!==-1
)
}).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};
if (index !== -1) { if (index !== -1) {
...@@ -276,7 +284,7 @@ const AssetAction = (props) => { ...@@ -276,7 +284,7 @@ const AssetAction = (props) => {
} }
return []; return [];
}, [metadataColumnList, standardList, pagination]) }, [metadataColumnList, standardList, pagination, keyword])
const getPermission = () => { const getPermission = () => {
dispatch({ dispatch({
...@@ -1090,6 +1098,14 @@ const AssetAction = (props) => { ...@@ -1090,6 +1098,14 @@ const AssetAction = (props) => {
字段级维护 字段级维护
</Button> </Button>
} }
<Input size="middle"
placeholder="中英文名称/业务规则"
value={keyword}
bordered={true} allowClear
onChange={(e) => {
setPagination({...paginate, pageNum: 1})
setKeyword(e.target.value)
}} />
{/* { {/* {
(reference===AssetManageReference||canEdit) && <Button type='primary' onClick={() => { (reference===AssetManageReference||canEdit) && <Button type='primary' onClick={() => {
uploadRef.current?.chooseFile() uploadRef.current?.chooseFile()
...@@ -1110,7 +1126,7 @@ const AssetAction = (props) => { ...@@ -1110,7 +1126,7 @@ const AssetAction = (props) => {
pagination={{ pagination={{
position: ['bottomLeft'], position: ['bottomLeft'],
size: 'small', size: 'small',
total: (metadataColumnList||[]).length, total: (tableData||[]).length,
showTotal: (total) => `${total}`, showTotal: (total) => `${total}`,
showSizeChanger: true, showSizeChanger: true,
current: pageNum, current: pageNum,
......
...@@ -10,12 +10,12 @@ const AssetDetailDrawer = (props) => { ...@@ -10,12 +10,12 @@ const AssetDetailDrawer = (props) => {
return ( return (
<Drawer <Drawer
forceRender
visible={ visible } visible={ visible }
title='资产目录详情' title='资产目录详情'
width='80%' width='80%'
placement="right" placement="right"
closable={ true } closable={ true }
destroyOnClose
onClose={() => { onClose={() => {
onCancel && onCancel(); onCancel && onCancel();
}} }}
......
...@@ -44,7 +44,7 @@ const AssetManageTree = (props) => { ...@@ -44,7 +44,7 @@ const AssetManageTree = (props) => {
id: MENU_ID, id: MENU_ID,
}); });
const { checkable = false, onSelect, className, onCheck, tableId, reference=AssetManageReference, onDirectoryChange, centerId } = props; const { checkable = false, onSelect, className, onCheck, tableId, reference=AssetManageReference, onDirectoryChange, centerId, metadataIds } = props;
const [ keyword, setKeyword ] = useState(''); const [ keyword, setKeyword ] = useState('');
const [ loading, setLoading ] = useState(false); const [ loading, setLoading ] = useState(false);
const [ treeData, setTreeData ] = useState([]); const [ treeData, setTreeData ] = useState([]);
...@@ -78,7 +78,12 @@ const AssetManageTree = (props) => { ...@@ -78,7 +78,12 @@ const AssetManageTree = (props) => {
const dataListRef = useRef([]); const dataListRef = useRef([]);
useEffect(() => { useEffect(() => {
if (reference === AssetManageReference) {
getTemplates() getTemplates()
} else {
getAllDirectoryAsTree(false)
}
window?.addEventListener("storage", storageChange); window?.addEventListener("storage", storageChange);
return () => { return () => {
...@@ -86,7 +91,7 @@ const AssetManageTree = (props) => { ...@@ -86,7 +91,7 @@ const AssetManageTree = (props) => {
} }
//eslint-disable-next-line react-hooks/exhaustive-deps //eslint-disable-next-line react-hooks/exhaustive-deps
}, []) }, [metadataIds])
// useEffect(() => { // useEffect(() => {
// if ((did||'') !== '') { // if ((did||'') !== '') {
...@@ -182,14 +187,7 @@ const AssetManageTree = (props) => { ...@@ -182,14 +187,7 @@ const AssetManageTree = (props) => {
// onSelect && onSelect('', ''); // onSelect && onSelect('', '');
// } // }
let url = ''; function disposeData(data) {
if (reference === AssetManageReference || reference === AssetMountReference) {
url = 'assetmanage.queryAllDirectoryAsTree';
}
dispatch({
type: url,
callback: data => {
setLoading(false); setLoading(false);
refresh && showMessage('success', '操作成功'); refresh && showMessage('success', '操作成功');
...@@ -262,11 +260,38 @@ const AssetManageTree = (props) => { ...@@ -262,11 +260,38 @@ const AssetManageTree = (props) => {
onSelect && onSelect(defaultItem.nodeId, defaultItem.type||'', defaultItem.level); onSelect && onSelect(defaultItem.nodeId, defaultItem.type||'', defaultItem.level);
} }
} }
}
if ((metadataIds??[]).length > 0) {
dispatch({
type: 'assetmanage.queryDirectoryTreeByMetadataId',
payload: {
metadataIdPath: metadataIds[0]
},
callback: data => {
disposeData(data)
}, },
error: () => { error: () => {
setLoading(false); setLoading(false);
} }
}); });
} else {
let url = '';
if (reference === AssetManageReference || reference === AssetMountReference) {
url = 'assetmanage.queryAllDirectoryAsTree';
}
dispatch({
type: url,
callback: data => {
disposeData(data)
},
error: () => {
setLoading(false);
}
});
}
} }
const treeDirectoryChanged = (did) => { const treeDirectoryChanged = (did) => {
......
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