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