feat(fix):视图、数据集界面优化

This commit is contained in:
junjie 2021-06-20 11:38:12 +08:00
parent a33bf12037
commit ffefb6032d
3 changed files with 21 additions and 18 deletions

View File

@ -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))

View File

@ -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>

View File

@ -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