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

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

@ -136,29 +136,9 @@ async function getResourceFileList(ctx, next) {
findObj.limit = Number(limit); findObj.limit = Number(limit);
findObj.offset = Number(page) * Number(limit); findObj.offset = Number(page) * Number(limit);
} }
const where = { fileName: { $not: null } };
if ("公司培训资料" == type) {
findObj.where = { fileName: { $not: null } };
if (departmentName) { if (departmentName) {
findObj.where.departmentName = departmentName; 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}%` };
}
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) { if (startTime && endTime) {
where.updateDate = { $between: [startTime, endTime] }; where.updateDate = { $between: [startTime, endTime] };
@ -167,6 +147,13 @@ async function getResourceFileList(ctx, next) {
where.fileName = { $like: `%${keyword}%` }; where.fileName = { $like: `%${keyword}%` };
} }
findObj.where = where; findObj.where = where;
if ("公司培训资料" == type) {
if (trainDate) { findObj.where.trainDate = trainDate; }
rlst = await models.TrainingInformation.findAndCountAll(findObj);
} else {
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); 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 child = data.children ? true : false;
const key = data.key.split('/'); const key = data.key.split('/');
return (<div> 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 ? {true == data.operation ?
<span className='tree-icon'> <span className='tree-icon'>
<IconEditStroked size='default' onClick={() => handleFolderClick(child ? '编辑' : '编辑子', !child, key[1], key[2] || undefined)} /> <IconEditStroked size='default' onClick={() => handleFolderClick(child ? '编辑' : '编辑子', !child, key[1], key[2] || undefined)} />
@ -129,7 +129,8 @@ const ResourceRepository = (props) => {
const handleDelFile = (id) => { const handleDelFile = (id) => {
dispatch(delResourceFile(id)).then(res => { dispatch(delResourceFile(id)).then(res => {
if (res.success) { 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] }; const query = pagination ? { ...pagination, type: arr[0] } : { ...paginationQuery, type: arr[0] };
if (opt && opt.restSearch) { if (opt && opt.restSearch) {
// //
setPaginatioQuery({ limit: 10, page: 0 });
setKeyword(null);
setDataRange(null);
} else { } else {
if (keyword) { query.keyword = keyword; } if (keyword) { query.keyword = keyword; }
if (dataRange) { if (dataRange) {

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

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

Loading…
Cancel
Save