Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
65aaff16
提交
65aaff16
authored
3月 14, 2022
作者:
taojinlong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 增加 mongoDB 的连接字符串
上级
39865e17
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
145 行增加
和
145 行删除
+145
-145
form.vue
frontend/src/views/system/datasource/form.vue
+145
-145
没有找到文件。
frontend/src/views/system/datasource/form.vue
浏览文件 @
65aaff16
...
@@ -45,9 +45,12 @@
...
@@ -45,9 +45,12 @@
<el-col>
<el-col>
<el-button
size=
"mini"
icon=
"el-icon-plus"
type=
"text"
@
click=
"addApiItem(undefined)"
/>
<el-button
size=
"mini"
icon=
"el-icon-plus"
type=
"text"
@
click=
"addApiItem(undefined)"
/>
<el-table
:data=
"form.apiConfiguration"
class=
"my_table"
max-height=
"300"
height=
"300"
>
<el-table
:data=
"form.apiConfiguration"
class=
"my_table"
max-height=
"300"
height=
"300"
>
<el-table-column
prop=
"name"
:label=
"$t('datasource.data_table_name')"
width=
"150"
show-overflow-tooltip
></el-table-column>
<el-table-column
prop=
"name"
:label=
"$t('datasource.data_table_name')"
width=
"150"
<el-table-column
prop=
"method"
:label=
"$t('datasource.method')"
width=
"150"
show-overflow-tooltip
></el-table-column>
show-overflow-tooltip
></el-table-column>
<el-table-column
prop=
"url"
:label=
"$t('datasource.url')"
width=
"150"
show-overflow-tooltip
></el-table-column>
<el-table-column
prop=
"method"
:label=
"$t('datasource.method')"
width=
"150"
show-overflow-tooltip
></el-table-column>
<el-table-column
prop=
"url"
:label=
"$t('datasource.url')"
width=
"150"
show-overflow-tooltip
></el-table-column>
<el-table-column
prop=
"status"
:label=
"$t('commons.status')"
width=
"150"
>
<el-table-column
prop=
"status"
:label=
"$t('commons.status')"
width=
"150"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<span
v-if=
"scope.row.status === 'Success'"
style=
"color: green"
>
<span
v-if=
"scope.row.status === 'Success'"
style=
"color: green"
>
...
@@ -70,13 +73,14 @@
...
@@ -70,13 +73,14 @@
</el-col>
</el-col>
</el-form-item>
</el-form-item>
<el-dialog
:title=
"api_table_title"
:visible=
"edit_api_item"
:before-close=
"closeEditItem"
width=
"60%"
class=
"dialog-css"
append-to-body
>
<el-dialog
:title=
"api_table_title"
:visible=
"edit_api_item"
:before-close=
"closeEditItem"
width=
"60%"
class=
"dialog-css"
append-to-body
>
<el-steps
:active=
"active"
align-center
>
<el-steps
:active=
"active"
align-center
>
<el-step
title=
"步骤 1"
></el-step>
<el-step
title=
"步骤 1"
></el-step>
<el-step
title=
"步骤 2"
></el-step>
<el-step
title=
"步骤 2"
></el-step>
</el-steps>
</el-steps>
<el-row
v-show=
"active === 1"
>
<el-row
v-show=
"active === 1"
>
<el-form
ref=
"apiItem"
size=
"small"
:model=
"apiItem"
label-width=
"100px"
:rules=
"rule"
>
<el-form
ref=
"apiItem"
size=
"small"
:model=
"apiItem"
label-width=
"100px"
:rules=
"rule"
>
<p
class=
"tip"
>
{{ $t('datasource.base_info') }}
</p>
<p
class=
"tip"
>
{{ $t('datasource.base_info') }}
</p>
...
@@ -85,7 +89,8 @@
...
@@ -85,7 +89,8 @@
</el-form-item>
</el-form-item>
<el-form-item
:label=
"$t('datasource.request')"
prop=
"url"
>
<el-form-item
:label=
"$t('datasource.request')"
prop=
"url"
>
<el-input
:placeholder=
"$t('datasource.path_all_info')"
v-model=
"apiItem.url"
class=
"ms-http-input"
size=
"small"
>
<el-input
:placeholder=
"$t('datasource.path_all_info')"
v-model=
"apiItem.url"
class=
"ms-http-input"
size=
"small"
>
<el-select
v-model=
"apiItem.method"
slot=
"prepend"
style=
"width: 100px"
size=
"small"
>
<el-select
v-model=
"apiItem.method"
slot=
"prepend"
style=
"width: 100px"
size=
"small"
>
<el-option
v-for=
"item in reqOptions"
:key=
"item.id"
:label=
"item.label"
:value=
"item.id"
/>
<el-option
v-for=
"item in reqOptions"
:key=
"item.id"
:label=
"item.label"
:value=
"item.id"
/>
</el-select>
</el-select>
...
@@ -96,84 +101,89 @@
...
@@ -96,84 +101,89 @@
<p
class=
"tip"
>
{{ $t('datasource.req_param') }}
</p>
<p
class=
"tip"
>
{{ $t('datasource.req_param') }}
</p>
<!-- HTTP 请求参数 -->
<!-- HTTP 请求参数 -->
<el-form-item>
<el-form-item>
<api-http-request-form
:headers=
"apiItem.request.headers"
:request=
"apiItem.request"
:response=
"responseData"
/>
<api-http-request-form
:headers=
"apiItem.request.headers"
:request=
"apiItem.request"
:response=
"responseData"
/>
</el-form-item>
</el-form-item>
</div>
</div>
<el-form-item
:label=
"$t('datasource.data_path')"
prop=
"dataPath"
>
<el-form-item
:label=
"$t('datasource.data_path')"
prop=
"dataPath"
>
<el-input
:placeholder=
"$t('datasource.data_path_desc')"
v-model=
"apiItem.dataPath"
autocomplete=
"off"
/>
<el-input
:placeholder=
"$t('datasource.data_path_desc')"
v-model=
"apiItem.dataPath"
autocomplete=
"off"
/>
</el-form-item>
</el-form-item>
<!-- <el-button style="margin-top: 12px;" @click="validateApi(undefined)" v-show="active === 1">{{ $t('commons.validate') }}</el-button>-->
<!-- <el-button style="margin-top: 12px;" @click="validateApi(undefined)" v-show="active === 1">{{ $t('commons.validate') }}</el-button>-->
</el-form>
</el-form>
</el-row>
</el-row>
<el-row
v-show=
"active === 2"
>
<el-row
v-show=
"active === 2"
>
<el-tabs
v-model=
"api_step2_active_name"
@
tab-click=
"handleClick"
>
<el-tabs
v-model=
"api_step2_active_name"
@
tab-click=
"handleClick"
>
<el-tab-pane
:label=
"$t('dataset.data_preview')"
name=
"first"
>
<el-tab-pane
:label=
"$t('dataset.data_preview')"
name=
"first"
>
<ux-grid
ref=
"plxTable"
size=
"mini"
style=
"width: 100%;"
:height=
"height"
:checkbox-config=
"{highlight: true}"
:width-resize=
"true"
>
<ux-grid
ref=
"plxTable"
size=
"mini"
style=
"width: 100%;"
:height=
"height"
<ux-table-column
v-for=
"field in apiItem.fields"
:key=
"field.originName"
min-width=
"200px"
:field=
"field.originName"
:resizable=
"true"
>
:checkbox-config=
"{highlight: true}"
:width-resize=
"true"
>
<ux-table-column
v-for=
"field in apiItem.fields"
:key=
"field.originName"
min-width=
"200px"
:field=
"field.originName"
:resizable=
"true"
>
<
template
slot=
"header"
>
<
template
slot=
"header"
>
<svg-icon
v-if=
"field.deExtractType === 0"
icon-class=
"field_text"
class=
"field-icon-text"
/>
<svg-icon
v-if=
"field.deExtractType === 0"
icon-class=
"field_text"
class=
"field-icon-text"
/>
<svg-icon
v-if=
"field.deExtractType === 1"
icon-class=
"field_time"
class=
"field-icon-time"
/>
<svg-icon
v-if=
"field.deExtractType === 1"
icon-class=
"field_time"
class=
"field-icon-time"
/>
<svg-icon
v-if=
"field.deExtractType === 2 || field.deExtractType === 3"
icon-class=
"field_value"
class=
"field-icon-value"
/>
<svg-icon
v-if=
"field.deExtractType === 2 || field.deExtractType === 3"
icon-class=
"field_value"
<svg-icon
v-if=
"field.deExtractType === 5"
icon-class=
"field_location"
class=
"field-icon-location"
/>
class=
"field-icon-value"
/>
<svg-icon
v-if=
"field.deExtractType === 5"
icon-class=
"field_location"
class=
"field-icon-location"
/>
<span>
{{
field
.
name
}}
</span>
<span>
{{
field
.
name
}}
</span>
</
template
>
</
template
>
</ux-table-column>
</ux-table-column>
</ux-grid>
</ux-grid>
</el-tab-pane>
</el-tab-pane>
<!-- 暂时屏蔽掉字段管理-->
<!-- 暂时屏蔽掉字段管理-->
<!-- <el-tab-pane label="字段管理" name="second">-->
<!-- <el-tab-pane label="字段管理" name="second">-->
<!-- <el-table :data="apiItem.fields" size="mini">-->
<!-- <el-table :data="apiItem.fields" size="mini">-->
<!-- <el-table-column property="name" :label="$t('dataset.field_name')" width="180">-->
<!-- <el-table-column property="name" :label="$t('dataset.field_name')" width="180">-->
<!-- <template slot-scope="scope">-->
<!-- <template slot-scope="scope">-->
<!-- <el-input v-model="scope.row.name" size="mini"/>-->
<!-- <el-input v-model="scope.row.name" size="mini"/>-->
<!-- </template>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- </el-table-column>-->
<!-- <el-table-column property="originName" :label="$t('dataset.field_origin_name')" width="100">-->
<!-- <el-table-column property="originName" :label="$t('dataset.field_origin_name')" width="100">-->
<!-- <template slot-scope="scope">-->
<!-- <template slot-scope="scope">-->
<!-- <span v-if="scope.row.extField === 0" :title="scope.row.originName" class="field-class" style="width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">-->
<!-- <span v-if="scope.row.extField === 0" :title="scope.row.originName" class="field-class" style="width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">-->
<!-- <span style="font-size: 12px;">{{ scope.row.originName }}</span>-->
<!-- <span style="font-size: 12px;">{{ scope.row.originName }}</span>-->
<!-- </span>-->
<!-- </span>-->
<!-- </template>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- </el-table-column>-->
<!-- <el-table-column property="deExtractType" :label="$t('dataset.field_type')" width="140">-->
<!-- <el-table-column property="deExtractType" :label="$t('dataset.field_type')" width="140">-->
<!-- <template slot-scope="scope">-->
<!-- <template slot-scope="scope">-->
<!-- <el-select v-model="scope.row.deExtractType" size="mini" style="display: inline-block;width: 26px;">-->
<!-- <el-select v-model="scope.row.deExtractType" size="mini" style="display: inline-block;width: 26px;">-->
<!-- <el-option v-for="item in fieldTypes" :key="item.value" :label="item.label" :value="item.value">-->
<!-- <el-option v-for="item in fieldTypes" :key="item.value" :label="item.label" :value="item.value">-->
<!-- <span style="float: left">-->
<!-- <span style="float: left">-->
<!-- <svg-icon v-if="item.value === 0" icon-class="field_text" class="field-icon-text" />-->
<!-- <svg-icon v-if="item.value === 0" icon-class="field_text" class="field-icon-text" />-->
<!-- <svg-icon v-if="item.value === 1" icon-class="field_time" class="field-icon-time" />-->
<!-- <svg-icon v-if="item.value === 1" icon-class="field_time" class="field-icon-time" />-->
<!-- <svg-icon v-if="item.value === 2 || item.value === 3" icon-class="field_value" class="field-icon-value" />-->
<!-- <svg-icon v-if="item.value === 2 || item.value === 3" icon-class="field_value" class="field-icon-value" />-->
<!-- <svg-icon v-if="item.value === 5" icon-class="field_location" class="field-icon-location" />-->
<!-- <svg-icon v-if="item.value === 5" icon-class="field_location" class="field-icon-location" />-->
<!-- </span>-->
<!-- </span>-->
<!-- <span style="float: left; color: #8492a6; font-size: 12px">{{ item.label }}</span>-->
<!-- <span style="float: left; color: #8492a6; font-size: 12px">{{ item.label }}</span>-->
<!-- </el-option>-->
<!-- </el-option>-->
<!-- </el-select>-->
<!-- </el-select>-->
<!-- <span style="margin-left: 8px;">-->
<!-- <span style="margin-left: 8px;">-->
<!-- <span v-if="scope.row.deExtractType === 0">-->
<!-- <span v-if="scope.row.deExtractType === 0">-->
<!-- <svg-icon icon-class="field_text" class="field-icon-text" />-->
<!-- <svg-icon icon-class="field_text" class="field-icon-text" />-->
<!-- <span class="field-class">{{ $t('dataset.text') }}</span>-->
<!-- <span class="field-class">{{ $t('dataset.text') }}</span>-->
<!-- </span>-->
<!-- </span>-->
<!-- <span v-if="scope.row.deExtractType === 1">-->
<!-- <span v-if="scope.row.deExtractType === 1">-->
<!-- <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">-->
<!-- <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" 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" 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 v-if="scope.row.deExtractType === 5">-->
<!-- <span v-if="scope.row.deExtractType === 5">-->
<!-- <svg-icon v-if="scope.row.deExtractType === 5" icon-class="field_location" class="field-icon-location" />-->
<!-- <svg-icon v-if="scope.row.deExtractType === 5" icon-class="field_location" class="field-icon-location" />-->
<!-- <span class="field-class">{{ $t('dataset.location') }}</span>-->
<!-- <span class="field-class">{{ $t('dataset.location') }}</span>-->
<!-- </span>-->
<!-- </span>-->
<!-- </span>-->
<!-- </span>-->
<!-- </template>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- </el-table-column>-->
<!-- </el-table>-->
<!-- </el-table>-->
<!-- </el-tab-pane>-->
<!-- </el-tab-pane>-->
</el-tabs>
</el-tabs>
</el-row>
</el-row>
<div
slot=
"footer"
class=
"dialog-footer"
>
<div
slot=
"footer"
class=
"dialog-footer"
>
...
@@ -388,32 +398,17 @@ export default {
...
@@ -388,32 +398,17 @@ export default {
'dataPath'
:
[{
required
:
true
,
message
:
i18n
.
t
(
'datasource.please_input_dataPath'
),
trigger
:
'change'
}]
'dataPath'
:
[{
required
:
true
,
message
:
i18n
.
t
(
'datasource.please_input_dataPath'
),
trigger
:
'change'
}]
},
},
allTypes
:
[
allTypes
:
[
{
{
name
:
'mysql'
,
label
:
'MySQL'
,
type
:
'jdbc'
,
extraParams
:
'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true'
},
name
:
'mysql'
,
label
:
'MySQL'
,
type
:
'jdbc'
,
extraParams
:
'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true'
},
{
name
:
'hive'
,
label
:
'Apache Hive'
,
type
:
'jdbc'
,
extraParams
:
''
},
{
name
:
'hive'
,
label
:
'Apache Hive'
,
type
:
'jdbc'
,
extraParams
:
''
},
{
name
:
'oracle'
,
label
:
'Oracle'
,
type
:
'jdbc'
},
{
name
:
'oracle'
,
label
:
'Oracle'
,
type
:
'jdbc'
},
{
name
:
'sqlServer'
,
label
:
'SQL Server'
,
type
:
'jdbc'
,
extraParams
:
''
},
{
name
:
'sqlServer'
,
label
:
'SQL Server'
,
type
:
'jdbc'
,
extraParams
:
''
},
{
name
:
'pg'
,
label
:
'PostgreSQL'
,
type
:
'jdbc'
,
extraParams
:
''
},
{
name
:
'pg'
,
label
:
'PostgreSQL'
,
type
:
'jdbc'
,
extraParams
:
''
},
{
name
:
'es'
,
label
:
'Elasticsearch'
,
type
:
'es'
},
{
name
:
'es'
,
label
:
'Elasticsearch'
,
type
:
'es'
},
{
{
name
:
'mariadb'
,
label
:
'MariaDB'
,
type
:
'jdbc'
,
extraParams
:
'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true'
},
name
:
'mariadb'
,
{
name
:
'ds_doris'
,
label
:
'Doris'
,
type
:
'jdbc'
,
extraParams
:
'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true'
},
label
:
'MariaDB'
,
type
:
'jdbc'
,
extraParams
:
'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true'
},
{
name
:
'ds_doris'
,
label
:
'Doris'
,
type
:
'jdbc'
,
extraParams
:
'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true'
},
{
name
:
'ck'
,
label
:
'ClickHouse'
,
type
:
'jdbc'
,
extraParams
:
''
},
{
name
:
'ck'
,
label
:
'ClickHouse'
,
type
:
'jdbc'
,
extraParams
:
''
},
{
name
:
'redshift'
,
label
:
'AWS Redshift'
,
type
:
'jdbc'
},
{
name
:
'redshift'
,
label
:
'AWS Redshift'
,
type
:
'jdbc'
},
{
name
:
'mongo'
,
label
:
'MongoDB'
,
type
:
'jdbc'
,
extraParams
:
'rebuildschema=true'
},
{
name
:
'mongo'
,
label
:
'MongoDB'
,
type
:
'jdbc'
,
extraParams
:
'rebuildschema=true
&authSource=admin
'
},
{
name
:
'db2'
,
label
:
'Db2'
,
type
:
'jdbc'
,
extraParams
:
''
},
{
name
:
'db2'
,
label
:
'Db2'
,
type
:
'jdbc'
,
extraParams
:
''
},
{
name
:
'api'
,
label
:
'API'
,
type
:
'api'
,
extraParams
:
''
}
{
name
:
'api'
,
label
:
'API'
,
type
:
'api'
,
extraParams
:
''
}
],
],
...
@@ -460,11 +455,11 @@ export default {
...
@@ -460,11 +455,11 @@ export default {
api_table_title
:
''
,
api_table_title
:
''
,
api_step2_active_name
:
'first'
,
api_step2_active_name
:
'first'
,
fieldTypes
:
[
fieldTypes
:
[
{
label
:
this
.
$t
(
'dataset.text'
),
value
:
0
},
{
label
:
this
.
$t
(
'dataset.text'
),
value
:
0
},
{
label
:
this
.
$t
(
'dataset.time'
),
value
:
1
},
{
label
:
this
.
$t
(
'dataset.time'
),
value
:
1
},
{
label
:
this
.
$t
(
'dataset.value'
),
value
:
2
},
{
label
:
this
.
$t
(
'dataset.value'
),
value
:
2
},
{
label
:
this
.
$t
(
'dataset.value'
)
+
'('
+
this
.
$t
(
'dataset.float'
)
+
')'
,
value
:
3
},
{
label
:
this
.
$t
(
'dataset.value'
)
+
'('
+
this
.
$t
(
'dataset.float'
)
+
')'
,
value
:
3
},
{
label
:
this
.
$t
(
'dataset.location'
),
value
:
5
}
{
label
:
this
.
$t
(
'dataset.location'
),
value
:
5
}
],
],
height
:
500
height
:
500
}
}
...
@@ -511,8 +506,8 @@ export default {
...
@@ -511,8 +506,8 @@ export default {
this
.
form
=
JSON
.
parse
(
JSON
.
stringify
(
row
))
this
.
form
=
JSON
.
parse
(
JSON
.
stringify
(
row
))
this
.
originConfiguration
=
this
.
form
.
configuration
this
.
originConfiguration
=
this
.
form
.
configuration
if
(
row
.
type
===
'api'
)
{
if
(
row
.
type
===
'api'
)
{
}
else
{
}
else
{
this
.
form
.
configuration
=
JSON
.
parse
(
this
.
form
.
configuration
)
this
.
form
.
configuration
=
JSON
.
parse
(
this
.
form
.
configuration
)
}
}
},
},
...
@@ -583,16 +578,16 @@ export default {
...
@@ -583,16 +578,16 @@ export default {
}
}
const
method
=
this
.
formType
===
'add'
?
addDs
:
editDs
const
method
=
this
.
formType
===
'add'
?
addDs
:
editDs
const
form
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
form
))
const
form
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
form
))
if
(
form
.
type
===
'api'
)
{
if
(
form
.
type
===
'api'
)
{
if
(
this
.
form
.
apiConfiguration
.
length
<
1
)
{
if
(
this
.
form
.
apiConfiguration
.
length
<
1
)
{
this
.
$message
.
error
(
i18n
.
t
(
'datasource.api_table_not_empty'
))
this
.
$message
.
error
(
i18n
.
t
(
'datasource.api_table_not_empty'
))
return
return
}
}
form
.
apiConfiguration
.
forEach
(
item
=>
{
form
.
apiConfiguration
.
forEach
(
item
=>
{
delete
item
.
status
delete
item
.
status
})
})
form
.
configuration
=
JSON
.
stringify
(
form
.
apiConfiguration
)
form
.
configuration
=
JSON
.
stringify
(
form
.
apiConfiguration
)
}
else
{
}
else
{
form
.
configuration
=
JSON
.
stringify
(
form
.
configuration
)
form
.
configuration
=
JSON
.
stringify
(
form
.
configuration
)
}
}
...
@@ -652,9 +647,9 @@ export default {
...
@@ -652,9 +647,9 @@ export default {
this
.
$refs
.
dsForm
.
validate
(
valid
=>
{
this
.
$refs
.
dsForm
.
validate
(
valid
=>
{
if
(
valid
)
{
if
(
valid
)
{
const
data
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
form
))
const
data
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
form
))
if
(
data
.
type
===
'api'
)
{
if
(
data
.
type
===
'api'
)
{
data
.
configuration
=
JSON
.
stringify
(
data
.
apiConfiguration
)
data
.
configuration
=
JSON
.
stringify
(
data
.
apiConfiguration
)
}
else
{
}
else
{
data
.
configuration
=
JSON
.
stringify
(
data
.
configuration
)
data
.
configuration
=
JSON
.
stringify
(
data
.
configuration
)
}
}
if
(
data
.
showModel
===
'show'
&&
!
this
.
canEdit
)
{
if
(
data
.
showModel
===
'show'
&&
!
this
.
canEdit
)
{
...
@@ -675,7 +670,7 @@ export default {
...
@@ -675,7 +670,7 @@ export default {
if
(
res
.
success
)
{
if
(
res
.
success
)
{
this
.
$success
(
i18n
.
t
(
'datasource.validate_success'
))
this
.
$success
(
i18n
.
t
(
'datasource.validate_success'
))
}
else
{
}
else
{
if
(
data
.
type
===
'api'
)
{
if
(
data
.
type
===
'api'
)
{
this
.
form
.
apiConfiguration
=
res
.
data
.
apiConfiguration
this
.
form
.
apiConfiguration
=
res
.
data
.
apiConfiguration
}
}
if
(
res
.
message
.
length
<
2500
)
{
if
(
res
.
message
.
length
<
2500
)
{
...
@@ -708,23 +703,23 @@ export default {
...
@@ -708,23 +703,23 @@ export default {
this
.
$emit
(
'refresh-type'
,
form
)
this
.
$emit
(
'refresh-type'
,
form
)
},
},
next
()
{
next
()
{
if
(
this
.
active
===
1
)
{
if
(
this
.
active
===
1
)
{
let
hasRepeatName
=
false
let
hasRepeatName
=
false
if
(
this
.
add_api_item
)
{
if
(
this
.
add_api_item
)
{
this
.
form
.
apiConfiguration
.
forEach
(
item
=>
{
this
.
form
.
apiConfiguration
.
forEach
(
item
=>
{
if
(
item
.
name
===
this
.
apiItem
.
name
)
{
if
(
item
.
name
===
this
.
apiItem
.
name
)
{
hasRepeatName
=
true
hasRepeatName
=
true
}
}
})
})
}
else
{
}
else
{
let
index
=
this
.
form
.
apiConfiguration
.
indexOf
(
this
.
apiItem
)
let
index
=
this
.
form
.
apiConfiguration
.
indexOf
(
this
.
apiItem
)
for
(
let
i
=
0
;
i
<
this
.
form
.
apiConfiguration
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
form
.
apiConfiguration
.
length
;
i
++
)
{
if
(
i
!==
index
&&
this
.
form
.
apiConfiguration
[
i
].
name
===
this
.
apiItem
.
name
)
{
if
(
i
!==
index
&&
this
.
form
.
apiConfiguration
[
i
].
name
===
this
.
apiItem
.
name
)
{
hasRepeatName
=
true
hasRepeatName
=
true
}
}
}
}
}
}
if
(
hasRepeatName
)
{
if
(
hasRepeatName
)
{
this
.
$message
.
error
(
i18n
.
t
(
'datasource.has_repeat_name'
))
this
.
$message
.
error
(
i18n
.
t
(
'datasource.has_repeat_name'
))
return
return
}
}
...
@@ -761,7 +756,7 @@ export default {
...
@@ -761,7 +756,7 @@ export default {
saveItem
()
{
saveItem
()
{
this
.
active
=
0
this
.
active
=
0
this
.
edit_api_item
=
false
this
.
edit_api_item
=
false
if
(
this
.
add_api_item
)
{
if
(
this
.
add_api_item
)
{
this
.
form
.
apiConfiguration
.
push
(
this
.
apiItem
)
this
.
form
.
apiConfiguration
.
push
(
this
.
apiItem
)
}
}
},
},
...
@@ -770,7 +765,7 @@ export default {
...
@@ -770,7 +765,7 @@ export default {
this
.
add_api_item
=
false
this
.
add_api_item
=
false
this
.
api_table_title
=
this
.
$t
(
'datasource.edit_api_table'
)
this
.
api_table_title
=
this
.
$t
(
'datasource.edit_api_table'
)
this
.
apiItem
=
item
this
.
apiItem
=
item
}
else
{
}
else
{
this
.
add_api_item
=
true
this
.
add_api_item
=
true
this
.
apiItem
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
defaultApiItem
))
this
.
apiItem
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
defaultApiItem
))
this
.
api_table_title
=
this
.
$t
(
'datasource.add_api_table'
)
this
.
api_table_title
=
this
.
$t
(
'datasource.add_api_table'
)
...
@@ -782,9 +777,9 @@ export default {
...
@@ -782,9 +777,9 @@ export default {
this
.
form
.
apiConfiguration
.
splice
(
this
.
form
.
apiConfiguration
.
indexOf
(
item
),
1
)
this
.
form
.
apiConfiguration
.
splice
(
this
.
form
.
apiConfiguration
.
indexOf
(
item
),
1
)
},
},
validateApi
(
item
)
{
validateApi
(
item
)
{
if
(
undefined
)
{
if
(
undefined
)
{
}
else
{
}
else
{
this
.
$refs
.
apiItem
.
validate
(
valid
=>
{
this
.
$refs
.
apiItem
.
validate
(
valid
=>
{
if
(
valid
)
{
if
(
valid
)
{
const
data
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
apiItem
))
const
data
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
apiItem
))
...
@@ -809,41 +804,46 @@ export default {
...
@@ -809,41 +804,46 @@ export default {
}
}
}
}
</
script
>
</
script
>
<
style
scoped
>
<
style
scoped
>
.el-input
{
.el-input
{
width
:
300px
;
width
:
300px
;
}
}
.el-select
{
width
:
300px
;
}
.ms-http-input
{
width
:
500px
;
margin-top
:
5px
;
}
.tip
{
padding
:
3px
5px
;
font-size
:
16px
;
border-radius
:
0
;
border-left
:
4px
solid
#409EFF
;
margin
:
5px
5px
10px
5px
;
}
.el-select
>>>
input
{
padding-right
:
10px
;
}
.el-select
>>>
.el-input__suffix
{
right
:
0
;
}
.dialog-css
>>>
.el-dialog__header
{
.el-select
{
padding
:
10px
20px
0px
;
width
:
30
0px
;
}
}
.dialog-css
>>>
.el-dialog__body
{
.ms-http-input
{
padding
:
10px
20px
10px
;
width
:
500px
;
}
margin-top
:
5px
;
}
.dialog-footer
>>>
.el-dialog__footer
{
.tip
{
padding
:
10px
10px
10px
;
padding
:
3px
5px
;
}
font-size
:
16px
;
border-radius
:
0
;
border-left
:
4px
solid
#409EFF
;
margin
:
5px
5px
10px
5px
;
}
.el-select
>>>
input
{
padding-right
:
10px
;
}
.el-select
>>>
.el-input__suffix
{
right
:
0
;
}
.dialog-css
>>>
.el-dialog__header
{
padding
:
10px
20px
0px
;
}
.dialog-css
>>>
.el-dialog__body
{
padding
:
10px
20px
10px
;
}
.dialog-footer
>>>
.el-dialog__footer
{
padding
:
10px
10px
10px
;
}
</
style
>
</
style
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论