Browse Source

文件搜索

master
wenlele 2 years ago
parent
commit
f1f4ab52ea
  1. 80
      api/app/lib/controllers/dataQuality/index.js
  2. 0
      scripts/0.0.8/01_alter_t_standard_doc_folder.sql
  3. 0
      scripts/0.0.8/02_alter_t_standard_doc.sql
  4. 0
      scripts/0.0.8/03_alter_ t_business_rule.sql
  5. 0
      scripts/0.0.8/04_alter_t_data_security_specification .sql
  6. BIN
      web/client/assets/files/common/1687654158463_1.jpg
  7. 14
      web/client/src/sections/dataQuality/containers/documentLibrary.js

80
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']
// },]
}
// 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);
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
}
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) {

0
scripts/0.0.8/04_alter_t_standard_doc_folder copy.sql → scripts/0.0.8/01_alter_t_standard_doc_folder.sql

0
scripts/0.0.8/01_alter_t_standard_doc.sql → scripts/0.0.8/02_alter_t_standard_doc.sql

0
scripts/0.0.8/02_alter_ t_business_rule.sql → scripts/0.0.8/03_alter_ t_business_rule.sql

0
scripts/0.0.8/03_alter_t_data_security_specification .sql → scripts/0.0.8/04_alter_t_data_security_specification .sql

BIN
web/client/assets/files/common/1687654158463_1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

14
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 });

Loading…
Cancel
Save