Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
njgzx
dataease
Commits
9ed61080
提交
9ed61080
authored
4月 29, 2021
作者:
fit2cloud-chenyw
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 数据源弹框改为隐藏路由
上级
639246df
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
158 行增加
和
9 行删除
+158
-9
DatasourceController.java
.../dataease/datasource/controller/DatasourceController.java
+1
-1
Topbar.vue
frontend/src/layout/components/Topbar.vue
+9
-1
form.vue
frontend/src/views/system/datasource/form.vue
+135
-0
index.vue
frontend/src/views/system/datasource/index.vue
+13
-7
没有找到文件。
backend/src/main/java/io/dataease/datasource/controller/DatasourceController.java
浏览文件 @
9ed61080
...
@@ -41,7 +41,7 @@ public class DatasourceController {
...
@@ -41,7 +41,7 @@ public class DatasourceController {
return
PageUtils
.
setPageInfo
(
page
,
datasourceService
.
gridQuery
(
request
));
return
PageUtils
.
setPageInfo
(
page
,
datasourceService
.
gridQuery
(
request
));
}
}
@
Ge
tMapping
(
"/delete/{datasourceID}"
)
@
Pos
tMapping
(
"/delete/{datasourceID}"
)
public
void
deleteDatasource
(
@PathVariable
(
value
=
"datasourceID"
)
String
datasourceID
)
{
public
void
deleteDatasource
(
@PathVariable
(
value
=
"datasourceID"
)
String
datasourceID
)
{
datasourceService
.
deleteDatasource
(
datasourceID
);
datasourceService
.
deleteDatasource
(
datasourceID
);
}
}
...
...
frontend/src/layout/components/Topbar.vue
浏览文件 @
9ed61080
...
@@ -187,12 +187,20 @@ export default {
...
@@ -187,12 +187,20 @@ export default {
},
},
// 设置侧边栏的显示和隐藏
// 设置侧边栏的显示和隐藏
setSidebarHide
(
route
)
{
setSidebarHide
(
route
)
{
if
(
!
route
.
children
||
route
.
children
.
length
===
1
)
{
// if (!route.children || route.children.length === 1) {
if
(
!
route
.
children
||
this
.
showChildLength
(
route
)
===
1
)
{
this
.
$store
.
dispatch
(
'app/toggleSideBarHide'
,
true
)
this
.
$store
.
dispatch
(
'app/toggleSideBarHide'
,
true
)
}
else
{
}
else
{
this
.
$store
.
dispatch
(
'app/toggleSideBarHide'
,
false
)
this
.
$store
.
dispatch
(
'app/toggleSideBarHide'
,
false
)
}
}
},
},
// 获取非隐藏子路由的个数
showChildLength
(
route
)
{
if
(
!
route
||
!
route
.
children
)
{
return
0
}
return
route
.
children
.
filter
(
kid
=>
!
kid
.
hidden
).
length
},
async
logout
()
{
async
logout
()
{
await
this
.
$store
.
dispatch
(
'user/logout'
)
await
this
.
$store
.
dispatch
(
'user/logout'
)
this
.
$router
.
push
(
`/login?redirect=
${
this
.
$route
.
fullPath
}
`
)
this
.
$router
.
push
(
`/login?redirect=
${
this
.
$route
.
fullPath
}
`
)
...
...
frontend/src/views/system/datasource/form.vue
0 → 100644
浏览文件 @
9ed61080
<
template
>
<layout-content
:header=
"formType=='add' ? $t('datasource.create') : $t('datasource.modify')"
back-name=
"数据源1"
>
<el-form
ref=
"dsForm"
:model=
"form"
:rules=
"rule"
size=
"small"
label-width=
"auto"
label-position=
"right"
>
<el-form-item
:label=
"$t('commons.name')"
prop=
"name"
>
<el-input
v-model=
"form.name"
autocomplete=
"off"
/>
</el-form-item>
<el-form-item
:label=
"$t('commons.description')"
prop=
"desc"
>
<el-input
v-model=
"form.desc"
autocomplete=
"off"
type=
"textarea"
/>
</el-form-item>
<el-form-item
:label=
"$t('datasource.type')"
prop=
"type"
>
<el-select
v-model=
"form.type"
:placeholder=
"$t('datasource.please_choose_type')"
class=
"select-width"
@
change=
"changeType()"
>
<el-option
v-for=
"item in allTypes"
:key=
"item.name"
:label=
"item.name"
:value=
"item.name"
/>
</el-select>
</el-form-item>
<el-form-item
v-if=
"form.configuration.dataSourceType=='jdbc'"
:label=
"$t('datasource.data_base')"
prop=
"configuration.dataBase"
>
<el-input
v-model=
"form.configuration.dataBase"
autocomplete=
"off"
/>
</el-form-item>
<el-form-item
v-if=
"form.configuration.dataSourceType=='jdbc'"
:label=
"$t('datasource.user_name')"
prop=
"configuration.username"
>
<el-input
v-model=
"form.configuration.username"
autocomplete=
"off"
/>
</el-form-item>
<el-form-item
v-if=
"form.configuration.dataSourceType=='jdbc'"
:label=
"$t('datasource.password')"
prop=
"configuration.password"
>
<el-input
v-model=
"form.configuration.password"
autocomplete=
"off"
/>
</el-form-item>
<el-form-item
v-if=
"form.configuration.dataSourceType=='jdbc'"
:label=
"$t('datasource.host')"
prop=
"configuration.host"
>
<el-input
v-model=
"form.configuration.host"
autocomplete=
"off"
/>
</el-form-item>
<el-form-item
v-if=
"form.configuration.dataSourceType=='jdbc'"
:label=
"$t('datasource.port')"
prop=
"configuration.port"
>
<el-input
v-model=
"form.configuration.port"
autocomplete=
"off"
/>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
@
click=
"save"
>
保存
</el-button>
<el-button
type=
"primary"
@
click=
"validaDatasource"
>
{{
$t
(
'commons.validate'
)
}}
</el-button>
<el-button
@
click=
"reset"
>
重置
</el-button>
</el-form-item>
</el-form>
</layout-content>
</
template
>
<
script
>
import
LayoutContent
from
'@/components/business/LayoutContent'
import
{
addDs
,
editDs
,
validateDs
}
from
'@/api/system/datasource'
export
default
{
components
:
{
LayoutContent
},
data
()
{
return
{
form
:
{
configuration
:
{}},
rule
:
{
name
:
[{
required
:
true
,
message
:
this
.
$t
(
'datasource.input_name'
),
trigger
:
'blur'
},
{
min
:
2
,
max
:
25
,
message
:
this
.
$t
(
'commons.input_limit'
,
[
2
,
25
]),
trigger
:
'blur'
}],
desc
:
[{
required
:
true
,
message
:
this
.
$t
(
'datasource.input_desc'
),
trigger
:
'blur'
},
{
min
:
2
,
max
:
50
,
message
:
this
.
$t
(
'commons.input_limit'
,
[
2
,
50
]),
trigger
:
'blur'
}],
type
:
[{
required
:
true
,
message
:
this
.
$t
(
'datasource.please_choose_type'
),
trigger
:
'change'
}],
'configuration.dataBase'
:
[{
required
:
true
,
message
:
this
.
$t
(
'datasource.please_input_data_base'
),
trigger
:
'blur'
}],
'configuration.username'
:
[{
required
:
true
,
message
:
this
.
$t
(
'datasource.please_input_user_name'
),
trigger
:
'blur'
}],
'configuration.password'
:
[{
required
:
true
,
message
:
this
.
$t
(
'datasource.please_input_password'
),
trigger
:
'change'
}],
'configuration.host'
:
[{
required
:
true
,
message
:
this
.
$t
(
'datasource.please_input_host'
),
trigger
:
'change'
}],
'configuration.port'
:
[{
required
:
true
,
message
:
this
.
$t
(
'datasource.please_input_port'
),
trigger
:
'change'
}]
},
allTypes
:
[{
name
:
'mysql'
,
type
:
'jdbc'
},
{
name
:
'sqlServer'
,
type
:
'jdbc'
}]
}
},
created
()
{
if
(
this
.
$router
.
currentRoute
.
params
&&
this
.
$router
.
currentRoute
.
params
.
id
)
{
const
row
=
this
.
$router
.
currentRoute
.
params
this
.
edit
(
row
)
}
else
{
this
.
create
()
}
},
methods
:
{
create
()
{
this
.
formType
=
'add'
},
edit
(
row
)
{
this
.
formType
=
'modify'
this
.
form
=
Object
.
assign
({},
row
)
this
.
form
.
configuration
=
JSON
.
parse
(
this
.
form
.
configuration
)
},
reset
()
{
this
.
$refs
.
dsForm
.
resetFields
()
},
save
()
{
this
.
$refs
.
dsForm
.
validate
(
valid
=>
{
if
(
valid
)
{
const
method
=
this
.
formType
===
'add'
?
addDs
:
editDs
this
.
form
.
configuration
=
JSON
.
stringify
(
this
.
form
.
configuration
)
method
(
this
.
form
).
then
(
res
=>
{
this
.
$success
(
this
.
$t
(
'commons.save_success'
))
this
.
backToList
()
})
}
else
{
return
false
}
})
},
validaDatasource
()
{
this
.
$refs
.
dsForm
.
validate
(
valid
=>
{
if
(
valid
)
{
const
data
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
form
))
data
.
configuration
=
JSON
.
stringify
(
data
.
configuration
)
validateDs
(
data
).
then
(
res
=>
{
this
.
$success
(
this
.
$t
(
'datasource.validate_success'
))
})
}
else
{
return
false
}
})
},
changeType
()
{
for
(
let
i
=
0
;
i
<
this
.
allTypes
.
length
;
i
++
)
{
if
(
this
.
allTypes
[
i
].
name
===
this
.
form
.
type
)
{
this
.
form
.
configuration
.
dataSourceType
=
this
.
allTypes
[
i
].
type
}
}
},
backToList
()
{
this
.
$router
.
push
({
name
:
'数据源1'
})
}
}
}
</
script
>
frontend/src/views/system/datasource/index.vue
浏览文件 @
9ed61080
...
@@ -125,7 +125,7 @@ export default {
...
@@ -125,7 +125,7 @@ export default {
label
:
this
.
$t
(
'commons.edit'
),
icon
:
'el-icon-edit'
,
click
:
this
.
edit
,
label
:
this
.
$t
(
'commons.edit'
),
icon
:
'el-icon-edit'
,
click
:
this
.
edit
,
show
:
checkPermission
([
'datasource:edit'
])
show
:
checkPermission
([
'datasource:edit'
])
},
{
},
{
label
:
this
.
$t
(
'commons.delete'
),
icon
:
'el-icon-delete'
,
type
:
'danger'
,
click
:
this
.
del
,
label
:
this
.
$t
(
'commons.delete'
),
icon
:
'el-icon-delete'
,
type
:
'danger'
,
click
:
this
.
_handleDelete
,
show
:
checkPermission
([
'datasource:del'
])
show
:
checkPermission
([
'datasource:del'
])
}
}
],
],
...
@@ -161,16 +161,22 @@ export default {
...
@@ -161,16 +161,22 @@ export default {
select
(
selection
)
{
select
(
selection
)
{
console
.
log
(
selection
)
console
.
log
(
selection
)
},
},
// create() {
// this.formType = 'add'
// this.dialogVisible = true
// },
create
()
{
create
()
{
this
.
formType
=
'add'
this
.
$router
.
push
({
name
:
'数据源表单'
})
this
.
dialogVisible
=
true
},
},
// edit(row) {
// this.formType = 'modify'
// this.dialogVisible = true
// this.form = Object.assign({}, row)
// this.form.configuration = JSON.parse(this.form.configuration)
// },
edit
(
row
)
{
edit
(
row
)
{
this
.
formType
=
'modify'
this
.
$router
.
push
({
name
:
'数据源表单'
,
params
:
row
})
this
.
dialogVisible
=
true
this
.
form
=
Object
.
assign
({},
row
)
this
.
form
.
configuration
=
JSON
.
parse
(
this
.
form
.
configuration
)
},
},
_handleDelete
(
datasource
)
{
_handleDelete
(
datasource
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论