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) { return async function (ctx, next) {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { page, limit, resourceName, applyBy, keyword, parent } = ctx.query; const { keyword, parent } = ctx.query;
let errMsg = { message: '获取标准文档目录列表失败' } let errMsg = { message: '获取标准文档目录列表失败' }
try { try {
let option = { let option = {
where: { parent: parent || null }, where: { parent: parent || null },
order: [["id", "desc"]], order: [["id", "desc"]]
// distinct: true, }
// include: [{
// model: models.User, let folderData = await models.StandardDocFolder.findAll(option) || []
// as: 'applyUser',
// attributes: ['id', 'name']
// }, { let fileAll = await models.StandardDoc.findAll({})
// model: models.User, let folderAll = await models.StandardDocFolder.findAll({})
// as: 'approveUser',
// attributes: ['id', 'name']
// },] const recursive = (id) => {
} let show = false
// if (resourceName) { let fileOne = fileAll.filter(f => f.folder == id && (f.docName.indexOf(keyword) != -1 || f.standardType.indexOf(keyword) != -1))
// option.where.resourceName = { $iLike: `%${resourceName}%` } if (fileOne.length > 0) {
// } return true
// if (applyBy) { }
// option.include[0].where = { '$applyUser.name$': { $iLike: `%${applyBy}%` } } let folderList = folderAll.filter(f => f.parent == id)
// } if (folderList.length > 0) {
let data = []
// if (limit) { folderList.map(d => {
// option.limit = Number(limit) let datum = recursive(d.id)
// } if (datum) {
// if (page && limit) { data.push(d)
// option.offset = Number(page) * Number(limit) }
// } })
if (data.length > 0) {
show = true
const res = await models.StandardDocFolder.findAll(option); }
} 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.status = 200;
ctx.body = res; ctx.body = res;
} catch (error) { } catch (error) {
@ -51,6 +71,8 @@ function getStandardDocFolders (opts) {
} }
// 标准文档目录新增失败 // 标准文档目录新增失败
function postStandardDocFolders (opts) { function postStandardDocFolders (opts) {
return async function (ctx, next) { 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) { if (folderId.current?.length || fileId.current?.length) {
dispatch(dataQuality.postFolderFile({ folderId: folderId.current, fileId: fileId.current })).then(res => { dispatch(dataQuality.postFolderFile({ folderId: folderId.current, fileId: fileId.current })).then(res => {
if (res.success) { if (res.success) {
resourceData(parent) resourceData(parent,keywords)
setCheckAll(false) setCheckAll(false)
console.log(res); console.log(res);
res.payload.data?.map(v => { res.payload.data?.map(v => {
@ -140,8 +140,8 @@ function Approve ({ loading, clientHeight, actions, dispatch, }) {
} }
}) })
setBreadcrumbData([...data]) setBreadcrumbData([...data])
resourceData(s.parent, null) resourceData(s.parent, keywords)
setKeywords(null) // setKeywords(null)
setParent(s.parent || null) setParent(s.parent || null)
fileId.current = [] fileId.current = []
setFileIds([]) setFileIds([])
@ -173,8 +173,8 @@ function Approve ({ loading, clientHeight, actions, dispatch, }) {
} else if (clicks === 2) { } else if (clicks === 2) {
breadcrumbData?.push({ name: v.name, parent: v.id || null }) breadcrumbData?.push({ name: v.name, parent: v.id || null })
setBreadcrumbData([...breadcrumbData]) setBreadcrumbData([...breadcrumbData])
resourceData(v.id, null) resourceData(v.id, keywords)
setKeywords(null) // setKeywords(null)
setParent(v.id || null) setParent(v.id || null)
} }
clicks = 0; clicks = 0;
@ -239,7 +239,7 @@ function Approve ({ loading, clientHeight, actions, dispatch, }) {
} }
success={ success={
() => { () => {
resourceData(parent) resourceData(parent,keywords)
} }
} }
/> : "" /> : ""
@ -252,7 +252,7 @@ function Approve ({ loading, clientHeight, actions, dispatch, }) {
setFileModal(false); setFileModal(false);
}} }}
success={() => { success={() => {
resourceData(parent) resourceData(parent,keywords)
}} }}
remove={url => { remove={url => {
RouteRequest.delete(RouteTable.cleanUpUploadTrash, { url: url }); RouteRequest.delete(RouteTable.cleanUpUploadTrash, { url: url });

Loading…
Cancel
Save