|
|
@ -34,7 +34,7 @@ const FilesTable = (props) => { |
|
|
|
dispatch(metadataManagement.getTagList()); |
|
|
|
setUpdateAtSort('descend'); |
|
|
|
initData({ limit, offset: currentPage - 1, orderDirection: SortValues[updateAtSort] }); |
|
|
|
}, [resourceCatalogId]); |
|
|
|
}, []); |
|
|
|
|
|
|
|
const initData = (query = {}) => { |
|
|
|
dispatch(metadataManagement.getMetadataFiles({ catalog: resourceCatalogId, keywords, orderBy: 'updateAt', ...query })).then(res => { |
|
|
@ -85,7 +85,8 @@ const FilesTable = (props) => { |
|
|
|
if (res.success) { |
|
|
|
const obj = { tagSet: [], tags: [], id: id }; |
|
|
|
if (res.payload.data.length) { |
|
|
|
obj.tagSet = res.payload.data.map(d => d.tagSet); |
|
|
|
const tagSetIds = res.payload.data.map(d => d.tagSet) |
|
|
|
obj.tagSet = [...new Set(tagSetIds)]; |
|
|
|
obj.tags = res.payload.data.map(d => d.id); |
|
|
|
} |
|
|
|
setEditTagData({ record: obj }); |
|
|
@ -232,7 +233,7 @@ const FilesTable = (props) => { |
|
|
|
if (isAll) { |
|
|
|
dispatch(metadataManagement.getMetadataFiles({ catalog: resourceCatalogId })).then(res => { |
|
|
|
if (res.success) { |
|
|
|
handleExportTable(tableHeader, res.payload.data.rows, isAll); |
|
|
|
handleExportTable(tableHeader, res.payload.data.rows); |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
@ -245,7 +246,7 @@ const FilesTable = (props) => { |
|
|
|
handleExportTable(tableHeader, data); |
|
|
|
} |
|
|
|
} |
|
|
|
const handleExportTable = (tableHeader, contentData, isAll = false) => { |
|
|
|
const handleExportTable = (tableHeader, contentData) => { |
|
|
|
let tableContent = ''; |
|
|
|
contentData.map(cd => { |
|
|
|
tableContent += `<tr>`; |
|
|
@ -254,7 +255,7 @@ const FilesTable = (props) => { |
|
|
|
tableContent += `<th style="font-weight:600"><div>${cd.type}</div></th>`; |
|
|
|
let tagName = cd.tagFiles.map(tagSet => tagSet.tag.name); |
|
|
|
tableContent += `<th style="font-weight:600"><div>${tagName.join(',')}</div></th>`; |
|
|
|
tableContent += `<th style="font-weight:600"><div>${cd.size}</div></th>`; |
|
|
|
tableContent += `<th style="font-weight:600"><div>${cd.size ? getfilesize(cd.size) : ''}</div></th>`; |
|
|
|
tableContent += `<th style="font-weight:600"><div>${moment(cd.updateAt).format('YYYY-MM-DD HH:mm:ss')}</div></th>`; |
|
|
|
tableContent += `</tr>`; |
|
|
|
}) |
|
|
@ -315,7 +316,7 @@ const FilesTable = (props) => { |
|
|
|
</Popconfirm> |
|
|
|
} |
|
|
|
<Button type='primary' style={{ marginLeft: 16, float: 'right' }} onClick={onSearch}>查询</Button> |
|
|
|
<Input style={{ width: 220, float: 'right' }} placeholder="输入名称/类型" |
|
|
|
<Input style={{ width: 220, float: 'right' }} placeholder="名称/类型" |
|
|
|
allowClear onPressEnter={onSearch} onChange={e => setKeywords(e.target.value || '')} /> |
|
|
|
</div > |
|
|
|
<Table |
|
|
@ -331,22 +332,7 @@ const FilesTable = (props) => { |
|
|
|
showSizeChanger: true, |
|
|
|
// showQuickJumper: true,
|
|
|
|
showTotal: (total) => { return <span style={{ fontSize: 15 }}>{`共${Math.ceil(total / limit)}页,${total}项`}</span> }, |
|
|
|
onShowSizeChange: (currentPage, pageSize) => { |
|
|
|
setCurrentPage(currentPage); |
|
|
|
setLimit(pageSize); |
|
|
|
}, |
|
|
|
onChange: (page, pageSize) => { |
|
|
|
setSelectedRowKeys([]); |
|
|
|
setSelectedRows([]); |
|
|
|
setCurrentPage(page); |
|
|
|
setLimit(pageSize); |
|
|
|
let queryParams = { |
|
|
|
orderDirection: SortValues[updateAtSort], |
|
|
|
page: page - 1, |
|
|
|
size: pageSize |
|
|
|
}; |
|
|
|
initData(queryParams); |
|
|
|
} |
|
|
|
|
|
|
|
}} |
|
|
|
rowSelection={{ |
|
|
|
onChange: (selectedRowKeys, selectedRows) => { |
|
|
@ -394,16 +380,15 @@ const FilesTable = (props) => { |
|
|
|
</Spin > |
|
|
|
} |
|
|
|
function mapStateToProps(state) { |
|
|
|
const { global, auth, metadataDatabases, metadataModels, tagList, tagMetadata, metadataResourceApplications } = state; |
|
|
|
const { global, auth, metadataFiles, metadataModels, tagList, tagMetadata, metadataResourceApplications } = state; |
|
|
|
return { |
|
|
|
user: auth.user, |
|
|
|
actions: global.actions, |
|
|
|
clientHeight: global.clientHeight, |
|
|
|
isRequesting: metadataDatabases.isRequesting || metadataModels.isRequesting || tagList.isRequesting |
|
|
|
isRequesting: metadataFiles.isRequesting || metadataModels.isRequesting || tagList.isRequesting |
|
|
|
|| tagMetadata.isRequesting || metadataResourceApplications.isRequesting, |
|
|
|
metadataModels: metadataModels.data, |
|
|
|
tagList: tagList.data || [], |
|
|
|
tagMetadata: tagMetadata.data || [], |
|
|
|
metadataResourceApplications: metadataResourceApplications.data || [] |
|
|
|
}; |
|
|
|
} |
|
|
|