Archer_cdm 2 years ago
parent
commit
bf03e48be4
  1. 41
      api/app/lib/controllers/resourceRepository/index.js
  2. 8
      web/client/src/sections/humanAffairs/containers/resourceRepository.jsx
  3. 25
      web/client/src/sections/humanAffairs/style.less

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

@ -136,37 +136,24 @@ async function getResourceFileList(ctx, next) {
findObj.limit = Number(limit);
findObj.offset = Number(page) * Number(limit);
}
const where = { fileName: { $not: null } };
if (departmentName) {
where.departmentName = departmentName;
}
if (startTime && endTime) {
where.updateDate = { $between: [startTime, endTime] };
}
if (keyword) {
where.fileName = { $like: `%${keyword}%` };
}
findObj.where = where;
if ("公司培训资料" == type) {
findObj.where = { fileName: { $not: null } };
if (departmentName) {
findObj.where.departmentName = departmentName;
}
if (trainDate) {
findObj.where.trainDate = trainDate;
}
if (startTime && endTime) {
findObj.where.updateDate = { $between: [startTime, endTime] };
}
if (keyword) {
findObj.where.fileName = { $like: `%${keyword}%` };
}
if (trainDate) { findObj.where.trainDate = trainDate; }
rlst = await models.TrainingInformation.findAndCountAll(findObj);
} else {
if (departmentName) {
const where = {
departmentName: departmentName
}
if (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')] };
}
if (startTime && endTime) {
where.updateDate = { $between: [startTime, endTime] };
}
if (keyword) {
where.fileName = { $like: `%${keyword}%` };
}
findObj.where = where;
if (trainDate) {
findObj.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')] };
}
rlst = await models.DeptTraining.findAndCountAll(findObj);
}

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

@ -75,7 +75,7 @@ const ResourceRepository = (props) => {
const child = data.children ? true : false;
const key = data.key.split('/');
return (<div>
<Tooltip content={label}><span >{label.length > 8 ? label.substring(0, 8) + '...' : label}</span></Tooltip>
<Tooltip content={label}><span >{label.length > 7 ? label.substring(0, 7) + '...' : label}</span></Tooltip>
{true == data.operation ?
<span className='tree-icon'>
<IconEditStroked size='default' onClick={() => handleFolderClick(child ? '编辑' : '编辑子', !child, key[1], key[2] || undefined)} />
@ -129,7 +129,8 @@ const ResourceRepository = (props) => {
const handleDelFile = (id) => {
dispatch(delResourceFile(id)).then(res => {
if (res.success) {
getFile(currentSelect);
getFile(currentSelect, { limit: 10, page: 0 }, { restSearch: true });
}
})
}
@ -177,6 +178,9 @@ const ResourceRepository = (props) => {
const query = pagination ? { ...pagination, type: arr[0] } : { ...paginationQuery, type: arr[0] };
if (opt && opt.restSearch) {
//
setPaginatioQuery({ limit: 10, page: 0 });
setKeyword(null);
setDataRange(null);
} else {
if (keyword) { query.keyword = keyword; }
if (dataRange) {

25
web/client/src/sections/humanAffairs/style.less

@ -24,19 +24,22 @@
margin-bottom: 20px;
}
.tree-icon {
padding-left: 6px;
opacity: 0;
-webkit-transition: opacity 0.1s 0.2s;
.semi-icon {
padding-left: 6px;
.semi-tree-option-list-block .semi-tree-option:hover{
.tree-icon {
opacity: 1;
-webkit-transition: opacity 0.2s;
}
}
.tree-icon:hover {
opacity: 1;
-webkit-transition: opacity 0.2s;
.semi-tree-option-list-block .semi-tree-option{
.tree-icon {
padding-left: 6px;
opacity: 0;
-webkit-transition: opacity 0.1s 0.2s;
.semi-icon {
padding-left: 6px;
}
}
}
}

Loading…
Cancel
Save