forked from github/dataease
feat(数据集): 关联数据集
This commit is contained in:
parent
b912c1fb97
commit
b2dc85232a
@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div class="ds-node" @click="nodeClick">
|
<div class="ds-node" @click="nodeClick">
|
||||||
<svg-icon v-if="currentNode.currentDs.type === 'db'" icon-class="ds-db" class="ds-icon-db" />
|
<svg-icon v-if="currentNode.currentDs.modelInnerType === 'db'" icon-class="ds-db" class="ds-icon-db" />
|
||||||
<svg-icon v-else-if="currentNode.currentDs.type === 'sql'" icon-class="ds-sql" class="ds-icon-sql" />
|
<svg-icon v-else-if="currentNode.currentDs.modelInnerType === 'sql'" icon-class="ds-sql" class="ds-icon-sql" />
|
||||||
<svg-icon v-else-if="currentNode.currentDs.type === 'excel'" icon-class="ds-excel" class="ds-icon-excel" />
|
<svg-icon v-else-if="currentNode.currentDs.modelInnerType === 'excel'" icon-class="ds-excel" class="ds-icon-excel" />
|
||||||
|
|
||||||
<span class="node-name" :title="currentNode.currentDs.name">{{ currentNode.currentDs.name }}</span>
|
<span class="node-name" :title="currentNode.currentDs.name">{{ currentNode.currentDs.name }}</span>
|
||||||
|
|
||||||
@ -35,14 +35,24 @@
|
|||||||
<el-button :disabled="!tempDs.id" type="primary" size="mini" @click="confirmSelectDs()">{{ $t('dataset.confirm') }}</el-button>
|
<el-button :disabled="!tempDs.id" type="primary" size="mini" @click="confirmSelectDs()">{{ $t('dataset.confirm') }}</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<!--编辑单个数据集字段-->
|
||||||
|
<el-dialog v-if="editField" v-dialogDrag :title="$t('dataset.field_select')" :visible="editField" :show-close="false" width="360px" class="dialog-css" destroy-on-close>
|
||||||
|
<union-field-edit :node="currentNode" />
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button size="mini" @click="closeEditField()">{{ $t('dataset.cancel') }}</el-button>
|
||||||
|
<el-button type="primary" size="mini" @click="confirmEditField()">{{ $t('dataset.confirm') }}</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import DatasetGroupSelectorTree from '@/views/dataset/common/DatasetGroupSelectorTree'
|
import DatasetGroupSelectorTree from '@/views/dataset/common/DatasetGroupSelectorTree'
|
||||||
|
import UnionFieldEdit from '@/views/dataset/add/union/UnionFieldEdit'
|
||||||
export default {
|
export default {
|
||||||
name: 'NodeItem',
|
name: 'NodeItem',
|
||||||
components: { DatasetGroupSelectorTree },
|
components: { UnionFieldEdit, DatasetGroupSelectorTree },
|
||||||
props: {
|
props: {
|
||||||
currentNode: {
|
currentNode: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@ -70,12 +80,13 @@ export default {
|
|||||||
// 弹框临时选中的数据集
|
// 弹框临时选中的数据集
|
||||||
tempDs: {},
|
tempDs: {},
|
||||||
// 父级数据集
|
// 父级数据集
|
||||||
tempParentDs: {}
|
tempParentDs: {},
|
||||||
|
editField: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
nodeClick() {
|
nodeClick() {
|
||||||
console.log('node click to edit')
|
this.editField = true
|
||||||
},
|
},
|
||||||
nodeMenuClick(param) {
|
nodeMenuClick(param) {
|
||||||
switch (param.type) {
|
switch (param.type) {
|
||||||
@ -102,6 +113,7 @@ export default {
|
|||||||
this.selectDs()
|
this.selectDs()
|
||||||
},
|
},
|
||||||
editNode(param) {
|
editNode(param) {
|
||||||
|
this.nodeClick()
|
||||||
},
|
},
|
||||||
deleteNode(param) {
|
deleteNode(param) {
|
||||||
this.$emit('deleteNode', this.nodeIndex)
|
this.$emit('deleteNode', this.nodeIndex)
|
||||||
@ -138,6 +150,12 @@ export default {
|
|||||||
// 增加与删除事件向父级传递
|
// 增加与删除事件向父级传递
|
||||||
notifyFirstParent(type) {
|
notifyFirstParent(type) {
|
||||||
this.$emit('notifyParent', { type: type, grandParentAdd: true, grandParentSub: true, subCount: this.currentNode.allChildCount })
|
this.$emit('notifyParent', { type: type, grandParentAdd: true, grandParentSub: true, subCount: this.currentNode.allChildCount })
|
||||||
|
},
|
||||||
|
closeEditField() {
|
||||||
|
this.editField = false
|
||||||
|
},
|
||||||
|
confirmEditField() {
|
||||||
|
this.editField = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,40 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>123</div>
|
<div>
|
||||||
|
<p>{{ node.currentDs.name }}</p>
|
||||||
|
<union-field-list :field-list="fieldList" :node="node" @checkedFields="changeFields" />
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { post } from '@/api/dataset/dataset'
|
||||||
|
import UnionFieldList from '@/views/dataset/add/union/UnionFieldList'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'UnionFieldEdit',
|
name: 'UnionFieldEdit',
|
||||||
|
components: { UnionFieldList },
|
||||||
|
props: {
|
||||||
|
node: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
fieldList: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
this.getFieldList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getFieldList() {
|
||||||
|
post('/dataset/field/list/' + this.node.currentDs.id, null, true).then(response => {
|
||||||
|
this.fieldList = JSON.parse(JSON.stringify(response.data)).filter(ele => ele.extField === 0)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
changeFields(val) {
|
||||||
|
this.node.currentDsField = val
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -130,11 +130,11 @@
|
|||||||
<span v-else slot-scope="{ node, data }" class="custom-tree-node-list father">
|
<span v-else slot-scope="{ node, data }" class="custom-tree-node-list father">
|
||||||
<span style="display: flex;flex: 1;width: 0;">
|
<span style="display: flex;flex: 1;width: 0;">
|
||||||
<span>
|
<span>
|
||||||
<svg-icon v-if="data.type === 'db'" icon-class="ds-db" class="ds-icon-db" />
|
<svg-icon v-if="data.modelInnerType === 'db'" icon-class="ds-db" class="ds-icon-db" />
|
||||||
<svg-icon v-if="data.type === 'sql'" icon-class="ds-sql" class="ds-icon-sql" />
|
<svg-icon v-if="data.modelInnerType === 'sql'" icon-class="ds-sql" class="ds-icon-sql" />
|
||||||
<svg-icon v-if="data.type === 'excel'" icon-class="ds-excel" class="ds-icon-excel" />
|
<svg-icon v-if="data.modelInnerType === 'excel'" icon-class="ds-excel" class="ds-icon-excel" />
|
||||||
<svg-icon v-if="data.type === 'custom'" icon-class="ds-custom" class="ds-icon-custom" />
|
<svg-icon v-if="data.modelInnerType === 'custom'" icon-class="ds-custom" class="ds-icon-custom" />
|
||||||
<svg-icon v-if="data.type === 'union'" icon-class="ds-union" class="ds-icon-union" />
|
<svg-icon v-if="data.modelInnerType === 'union'" icon-class="ds-union" class="ds-icon-union" />
|
||||||
</span>
|
</span>
|
||||||
<span v-if="data.modelInnerType === 'db' || data.modelInnerType === 'sql'">
|
<span v-if="data.modelInnerType === 'db' || data.modelInnerType === 'sql'">
|
||||||
<span v-if="data.mode === 0" style="margin-left: 6px"><i class="el-icon-s-operation" /></span>
|
<span v-if="data.mode === 0" style="margin-left: 6px"><i class="el-icon-s-operation" /></span>
|
||||||
|
Loading…
Reference in New Issue
Block a user