Merge pull request #505 from dataease/pr@dev@refactor_数据集tree搜索优化

refactor: 数据集tree修复
This commit is contained in:
XiaJunjie2020 2021-08-03 17:13:41 +08:00 committed by GitHub
commit 80bf45de43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,7 +68,6 @@
<script> <script>
import { isKettleRunning, post } from '@/api/dataset/dataset' import { isKettleRunning, post } from '@/api/dataset/dataset'
import { authModel } from '@/api/system/sysAuth'
import { hasDataPermission } from '@/utils/permission' import { hasDataPermission } from '@/utils/permission'
export default { export default {
@ -403,11 +402,14 @@ export default {
searchTree(val) { searchTree(val) {
const queryCondition = { const queryCondition = {
withExtend: 'parent', // withExtend: 'parent',
modelType: 'dataset', // modelType: 'dataset',
name: val name: val
} }
authModel(queryCondition).then(res => { // authModel(queryCondition).then(res => {
// this.data = this.buildTree(res.data)
// })
post('/dataset/table/search', queryCondition).then(res => {
this.data = this.buildTree(res.data) this.data = this.buildTree(res.data)
}) })
}, },
@ -420,8 +422,8 @@ export default {
const roots = [] const roots = []
arrs.forEach(el => { arrs.forEach(el => {
// ### // ###
el.type = el.modelInnerType // el.type = el.modelInnerType
el.isLeaf = el.leaf // el.isLeaf = el.leaf
if (el[this.treeProps.parentId] === null || el[this.treeProps.parentId] === 0 || el[this.treeProps.parentId] === '0') { if (el[this.treeProps.parentId] === null || el[this.treeProps.parentId] === 0 || el[this.treeProps.parentId] === '0') {
roots.push(el) roots.push(el)
return return