forked from github/dataease
feat(fix):视图、数据集界面优化
This commit is contained in:
parent
a33bf12037
commit
ffefb6032d
@ -471,15 +471,17 @@ export default {
|
||||
}
|
||||
},
|
||||
initTableField(id) {
|
||||
post('/dataset/table/getFieldsFromDE', this.table).then(response => {
|
||||
this.dimension = response.data.dimension
|
||||
this.quota = response.data.quota
|
||||
}).catch(err => {
|
||||
this.resetView()
|
||||
this.httpRequest.status = err.response.data.success
|
||||
this.httpRequest.msg = err.response.data.message
|
||||
return true
|
||||
})
|
||||
if (this.table) {
|
||||
post('/dataset/table/getFieldsFromDE', this.table).then(response => {
|
||||
this.dimension = response.data.dimension
|
||||
this.quota = response.data.quota
|
||||
}).catch(err => {
|
||||
this.resetView()
|
||||
this.httpRequest.status = err.response.data.success
|
||||
this.httpRequest.msg = err.response.data.message
|
||||
return true
|
||||
})
|
||||
}
|
||||
},
|
||||
save(getData, trigger, needRefreshGroup = false) {
|
||||
const view = JSON.parse(JSON.stringify(this.view))
|
||||
|
@ -57,9 +57,9 @@
|
||||
<svg-icon v-if="scope.row.deExtractType === 1" icon-class="field_time" class="field-icon-time" />
|
||||
<span class="field-class">{{ $t('dataset.time') }}</span>
|
||||
</span>
|
||||
<span v-if="scope.row.deExtractType === 2 || scope.row.deExtractType === 3">
|
||||
<svg-icon v-if="scope.row.deExtractType === 2 || scope.row.deExtractType === 3" icon-class="field_value" class="field-icon-value" />
|
||||
<span v-if="scope.row.deExtractType === 2" class="field-class">{{ $t('dataset.value') }}</span>
|
||||
<span v-if="scope.row.deExtractType === 2 || scope.row.deExtractType === 3 || scope.row.deExtractType === 4">
|
||||
<svg-icon v-if="scope.row.deExtractType === 2 || scope.row.deExtractType === 3 || scope.row.deExtractType === 4" icon-class="field_value" class="field-icon-value" />
|
||||
<span v-if="scope.row.deExtractType === 2 || scope.row.deExtractType === 4" class="field-class">{{ $t('dataset.value') }}</span>
|
||||
<span v-if="scope.row.deExtractType === 3" class="field-class">{{ $t('dataset.value') + '(' + $t('dataset.float') + ')' }}</span>
|
||||
</span>
|
||||
</span>
|
||||
|
@ -410,7 +410,9 @@ export default {
|
||||
treeProps: {
|
||||
label: 'name',
|
||||
children: 'children',
|
||||
isLeaf: 'isLeaf'
|
||||
isLeaf: 'isLeaf',
|
||||
id: 'id',
|
||||
parentId: 'pid'
|
||||
},
|
||||
isTreeSearch: false
|
||||
}
|
||||
@ -845,31 +847,30 @@ export default {
|
||||
name: val
|
||||
}
|
||||
authModel(queryCondition).then(res => {
|
||||
debugger
|
||||
this.tData = this.buildTree(res.data)
|
||||
})
|
||||
},
|
||||
|
||||
buildTree(arrs) {
|
||||
const idMapping = arrs.reduce((acc, el, i) => {
|
||||
acc[el[this.defaultProps.id]] = i
|
||||
acc[el[this.treeProps.id]] = i
|
||||
return acc
|
||||
}, {})
|
||||
const roots = []
|
||||
arrs.forEach(el => {
|
||||
// 判断根节点 ###
|
||||
if (el[this.defaultProps.parentId] === null || el[this.defaultProps.parentId] === 0 || el[this.defaultProps.parentId] === '0') {
|
||||
if (el[this.treeProps.parentId] === null || el[this.treeProps.parentId] === 0 || el[this.treeProps.parentId] === '0') {
|
||||
roots.push(el)
|
||||
return
|
||||
}
|
||||
// 用映射表找到父元素
|
||||
const parentEl = arrs[idMapping[el[this.defaultProps.parentId]]]
|
||||
const parentEl = arrs[idMapping[el[this.treeProps.parentId]]]
|
||||
// 把当前元素添加到父元素的`children`数组中
|
||||
parentEl.children = [...(parentEl.children || []), el]
|
||||
|
||||
// 设置展开节点 如果没有子节点则不进行展开
|
||||
if (parentEl.children.length > 0) {
|
||||
this.expandedKey.push(parentEl[this.defaultProps.id])
|
||||
this.expandedArray.push(parentEl[this.treeProps.id])
|
||||
}
|
||||
})
|
||||
return roots
|
||||
|
Loading…
Reference in New Issue
Block a user