forked from github/dataease
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
6e9cee5af2
@ -2,6 +2,8 @@ package io.dataease.controller.panel.api;
|
|||||||
|
|
||||||
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||||
|
import io.dataease.auth.annotation.DePermission;
|
||||||
|
import io.dataease.commons.constants.DePermissionType;
|
||||||
import io.dataease.controller.request.chart.ChartExtRequest;
|
import io.dataease.controller.request.chart.ChartExtRequest;
|
||||||
import io.dataease.controller.request.panel.link.*;
|
import io.dataease.controller.request.panel.link.*;
|
||||||
import io.dataease.dto.panel.link.GenerateDto;
|
import io.dataease.dto.panel.link.GenerateDto;
|
||||||
@ -18,26 +20,32 @@ import java.util.Map;
|
|||||||
public interface LinkApi {
|
public interface LinkApi {
|
||||||
|
|
||||||
|
|
||||||
|
@DePermission(type = DePermissionType.PANEL, value = "resourceId")
|
||||||
@ApiOperation("重置密码")
|
@ApiOperation("重置密码")
|
||||||
@PostMapping("/resetPwd")
|
@PostMapping("/resetPwd")
|
||||||
void replacePwd(PasswordRequest request);
|
void replacePwd(PasswordRequest request);
|
||||||
|
|
||||||
|
@DePermission(type = DePermissionType.PANEL, value = "resourceId")
|
||||||
@ApiOperation("启用密码")
|
@ApiOperation("启用密码")
|
||||||
@PostMapping("/enablePwd")
|
@PostMapping("/enablePwd")
|
||||||
void enablePwd(EnablePwdRequest request);
|
void enablePwd(EnablePwdRequest request);
|
||||||
|
|
||||||
|
@DePermission(type = DePermissionType.PANEL, value = "resourceId")
|
||||||
@ApiOperation("过期时间")
|
@ApiOperation("过期时间")
|
||||||
@PostMapping("/resetOverTime")
|
@PostMapping("/resetOverTime")
|
||||||
void resetOverTime(OverTimeRequest request);
|
void resetOverTime(OverTimeRequest request);
|
||||||
|
|
||||||
|
@DePermission(type = DePermissionType.PANEL, value = "resourceId")
|
||||||
@ApiOperation("启用/禁用链接分享")
|
@ApiOperation("启用/禁用链接分享")
|
||||||
@PostMapping("/switchLink")
|
@PostMapping("/switchLink")
|
||||||
void switchLink(LinkRequest request);
|
void switchLink(LinkRequest request);
|
||||||
|
|
||||||
|
@DePermission(type = DePermissionType.PANEL)
|
||||||
@ApiOperation("当前链接信息")
|
@ApiOperation("当前链接信息")
|
||||||
@PostMapping("/currentGenerate/{resourceId}")
|
@PostMapping("/currentGenerate/{resourceId}")
|
||||||
GenerateDto currentGenerate(String resourceId);
|
GenerateDto currentGenerate(String resourceId);
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("验证访问")
|
@ApiOperation("验证访问")
|
||||||
@PostMapping("/validate")
|
@PostMapping("/validate")
|
||||||
ValidateDto validate(LinkValidateRequest request) throws Exception;
|
ValidateDto validate(LinkValidateRequest request) throws Exception;
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package io.dataease.controller.panel.api;
|
package io.dataease.controller.panel.api;
|
||||||
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||||
|
import io.dataease.auth.annotation.DePermission;
|
||||||
import io.dataease.base.domain.PanelShare;
|
import io.dataease.base.domain.PanelShare;
|
||||||
|
import io.dataease.commons.constants.DePermissionType;
|
||||||
import io.dataease.controller.request.panel.PanelShareFineDto;
|
import io.dataease.controller.request.panel.PanelShareFineDto;
|
||||||
import io.dataease.controller.request.panel.PanelShareRemoveRequest;
|
import io.dataease.controller.request.panel.PanelShareRemoveRequest;
|
||||||
import io.dataease.controller.sys.base.BaseGridRequest;
|
import io.dataease.controller.sys.base.BaseGridRequest;
|
||||||
@ -47,6 +49,7 @@ public interface ShareApi {
|
|||||||
List<PanelShareOutDTO> queryTargets(@PathVariable("panelId") String panelId);
|
List<PanelShareOutDTO> queryTargets(@PathVariable("panelId") String panelId);
|
||||||
|
|
||||||
|
|
||||||
|
@DePermission(type = DePermissionType.PANEL, value = "resourceId")
|
||||||
@ApiOperation("创建分享")
|
@ApiOperation("创建分享")
|
||||||
@PostMapping("/fineSave")
|
@PostMapping("/fineSave")
|
||||||
void fineSave(PanelShareFineDto panelShareFineDto);
|
void fineSave(PanelShareFineDto panelShareFineDto);
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package io.dataease.controller.panel.api;
|
package io.dataease.controller.panel.api;
|
||||||
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||||
|
import io.dataease.auth.annotation.DePermission;
|
||||||
|
import io.dataease.commons.constants.DePermissionType;
|
||||||
import io.dataease.controller.sys.base.BaseGridRequest;
|
import io.dataease.controller.sys.base.BaseGridRequest;
|
||||||
import io.dataease.dto.panel.PanelStoreDto;
|
import io.dataease.dto.panel.PanelStoreDto;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@ -21,6 +23,7 @@ import java.util.List;
|
|||||||
@RequestMapping("/api/store")
|
@RequestMapping("/api/store")
|
||||||
public interface StoreApi {
|
public interface StoreApi {
|
||||||
|
|
||||||
|
@DePermission(type = DePermissionType.PANEL)
|
||||||
@ApiOperation("创建收藏")
|
@ApiOperation("创建收藏")
|
||||||
@PostMapping("/{id}")
|
@PostMapping("/{id}")
|
||||||
void store(@PathVariable("id") String id);
|
void store(@PathVariable("id") String id);
|
||||||
|
@ -185,7 +185,7 @@ public class ApiProvider extends DatasourceProvider{
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
while (it.hasNext()){
|
while (it.hasNext()){
|
||||||
Map.Entry entry = (Map.Entry)it.next();
|
Map.Entry entry = (Map.Entry)it.next();
|
||||||
row[i] = Optional.ofNullable(entry.getValue()).orElse("").toString();
|
row[i] = Optional.ofNullable(entry.getValue()).orElse("").toString().replaceAll("\n", " ").replaceAll("\r", " ");
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
dataList.add(row);
|
dataList.add(row);
|
||||||
|
@ -367,7 +367,6 @@ public class JdbcProvider extends DatasourceProvider {
|
|||||||
try (Connection con = getConnection(datasourceRequest); Statement statement = con.createStatement(); ResultSet resultSet = statement.executeQuery(queryStr)) {
|
try (Connection con = getConnection(datasourceRequest); Statement statement = con.createStatement(); ResultSet resultSet = statement.executeQuery(queryStr)) {
|
||||||
return "Success";
|
return "Success";
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
|
||||||
DataEaseException.throwException(e.getMessage());
|
DataEaseException.throwException(e.getMessage());
|
||||||
}
|
}
|
||||||
return "Error";
|
return "Error";
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package io.dataease.service.dataset;
|
package io.dataease.service.dataset;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import io.dataease.auth.annotation.DeCleaner;
|
||||||
import io.dataease.base.domain.*;
|
import io.dataease.base.domain.*;
|
||||||
import io.dataease.base.mapper.*;
|
import io.dataease.base.mapper.*;
|
||||||
import io.dataease.base.mapper.ext.ExtDataSetGroupMapper;
|
import io.dataease.base.mapper.ext.ExtDataSetGroupMapper;
|
||||||
@ -103,6 +104,7 @@ public class DataSetTableService {
|
|||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(ClassloaderResponsity.class);
|
private static Logger logger = LoggerFactory.getLogger(ClassloaderResponsity.class);
|
||||||
|
|
||||||
|
@DeCleaner(value = DePermissionType.DATASET)
|
||||||
public void batchInsert(List<DataSetTableRequest> datasetTable) throws Exception {
|
public void batchInsert(List<DataSetTableRequest> datasetTable) throws Exception {
|
||||||
for (DataSetTableRequest table : datasetTable) {
|
for (DataSetTableRequest table : datasetTable) {
|
||||||
save(table);
|
save(table);
|
||||||
@ -126,6 +128,7 @@ public class DataSetTableService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DeCleaner(value = DePermissionType.DATASET)
|
||||||
public void saveExcel(DataSetTableRequest datasetTable) throws Exception {
|
public void saveExcel(DataSetTableRequest datasetTable) throws Exception {
|
||||||
List<String> datasetIdList = new ArrayList<>();
|
List<String> datasetIdList = new ArrayList<>();
|
||||||
|
|
||||||
@ -233,6 +236,7 @@ public class DataSetTableService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DeCleaner(value = DePermissionType.DATASET)
|
||||||
public DatasetTable save(DataSetTableRequest datasetTable) throws Exception {
|
public DatasetTable save(DataSetTableRequest datasetTable) throws Exception {
|
||||||
checkName(datasetTable);
|
checkName(datasetTable);
|
||||||
if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "sql")) {
|
if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "sql")) {
|
||||||
@ -1795,6 +1799,7 @@ public class DataSetTableService {
|
|||||||
return dataSetDetail;
|
return dataSetDetail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DeCleaner(value = DePermissionType.DATASET)
|
||||||
public ExcelFileData excelSaveAndParse(MultipartFile file, String tableId, Integer editType) throws Exception {
|
public ExcelFileData excelSaveAndParse(MultipartFile file, String tableId, Integer editType) throws Exception {
|
||||||
String filename = file.getOriginalFilename();
|
String filename = file.getOriginalFilename();
|
||||||
// parse file
|
// parse file
|
||||||
|
@ -467,6 +467,10 @@ public class ExtractDataService {
|
|||||||
while ((line = input.readLine()) != null) {
|
while ((line = input.readLine()) != null) {
|
||||||
errMsg = errMsg + line + System.getProperty("line.separator");
|
errMsg = errMsg + line + System.getProperty("line.separator");
|
||||||
}
|
}
|
||||||
|
input = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||||
|
while ((line = input.readLine()) != null) {
|
||||||
|
errMsg = errMsg + line + System.getProperty("line.separator");
|
||||||
|
}
|
||||||
throw new Exception(errMsg);
|
throw new Exception(errMsg);
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
|
@ -161,7 +161,16 @@ public class DatasourceService {
|
|||||||
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(datasource.getType());
|
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(datasource.getType());
|
||||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||||
datasourceRequest.setDatasource(datasource);
|
datasourceRequest.setDatasource(datasource);
|
||||||
datasourceProvider.checkStatus(datasourceRequest);
|
String status = datasourceProvider.checkStatus(datasourceRequest);
|
||||||
|
if (status.equalsIgnoreCase("Success")) {
|
||||||
|
return ResultHolder.success("Success");
|
||||||
|
}
|
||||||
|
if (status.equalsIgnoreCase("Warning")) {
|
||||||
|
return ResultHolder.error("Datasource has invalid items");
|
||||||
|
}
|
||||||
|
if (status.equalsIgnoreCase("Error")) {
|
||||||
|
return ResultHolder.error("Datasource is invalid");
|
||||||
|
}
|
||||||
return ResultHolder.success("Success");
|
return ResultHolder.success("Success");
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
return ResultHolder.error("Datasource is invalid: " + e.getMessage());
|
return ResultHolder.error("Datasource is invalid: " + e.getMessage());
|
||||||
@ -178,8 +187,17 @@ public class DatasourceService {
|
|||||||
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(datasource.getType());
|
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(datasource.getType());
|
||||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||||
datasourceRequest.setDatasource(datasource);
|
datasourceRequest.setDatasource(datasource);
|
||||||
datasourceProvider.checkStatus(datasourceRequest);
|
String status = datasourceProvider.checkStatus(datasourceRequest);
|
||||||
datasource.setStatus("Success");
|
datasource.setStatus(status);
|
||||||
|
if (status.equalsIgnoreCase("Success")) {
|
||||||
|
return ResultHolder.success("Success");
|
||||||
|
}
|
||||||
|
if (status.equalsIgnoreCase("Warning")) {
|
||||||
|
return ResultHolder.error("Datasource has invalid items");
|
||||||
|
}
|
||||||
|
if (status.equalsIgnoreCase("Error")) {
|
||||||
|
return ResultHolder.error("Datasource is invalid");
|
||||||
|
}
|
||||||
return ResultHolder.success("Success");
|
return ResultHolder.success("Success");
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
datasource.setStatus("Error");
|
datasource.setStatus("Error");
|
||||||
@ -206,7 +224,8 @@ public class DatasourceService {
|
|||||||
|
|
||||||
// 获取当前数据源下的db类型数据集
|
// 获取当前数据源下的db类型数据集
|
||||||
DatasetTableExample datasetTableExample = new DatasetTableExample();
|
DatasetTableExample datasetTableExample = new DatasetTableExample();
|
||||||
datasetTableExample.createCriteria().andTypeEqualTo("db").andDataSourceIdEqualTo(datasource.getId());
|
|
||||||
|
datasetTableExample.createCriteria().andTypeIn(Arrays.asList("db","api")).andDataSourceIdEqualTo(datasource.getId());
|
||||||
List<DatasetTable> datasetTables = datasetTableMapper.selectByExampleWithBLOBs(datasetTableExample);
|
List<DatasetTable> datasetTables = datasetTableMapper.selectByExampleWithBLOBs(datasetTableExample);
|
||||||
List<DBTableDTO> list = new ArrayList<>();
|
List<DBTableDTO> list = new ArrayList<>();
|
||||||
for (TableDesc tableDesc : tables) {
|
for (TableDesc tableDesc : tables) {
|
||||||
@ -256,6 +275,7 @@ public class DatasourceService {
|
|||||||
DatasourceExample example = new DatasourceExample();
|
DatasourceExample example = new DatasourceExample();
|
||||||
DatasourceExample.Criteria criteria = example.createCriteria();
|
DatasourceExample.Criteria criteria = example.createCriteria();
|
||||||
criteria.andNameEqualTo(datasource.getName());
|
criteria.andNameEqualTo(datasource.getName());
|
||||||
|
criteria.andTypeEqualTo(datasource.getType());
|
||||||
if (StringUtils.isNotEmpty(datasource.getId())) {
|
if (StringUtils.isNotEmpty(datasource.getId())) {
|
||||||
criteria.andIdNotEqualTo(datasource.getId());
|
criteria.andIdNotEqualTo(datasource.getId());
|
||||||
}
|
}
|
||||||
@ -271,8 +291,16 @@ public class DatasourceService {
|
|||||||
|
|
||||||
public ApiDefinition checkApiDatasource(ApiDefinition apiDefinition) throws Exception {
|
public ApiDefinition checkApiDatasource(ApiDefinition apiDefinition) throws Exception {
|
||||||
String response = ApiProvider.execHttpRequest(apiDefinition);
|
String response = ApiProvider.execHttpRequest(apiDefinition);
|
||||||
|
if(StringUtils.isEmpty(response)){
|
||||||
|
throw new Exception("该请求返回数据为空");
|
||||||
|
}
|
||||||
|
List<LinkedHashMap> datas = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
datas = JsonPath.read(response,apiDefinition.getDataPath());
|
||||||
|
}catch (Exception e){
|
||||||
|
throw new Exception("jsonPath 路径错误:" + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
List<LinkedHashMap> datas = JsonPath.read(response,apiDefinition.getDataPath());
|
|
||||||
List<JSONObject> dataList = new ArrayList<>();
|
List<JSONObject> dataList = new ArrayList<>();
|
||||||
List<DatasetTableField> fields = new ArrayList<>();
|
List<DatasetTableField> fields = new ArrayList<>();
|
||||||
Boolean getFileds = true;
|
Boolean getFileds = true;
|
||||||
@ -282,7 +310,7 @@ public class DatasourceService {
|
|||||||
Iterator it = data.entrySet().iterator();
|
Iterator it = data.entrySet().iterator();
|
||||||
while (it.hasNext()){
|
while (it.hasNext()){
|
||||||
Map.Entry entry = (Map.Entry)it.next();
|
Map.Entry entry = (Map.Entry)it.next();
|
||||||
jsonObject.put((String) entry.getKey(), entry.getValue());
|
jsonObject.put((String) entry.getKey(), Optional.ofNullable(entry.getValue()).orElse("").toString().replaceAll("\n", " ").replaceAll("\r", " "));
|
||||||
if(getFileds) {
|
if(getFileds) {
|
||||||
DatasetTableField tableField = new DatasetTableField();
|
DatasetTableField tableField = new DatasetTableField();
|
||||||
tableField.setOriginName((String) entry.getKey());
|
tableField.setOriginName((String) entry.getKey());
|
||||||
|
@ -1310,7 +1310,7 @@ export default {
|
|||||||
port_no_less_then_0: 'Port cannot be less than zero',
|
port_no_less_then_0: 'Port cannot be less than zero',
|
||||||
priority: 'Advanced setting',
|
priority: 'Advanced setting',
|
||||||
extra_params: 'Extra JDBC connection string',
|
extra_params: 'Extra JDBC connection string',
|
||||||
please_input_dataPath: '请输入 JsonPath 数据路径',
|
please_input_dataPath: 'Please enter the JsonPath data path',
|
||||||
warning: 'Contains invalid datasets',
|
warning: 'Contains invalid datasets',
|
||||||
data_table: 'Dataset Table',
|
data_table: 'Dataset Table',
|
||||||
data_table_name: 'Dataset Table name',
|
data_table_name: 'Dataset Table name',
|
||||||
|
@ -1584,6 +1584,10 @@ export default {
|
|||||||
this.view.customAttr = this.view.customAttr ? JSON.parse(this.view.customAttr) : {}
|
this.view.customAttr = this.view.customAttr ? JSON.parse(this.view.customAttr) : {}
|
||||||
this.view.customStyle = this.view.customStyle ? JSON.parse(this.view.customStyle) : {}
|
this.view.customStyle = this.view.customStyle ? JSON.parse(this.view.customStyle) : {}
|
||||||
this.view.customFilter = this.view.customFilter ? JSON.parse(this.view.customFilter) : {}
|
this.view.customFilter = this.view.customFilter ? JSON.parse(this.view.customFilter) : {}
|
||||||
|
|
||||||
|
// 将视图传入echart组件
|
||||||
|
this.chart = response.data
|
||||||
|
this.data = response.data.data
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
this.httpRequest.status = err.response.data.success
|
this.httpRequest.status = err.response.data.success
|
||||||
this.httpRequest.msg = err.response.data.message
|
this.httpRequest.msg = err.response.data.message
|
||||||
|
@ -125,7 +125,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
initDataSource() {
|
initDataSource() {
|
||||||
listDatasource().then(response => {
|
listDatasource().then(response => {
|
||||||
this.options = response.data
|
this.options = response.data.filter(item => item.type !== 'api')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
kettleState() {
|
kettleState() {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<el-row>
|
<el-row>
|
||||||
<el-row style="height: 26px;" class="title-text">
|
<el-row style="height: 26px;" class="title-text">
|
||||||
<span style="line-height: 26px;">
|
<span style="line-height: 26px;">
|
||||||
{{ param.tableId?$t('dataset.edit_sql'):$t('dataset.add_sql_table') }}
|
{{ param.tableId ? $t('dataset.edit_sql') : $t('dataset.add_sql_table') }}
|
||||||
</span>
|
</span>
|
||||||
<el-row style="float: right">
|
<el-row style="float: right">
|
||||||
<el-button size="mini" @click="cancel">
|
<el-button size="mini" @click="cancel">
|
||||||
@ -14,11 +14,12 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-divider />
|
<el-divider/>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-form :inline="true">
|
<el-form :inline="true">
|
||||||
<el-form-item class="form-item">
|
<el-form-item class="form-item">
|
||||||
<el-select v-model="dataSource" filterable :placeholder="$t('dataset.pls_slc_data_source')" size="mini" @change="changeDatasource()">
|
<el-select v-model="dataSource" filterable :placeholder="$t('dataset.pls_slc_data_source')" size="mini"
|
||||||
|
@change="changeDatasource()">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in options"
|
v-for="item in options"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
@ -28,19 +29,20 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item class="form-item">
|
<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')"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="!param.tableId" class="form-item">
|
<el-form-item v-if="!param.tableId" class="form-item">
|
||||||
<el-select v-model="mode" filterable :placeholder="$t('dataset.connect_mode')" size="mini">
|
<el-select v-model="mode" filterable :placeholder="$t('dataset.connect_mode')" size="mini">
|
||||||
<el-option :label="$t('dataset.direct_connect')" value="0" />
|
<el-option :label="$t('dataset.direct_connect')" value="0"/>
|
||||||
<el-option :label="$t('dataset.sync_data')" value="1" :disabled="!kettleRunning || selectedDatasource.type==='es' || selectedDatasource.type==='ck'|| selectedDatasource.type==='mongo'|| selectedDatasource.type==='redshift' || selectedDatasource.type==='hive'" />
|
<el-option :label="$t('dataset.sync_data')" value="1"
|
||||||
|
:disabled="!kettleRunning || selectedDatasource.type==='es' || selectedDatasource.type==='ck'|| selectedDatasource.type==='mongo'|| selectedDatasource.type==='redshift' || selectedDatasource.type==='hive'"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item v-if="mode === '1'" class="form-item">
|
<el-form-item v-if="mode === '1'" class="form-item">
|
||||||
<el-select v-model="syncType" filterable :placeholder="$t('dataset.connect_mode')" size="mini">
|
<el-select v-model="syncType" filterable :placeholder="$t('dataset.connect_mode')" size="mini">
|
||||||
<el-option :label="$t('dataset.sync_now')" value="sync_now" />
|
<el-option :label="$t('dataset.sync_now')" value="sync_now"/>
|
||||||
<el-option :label="$t('dataset.sync_latter')" value="sync_latter" />
|
<el-option :label="$t('dataset.sync_latter')" value="sync_latter"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -62,7 +64,9 @@
|
|||||||
<el-card class="box-card dataPreview" shadow="never">
|
<el-card class="box-card dataPreview" shadow="never">
|
||||||
<div slot="header" class="clearfix">
|
<div slot="header" class="clearfix">
|
||||||
<span>{{ $t('dataset.data_preview') }}</span>
|
<span>{{ $t('dataset.data_preview') }}</span>
|
||||||
<el-button style="float: right; padding: 3px 0" type="text" size="mini" @click="getSQLPreview">{{ $t('dataset.preview') }}</el-button>
|
<el-button style="float: right; padding: 3px 0" type="text" size="mini" @click="getSQLPreview">
|
||||||
|
{{ $t('dataset.preview') }}
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="text item">
|
<div class="text item">
|
||||||
<ux-grid
|
<ux-grid
|
||||||
@ -95,9 +99,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { post, listDatasource, isKettleRunning } from '@/api/dataset/dataset'
|
import {post, listDatasource, isKettleRunning} from '@/api/dataset/dataset'
|
||||||
import { codemirror } from 'vue-codemirror'
|
import {codemirror} from 'vue-codemirror'
|
||||||
import { getTable } from '@/api/dataset/dataset'
|
import {getTable} from '@/api/dataset/dataset'
|
||||||
// 核心样式
|
// 核心样式
|
||||||
import 'codemirror/lib/codemirror.css'
|
import 'codemirror/lib/codemirror.css'
|
||||||
// 引入主题后还需要在 options 中指定主题才会生效
|
// 引入主题后还需要在 options 中指定主题才会生效
|
||||||
@ -123,7 +127,7 @@ import 'codemirror/addon/hint/show-hint'
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'AddSQL',
|
name: 'AddSQL',
|
||||||
components: { codemirror },
|
components: {codemirror},
|
||||||
props: {
|
props: {
|
||||||
param: {
|
param: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@ -163,7 +167,7 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'param.tableId': {
|
'param.tableId': {
|
||||||
handler: function() {
|
handler: function () {
|
||||||
this.resetComponent()
|
this.resetComponent()
|
||||||
this.initTableInfo()
|
this.initTableInfo()
|
||||||
}
|
}
|
||||||
@ -199,14 +203,14 @@ export default {
|
|||||||
},
|
},
|
||||||
calHeight() {
|
calHeight() {
|
||||||
const that = this
|
const that = this
|
||||||
setTimeout(function() {
|
setTimeout(function () {
|
||||||
const currentHeight = document.documentElement.clientHeight
|
const currentHeight = document.documentElement.clientHeight
|
||||||
that.height = currentHeight - 56 - 30 - 26 - 25 - 43 - 160 - 10 - 37 - 20 - 10 - 16
|
that.height = currentHeight - 56 - 30 - 26 - 25 - 43 - 160 - 10 - 37 - 20 - 10 - 16
|
||||||
}, 10)
|
}, 10)
|
||||||
},
|
},
|
||||||
initDataSource() {
|
initDataSource() {
|
||||||
listDatasource().then(response => {
|
listDatasource().then(response => {
|
||||||
this.options = response.data
|
this.options = response.data.filter(item => item.type !== 'api')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -237,7 +241,7 @@ export default {
|
|||||||
dataSourceId: this.dataSource,
|
dataSourceId: this.dataSource,
|
||||||
type: 'sql',
|
type: 'sql',
|
||||||
// info: '{"sql":"' + this.sql + '"}',
|
// info: '{"sql":"' + this.sql + '"}',
|
||||||
info: JSON.stringify({ sql: this.sql.trim() })
|
info: JSON.stringify({sql: this.sql.trim()})
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
this.fields = response.data.fields
|
this.fields = response.data.fields
|
||||||
this.data = response.data.data
|
this.data = response.data.data
|
||||||
@ -280,7 +284,7 @@ export default {
|
|||||||
syncType: this.syncType,
|
syncType: this.syncType,
|
||||||
mode: parseInt(this.mode),
|
mode: parseInt(this.mode),
|
||||||
// info: '{"sql":"' + this.sql + '"}',
|
// info: '{"sql":"' + this.sql + '"}',
|
||||||
info: JSON.stringify({ sql: this.sql.trim() })
|
info: JSON.stringify({sql: this.sql.trim()})
|
||||||
}
|
}
|
||||||
post('/dataset/table/update', table).then(response => {
|
post('/dataset/table/update', table).then(response => {
|
||||||
// this.$store.dispatch('dataset/setSceneData', new Date().getTime())
|
// this.$store.dispatch('dataset/setSceneData', new Date().getTime())
|
||||||
@ -292,9 +296,9 @@ export default {
|
|||||||
cancel() {
|
cancel() {
|
||||||
// this.dataReset()
|
// this.dataReset()
|
||||||
if (this.param.tableId) {
|
if (this.param.tableId) {
|
||||||
this.$emit('switchComponent', { name: 'ViewTable', param: this.param.table })
|
this.$emit('switchComponent', {name: 'ViewTable', param: this.param.table})
|
||||||
} else {
|
} else {
|
||||||
this.$emit('switchComponent', { name: '' })
|
this.$emit('switchComponent', {name: ''})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -327,48 +331,51 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.el-divider--horizontal {
|
.el-divider--horizontal {
|
||||||
margin: 12px 0;
|
margin: 12px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-item {
|
.form-item {
|
||||||
margin-bottom: 6px;
|
margin-bottom: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-checkbox {
|
.el-checkbox {
|
||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
margin-right: 14px;
|
margin-right: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-checkbox.is-bordered + .el-checkbox.is-bordered {
|
.el-checkbox.is-bordered + .el-checkbox.is-bordered {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.codemirror {
|
.codemirror {
|
||||||
height: 160px;
|
height: 160px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
.codemirror >>> .CodeMirror-scroll {
|
|
||||||
height: 160px;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dataPreview>>>.el-card__header{
|
.codemirror >>> .CodeMirror-scroll {
|
||||||
padding: 6px 8px;
|
height: 160px;
|
||||||
}
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
.dataPreview>>>.el-card__body{
|
.dataPreview >>> .el-card__header {
|
||||||
padding:10px;
|
padding: 6px 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
span{
|
.dataPreview >>> .el-card__body {
|
||||||
font-size: 14px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
.span-number{
|
|
||||||
color: #0a7be0;
|
span {
|
||||||
}
|
font-size: 14px;
|
||||||
.table-count{
|
}
|
||||||
color: #606266;
|
|
||||||
}
|
.span-number {
|
||||||
|
color: #0a7be0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-count {
|
||||||
|
color: #606266;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -369,14 +369,14 @@ export default {
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.ms-query {
|
.ms-query {
|
||||||
background: #783887;
|
background: #409EFF;
|
||||||
color: white;
|
color: white;
|
||||||
height: 18px;
|
height: 18px;
|
||||||
border-radius: 42%;
|
border-radius: 42%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ms-header {
|
.ms-header {
|
||||||
background: #783887;
|
background: #409EFF;
|
||||||
color: white;
|
color: white;
|
||||||
height: 18px;
|
height: 18px;
|
||||||
border-radius: 42%;
|
border-radius: 42%;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
<div class="kv-row item" v-for="(item, index) in items" :key="index">
|
<div class="kv-row item" v-for="(item, index) in items" :key="index">
|
||||||
|
|
||||||
<el-row type="flex" :gutter="20" justify="space-between" align="middle">
|
<el-row type="flex" :gutter="20" justify="space-between" align="middle">
|
||||||
|
<span style="margin-left: 10px"></span>
|
||||||
<i class="el-icon-top" style="cursor:pointer" @click="moveTop(index)"/>
|
<i class="el-icon-top" style="cursor:pointer" @click="moveTop(index)"/>
|
||||||
<i class="el-icon-bottom" style="cursor:pointer;" @click="moveBottom(index)"/>
|
<i class="el-icon-bottom" style="cursor:pointer;" @click="moveBottom(index)"/>
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
:default-expanded-keys="expandedArray"
|
:default-expanded-keys="expandedArray"
|
||||||
:data="tData"
|
:data="tData"
|
||||||
node-key="id"
|
node-key="id"
|
||||||
default-expand-all
|
|
||||||
:expand-on-click-node="true"
|
:expand-on-click-node="true"
|
||||||
:filter-node-method="filterNode"
|
:filter-node-method="filterNode"
|
||||||
@node-click="nodeClick"
|
@node-click="nodeClick"
|
||||||
|
@ -58,14 +58,14 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-dialog v-dialogDrag :title="api_table_title" :visible="edit_api_item" :before-close="closeEditItem" width="70%" 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" :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>
|
||||||
|
|
||||||
<el-form-item :label="$t('commons.name')" prop="name">
|
<el-form-item :label="$t('commons.name')" prop="name">
|
||||||
@ -91,12 +91,12 @@
|
|||||||
<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="数据预览" 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" :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">
|
<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">
|
||||||
@ -109,64 +109,65 @@
|
|||||||
</ux-table-column>
|
</ux-table-column>
|
||||||
</ux-grid>
|
</ux-grid>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="字段管理" name="second">
|
<!-- 暂时屏蔽掉字段管理-->
|
||||||
<el-table :data="apiItem.fields" size="mini">
|
<!-- <el-tab-pane label="字段管理" name="second">-->
|
||||||
<el-table-column property="name" :label="$t('dataset.field_name')" width="180">
|
<!-- <el-table :data="apiItem.fields" size="mini">-->
|
||||||
<template slot-scope="scope">
|
<!-- <el-table-column property="name" :label="$t('dataset.field_name')" width="180">-->
|
||||||
<el-input v-model="scope.row.name" size="mini"/>
|
<!-- <template slot-scope="scope">-->
|
||||||
</template>
|
<!-- <el-input v-model="scope.row.name" size="mini"/>-->
|
||||||
</el-table-column>
|
<!-- </template>-->
|
||||||
|
<!-- </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">
|
||||||
<el-button style="margin-top: 12px;" @click="next" v-show="active === 1">{{ $t('fu.steps.next') }}</el-button>
|
<el-button @click="next" v-show="active === 1">{{ $t('fu.steps.next') }}</el-button>
|
||||||
<el-button style="margin-top: 12px;" @click="before" v-show="active === 2">{{ $t('fu.steps.prev') }}</el-button>
|
<el-button @click="before" v-show="active === 2">{{ $t('fu.steps.prev') }}</el-button>
|
||||||
<el-button style="margin-top: 12px;" @click="saveItem" v-show="active === 2">{{ $t('commons.save') }}</el-button>
|
<el-button @click="saveItem" v-show="active === 2">{{ $t('commons.save') }}</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -314,8 +315,8 @@ export default {
|
|||||||
apiConfiguration: []
|
apiConfiguration: []
|
||||||
},
|
},
|
||||||
rule: {
|
rule: {
|
||||||
name: [{required: true, message: i18n.t('datasource.input_name'), trigger: 'blur'},
|
name: [{required: true, message: i18n.t('datasource.input_name'), trigger: 'change'},
|
||||||
{min: 2, max: 25, message: i18n.t('datasource.input_limit_2_25', [2, 25]), trigger: 'blur'}],
|
{min: 2, max: 25, message: i18n.t('datasource.input_limit_2_25', [2, 25]), trigger: 'change'}],
|
||||||
desc: [{min: 2, max: 50, message: i18n.t('datasource.input_limit_2_50'), trigger: 'blur'}],
|
desc: [{min: 2, max: 50, message: i18n.t('datasource.input_limit_2_50'), trigger: 'blur'}],
|
||||||
type: [{required: true, message: i18n.t('datasource.please_choose_type'), trigger: 'change'}],
|
type: [{required: true, message: i18n.t('datasource.please_choose_type'), trigger: 'change'}],
|
||||||
'configuration.dataBase': [{
|
'configuration.dataBase': [{
|
||||||
@ -415,8 +416,12 @@ export default {
|
|||||||
url: '',
|
url: '',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
request: {
|
request: {
|
||||||
headers: [],
|
headers: [{}],
|
||||||
body: {}
|
body: {
|
||||||
|
"type": "",
|
||||||
|
"raw": "",
|
||||||
|
"kvs": []
|
||||||
|
}
|
||||||
},
|
},
|
||||||
fields: []
|
fields: []
|
||||||
},
|
},
|
||||||
@ -427,7 +432,11 @@ export default {
|
|||||||
dataPath: '',
|
dataPath: '',
|
||||||
request: {
|
request: {
|
||||||
headers: [],
|
headers: [],
|
||||||
body: {},
|
body: {
|
||||||
|
"type": "",
|
||||||
|
"raw": "",
|
||||||
|
"kvs": []
|
||||||
|
},
|
||||||
authManager: {}
|
authManager: {}
|
||||||
},
|
},
|
||||||
fields: []
|
fields: []
|
||||||
@ -623,7 +632,11 @@ 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))
|
||||||
data.configuration = JSON.stringify(data.configuration)
|
if(data.type === 'api') {
|
||||||
|
data.configuration = JSON.stringify(data.apiConfiguration)
|
||||||
|
}else {
|
||||||
|
data.configuration = JSON.stringify(data.configuration)
|
||||||
|
}
|
||||||
if (data.showModel === 'show' && !this.canEdit) {
|
if (data.showModel === 'show' && !this.canEdit) {
|
||||||
validateDsById(data.id).then(res => {
|
validateDsById(data.id).then(res => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
@ -675,13 +688,11 @@ export default {
|
|||||||
if(this.active === 1){
|
if(this.active === 1){
|
||||||
this.$refs.apiItem.validate(valid => {
|
this.$refs.apiItem.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
console.log(this.apiItem)
|
|
||||||
const data = JSON.parse(JSON.stringify(this.apiItem))
|
const data = JSON.parse(JSON.stringify(this.apiItem))
|
||||||
data.request = JSON.stringify(data.request)
|
data.request = JSON.stringify(data.request)
|
||||||
this.loading = true
|
this.loading = true
|
||||||
checkApiDatasource(data).then(res => {
|
checkApiDatasource(data).then(res => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
console.log(res)
|
|
||||||
this.$success(i18n.t('commons.success'))
|
this.$success(i18n.t('commons.success'))
|
||||||
this.active++
|
this.active++
|
||||||
this.apiItem.fields = res.data.fields
|
this.apiItem.fields = res.data.fields
|
||||||
@ -753,7 +764,6 @@ export default {
|
|||||||
this.loading = true
|
this.loading = true
|
||||||
checkApiDatasource(data).then(res => {
|
checkApiDatasource(data).then(res => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
console.log(res)
|
|
||||||
this.$success(i18n.t('commons.success'))
|
this.$success(i18n.t('commons.success'))
|
||||||
this.apiItem.fields = res.data.fields
|
this.apiItem.fields = res.data.fields
|
||||||
this.$refs.plxTable.reloadData(res.data.datas)
|
this.$refs.plxTable.reloadData(res.data.datas)
|
||||||
@ -767,43 +777,45 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleClick(tab, event) {
|
handleClick(tab, event) {
|
||||||
console.log(tab, event);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style scoped>
|
||||||
|
.el-input {
|
||||||
.back-button {
|
width: 300px;
|
||||||
cursor: pointer;
|
|
||||||
margin-right: 10px;
|
|
||||||
font-weight: 600;
|
|
||||||
|
|
||||||
&:active {
|
|
||||||
transform: scale(0.85);
|
|
||||||
}
|
}
|
||||||
}
|
.el-select {
|
||||||
.el-input {
|
width: 300px;
|
||||||
width: 300px;
|
}
|
||||||
}
|
.ms-http-input {
|
||||||
.el-select {
|
width: 500px;
|
||||||
width: 300px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
.ms-http-input {
|
.tip {
|
||||||
width: 500px;
|
padding: 3px 5px;
|
||||||
margin-top: 5px;
|
font-size: 16px;
|
||||||
}
|
border-radius: 0;
|
||||||
.tip {
|
border-left: 4px solid #409EFF;
|
||||||
padding: 3px 5px;
|
margin: 5px 5px 10px 5px;
|
||||||
font-size: 16px;
|
}
|
||||||
border-radius: 0;
|
.el-select>>>input{
|
||||||
border-left: 4px solid #783887;
|
padding-right: 10px;
|
||||||
margin: 5px 5px 10px 5px;
|
}
|
||||||
}
|
.el-select>>>.el-input__suffix{
|
||||||
.el-select>>>input{
|
right: 0;
|
||||||
padding-right: 10px;
|
}
|
||||||
}
|
|
||||||
.el-select>>>.el-input__suffix{
|
.dialog-css>>>.el-dialog__header {
|
||||||
right: 0;
|
padding: 10px 20px 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dialog-css>>>.el-dialog__body {
|
||||||
|
padding: 10px 20px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-footer>>> .el-dialog__footer {
|
||||||
|
padding: 10px 10px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user