Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
njgzx
dataease
Commits
c7aa73cd
提交
c7aa73cd
authored
11月 30, 2021
作者:
junjie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(数据集): 关联数据集
上级
d19f0f2a
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
170 行增加
和
12 行删除
+170
-12
en.js
frontend/src/lang/en.js
+3
-1
tw.js
frontend/src/lang/tw.js
+3
-1
zh.js
frontend/src/lang/zh.js
+3
-1
AddUnion.vue
frontend/src/views/dataset/add/AddUnion.vue
+76
-6
NodeItem.vue
frontend/src/views/dataset/add/union/NodeItem.vue
+52
-2
UnionNode.vue
frontend/src/views/dataset/add/union/UnionNode.vue
+27
-1
ViewTable.vue
frontend/src/views/dataset/data/ViewTable.vue
+6
-0
没有找到文件。
frontend/src/lang/en.js
浏览文件 @
c7aa73cd
...
...
@@ -1161,7 +1161,9 @@ export default {
edit_union_relation
:
'Edit Union Relation'
,
add_union_relation
:
'Add Union Relation'
,
field_select
:
'Select Field'
,
add_union_field
:
'Add Union Field'
add_union_field
:
'Add Union Field'
,
union_error
:
'Union relation and field can not be empty'
,
union_repeat
:
'This dataset is already union,do not union repeat'
},
datasource
:
{
datasource
:
'Data Source'
,
...
...
frontend/src/lang/tw.js
浏览文件 @
c7aa73cd
...
...
@@ -1162,7 +1162,9 @@ export default {
edit_union_relation
:
'編輯關聯關系'
,
add_union_relation
:
'新建關聯關系'
,
field_select
:
'字段選擇'
,
add_union_field
:
'添加關聯字段'
add_union_field
:
'添加關聯字段'
,
union_error
:
'關聯關系與關聯字段不能為空'
,
union_repeat
:
'當前數據集已被關聯,請勿重復關聯'
},
datasource
:
{
datasource
:
'數據源'
,
...
...
frontend/src/lang/zh.js
浏览文件 @
c7aa73cd
...
...
@@ -1164,7 +1164,9 @@ export default {
edit_union_relation
:
'编辑关联关系'
,
add_union_relation
:
'新建关联关系'
,
field_select
:
'字段选择'
,
add_union_field
:
'添加关联字段'
add_union_field
:
'添加关联字段'
,
union_error
:
'关联关系与关联字段不能为空'
,
union_repeat
:
'当前数据集已被关联,请勿重复关联'
},
datasource
:
{
datasource
:
'数据源'
,
...
...
frontend/src/views/dataset/add/AddUnion.vue
浏览文件 @
c7aa73cd
...
...
@@ -8,7 +8,7 @@
<el-button
size=
"mini"
@
click=
"cancel"
>
{{
$t
(
'dataset.cancel'
)
}}
</el-button>
<el-button
size=
"mini"
type=
"primary"
@
click=
"save"
>
<el-button
:disabled=
"!name"
size=
"mini"
type=
"primary"
@
click=
"save"
>
{{
$t
(
'dataset.confirm'
)
}}
</el-button>
</el-row>
...
...
@@ -17,7 +17,7 @@
<div>
<el-form
:inline=
"true"
>
<el-form-item
class=
"form-item"
>
<el-input
v-model=
"name"
size=
"mini"
:placeholder=
"$t('commons.name')"
/>
<el-input
v-model=
"name"
size=
"mini"
:placeholder=
"$t('commons.name')"
clearable
/>
</el-form-item>
</el-form>
<!--添加第一个数据集按钮-->
...
...
@@ -78,6 +78,7 @@ import UnionNode from '@/views/dataset/add/union/UnionNode'
import
NodeItem
from
'@/views/dataset/add/union/NodeItem'
import
DatasetGroupSelectorTree
from
'@/views/dataset/common/DatasetGroupSelectorTree'
import
UnionEdit
from
'@/views/dataset/add/union/UnionEdit'
import
{
getTable
,
post
}
from
'@/api/dataset/dataset'
export
default
{
name
:
'AddUnion'
,
components
:
{
UnionEdit
,
DatasetGroupSelectorTree
,
NodeItem
,
UnionNode
},
...
...
@@ -126,7 +127,7 @@ export default {
},
allChildCount
:
0
},
name
:
''
,
name
:
'
关联数据集
'
,
customType
:
[
'db'
,
'sql'
,
'excel'
],
selectDsDialog
:
false
,
// 弹框临时选中的数据集
...
...
@@ -135,11 +136,45 @@ export default {
unionParam
:
{}
}
},
watch
:
{
'param.tableId'
:
function
()
{
this
.
initTableData
()
}
},
mounted
()
{
this
.
initTableData
()
},
methods
:
{
save
()
{
if
(
!
this
.
name
||
this
.
name
===
''
)
{
this
.
$message
({
showClose
:
true
,
message
:
this
.
$t
(
'dataset.pls_input_name'
),
type
:
'error'
})
return
}
if
(
this
.
name
.
length
>
50
)
{
this
.
$message
({
showClose
:
true
,
message
:
this
.
$t
(
'dataset.char_can_not_more_50'
),
type
:
'error'
})
return
}
const
table
=
{
id
:
this
.
param
.
tableId
,
name
:
this
.
name
,
sceneId
:
this
.
param
.
id
,
dataSourceId
:
this
.
dataset
[
0
].
currentDs
.
dataSourceId
,
type
:
'union'
,
mode
:
this
.
dataset
[
0
].
currentDs
.
mode
,
info
:
'{"list":'
+
JSON
.
stringify
(
this
.
dataset
)
+
'}'
}
post
(
'/dataset/table/update'
,
table
).
then
(
response
=>
{
this
.
$emit
(
'saveSuccess'
,
table
)
this
.
cancel
()
})
},
cancel
()
{
if
(
this
.
param
.
tableId
)
{
...
...
@@ -198,11 +233,46 @@ export default {
}
},
confirmEditUnion
()
{
// todo 校验关联关系与字段,必填
this
.
editUnion
=
false
// 校验关联关系与字段,必填
if
(
this
.
checkUnion
())
{
this
.
editUnion
=
false
}
else
{
this
.
$message
({
message
:
this
.
$t
(
'dataset.union_error'
),
type
:
'error'
,
showClose
:
true
})
}
},
cancelUnion
(
val
)
{
this
.
dataset
=
val
},
checkUnion
()
{
const
union
=
this
.
unionParam
.
node
.
unionToParent
if
(
!
union
.
unionType
)
{
return
false
}
if
(
!
union
.
unionFields
||
union
.
unionFields
.
length
<
1
)
{
return
false
}
for
(
let
i
=
0
;
i
<
union
.
unionFields
.
length
;
i
++
)
{
const
ele
=
union
.
unionFields
[
i
]
if
(
!
ele
.
parentField
||
!
ele
.
parentField
.
id
||
!
ele
.
currentField
||
!
ele
.
currentField
.
id
)
{
return
false
}
}
return
true
},
initTableData
()
{
if
(
this
.
param
.
tableId
)
{
getTable
(
this
.
param
.
tableId
).
then
(
response
=>
{
const
table
=
JSON
.
parse
(
JSON
.
stringify
(
response
.
data
))
this
.
name
=
table
.
name
this
.
dataset
=
JSON
.
parse
(
table
.
info
).
list
})
}
}
}
}
...
...
frontend/src/views/dataset/add/union/NodeItem.vue
浏览文件 @
c7aa73cd
...
...
@@ -13,7 +13,7 @@
<el-button
icon=
"el-icon-more"
type=
"text"
size=
"small"
/>
</span>
<el-dropdown-menu
slot=
"dropdown"
>
<el-dropdown-item
icon=
"el-icon-copy-document"
:command=
"beforeNodeMenuClick('union',currentNode)"
>
<el-dropdown-item
:disabled=
"currentNode.currentDs.mode === 0 && currentNode.currentDs.modelInnerType === 'sql'"
icon=
"el-icon-copy-document"
:command=
"beforeNodeMenuClick('union',currentNode)"
>
<span
style=
"font-size: 12px;"
>
{{
$t
(
'dataset.union'
)
}}
</span>
</el-dropdown-item>
<el-dropdown-item
icon=
"el-icon-edit-outline"
:command=
"beforeNodeMenuClick('edit',currentNode)"
>
...
...
@@ -29,7 +29,7 @@
<!--选择数据集-->
<el-dialog
v-dialogDrag
:title=
"$t('chart.select_dataset')"
:visible=
"selectDsDialog"
:show-close=
"false"
width=
"360px"
class=
"dialog-css"
destroy-on-close
>
<dataset-group-selector-tree
:fix-height=
"true"
show-mode=
"union"
:custom-type=
"customType"
@
getTable=
"firstDs"
/>
<dataset-group-selector-tree
:fix-height=
"true"
show-mode=
"union"
:custom-type=
"customType"
:mode=
"currentNode.currentDs.mode"
@
getTable=
"firstDs"
/>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
size=
"mini"
@
click=
"closeSelectDs()"
>
{{
$t
(
'dataset.cancel'
)
}}
</el-button>
<el-button
:disabled=
"!tempDs.id"
type=
"primary"
size=
"mini"
@
click=
"confirmSelectDs()"
>
{{
$t
(
'dataset.confirm'
)
}}
</el-button>
...
...
@@ -127,6 +127,16 @@ export default {
},
selectDs
()
{
// 根据父级node,过滤不同的数据集
if
(
this
.
currentNode
.
currentDs
.
mode
===
1
)
{
this
.
customType
=
[
'db'
,
'sql'
,
'excel'
]
}
else
if
(
this
.
currentNode
.
currentDs
.
mode
===
0
)
{
if
(
this
.
currentNode
.
currentDs
.
modelInnerType
===
'db'
)
{
this
.
customType
=
[
'db'
]
}
else
{
this
.
customType
=
[]
}
}
this
.
selectDsDialog
=
true
},
// 弹框中选择数据集
...
...
@@ -138,6 +148,27 @@ export default {
this
.
tempDs
=
{}
},
confirmSelectDs
()
{
// 校验当前数据集是否已被关联,以及直连模式是否属于同一数据源
if
(
this
.
tempDs
.
mode
===
0
)
{
if
(
this
.
tempDs
.
dataSourceId
!==
this
.
tempParentDs
.
currentDs
.
dataSourceId
)
{
this
.
$message
({
type
:
'error'
,
message
:
this
.
$t
(
'dataset.can_not_union_diff_datasource'
),
showClose
:
true
})
return
}
}
const
arr
=
this
.
getAllDs
()
if
(
arr
.
indexOf
(
this
.
tempDs
.
id
)
>
-
1
)
{
this
.
$message
({
type
:
'error'
,
message
:
this
.
$t
(
'dataset.union_repeat'
),
showClose
:
true
})
return
}
// check over
const
ds
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
unionItem
))
ds
.
currentDs
=
this
.
tempDs
this
.
tempParentDs
.
childrenDs
.
push
(
ds
)
...
...
@@ -163,6 +194,25 @@ export default {
},
confirmEditField
()
{
this
.
editField
=
false
},
getAllDs
()
{
const
arr
=
[]
for
(
let
i
=
0
;
i
<
this
.
originData
.
length
;
i
++
)
{
arr
.
push
(
this
.
originData
[
0
].
currentDs
.
id
)
if
(
this
.
originData
[
0
].
childrenDs
&&
this
.
originData
[
0
].
childrenDs
.
length
>
0
)
{
this
.
getDs
(
this
.
originData
[
0
].
childrenDs
,
arr
)
}
}
return
arr
},
getDs
(
dsList
,
arr
)
{
for
(
let
i
=
0
;
i
<
dsList
.
length
;
i
++
)
{
arr
.
push
(
dsList
[
i
].
currentDs
.
id
)
if
(
dsList
[
i
].
childrenDs
&&
dsList
[
i
].
childrenDs
.
length
>
0
)
{
this
.
getDs
(
dsList
[
i
].
childrenDs
,
arr
)
}
}
}
}
}
...
...
frontend/src/views/dataset/add/union/UnionNode.vue
浏览文件 @
c7aa73cd
...
...
@@ -191,11 +191,37 @@ export default {
}
},
confirmEditUnion
()
{
this
.
editUnion
=
false
// 校验关联关系与字段,必填
if
(
this
.
checkUnion
())
{
this
.
editUnion
=
false
}
else
{
this
.
$message
({
message
:
this
.
$t
(
'dataset.union_error'
),
type
:
'error'
,
showClose
:
true
})
}
},
// 向上级传递
cancelUnion
(
val
)
{
this
.
$emit
(
'cancelUnionEdit'
,
val
)
},
checkUnion
()
{
const
union
=
this
.
unionParam
.
node
.
unionToParent
if
(
!
union
.
unionType
)
{
return
false
}
if
(
!
union
.
unionFields
||
union
.
unionFields
.
length
<
1
)
{
return
false
}
for
(
let
i
=
0
;
i
<
union
.
unionFields
.
length
;
i
++
)
{
const
ele
=
union
.
unionFields
[
i
]
if
(
!
ele
.
parentField
||
!
ele
.
parentField
.
id
||
!
ele
.
currentField
||
!
ele
.
currentField
.
id
)
{
return
false
}
}
return
true
}
}
}
...
...
frontend/src/views/dataset/data/ViewTable.vue
浏览文件 @
c7aa73cd
...
...
@@ -36,6 +36,9 @@
<el-button
v-if=
"table.type ==='sql'"
size=
"mini"
@
click=
"editSql"
>
{{
$t
(
'dataset.edit_sql'
)
}}
</el-button>
<el-button
v-if=
"table.type ==='union'"
size=
"mini"
@
click=
"editUnion"
>
{{
$t
(
'dataset.edit_union'
)
}}
</el-button>
<!--
<el-button
size=
"mini"
@
click=
"edit"
>
-->
<!--
{{
$t
(
'dataset.edit_field'
)
}}
-->
<!--
</el-button>
-->
...
...
@@ -168,6 +171,9 @@ export default {
editCustom
()
{
this
.
$emit
(
'switchComponent'
,
{
name
:
'AddCustom'
,
param
:
{
id
:
this
.
table
.
sceneId
,
tableId
:
this
.
table
.
id
,
table
:
this
.
table
}})
},
editUnion
()
{
this
.
$emit
(
'switchComponent'
,
{
name
:
'AddUnion'
,
param
:
{
id
:
this
.
table
.
sceneId
,
tableId
:
this
.
table
.
id
,
table
:
this
.
table
}})
},
reSearch
(
val
)
{
this
.
tableViewRowForm
=
val
.
form
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论