|
|
@ -57,10 +57,11 @@ const FilesTable = (props) => { |
|
|
|
setEditData({ |
|
|
|
title: '修改文件元数据', record: { |
|
|
|
...record, ...record.attributesParam, |
|
|
|
files: [{ |
|
|
|
url: "\\assets\\files\\common\\" + record.name + '.' + record.type, name: record.name |
|
|
|
}] |
|
|
|
} |
|
|
|
files: record.fileName ? [{ |
|
|
|
url: "\\assets\\files\\common\\" + record.fileName, name: record.fileName.split('_').pop() |
|
|
|
}] : [] |
|
|
|
}, |
|
|
|
// metadataModels: res.payload.data
|
|
|
|
}); |
|
|
|
setModalVisible(true); |
|
|
|
} |
|
|
@ -70,7 +71,7 @@ const FilesTable = (props) => { |
|
|
|
dispatch(metadataManagement.delMetadataFiles(record.id)).then(res => { |
|
|
|
if (res.success) { |
|
|
|
onSearch(); setModalVisible(false); |
|
|
|
deleteFile({ url: "\\assets\\files\\common\\" + record.name + '.' + record.type }) |
|
|
|
deleteFile({ url: "\\assets\\files\\common\\" + record.fileName }) |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
@ -159,7 +160,13 @@ const FilesTable = (props) => { |
|
|
|
title: '类型', |
|
|
|
dataIndex: 'type', |
|
|
|
key: 'type', |
|
|
|
width: '10%' |
|
|
|
width: '10%', |
|
|
|
render: (text, record) => { |
|
|
|
if (record.fileName) |
|
|
|
return <span>{text}</span> |
|
|
|
else |
|
|
|
return '' |
|
|
|
} |
|
|
|
}, { |
|
|
|
title: '标签', |
|
|
|
dataIndex: 'tags', |
|
|
@ -175,7 +182,12 @@ const FilesTable = (props) => { |
|
|
|
dataIndex: 'size', |
|
|
|
key: 'size', |
|
|
|
width: '10%', |
|
|
|
render: (text) => <span>{getfilesize(text)}</span> |
|
|
|
render: (text, record) => { |
|
|
|
if (record.fileName) |
|
|
|
return <span>{getfilesize(text)}</span> |
|
|
|
else |
|
|
|
return '' |
|
|
|
} |
|
|
|
}, { |
|
|
|
title: '修改时间', |
|
|
|
dataIndex: 'updateAt', |
|
|
@ -262,6 +274,7 @@ const FilesTable = (props) => { |
|
|
|
if (values.files && values.files.length) { |
|
|
|
obj.type = values.files[0].name.split('.').pop(); |
|
|
|
obj.size = values.files[0].size; |
|
|
|
obj.fileName = values.files[0].url.split('\\').pop(); |
|
|
|
} |
|
|
|
dispatch(metadataManagement.postMetadataFiles(obj)).then(() => { |
|
|
|
onSearch(); setModalVisible(false); |
|
|
@ -270,7 +283,10 @@ const FilesTable = (props) => { |
|
|
|
obj = { catalog: resourceCatalogId, catalogKey: resourceCatalogKey, ...values } |
|
|
|
if (values.files && values.files.length) { |
|
|
|
obj.type = values.files[0].name.split('.').pop(); |
|
|
|
obj.size = values.files[0].size; |
|
|
|
if (values.files[0].size) { |
|
|
|
obj.size = values.files[0].size; |
|
|
|
} |
|
|
|
obj.fileName = values.files[0].url.split('\\').pop(); |
|
|
|
} |
|
|
|
dispatch(metadataManagement.putMetadataFiles(editData.record.id, obj)).then(res => { |
|
|
|
if (res.success) { |
|
|
@ -345,10 +361,17 @@ const FilesTable = (props) => { |
|
|
|
<MetadataFileModal |
|
|
|
metadataModels={metadataModels.filter(m => m.modelType === '文件')} |
|
|
|
editData={editData} |
|
|
|
onCancel={(file) => { |
|
|
|
onCancel={(file, updateId) => { |
|
|
|
setModalVisible(false) |
|
|
|
if (file) |
|
|
|
deleteFile(file); |
|
|
|
if (updateId) { |
|
|
|
dispatch(metadataManagement.putMetadataFiles(updateId, {}, true)).then(res => { |
|
|
|
if (res.success) { |
|
|
|
onSearch(); setModalVisible(false); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}} |
|
|
|
onConfirm={onConfirm} /> : '' |
|
|
|
} |
|
|
|