diff --git a/api/app/lib/controllers/dataQuality/index.js b/api/app/lib/controllers/dataQuality/index.js index 770f61b..4a628b0 100644 --- a/api/app/lib/controllers/dataQuality/index.js +++ b/api/app/lib/controllers/dataQuality/index.js @@ -5,41 +5,61 @@ function getStandardDocFolders (opts) { return async function (ctx, next) { const models = ctx.fs.dc.models; - const { page, limit, resourceName, applyBy, keyword, parent } = ctx.query; + const { keyword, parent } = ctx.query; let errMsg = { message: '获取标准文档目录列表失败' } try { let option = { where: { parent: parent || null }, - order: [["id", "desc"]], - // distinct: true, - // include: [{ - // model: models.User, - // as: 'applyUser', - // attributes: ['id', 'name'] - // }, { - // model: models.User, - // as: 'approveUser', - // attributes: ['id', 'name'] - // },] + order: [["id", "desc"]] + } + + let folderData = await models.StandardDocFolder.findAll(option) || [] + + + let fileAll = await models.StandardDoc.findAll({}) + let folderAll = await models.StandardDocFolder.findAll({}) + + + const recursive = (id) => { + let show = false + let fileOne = fileAll.filter(f => f.folder == id && (f.docName.indexOf(keyword) != -1 || f.standardType.indexOf(keyword) != -1)) + if (fileOne.length > 0) { + return true + } + let folderList = folderAll.filter(f => f.parent == id) + if (folderList.length > 0) { + let data = [] + folderList.map(d => { + let datum = recursive(d.id) + if (datum) { + data.push(d) + } + }) + if (data.length > 0) { + show = true + } + } else { + return false + } + return show } - // if (resourceName) { - // option.where.resourceName = { $iLike: `%${resourceName}%` } - // } - // if (applyBy) { - // option.include[0].where = { '$applyUser.name$': { $iLike: `%${applyBy}%` } } - // } - - // if (limit) { - // option.limit = Number(limit) - // } - // if (page && limit) { - // option.offset = Number(page) * Number(limit) - // } - - - const res = await models.StandardDocFolder.findAll(option); + let res = [] + + if (folderData.length > 0 && keyword) { + + folderData.map(d => { + let findOne = recursive(d.id) + if (findOne) { + res.push(d) + } + }) + + } else { + res = folderData + } + ctx.status = 200; ctx.body = res; } catch (error) { @@ -51,6 +71,8 @@ function getStandardDocFolders (opts) { } + + // 标准文档目录新增失败 function postStandardDocFolders (opts) { return async function (ctx, next) { diff --git a/scripts/0.0.8/04_alter_t_standard_doc_folder copy.sql b/scripts/0.0.8/01_alter_t_standard_doc_folder.sql similarity index 100% rename from scripts/0.0.8/04_alter_t_standard_doc_folder copy.sql rename to scripts/0.0.8/01_alter_t_standard_doc_folder.sql diff --git a/scripts/0.0.8/01_alter_t_standard_doc.sql b/scripts/0.0.8/02_alter_t_standard_doc.sql similarity index 100% rename from scripts/0.0.8/01_alter_t_standard_doc.sql rename to scripts/0.0.8/02_alter_t_standard_doc.sql diff --git a/scripts/0.0.8/02_alter_ t_business_rule.sql b/scripts/0.0.8/03_alter_ t_business_rule.sql similarity index 100% rename from scripts/0.0.8/02_alter_ t_business_rule.sql rename to scripts/0.0.8/03_alter_ t_business_rule.sql diff --git a/scripts/0.0.8/03_alter_t_data_security_specification .sql b/scripts/0.0.8/04_alter_t_data_security_specification .sql similarity index 100% rename from scripts/0.0.8/03_alter_t_data_security_specification .sql rename to scripts/0.0.8/04_alter_t_data_security_specification .sql diff --git a/web/client/assets/files/common/1687654158463_1.jpg b/web/client/assets/files/common/1687654158463_1.jpg new file mode 100644 index 0000000..e2c29e8 Binary files /dev/null and b/web/client/assets/files/common/1687654158463_1.jpg differ diff --git a/web/client/src/sections/dataQuality/containers/documentLibrary.js b/web/client/src/sections/dataQuality/containers/documentLibrary.js index beecdb7..ad44424 100644 --- a/web/client/src/sections/dataQuality/containers/documentLibrary.js +++ b/web/client/src/sections/dataQuality/containers/documentLibrary.js @@ -86,7 +86,7 @@ function Approve ({ loading, clientHeight, actions, dispatch, }) { if (folderId.current?.length || fileId.current?.length) { dispatch(dataQuality.postFolderFile({ folderId: folderId.current, fileId: fileId.current })).then(res => { if (res.success) { - resourceData(parent) + resourceData(parent,keywords) setCheckAll(false) console.log(res); res.payload.data?.map(v => { @@ -140,8 +140,8 @@ function Approve ({ loading, clientHeight, actions, dispatch, }) { } }) setBreadcrumbData([...data]) - resourceData(s.parent, null) - setKeywords(null) + resourceData(s.parent, keywords) + // setKeywords(null) setParent(s.parent || null) fileId.current = [] setFileIds([]) @@ -173,8 +173,8 @@ function Approve ({ loading, clientHeight, actions, dispatch, }) { } else if (clicks === 2) { breadcrumbData?.push({ name: v.name, parent: v.id || null }) setBreadcrumbData([...breadcrumbData]) - resourceData(v.id, null) - setKeywords(null) + resourceData(v.id, keywords) + // setKeywords(null) setParent(v.id || null) } clicks = 0; @@ -239,7 +239,7 @@ function Approve ({ loading, clientHeight, actions, dispatch, }) { } success={ () => { - resourceData(parent) + resourceData(parent,keywords) } } /> : "" @@ -252,7 +252,7 @@ function Approve ({ loading, clientHeight, actions, dispatch, }) { setFileModal(false); }} success={() => { - resourceData(parent) + resourceData(parent,keywords) }} remove={url => { RouteRequest.delete(RouteTable.cleanUpUploadTrash, { url: url });