Commit 14b78fe3 by zhaochengxiang

表级搜索

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