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