forked from github/dataease
Merge pull request #4042 from dataease/pr@dev@feat_app-new-ds
feat(应用): 应用模板支持选择存量数据源
This commit is contained in:
commit
e175e0bfa0
@ -20,9 +20,9 @@ public class PanelConstants {
|
|||||||
|
|
||||||
public final static String PANEL_NODE_TYPE_PANEL = "panel";
|
public final static String PANEL_NODE_TYPE_PANEL = "panel";
|
||||||
|
|
||||||
public final static String OPT_TYPE_INSERT="insert";
|
public final static String OPT_TYPE_INSERT = "insert";
|
||||||
|
|
||||||
public final static String OPT_TYPE_UPDATE="update";
|
public final static String OPT_TYPE_UPDATE = "update";
|
||||||
|
|
||||||
public final static String PANEL_GATHER_DEFAULT_PANEL = "default_panel";
|
public final static String PANEL_GATHER_DEFAULT_PANEL = "default_panel";
|
||||||
|
|
||||||
@ -68,4 +68,16 @@ public class PanelConstants {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//应用数据源来源
|
||||||
|
public static final class APP_DATASOURCE_FROM {
|
||||||
|
|
||||||
|
// 新建
|
||||||
|
public static final String NEW = "new";
|
||||||
|
|
||||||
|
// 复用
|
||||||
|
public static final String HISTORY = "history";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,5 +29,9 @@ public class PanelAppTemplateApplyRequest {
|
|||||||
|
|
||||||
private String appTemplateId;
|
private String appTemplateId;
|
||||||
|
|
||||||
|
private String datasourceFrom;
|
||||||
|
|
||||||
|
private String datasourceHistoryId;
|
||||||
|
|
||||||
private List<Datasource> datasourceList;
|
private List<Datasource> datasourceList;
|
||||||
}
|
}
|
||||||
|
@ -16,40 +16,42 @@
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
<select id="query" parameterType="io.dataease.service.panel.applog.AppLogQueryParam" resultMap="BaseResultMapDTO">
|
<select id="query" parameterType="io.dataease.service.panel.applog.AppLogQueryParam" resultMap="BaseResultMapDTO">
|
||||||
select
|
select
|
||||||
logInfo.*,
|
logInfo.*,
|
||||||
get_auths(logInfo.dataset_group_id,'dataset',#{userId}) as `dataset_privileges`,
|
get_auths(logInfo.dataset_group_id,'dataset',#{userId}) as `dataset_privileges`,
|
||||||
get_auths(logInfo.panel_id,'panel',#{userId}) as `panel_privileges`,
|
get_auths(logInfo.panel_id,'panel',#{userId}) as `panel_privileges`,
|
||||||
get_auths(logInfo.datasource_id,'link',#{userId}) as `datasource_privileges`
|
get_auths(logInfo.datasource_id,'link',#{userId}) as `datasource_privileges`
|
||||||
from
|
from
|
||||||
(select * from
|
(select * from
|
||||||
(SELECT
|
(SELECT
|
||||||
panel_app_template_log.id,
|
panel_app_template_log.id,
|
||||||
panel_app_template_log.app_template_id,
|
panel_app_template_log.app_template_id,
|
||||||
panel_app_template_log.app_template_name,
|
panel_app_template_log.app_template_name,
|
||||||
datasource.id as datasource_id,
|
datasource.id as datasource_id,
|
||||||
panel_app_template_log.source_datasource_name,
|
panel_app_template_log.source_datasource_name,
|
||||||
dataset_group.id as dataset_group_id,
|
panel_app_template_log.datasource_from,
|
||||||
panel_app_template_log.source_dataset_group_name,
|
dataset_group.id as dataset_group_id,
|
||||||
panel_group.id as panel_id,
|
panel_app_template_log.source_dataset_group_name,
|
||||||
panel_app_template_log.source_panel_name,
|
panel_group.id as panel_id,
|
||||||
panel_app_template_log.apply_time,
|
panel_app_template_log.source_panel_name,
|
||||||
panel_app_template_log.apply_persion,
|
panel_app_template_log.apply_time,
|
||||||
panel_app_template_log.is_success,
|
panel_app_template_log.apply_persion,
|
||||||
panel_app_template_log.remark,
|
panel_app_template_log.is_success,
|
||||||
panel_group.pid as panel_group_pid,
|
panel_app_template_log.remark,
|
||||||
datasource.type as datasource_type,
|
panel_group.pid as panel_group_pid,
|
||||||
dataset_group.pid as dataset_group_pid,
|
datasource.type as datasource_type,
|
||||||
IFNULL(panel_app_template.name,CONCAT(panel_app_template_log.app_template_name,'(Deleted)')) as app_name,
|
dataset_group.pid as dataset_group_pid,
|
||||||
IFNULL(panel_group.name,CONCAT(panel_app_template_log.source_panel_name,'(Deleted)')) as panel_name,
|
IFNULL(panel_app_template.name,CONCAT(panel_app_template_log.app_template_name,'(Deleted)')) as app_name,
|
||||||
IFNULL(dataset_group.name,CONCAT(panel_app_template_log.source_dataset_group_name,'(Deleted)')) as dataset_group_name,
|
IFNULL(panel_group.name,CONCAT(panel_app_template_log.source_panel_name,'(Deleted)')) as panel_name,
|
||||||
IFNULL(datasource.`name`,CONCAT(panel_app_template_log.source_datasource_name,'(Deleted)')) as datasource_name
|
IFNULL(dataset_group.name,CONCAT(panel_app_template_log.source_dataset_group_name,'(Deleted)')) as
|
||||||
FROM
|
dataset_group_name,
|
||||||
panel_app_template_log
|
IFNULL(datasource.`name`,CONCAT(panel_app_template_log.source_datasource_name,'(Deleted)')) as datasource_name
|
||||||
LEFT JOIN panel_group ON panel_app_template_log.panel_id = panel_group.id
|
FROM
|
||||||
left join dataset_group on panel_app_template_log.dataset_group_id = dataset_group.id
|
panel_app_template_log
|
||||||
left join datasource on panel_app_template_log.datasource_id = datasource.id
|
LEFT JOIN panel_group ON panel_app_template_log.panel_id = panel_group.id
|
||||||
left join panel_app_template on panel_app_template_log.app_template_id = panel_app_template.id
|
left join dataset_group on panel_app_template_log.dataset_group_id = dataset_group.id
|
||||||
) t
|
left join datasource on panel_app_template_log.datasource_id = datasource.id
|
||||||
|
left join panel_app_template on panel_app_template_log.app_template_id = panel_app_template.id
|
||||||
|
) t
|
||||||
where 1=1
|
where 1=1
|
||||||
<if test="extendCondition != null">
|
<if test="extendCondition != null">
|
||||||
and
|
and
|
||||||
|
@ -137,13 +137,18 @@ public class PanelAppTemplateService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Map<String, String> applyDatasource(List<Datasource> oldDatasourceList, List<Datasource> newDatasourceList) throws Exception {
|
public Map<String, String> applyDatasource(List<Datasource> oldDatasourceList, PanelAppTemplateApplyRequest request) throws Exception {
|
||||||
Map<String, String> datasourceRealMap = new HashMap<>();
|
Map<String, String> datasourceRealMap = new HashMap<>();
|
||||||
for (int i = 0; i < newDatasourceList.size(); i++) {
|
if (PanelConstants.APP_DATASOURCE_FROM.HISTORY.equals(request.getDatasourceFrom())) {
|
||||||
Datasource datasource = newDatasourceList.get(0);
|
datasourceRealMap.put(oldDatasourceList.get(0).getId(), request.getDatasourceHistoryId());
|
||||||
datasource.setId(null);
|
} else {
|
||||||
Datasource newDatasource = datasourceService.addDatasource(datasource);
|
List<Datasource> newDatasourceList = request.getDatasourceList();
|
||||||
datasourceRealMap.put(oldDatasourceList.get(i).getId(), newDatasource.getId());
|
for (int i = 0; i < newDatasourceList.size(); i++) {
|
||||||
|
Datasource datasource = newDatasourceList.get(0);
|
||||||
|
datasource.setId(null);
|
||||||
|
Datasource newDatasource = datasourceService.addDatasource(datasource);
|
||||||
|
datasourceRealMap.put(oldDatasourceList.get(i).getId(), newDatasource.getId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return datasourceRealMap;
|
return datasourceRealMap;
|
||||||
}
|
}
|
||||||
@ -366,18 +371,22 @@ public class PanelAppTemplateService {
|
|||||||
datasetGroup.setPid(request.getDatasetGroupPid());
|
datasetGroup.setPid(request.getDatasetGroupPid());
|
||||||
datasetGroup.setName(request.getDatasetGroupName());
|
datasetGroup.setName(request.getDatasetGroupName());
|
||||||
dataSetGroupService.checkName(datasetGroup);
|
dataSetGroupService.checkName(datasetGroup);
|
||||||
request.getDatasourceList().stream().forEach(datasource -> {
|
if (PanelConstants.APP_DATASOURCE_FROM.NEW.equals(request.getDatasourceFrom())) {
|
||||||
datasourceService.checkName(datasource.getName(), datasource.getType(), null);
|
request.getDatasourceList().stream().forEach(datasource -> {
|
||||||
});
|
datasourceService.checkName(datasource.getName(), datasource.getType(), null);
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
DatasetGroup datasetGroup = new DatasetGroup();
|
DatasetGroup datasetGroup = new DatasetGroup();
|
||||||
datasetGroup.setPid(request.getDatasetGroupPid());
|
datasetGroup.setPid(request.getDatasetGroupPid());
|
||||||
datasetGroup.setName(request.getDatasetGroupName());
|
datasetGroup.setName(request.getDatasetGroupName());
|
||||||
datasetGroup.setId(request.getDatasetGroupId());
|
datasetGroup.setId(request.getDatasetGroupId());
|
||||||
dataSetGroupService.checkName(datasetGroup);
|
dataSetGroupService.checkName(datasetGroup);
|
||||||
request.getDatasourceList().stream().forEach(datasource -> {
|
if (PanelConstants.APP_DATASOURCE_FROM.NEW.equals(request.getDatasourceFrom())) {
|
||||||
datasourceService.checkName(datasource.getName(), datasource.getType(), datasource.getId());
|
request.getDatasourceList().stream().forEach(datasource -> {
|
||||||
});
|
datasourceService.checkName(datasource.getName(), datasource.getType(), datasource.getId());
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -898,7 +898,7 @@ public class PanelGroupService {
|
|||||||
List<PanelView> panelViewsInfo = gson.fromJson(appInfo.getPanelViewsInfo(), new TypeToken<List<PanelView>>() {
|
List<PanelView> panelViewsInfo = gson.fromJson(appInfo.getPanelViewsInfo(), new TypeToken<List<PanelView>>() {
|
||||||
}.getType());
|
}.getType());
|
||||||
|
|
||||||
Map<String, String> datasourceRealMap = panelAppTemplateService.applyDatasource(oldDatasourceInfo, request.getDatasourceList());
|
Map<String, String> datasourceRealMap = panelAppTemplateService.applyDatasource(oldDatasourceInfo, request);
|
||||||
|
|
||||||
Map<String, String> datasetsRealMap = panelAppTemplateService.applyDataset(datasetTablesInfo, datasourceRealMap, asideDatasetGroupId);
|
Map<String, String> datasetsRealMap = panelAppTemplateService.applyDataset(datasetTablesInfo, datasourceRealMap, asideDatasetGroupId);
|
||||||
|
|
||||||
@ -909,7 +909,7 @@ public class PanelGroupService {
|
|||||||
Map<String, String> datasetFieldsRealMap = panelAppTemplateService.applyDatasetField(datasetTableFieldsInfo, datasetsRealMap, datasetTypeRealMap, datasetFieldsMd5FormatRealMap);
|
Map<String, String> datasetFieldsRealMap = panelAppTemplateService.applyDatasetField(datasetTableFieldsInfo, datasetsRealMap, datasetTypeRealMap, datasetFieldsMd5FormatRealMap);
|
||||||
|
|
||||||
panelAppTemplateService.createDorisTable(datasetTablesInfo);
|
panelAppTemplateService.createDorisTable(datasetTablesInfo);
|
||||||
|
|
||||||
panelAppTemplateService.resetCustomAndUnionDataset(datasetTablesInfo, datasetsRealMap, datasetFieldsRealMap);
|
panelAppTemplateService.resetCustomAndUnionDataset(datasetTablesInfo, datasetsRealMap, datasetFieldsRealMap);
|
||||||
|
|
||||||
Map<String, String> chartViewsRealMap = panelAppTemplateService.applyViews(chartViewsInfo, datasetsRealMap, datasetFieldsRealMap, datasetFieldsMd5FormatRealMap, newPanelId);
|
Map<String, String> chartViewsRealMap = panelAppTemplateService.applyViews(chartViewsInfo, datasetsRealMap, datasetFieldsRealMap, datasetFieldsMd5FormatRealMap, newPanelId);
|
||||||
@ -922,17 +922,19 @@ public class PanelGroupService {
|
|||||||
|
|
||||||
String newDatasourceId = datasourceRealMap.entrySet().stream().findFirst().get().getValue();
|
String newDatasourceId = datasourceRealMap.entrySet().stream().findFirst().get().getValue();
|
||||||
|
|
||||||
String newDatasourceName = request.getDatasourceList().get(0).getName();
|
|
||||||
|
|
||||||
PanelAppTemplateLog templateLog = new PanelAppTemplateLog();
|
PanelAppTemplateLog templateLog = new PanelAppTemplateLog();
|
||||||
templateLog.setPanelId(newPanelId);
|
templateLog.setPanelId(newPanelId);
|
||||||
templateLog.setSourcePanelName(request.getPanelName());
|
templateLog.setSourcePanelName(request.getPanelName());
|
||||||
templateLog.setDatasourceId(newDatasourceId);
|
templateLog.setDatasourceId(newDatasourceId);
|
||||||
templateLog.setSourceDatasourceName(newDatasourceName);
|
if (PanelConstants.APP_DATASOURCE_FROM.NEW.equals(request.getDatasourceFrom())) {
|
||||||
|
templateLog.setSourceDatasourceName(request.getDatasourceList().get(0).getName());
|
||||||
|
}
|
||||||
templateLog.setDatasetGroupId(asideDatasetGroupId);
|
templateLog.setDatasetGroupId(asideDatasetGroupId);
|
||||||
templateLog.setSourceDatasetGroupName(request.getDatasetGroupName());
|
templateLog.setSourceDatasetGroupName(request.getDatasetGroupName());
|
||||||
templateLog.setAppTemplateId(appInfo.getId());
|
templateLog.setAppTemplateId(appInfo.getId());
|
||||||
templateLog.setAppTemplateName(appInfo.getName());
|
templateLog.setAppTemplateName(appInfo.getName());
|
||||||
|
templateLog.setDatasourceFrom(request.getDatasourceFrom());
|
||||||
appTemplateLogService.newAppApplyLog(templateLog);
|
appTemplateLogService.newAppApplyLog(templateLog);
|
||||||
return newPanelId;
|
return newPanelId;
|
||||||
}
|
}
|
||||||
|
2
backend/src/main/resources/db/migration/V45__1.18.sql
Normal file
2
backend/src/main/resources/db/migration/V45__1.18.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE `panel_app_template_log`
|
||||||
|
ADD COLUMN `datasource_from` varchar(255) NULL DEFAULT 'new' COMMENT '数据源来源' AFTER `datasource_id`;
|
@ -2746,6 +2746,9 @@ export default {
|
|||||||
'I18N_USER_TEMPLATE_ERROR': 'Template file error',
|
'I18N_USER_TEMPLATE_ERROR': 'Template file error',
|
||||||
'i18n_max_user_import_size': 'File size exceeds 10M',
|
'i18n_max_user_import_size': 'File size exceeds 10M',
|
||||||
app_template: {
|
app_template: {
|
||||||
|
datasource_new: 'New',
|
||||||
|
datasource_history: 'Multiplexing',
|
||||||
|
datasource_from: 'Datasource From',
|
||||||
apply_template: 'Apply template',
|
apply_template: 'Apply template',
|
||||||
execution_time: 'Execution time',
|
execution_time: 'Execution time',
|
||||||
app_manager: 'Application management',
|
app_manager: 'Application management',
|
||||||
|
@ -2740,6 +2740,9 @@ export default {
|
|||||||
'I18N_USER_TEMPLATE_ERROR': '模版錯誤',
|
'I18N_USER_TEMPLATE_ERROR': '模版錯誤',
|
||||||
'i18n_max_user_import_size': '文件最大不能超過10M',
|
'i18n_max_user_import_size': '文件最大不能超過10M',
|
||||||
app_template: {
|
app_template: {
|
||||||
|
datasource_new: '新建',
|
||||||
|
datasource_history: '復用',
|
||||||
|
datasource_from: '數據來源',
|
||||||
apply_template: '應用模版',
|
apply_template: '應用模版',
|
||||||
execution_time: '执行时间',
|
execution_time: '执行时间',
|
||||||
app_manager: '應用管理',
|
app_manager: '應用管理',
|
||||||
|
@ -2740,6 +2740,9 @@ export default {
|
|||||||
'I18N_USER_TEMPLATE_ERROR': '模版错误',
|
'I18N_USER_TEMPLATE_ERROR': '模版错误',
|
||||||
'i18n_max_user_import_size': '文件最大不能超过10M',
|
'i18n_max_user_import_size': '文件最大不能超过10M',
|
||||||
app_template: {
|
app_template: {
|
||||||
|
datasource_new: '新建',
|
||||||
|
datasource_history: '复用',
|
||||||
|
datasource_from: '数据来源',
|
||||||
apply_template: '应用模板',
|
apply_template: '应用模板',
|
||||||
execution_time: '执行时间',
|
execution_time: '执行时间',
|
||||||
app_manager: '应用管理',
|
app_manager: '应用管理',
|
||||||
|
@ -36,8 +36,8 @@
|
|||||||
icon="iconfont icon-icon-filter"
|
icon="iconfont icon-icon-filter"
|
||||||
@click="filterShow"
|
@click="filterShow"
|
||||||
>{{
|
>{{
|
||||||
$t('user.filter')
|
$t('user.filter')
|
||||||
}}
|
}}
|
||||||
<template v-if="filterTexts.length">
|
<template v-if="filterTexts.length">
|
||||||
({{ cacheCondition.length }})
|
({{ cacheCondition.length }})
|
||||||
</template>
|
</template>
|
||||||
@ -50,7 +50,7 @@
|
|||||||
>
|
>
|
||||||
<span class="sum">{{ paginationConfig.total }}</span>
|
<span class="sum">{{ paginationConfig.total }}</span>
|
||||||
<span class="title">{{ $t('user.result_one') }}</span>
|
<span class="title">{{ $t('user.result_one') }}</span>
|
||||||
<el-divider direction="vertical" />
|
<el-divider direction="vertical"/>
|
||||||
<i
|
<i
|
||||||
v-if="showScroll"
|
v-if="showScroll"
|
||||||
class="el-icon-arrow-left arrow-filter"
|
class="el-icon-arrow-left arrow-filter"
|
||||||
@ -63,9 +63,9 @@
|
|||||||
class="text"
|
class="text"
|
||||||
>
|
>
|
||||||
{{ ele }} <i
|
{{ ele }} <i
|
||||||
class="el-icon-close"
|
class="el-icon-close"
|
||||||
@click="clearOneFilter(index)"
|
@click="clearOneFilter(index)"
|
||||||
/>
|
/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<i
|
<i
|
||||||
@ -306,6 +306,8 @@ export default {
|
|||||||
},
|
},
|
||||||
editApply(item) {
|
editApply(item) {
|
||||||
const param = {
|
const param = {
|
||||||
|
datasourceFrom: item.datasourceFrom,
|
||||||
|
datasourceHistoryId: item.datasourceFrom === 'history' ? item.datasourceId : null,
|
||||||
datasourceType: item.datasourceType,
|
datasourceType: item.datasourceType,
|
||||||
logId: item.id,
|
logId: item.id,
|
||||||
panelId: item.panelId,
|
panelId: item.panelId,
|
||||||
|
@ -14,10 +14,10 @@
|
|||||||
/>
|
/>
|
||||||
{{
|
{{
|
||||||
params &&
|
params &&
|
||||||
params.id &&
|
params.id &&
|
||||||
params.showModel &&
|
params.showModel &&
|
||||||
params.showModel === 'show' &&
|
params.showModel === 'show' &&
|
||||||
!canEdit
|
!canEdit
|
||||||
? $t('datasource.show_info')
|
? $t('datasource.show_info')
|
||||||
: formType == 'add'
|
: formType == 'add'
|
||||||
? `${$t('commons.create') + typeMap}${$t('commons.datasource')}`
|
? `${$t('commons.create') + typeMap}${$t('commons.datasource')}`
|
||||||
@ -132,8 +132,62 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
<div class="de-row-rules">
|
||||||
|
<span>{{
|
||||||
|
positionCheck('appMarket') ? $t('app_template.datasource_info') : $t('datasource.basic_info')
|
||||||
|
}}</span>
|
||||||
|
</div>
|
||||||
|
<el-form
|
||||||
|
ref="historyDsForm"
|
||||||
|
:model="attachForm"
|
||||||
|
:rules="historyFormRule"
|
||||||
|
size="small"
|
||||||
|
:disabled="formType === 'modify'"
|
||||||
|
class="de-form-item"
|
||||||
|
label-width="180px"
|
||||||
|
label-position="right"
|
||||||
|
>
|
||||||
|
<el-form-item
|
||||||
|
:label="$t('app_template.datasource_from')"
|
||||||
|
prop="datasourceFrom"
|
||||||
|
v-if="positionCheck('appMarket')"
|
||||||
|
>
|
||||||
|
<el-radio-group
|
||||||
|
v-model="attachForm.datasourceFrom"
|
||||||
|
size="mini"
|
||||||
|
>
|
||||||
|
<el-radio :label="'new'">
|
||||||
|
{{ $t('app_template.datasource_new') }}
|
||||||
|
</el-radio>
|
||||||
|
<el-radio :label="'history'">
|
||||||
|
{{ $t('app_template.datasource_history') }}
|
||||||
|
</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item
|
||||||
|
v-if="positionCheck('appMarket') && attachForm.datasourceFrom === 'history'"
|
||||||
|
:label="$t('app_template.datasource')"
|
||||||
|
prop="datasourceHistoryId"
|
||||||
|
>
|
||||||
|
<el-select
|
||||||
|
v-model="attachForm.datasourceHistoryId"
|
||||||
|
filterable
|
||||||
|
:placeholder="$t('dataset.pls_slc_data_source')"
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in appMarketDatasource"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
<el-form
|
<el-form
|
||||||
|
v-if="!positionCheck('appMarket') || (positionCheck('appMarket')&& attachForm.datasourceFrom === 'new')"
|
||||||
ref="dsForm"
|
ref="dsForm"
|
||||||
:model="form"
|
:model="form"
|
||||||
:rules="rule"
|
:rules="rule"
|
||||||
@ -143,11 +197,6 @@
|
|||||||
label-width="180px"
|
label-width="180px"
|
||||||
label-position="right"
|
label-position="right"
|
||||||
>
|
>
|
||||||
<div class="de-row-rules">
|
|
||||||
<span>{{
|
|
||||||
positionCheck('appMarket') ? $t('app_template.datasource_info') : $t('datasource.basic_info')
|
|
||||||
}}</span>
|
|
||||||
</div>
|
|
||||||
<el-form-item
|
<el-form-item
|
||||||
:label="$t('datasource.display_name')"
|
:label="$t('datasource.display_name')"
|
||||||
prop="name"
|
prop="name"
|
||||||
@ -226,7 +275,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="positionCheck('appMarket')"
|
v-if="positionCheck('appMarket') && attachForm.datasourceFrom === 'new'"
|
||||||
class="de-ds-bottom"
|
class="de-ds-bottom"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@ -271,25 +320,50 @@
|
|||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-if="positionCheck('appMarket') && attachForm.datasourceFrom === 'history'"
|
||||||
|
class="de-ds-bottom"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="apply"
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<template v-if="canEdit">
|
||||||
|
<deBtn
|
||||||
|
secondary
|
||||||
|
@click="closeDraw"
|
||||||
|
>{{ $t('commons.cancel') }}
|
||||||
|
</deBtn>
|
||||||
|
<deBtn
|
||||||
|
v-if="formType === 'add'"
|
||||||
|
type="primary"
|
||||||
|
@click="saveAppMarketHistory"
|
||||||
|
>{{ $t('commons.save') }}
|
||||||
|
</deBtn>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
addDs,
|
addDs,
|
||||||
editDs,
|
|
||||||
getSchema,
|
|
||||||
validateDs,
|
|
||||||
validateDsById,
|
|
||||||
checkApiDatasource,
|
checkApiDatasource,
|
||||||
|
editDs,
|
||||||
|
getDatasourceDetail,
|
||||||
|
getSchema,
|
||||||
|
listDatasource,
|
||||||
|
listDatasourceType,
|
||||||
listDriverByType,
|
listDriverByType,
|
||||||
getDatasourceDetail
|
validateDs,
|
||||||
|
validateDsById
|
||||||
} from '@/api/system/datasource'
|
} from '@/api/system/datasource'
|
||||||
import { $confirm } from '@/utils/message'
|
import { $confirm } from '@/utils/message'
|
||||||
import i18n from '@/lang/index'
|
import i18n from '@/lang/index'
|
||||||
import DsConfiguration from '@/views/system/datasource/DsConfiguration'
|
import DsConfiguration from '@/views/system/datasource/DsConfiguration'
|
||||||
import PluginCom from '@/views/system/plugin/PluginCom'
|
import PluginCom from '@/views/system/plugin/PluginCom'
|
||||||
import { listDatasourceType, listDatasource } from '@/api/system/datasource'
|
|
||||||
import deTextarea from '@/components/deCustomCm/DeTextarea.vue'
|
import deTextarea from '@/components/deCustomCm/DeTextarea.vue'
|
||||||
import msgCfm from '@/components/msgCfm'
|
import msgCfm from '@/components/msgCfm'
|
||||||
import { dsGroupTree } from '@/api/dataset/dataset'
|
import { dsGroupTree } from '@/api/dataset/dataset'
|
||||||
@ -317,6 +391,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
appMarketDatasource: [],
|
||||||
appMarketEdit: true,
|
appMarketEdit: true,
|
||||||
attachRule: {
|
attachRule: {
|
||||||
panelName: [
|
panelName: [
|
||||||
@ -348,9 +423,20 @@ export default {
|
|||||||
panelName: '',
|
panelName: '',
|
||||||
datasetGroupPid: null,
|
datasetGroupPid: null,
|
||||||
datasetGroupId: null,
|
datasetGroupId: null,
|
||||||
datasetGroupName: ''
|
datasetGroupName: '',
|
||||||
|
datasourceFrom: 'new',
|
||||||
|
datasourceHistoryId: null
|
||||||
},
|
},
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
historyFormRule: {
|
||||||
|
datasourceFrom: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
datasourceHistoryId: [{ required: true, message: i18n.t('dataset.pls_slc_data_source'), trigger: 'blur' }]
|
||||||
|
},
|
||||||
form: {
|
form: {
|
||||||
configuration: {
|
configuration: {
|
||||||
initialPoolSize: 5,
|
initialPoolSize: 5,
|
||||||
@ -591,6 +677,8 @@ export default {
|
|||||||
this.attachForm.datasetGroupPid = this.outerParams.datasetGroupPid ? this.outerParams.datasetGroupPid : '0'
|
this.attachForm.datasetGroupPid = this.outerParams.datasetGroupPid ? this.outerParams.datasetGroupPid : '0'
|
||||||
this.attachForm.datasetGroupId = this.outerParams.datasetGroupId
|
this.attachForm.datasetGroupId = this.outerParams.datasetGroupId
|
||||||
this.attachForm.datasetGroupName = this.outerParams.datasetGroupName
|
this.attachForm.datasetGroupName = this.outerParams.datasetGroupName
|
||||||
|
this.attachForm.datasourceFrom = this.outerParams.datasourceFrom ? this.outerParams.datasourceFrom : 'new'
|
||||||
|
this.attachForm.datasourceHistoryId = this.outerParams.datasourceHistoryId
|
||||||
this.params = {
|
this.params = {
|
||||||
id: this.outerParams.datasourceId,
|
id: this.outerParams.datasourceId,
|
||||||
showModel: this.outerParams.showModel,
|
showModel: this.outerParams.showModel,
|
||||||
@ -625,6 +713,11 @@ export default {
|
|||||||
delete node.children
|
delete node.children
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
getDatasourceOptions() {
|
||||||
|
return listDatasource().then((response) => {
|
||||||
|
this.options = response.data.filter((item) => item.type !== 'api')
|
||||||
|
})
|
||||||
|
},
|
||||||
getDatasetGroupTree() {
|
getDatasetGroupTree() {
|
||||||
dsGroupTree({ nodeType: 'group', excludedId: this.attachForm.datasetGroupId }).then(res => {
|
dsGroupTree({ nodeType: 'group', excludedId: this.attachForm.datasetGroupId }).then(res => {
|
||||||
this.datasetGroupList = [{
|
this.datasetGroupList = [{
|
||||||
@ -665,6 +758,9 @@ export default {
|
|||||||
queryTreeData() {
|
queryTreeData() {
|
||||||
listDatasource().then((res) => {
|
listDatasource().then((res) => {
|
||||||
this.tData = this.buildTree(res.data)
|
this.tData = this.buildTree(res.data)
|
||||||
|
if (this.positionCheck('appMarket') && res.data) {
|
||||||
|
this.appMarketDatasource = res.data.filter((item) => item.type === this.outerParams.datasourceType)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
buildTree(array) {
|
buildTree(array) {
|
||||||
@ -736,6 +832,20 @@ export default {
|
|||||||
reset() {
|
reset() {
|
||||||
this.$refs.dsForm.resetFields()
|
this.$refs.dsForm.resetFields()
|
||||||
},
|
},
|
||||||
|
saveAppMarketHistory() {
|
||||||
|
this.$refs.historyDsForm.validate(valid => {
|
||||||
|
if (!valid) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
const appApplyForm = {
|
||||||
|
...this.attachForm,
|
||||||
|
...this.historyDsForm
|
||||||
|
}
|
||||||
|
const method = this.formType === 'add' ? appApply : appEdit
|
||||||
|
this.appApplyMethod(method, appApplyForm)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
save() {
|
save() {
|
||||||
if (
|
if (
|
||||||
!this.form.configuration.schema &&
|
!this.form.configuration.schema &&
|
||||||
@ -879,10 +989,10 @@ export default {
|
|||||||
}
|
}
|
||||||
if (this.positionCheck('appMarket')) {
|
if (this.positionCheck('appMarket')) {
|
||||||
this.$refs.attachParamsForm.validate(valid => {
|
this.$refs.attachParamsForm.validate(valid => {
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
return false
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
this.$refs.dsForm.validate((valid) => {
|
this.$refs.dsForm.validate((valid) => {
|
||||||
@ -912,6 +1022,7 @@ export default {
|
|||||||
}
|
}
|
||||||
appApplyForm = {
|
appApplyForm = {
|
||||||
...this.attachForm,
|
...this.attachForm,
|
||||||
|
...this.historyDsForm,
|
||||||
datasourceList: [deepCopy(form)]
|
datasourceList: [deepCopy(form)]
|
||||||
}
|
}
|
||||||
method = this.formType === 'add' ? appApply : appEdit
|
method = this.formType === 'add' ? appApply : appEdit
|
||||||
@ -1024,10 +1135,10 @@ export default {
|
|||||||
}
|
}
|
||||||
if (this.positionCheck('appMarket')) {
|
if (this.positionCheck('appMarket')) {
|
||||||
this.$refs.attachParamsForm.validate(valid => {
|
this.$refs.attachParamsForm.validate(valid => {
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
return false
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
this.$refs.dsForm.validate((valid) => {
|
this.$refs.dsForm.validate((valid) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user