Browse Source

(*)培训资料库: 优化三级公司类文件可上传、删除

master
周沫沫历险记 2 years ago
parent
commit
33b87bec75
  1. 3
      api/app/lib/controllers/resourceRepository/index.js
  2. 16
      web/client/src/sections/humanAffairs/components/resourceRepository/upload-modal.jsx
  3. 6
      web/client/src/sections/humanAffairs/containers/resourceRepository.jsx

3
api/app/lib/controllers/resourceRepository/index.js

@ -152,8 +152,7 @@ async function getResourceFileList(ctx, next) {
departmentName: departmentName
}
if (trainDate) {
//todo
where.trainDate = trainDate
where.trainDate = { $between: [moment(trainDate).startOf('month').format('YYYY-MM-DD HH:mm:ss'), moment(trainDate).endOf('month').format('YYYY-MM-DD HH:mm:ss')] };
}
findObj.where = where;
}

16
web/client/src/sections/humanAffairs/components/resourceRepository/upload-modal.jsx

@ -35,15 +35,23 @@ const ResourceUploadModal = (props) => {
onSizeError={(file, fileList) => Toast.error(`${file.name} 超过200M`)}
onExceed={(fileList) => { Toast.error(`一次最多上传5个文件`) }}
rules={[{ required: true, message: '请上传文件' }]}
extraText={<div
style={{
color: 'var(--semi-color-link)',
fontSize: 14,
userSelect: 'none'
}}
>
支持文件类型.doc,.docx,.xls,.xlsx,.pdf,.pptx
支持压缩包类型ziprar7z
文件大小一个不能超过200M一次最多上传5个文件
</div>
}
>
<Button icon={<IconUpload />} theme="light">
点击上传
</Button>
</Form.Upload>
<p>支持文件类型.doc,.docx,.xls,.xlsx,.pdf,.pptx
支持压缩包类型ziprar7z
文件大小一个不能超过200M一次最多上传5个文件
</p>
</Form>
</Modal >
)

6
web/client/src/sections/humanAffairs/containers/resourceRepository.jsx

@ -54,7 +54,7 @@ const ResourceRepository = (props) => {
return <div style={{ color: "#1890FF" }}>
<Space>
<a href={'/_file-server/' + record.attachPath + '?filename=' + encodeURIComponent(record.fileName + record.fileType)}>下载</a>
<a onClick={() => handleDelFile(record.id)}>删除</a>
{currentSelect.includes("公司培训资料") && <a style={{ cursor: 'pointer' }} onClick={() => handleDelFile(record.id)}>删除</a>}
</Space>
</div>
}
@ -175,7 +175,7 @@ const ResourceRepository = (props) => {
setDefaultExpandedKey([payload.data[0].key]);
}
}
setCurrentSelect([defaultKey]);
setCurrentSelect(defaultKey);
setTreeData(payload.data);
getFile(defaultKey);
}
@ -228,7 +228,7 @@ const ResourceRepository = (props) => {
<Row type="flex" justify="space-around" align="middle">
<Col span={18}>
<Space>
{currentSelect && currentSelect.includes("部门培训资料") ? null : <Button theme='solid' type='primary' onClick={() => { setUploadModalVisiable(true) }} >上传文件</Button>}
{currentSelect && currentSelect.includes("公司培训资料") && currentSelect.split("/").length == 3 ? <Button theme='solid' type='primary' onClick={() => { setUploadModalVisiable(true) }} >上传文件</Button> : null}
<span className="path-lable"><strong>当前文件夹{currentSelect}</strong></span>
</Space>
</Col>

Loading…
Cancel
Save