Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
73bf2294
提交
73bf2294
authored
2月 23, 2021
作者:
junjie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(数据集): 添加DB,DB curd
上级
318ff159
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
18 个修改的文件
包含
771 行增加
和
28 行删除
+771
-28
DatasetTable.java
...d/src/main/java/io/dataease/base/domain/DatasetTable.java
+24
-0
DatasetTableExample.java
...ain/java/io/dataease/base/domain/DatasetTableExample.java
+0
-0
DatasetTableMapper.java
...main/java/io/dataease/base/mapper/DatasetTableMapper.java
+31
-0
DatasetTableMapper.xml
.../main/java/io/dataease/base/mapper/DatasetTableMapper.xml
+244
-0
DataSetTableController.java
...o/dataease/controller/dataset/DataSetTableController.java
+45
-0
DataSetTableRequest.java
...aease/controller/request/dataset/DataSetTableRequest.java
+18
-0
DataSetTableDTO.java
...rc/main/java/io/dataease/dto/dataset/DataSetTableDTO.java
+17
-0
DataSetTableService.java
...java/io/dataease/service/dataset/DataSetTableService.java
+57
-0
V9__dataset_tables.sql
...nd/src/main/resources/db/migration/V9__dataset_tables.sql
+11
-0
AddDB.vue
frontend/src/business/components/dataset/data/AddDB.vue
+17
-3
TabDataPreview.vue
...d/src/business/components/dataset/data/TabDataPreview.vue
+64
-0
ViewTable.vue
frontend/src/business/components/dataset/data/ViewTable.vue
+94
-0
Group.vue
frontend/src/business/components/dataset/group/Group.vue
+121
-19
router.js
frontend/src/business/components/dataset/router.js
+6
-0
store.js
frontend/src/business/store.js
+5
-1
en-US.js
frontend/src/i18n/en-US.js
+5
-1
zh-CN.js
frontend/src/i18n/zh-CN.js
+7
-3
zh-TW.js
frontend/src/i18n/zh-TW.js
+5
-1
没有找到文件。
backend/src/main/java/io/dataease/base/domain/DatasetTable.java
0 → 100644
浏览文件 @
73bf2294
package
io
.
dataease
.
base
.
domain
;
import
java.io.Serializable
;
import
lombok.Data
;
@Data
public
class
DatasetTable
implements
Serializable
{
private
String
id
;
private
String
name
;
private
String
sceneId
;
private
String
dataSourceId
;
private
String
type
;
private
String
createBy
;
private
Long
createTime
;
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
backend/src/main/java/io/dataease/base/domain/DatasetTableExample.java
0 → 100644
浏览文件 @
73bf2294
差异被折叠。
点击展开。
backend/src/main/java/io/dataease/base/mapper/DatasetTableMapper.java
0 → 100644
浏览文件 @
73bf2294
package
io
.
dataease
.
base
.
mapper
;
import
io.dataease.base.domain.DatasetTable
;
import
io.dataease.base.domain.DatasetTableExample
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Param
;
public
interface
DatasetTableMapper
{
long
countByExample
(
DatasetTableExample
example
);
int
deleteByExample
(
DatasetTableExample
example
);
int
deleteByPrimaryKey
(
String
id
);
int
insert
(
DatasetTable
record
);
int
insertSelective
(
DatasetTable
record
);
List
<
DatasetTable
>
selectByExample
(
DatasetTableExample
example
);
DatasetTable
selectByPrimaryKey
(
String
id
);
int
updateByExampleSelective
(
@Param
(
"record"
)
DatasetTable
record
,
@Param
(
"example"
)
DatasetTableExample
example
);
int
updateByExample
(
@Param
(
"record"
)
DatasetTable
record
,
@Param
(
"example"
)
DatasetTableExample
example
);
int
updateByPrimaryKeySelective
(
DatasetTable
record
);
int
updateByPrimaryKey
(
DatasetTable
record
);
}
\ No newline at end of file
backend/src/main/java/io/dataease/base/mapper/DatasetTableMapper.xml
0 → 100644
浏览文件 @
73bf2294
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"io.dataease.base.mapper.DatasetTableMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"io.dataease.base.domain.DatasetTable"
>
<id
column=
"id"
jdbcType=
"VARCHAR"
property=
"id"
/>
<result
column=
"name"
jdbcType=
"VARCHAR"
property=
"name"
/>
<result
column=
"scene_id"
jdbcType=
"VARCHAR"
property=
"sceneId"
/>
<result
column=
"data_source_id"
jdbcType=
"VARCHAR"
property=
"dataSourceId"
/>
<result
column=
"type"
jdbcType=
"VARCHAR"
property=
"type"
/>
<result
column=
"create_by"
jdbcType=
"VARCHAR"
property=
"createBy"
/>
<result
column=
"create_time"
jdbcType=
"BIGINT"
property=
"createTime"
/>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
<where>
<foreach
collection=
"oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
prefixOverrides=
"and"
suffix=
")"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
close=
")"
collection=
"criterion.value"
item=
"listItem"
open=
"("
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Update_By_Example_Where_Clause"
>
<where>
<foreach
collection=
"example.oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
prefixOverrides=
"and"
suffix=
")"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
close=
")"
collection=
"criterion.value"
item=
"listItem"
open=
"("
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Base_Column_List"
>
id, `name`, scene_id, data_source_id, `type`, create_by, create_time
</sql>
<select
id=
"selectByExample"
parameterType=
"io.dataease.base.domain.DatasetTableExample"
resultMap=
"BaseResultMap"
>
select
<if
test=
"distinct"
>
distinct
</if>
<include
refid=
"Base_Column_List"
/>
from dataset_table
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
<if
test=
"orderByClause != null"
>
order by ${orderByClause}
</if>
</select>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.String"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from dataset_table
where id = #{id,jdbcType=VARCHAR}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.String"
>
delete from dataset_table
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete
id=
"deleteByExample"
parameterType=
"io.dataease.base.domain.DatasetTableExample"
>
delete from dataset_table
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</delete>
<insert
id=
"insert"
parameterType=
"io.dataease.base.domain.DatasetTable"
>
insert into dataset_table (id, `name`, scene_id,
data_source_id, `type`, create_by,
create_time)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{sceneId,jdbcType=VARCHAR},
#{dataSourceId,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT})
</insert>
<insert
id=
"insertSelective"
parameterType=
"io.dataease.base.domain.DatasetTable"
>
insert into dataset_table
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"name != null"
>
`name`,
</if>
<if
test=
"sceneId != null"
>
scene_id,
</if>
<if
test=
"dataSourceId != null"
>
data_source_id,
</if>
<if
test=
"type != null"
>
`type`,
</if>
<if
test=
"createBy != null"
>
create_by,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=VARCHAR},
</if>
<if
test=
"name != null"
>
#{name,jdbcType=VARCHAR},
</if>
<if
test=
"sceneId != null"
>
#{sceneId,jdbcType=VARCHAR},
</if>
<if
test=
"dataSourceId != null"
>
#{dataSourceId,jdbcType=VARCHAR},
</if>
<if
test=
"type != null"
>
#{type,jdbcType=VARCHAR},
</if>
<if
test=
"createBy != null"
>
#{createBy,jdbcType=VARCHAR},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select
id=
"countByExample"
parameterType=
"io.dataease.base.domain.DatasetTableExample"
resultType=
"java.lang.Long"
>
select count(*) from dataset_table
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</select>
<update
id=
"updateByExampleSelective"
parameterType=
"map"
>
update dataset_table
<set>
<if
test=
"record.id != null"
>
id = #{record.id,jdbcType=VARCHAR},
</if>
<if
test=
"record.name != null"
>
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if
test=
"record.sceneId != null"
>
scene_id = #{record.sceneId,jdbcType=VARCHAR},
</if>
<if
test=
"record.dataSourceId != null"
>
data_source_id = #{record.dataSourceId,jdbcType=VARCHAR},
</if>
<if
test=
"record.type != null"
>
`type` = #{record.type,jdbcType=VARCHAR},
</if>
<if
test=
"record.createBy != null"
>
create_by = #{record.createBy,jdbcType=VARCHAR},
</if>
<if
test=
"record.createTime != null"
>
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
</set>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByExample"
parameterType=
"map"
>
update dataset_table
set id = #{record.id,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
scene_id = #{record.sceneId,jdbcType=VARCHAR},
data_source_id = #{record.dataSourceId,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
create_by = #{record.createBy,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"io.dataease.base.domain.DatasetTable"
>
update dataset_table
<set>
<if
test=
"name != null"
>
`name` = #{name,jdbcType=VARCHAR},
</if>
<if
test=
"sceneId != null"
>
scene_id = #{sceneId,jdbcType=VARCHAR},
</if>
<if
test=
"dataSourceId != null"
>
data_source_id = #{dataSourceId,jdbcType=VARCHAR},
</if>
<if
test=
"type != null"
>
`type` = #{type,jdbcType=VARCHAR},
</if>
<if
test=
"createBy != null"
>
create_by = #{createBy,jdbcType=VARCHAR},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"io.dataease.base.domain.DatasetTable"
>
update dataset_table
set `name` = #{name,jdbcType=VARCHAR},
scene_id = #{sceneId,jdbcType=VARCHAR},
data_source_id = #{dataSourceId,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
backend/src/main/java/io/dataease/controller/dataset/DataSetTableController.java
0 → 100644
浏览文件 @
73bf2294
package
io
.
dataease
.
controller
.
dataset
;
import
io.dataease.base.domain.DatasetTable
;
import
io.dataease.controller.request.dataset.DataSetTableRequest
;
import
io.dataease.service.dataset.DataSetTableService
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* @Author gin
* @Date 2021/2/20 8:29 下午
*/
@RestController
@RequestMapping
(
"dataset/table"
)
public
class
DataSetTableController
{
@Resource
private
DataSetTableService
dataSetTableService
;
@PostMapping
(
"batchAdd"
)
public
void
batchAdd
(
@RequestBody
List
<
DatasetTable
>
datasetTable
)
{
dataSetTableService
.
batchInsert
(
datasetTable
);
}
@PostMapping
(
"update"
)
public
DatasetTable
save
(
@RequestBody
DatasetTable
datasetTable
)
{
return
dataSetTableService
.
save
(
datasetTable
);
}
@PostMapping
(
"delete/{id}"
)
public
void
delete
(
@PathVariable
String
id
)
{
dataSetTableService
.
delete
(
id
);
}
@PostMapping
(
"list"
)
public
List
<
DatasetTable
>
list
(
@RequestBody
DataSetTableRequest
dataSetTableRequest
)
{
return
dataSetTableService
.
list
(
dataSetTableRequest
);
}
@PostMapping
(
"get/{id}"
)
public
DatasetTable
get
(
@PathVariable
String
id
)
{
return
dataSetTableService
.
get
(
id
);
}
}
backend/src/main/java/io/dataease/controller/request/dataset/DataSetTableRequest.java
0 → 100644
浏览文件 @
73bf2294
package
io
.
dataease
.
controller
.
request
.
dataset
;
import
io.dataease.base.domain.DatasetTable
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.util.List
;
/**
* @Author gin
* @Date 2021/2/23 3:06 下午
*/
@Setter
@Getter
public
class
DataSetTableRequest
extends
DatasetTable
{
private
String
sort
;
private
List
<
String
>
tableNames
;
}
backend/src/main/java/io/dataease/dto/dataset/DataSetTableDTO.java
0 → 100644
浏览文件 @
73bf2294
package
io
.
dataease
.
dto
.
dataset
;
import
io.dataease.base.domain.DatasetTable
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.util.List
;
/**
* @Author gin
* @Date 2021/2/23 2:55 下午
*/
@Setter
@Getter
public
class
DataSetTableDTO
extends
DatasetTable
{
private
List
<
DataSetTableDTO
>
children
;
}
backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java
0 → 100644
浏览文件 @
73bf2294
package
io
.
dataease
.
service
.
dataset
;
import
com.alibaba.nacos.common.util.UuidUtils
;
import
io.dataease.base.domain.DatasetTable
;
import
io.dataease.base.domain.DatasetTableExample
;
import
io.dataease.base.mapper.DatasetTableMapper
;
import
io.dataease.commons.utils.BeanUtils
;
import
io.dataease.controller.request.dataset.DataSetTableRequest
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* @Author gin
* @Date 2021/2/23 2:54 下午
*/
@Service
public
class
DataSetTableService
{
@Resource
private
DatasetTableMapper
datasetTableMapper
;
public
void
batchInsert
(
List
<
DatasetTable
>
datasetTable
)
{
for
(
DatasetTable
table
:
datasetTable
)
{
save
(
table
);
}
}
public
DatasetTable
save
(
DatasetTable
datasetTable
)
{
if
(
StringUtils
.
isEmpty
(
datasetTable
.
getId
()))
{
datasetTable
.
setId
(
UuidUtils
.
generateUuid
());
datasetTable
.
setCreateTime
(
System
.
currentTimeMillis
());
datasetTableMapper
.
insert
(
datasetTable
);
}
else
{
datasetTableMapper
.
updateByPrimaryKey
(
datasetTable
);
}
return
datasetTable
;
}
public
void
delete
(
String
id
)
{
datasetTableMapper
.
deleteByPrimaryKey
(
id
);
}
public
List
<
DatasetTable
>
list
(
DataSetTableRequest
dataSetTableRequest
)
{
DatasetTableExample
datasetTableExample
=
new
DatasetTableExample
();
datasetTableExample
.
createCriteria
().
andSceneIdEqualTo
(
dataSetTableRequest
.
getSceneId
());
if
(
StringUtils
.
isNotEmpty
(
dataSetTableRequest
.
getSort
()))
{
datasetTableExample
.
setOrderByClause
(
dataSetTableRequest
.
getSort
());
}
return
datasetTableMapper
.
selectByExample
(
datasetTableExample
);
}
public
DatasetTable
get
(
String
id
)
{
return
datasetTableMapper
.
selectByPrimaryKey
(
id
);
}
}
backend/src/main/resources/db/migration/V9__dataset_tables.sql
0 → 100644
浏览文件 @
73bf2294
CREATE
TABLE
IF
NOT
EXISTS
`dataset_table`
(
`id`
varchar
(
50
)
NOT
NULL
COMMENT
'ID'
,
`name`
varchar
(
64
)
NOT
NULL
COMMENT
'表名称'
,
`scene_id`
varchar
(
50
)
NOT
NULL
COMMENT
'场景ID'
,
`data_source_id`
varchar
(
50
)
NOT
NULL
COMMENT
'数据源ID'
,
`type`
varchar
(
50
)
COMMENT
'db,sql,excel,custom'
,
`create_by`
varchar
(
50
)
COMMENT
'创建人ID'
,
`create_time`
bigint
(
13
)
COMMENT
'创建时间'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
;
frontend/src/business/components/dataset/data/AddDB.vue
浏览文件 @
73bf2294
...
...
@@ -81,9 +81,23 @@ export default {
},
save
()
{
console
.
log
(
this
.
checkTableList
);
console
.
log
(
this
.
scene
);
this
.
$store
.
commit
(
'setSceneData'
,
new
Date
().
getTime
());
// console.log(this.checkTableList);
// console.log(this.scene);
let
sceneId
=
this
.
scene
.
id
;
let
dataSourceId
=
this
.
dataSource
;
let
tables
=
[];
this
.
checkTableList
.
forEach
(
function
(
name
)
{
tables
.
push
({
name
:
name
,
sceneId
:
sceneId
,
dataSourceId
:
dataSourceId
,
type
:
'db'
})
});
this
.
$post
(
'/dataset/table/batchAdd'
,
tables
,
response
=>
{
this
.
$store
.
commit
(
'setSceneData'
,
new
Date
().
getTime
());
this
.
cancel
();
});
},
cancel
()
{
...
...
frontend/src/business/components/dataset/data/TabDataPreview.vue
0 → 100644
浏览文件 @
73bf2294
<
template
>
<el-col>
<el-table
size=
"mini"
:data=
"tableData"
border
style=
"width: 100%"
>
<el-table-column
prop=
"date"
label=
"日期"
width=
"180"
>
</el-table-column>
<el-table-column
prop=
"name"
label=
"姓名"
width=
"180"
>
</el-table-column>
<el-table-column
prop=
"address"
label=
"地址"
>
</el-table-column>
</el-table>
</el-col>
</
template
>
<
script
>
export
default
{
name
:
"TabDataPreview"
,
data
()
{
return
{
tableData
:
[{
date
:
'2016-05-02'
,
name
:
'王小虎'
,
address
:
'上海市普陀区金沙江路 1518 弄'
},
{
date
:
'2016-05-04'
,
name
:
'王小虎'
,
address
:
'上海市普陀区金沙江路 1517 弄'
},
{
date
:
'2016-05-01'
,
name
:
'王小虎'
,
address
:
'上海市普陀区金沙江路 1519 弄'
},
{
date
:
'2016-05-03'
,
name
:
'王小虎'
,
address
:
'上海市普陀区金沙江路 1516 弄'
}]
}
},
computed
:
{},
created
()
{
},
mounted
()
{
},
activated
()
{
},
methods
:
{},
watch
:
{}
}
</
script
>
<
style
scoped
>
</
style
>
frontend/src/business/components/dataset/data/ViewTable.vue
0 → 100644
浏览文件 @
73bf2294
<
template
>
<el-col>
<el-row>
<el-row
style=
"height: 26px;"
>
<span
v-show=
"false"
>
{{
tableId
}}
</span>
<span
style=
"line-height: 26px;"
>
{{
table
.
name
}}
</span>
<el-row
style=
"float: right"
>
<el-button
size=
"mini"
>
{{
$t
(
'dataset.edit'
)
}}
</el-button>
<el-button
size=
"mini"
>
{{
$t
(
'dataset.create_view'
)
}}
</el-button>
</el-row>
</el-row>
<el-divider/>
<el-tabs
v-model=
"tabActive"
>
<el-tab-pane
:label=
"$t('dataset.data_preview')"
name=
"dataPreview"
>
<tab-data-preview/>
</el-tab-pane>
<el-tab-pane
label=
"tab2"
name=
"tab2"
>
tab2
</el-tab-pane>
<el-tab-pane
label=
"tab3"
name=
"tab3"
>
tab3
</el-tab-pane>
<el-tab-pane
label=
"tab4"
name=
"tab4"
>
tab4
</el-tab-pane>
</el-tabs>
</el-row>
</el-col>
</
template
>
<
script
>
import
TabDataPreview
from
"./TabDataPreview"
;
export
default
{
name
:
"ViewTable"
,
components
:
{
TabDataPreview
},
data
()
{
return
{
table
:
{
name
:
''
},
tabActive
:
'dataPreview'
}
},
computed
:
{
tableId
()
{
this
.
initTable
(
this
.
$store
.
state
.
dataset
.
table
);
return
this
.
$store
.
state
.
dataset
.
table
;
}
},
created
()
{
this
.
resetTable
();
},
mounted
()
{
this
.
resetTable
();
},
activated
()
{
this
.
resetTable
();
},
methods
:
{
initTable
(
id
)
{
if
(
id
!==
null
)
{
this
.
$post
(
'/dataset/table/get/'
+
id
,
null
,
response
=>
{
this
.
table
=
response
.
data
;
})
}
},
resetTable
()
{
this
.
table
=
{
name
:
''
}
}
},
watch
:
{}
}
</
script
>
<
style
scoped
>
.el-divider--horizontal
{
margin
:
12px
0
;
}
.form-item
{
margin-bottom
:
6px
;
}
</
style
>
frontend/src/business/components/dataset/group/Group.vue
浏览文件 @
73bf2294
...
...
@@ -164,20 +164,15 @@
</el-form>
</el-row>
<span
v-show=
"false"
>
{{
sceneData
}}
</span>
<!-- todo el-tree -->
<el-tree
:data=
"
null
"
:data=
"
tableData
"
node-key=
"id"
:expand-on-click-node=
"true"
@
node-click=
"sceneClick"
>
<span
class=
"custom-tree-node"
slot-scope=
"
{ node, data }">
<span>
<span
v-if=
"data.type === 'scene'"
>
<el-button
icon=
"el-icon-folder"
type=
"text"
size=
"mini"
>
</el-button>
<span>
(
{{
data
.
type
}}
)
</span>
<span
style=
"margin-left: 6px"
>
{{
data
.
name
}}
</span>
</span>
...
...
@@ -192,13 +187,13 @@
</el-button>
</span>
<el-dropdown-menu
slot=
"dropdown"
>
<el-dropdown-item
icon=
"el-icon-edit-outline"
:command=
"beforeClickMore('rename',data,node)"
>
<el-dropdown-item
icon=
"el-icon-edit-outline"
:command=
"beforeClickMore('rename
Table
',data,node)"
>
{{
$t
(
'dataset.rename'
)
}}
</el-dropdown-item>
<!--
<el-dropdown-item
icon=
"el-icon-right"
:command=
"beforeClickMore('move',data,node)"
>
-->
<!--
{{
$t
(
'dataset.move_to'
)
}}
-->
<!--
</el-dropdown-item>
-->
<el-dropdown-item
icon=
"el-icon-delete"
:command=
"beforeClickMore('delete',data,node)"
>
<el-dropdown-item
icon=
"el-icon-delete"
:command=
"beforeClickMore('delete
Table
',data,node)"
>
{{
$t
(
'dataset.delete'
)
}}
</el-dropdown-item>
</el-dropdown-menu>
...
...
@@ -207,6 +202,19 @@
</span>
</span>
</el-tree>
<el-dialog
:title=
"$t('dataset.table')"
:visible=
"editTable"
:show-close=
"false"
width=
"30%"
>
<el-form
:model=
"tableForm"
:rules=
"tableFormRules"
ref=
"tableForm"
>
<el-form-item
:label=
"$t('commons.name')"
prop=
"name"
>
<el-input
v-model=
"tableForm.name"
></el-input>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"closeTable()"
size=
"mini"
>
{{
$t
(
'dataset.cancel'
)
}}
</el-button>
<el-button
type=
"primary"
@
click=
"saveTable(tableForm)"
size=
"mini"
>
{{
$t
(
'dataset.confirm'
)
}}
</el-button>
</div>
</el-dialog>
</el-col>
</el-col>
</
template
>
...
...
@@ -220,7 +228,9 @@ export default {
dialogTitle
:
''
,
search
:
''
,
editGroup
:
false
,
data
:
null
,
editTable
:
false
,
data
:
[],
tableData
:
[],
currGroup
:
null
,
expandedArray
:
[],
groupForm
:
{
...
...
@@ -231,25 +241,37 @@ export default {
children
:
[],
sort
:
'type desc,name asc'
},
tableForm
:
{
name
:
''
,
sort
:
'type asc,create_time desc,name asc'
},
groupFormRules
:
{
name
:
[
{
required
:
true
,
message
:
this
.
$t
(
'commons.input_content'
),
trigger
:
'blur'
},
],
},
tableFormRules
:
{
name
:
[
{
required
:
true
,
message
:
this
.
$t
(
'commons.input_content'
),
trigger
:
'blur'
},
],
}
}
},
computed
:
{
sceneData
:
function
()
{
console
.
log
(
this
.
$store
.
state
.
dataset
.
sceneData
+
' do post'
);
this
.
tableTree
();
return
this
.
$store
.
state
.
dataset
.
sceneData
;
}
},
mounted
()
{
this
.
tree
(
this
.
groupForm
);
this
.
tableTree
();
this
.
$router
.
push
(
'/dataset'
);
},
activated
()
{
this
.
tree
(
this
.
groupForm
);
this
.
tableTree
();
this
.
$router
.
push
(
'/dataset'
);
},
watch
:
{
...
...
@@ -275,11 +297,11 @@ export default {
},
clickMore
(
param
)
{
//
console.log(param);
console
.
log
(
param
);
switch
(
param
.
type
)
{
case
'rename'
:
this
.
add
(
param
.
data
.
type
);
this
.
groupForm
=
param
.
data
;
this
.
groupForm
=
JSON
.
parse
(
JSON
.
stringify
(
param
.
data
))
;
break
;
case
'move'
:
...
...
@@ -287,6 +309,13 @@ export default {
case
'delete'
:
this
.
delete
(
param
.
data
);
break
;
case
'renameTable'
:
this
.
editTable
=
true
;
this
.
tableForm
=
JSON
.
parse
(
JSON
.
stringify
(
param
.
data
));
break
;
case
'deleteTable'
:
this
.
deleteTable
(
param
.
data
);
break
;
}
},
...
...
@@ -335,6 +364,32 @@ export default {
});
},
saveTable
(
table
)
{
console
.
log
(
table
);
this
.
$refs
[
'tableForm'
].
validate
((
valid
)
=>
{
if
(
valid
)
{
this
.
$post
(
"/dataset/table/update"
,
table
,
response
=>
{
this
.
closeTable
();
this
.
$message
({
message
:
this
.
$t
(
'commons.save_success'
),
type
:
'success'
,
showClose
:
true
,
});
this
.
tableTree
();
this
.
$router
.
push
(
'/dataset/home'
);
this
.
$store
.
commit
(
'setTable'
,
null
);
})
}
else
{
this
.
$message
({
message
:
this
.
$t
(
'commons.input_content'
),
type
:
'error'
,
showClose
:
true
,
});
return
false
;
}
});
},
delete
(
data
)
{
this
.
$confirm
(
this
.
$t
(
'dataset.confirm_delete'
),
this
.
$t
(
'dataset.tips'
),
{
confirmButtonText
:
this
.
$t
(
'dataset.confirm'
),
...
...
@@ -353,6 +408,26 @@ export default {
});
},
deleteTable
(
data
)
{
this
.
$confirm
(
this
.
$t
(
'dataset.confirm_delete'
),
this
.
$t
(
'dataset.tips'
),
{
confirmButtonText
:
this
.
$t
(
'dataset.confirm'
),
cancelButtonText
:
this
.
$t
(
'dataset.cancel'
),
type
:
'warning'
}).
then
(()
=>
{
this
.
$post
(
"/dataset/table/delete/"
+
data
.
id
,
null
,
response
=>
{
this
.
$message
({
type
:
'success'
,
message
:
this
.
$t
(
'dataset.delete_success'
),
showClose
:
true
,
});
this
.
tableTree
();
this
.
$router
.
push
(
'/dataset/home'
);
this
.
$store
.
commit
(
'setTable'
,
null
);
});
}).
catch
(()
=>
{
});
},
close
()
{
this
.
editGroup
=
false
;
this
.
groupForm
=
{
...
...
@@ -365,12 +440,31 @@ export default {
}
},
closeTable
()
{
this
.
editTable
=
false
;
this
.
tableForm
=
{
name
:
''
,
}
},
tree
(
group
)
{
this
.
$post
(
"/dataset/group/tree"
,
group
,
response
=>
{
this
.
data
=
response
.
data
;
})
},
tableTree
()
{
this
.
tableData
=
[];
if
(
this
.
currGroup
)
{
this
.
$post
(
'/dataset/table/list'
,
{
sort
:
'type asc,create_time desc,name asc'
,
sceneId
:
this
.
currGroup
.
id
},
response
=>
{
this
.
tableData
=
response
.
data
;
});
}
},
nodeClick
(
data
,
node
)
{
// console.log(data);
// console.log(node);
...
...
@@ -418,10 +512,6 @@ export default {
}
},
sceneClick
()
{
},
addDB
()
{
this
.
$router
.
push
({
name
:
'add_db'
,
...
...
@@ -429,8 +519,20 @@ export default {
scene
:
this
.
currGroup
}
})
}
}
},
sceneClick
(
data
,
node
)
{
// console.log(data);
this
.
$store
.
commit
(
'setTable'
,
data
.
id
);
this
.
$router
.
push
({
name
:
'table'
,
params
:
{
table
:
data
}
});
},
},
}
</
script
>
...
...
frontend/src/business/components/dataset/router.js
浏览文件 @
73bf2294
const
DataSet
=
()
=>
import
(
'@/business/components/dataset/DataSet'
);
const
DataSetHome
=
()
=>
import
(
'@/business/components/dataset/data/DataHome'
);
const
DataSetAddDB
=
()
=>
import
(
'@/business/components/dataset/data/AddDB'
);
const
DataSetTable
=
()
=>
import
(
'@/business/components/dataset/data/ViewTable'
);
// const PerformanceTestHome = () => import('@/business/components/performance/home/PerformanceTestHome')
// const EditPerformanceTest = () => import('@/business/components/performance/test/EditPerformanceTest')
// const PerformanceTestList = () => import('@/business/components/performance/test/PerformanceTestList')
...
...
@@ -26,6 +27,11 @@ export default {
name
:
'add_db'
,
component
:
DataSetAddDB
,
},
{
path
:
'table'
,
name
:
'table'
,
component
:
DataSetTable
,
},
// {
// path: 'test/create',
// name: "createPerTest",
...
...
frontend/src/business/store.js
浏览文件 @
73bf2294
...
...
@@ -5,11 +5,15 @@ Vue.use(Vuex);
const
Dataset
=
{
state
:
{
sceneData
:
""
sceneData
:
""
,
table
:
""
},
mutations
:
{
setSceneData
(
state
,
sceneData
)
{
state
.
sceneData
=
sceneData
;
},
setTable
(
state
,
table
)
{
state
.
table
=
table
;
}
}
}
...
...
frontend/src/i18n/en-US.js
浏览文件 @
73bf2294
...
...
@@ -1545,6 +1545,10 @@ export default {
custom_data
:
'Custom Data'
,
pls_slc_tbl_left
:
'Please select table from left'
,
add_db_table
:
'Add Table'
,
pls_slc_data_source
:
'Select Data Source'
pls_slc_data_source
:
'Select Data Source'
,
table
:
'Table'
,
edit
:
'Edit'
,
create_view
:
'Create View'
,
data_preview
:
'Data Preview'
}
};
frontend/src/i18n/zh-CN.js
浏览文件 @
73bf2294
...
...
@@ -1552,9 +1552,13 @@ export default {
sql_data
:
'SQL数据集'
,
excel_data
:
'Excel数据集'
,
custom_data
:
'自助数据集'
,
pls_slc_tbl_left
:
'请从左侧选择表'
,
add_db_table
:
'添加数据库表'
,
pls_slc_data_source
:
'请选择数据库连接'
pls_slc_tbl_left
:
'请从左侧选择表'
,
add_db_table
:
'添加数据库表'
,
pls_slc_data_source
:
'请选择数据库连接'
,
table
:
'表'
,
edit
:
'编辑'
,
create_view
:
'创建试图'
,
data_preview
:
'数据预览'
},
datasource
:
{
create
:
'新建数据连接'
,
...
...
frontend/src/i18n/zh-TW.js
浏览文件 @
73bf2294
...
...
@@ -1546,6 +1546,10 @@ export default {
custom_data
:
'自助數據集'
,
pls_slc_tbl_left
:
'請從左側選擇表'
,
add_db_table
:
'添加數據庫表'
,
pls_slc_data_source
:
'請選擇數據庫連接'
pls_slc_data_source
:
'請選擇數據庫連接'
,
table
:
'表'
,
edit
:
'編輯'
,
create_view
:
'創建試圖'
,
data_preview
:
'數據預覽'
}
};
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论