forked from github/dataease
feat:功能优化
This commit is contained in:
parent
708208d6d1
commit
9d3a5bc39e
@ -5,6 +5,7 @@ import io.dataease.base.domain.DatasetTableTaskExample;
|
||||
import io.dataease.base.mapper.DatasetTableTaskMapper;
|
||||
import io.dataease.service.ScheduleService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.quartz.CronExpression;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -24,6 +25,12 @@ public class DataSetTableTaskService {
|
||||
private ScheduleService scheduleService;
|
||||
|
||||
public DatasetTableTask save(DatasetTableTask datasetTableTask) throws Exception {
|
||||
// check
|
||||
if (StringUtils.isNotEmpty(datasetTableTask.getCron())) {
|
||||
if (!CronExpression.isValidExpression(datasetTableTask.getCron())) {
|
||||
throw new RuntimeException("cron expression error.");
|
||||
}
|
||||
}
|
||||
if (StringUtils.isEmpty(datasetTableTask.getId())) {
|
||||
datasetTableTask.setId(UUID.randomUUID().toString());
|
||||
datasetTableTask.setCreateTime(System.currentTimeMillis());
|
||||
|
@ -628,7 +628,8 @@ export default {
|
||||
save_success: '保存成功',
|
||||
close: '关闭',
|
||||
required: '必填',
|
||||
input_content: '请输入内容'
|
||||
input_content: '请输入内容',
|
||||
add_sql_table: '添加SQL'
|
||||
},
|
||||
datasource: {
|
||||
create: '新建数据连接',
|
||||
|
@ -30,7 +30,7 @@
|
||||
@end="end1"
|
||||
>
|
||||
<transition-group>
|
||||
<div v-for="item in dimension" :key="item.id" class="item" @click="click1(item)">{{ item.name }}</div>
|
||||
<span v-for="item in dimension" :key="item.id" class="item" @click="click1(item)">{{ item.name }}</span>
|
||||
</transition-group>
|
||||
</draggable>
|
||||
</div>
|
||||
@ -45,7 +45,7 @@
|
||||
@end="end2"
|
||||
>
|
||||
<transition-group>
|
||||
<div v-for="item in quota" :key="item.id" class="item" @click="click2(item)">{{ item.name }}</div>
|
||||
<span v-for="item in quota" :key="item.id" class="item" @click="click2(item)">{{ item.name }}</span>
|
||||
</transition-group>
|
||||
</draggable>
|
||||
</div>
|
||||
@ -111,7 +111,7 @@
|
||||
v-for="(item,index) in view.xaxis"
|
||||
:key="index"
|
||||
size="small"
|
||||
class="item"
|
||||
class="item-axis"
|
||||
closable
|
||||
@close="clear1(index)"
|
||||
>
|
||||
@ -135,7 +135,7 @@
|
||||
v-for="(item,index) in view.yaxis"
|
||||
:key="index"
|
||||
size="small"
|
||||
class="item"
|
||||
class="item-axis"
|
||||
closable
|
||||
@close="clear2(index)"
|
||||
>
|
||||
@ -354,7 +354,7 @@ export default {
|
||||
// 基于准备好的dom,初始化echarts实例
|
||||
var myChart = this.$echarts.init(document.getElementById('echart'))
|
||||
// 指定图表的配置项和数据
|
||||
myChart.setOption(option, true)
|
||||
setTimeout(myChart.setOption(option, true), 500)
|
||||
window.onresize = function() {
|
||||
myChart.resize()
|
||||
}
|
||||
@ -392,6 +392,7 @@ export default {
|
||||
border: solid 1px #eee;
|
||||
background-color: #f1f1f1;
|
||||
text-align: left;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.item + .item {
|
||||
@ -404,6 +405,19 @@ export default {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.item-axis {
|
||||
padding: 2px 12px;
|
||||
margin: 3px 3px 0 3px;
|
||||
border: solid 1px #eee;
|
||||
background-color: #f1f1f1;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.item-axis:hover {
|
||||
background-color: #fdfdfd;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.el-form-item {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
86
frontend/src/views/dataset/add/AddSQL.vue
Normal file
86
frontend/src/views/dataset/add/AddSQL.vue
Normal file
@ -0,0 +1,86 @@
|
||||
<template>
|
||||
<el-col>
|
||||
<el-row>
|
||||
<el-row style="height: 26px;">
|
||||
<span style="line-height: 26px;">
|
||||
{{ $t('dataset.add_sql_table') }}
|
||||
</span>
|
||||
<el-row style="float: right">
|
||||
<el-button size="mini" @click="cancel">
|
||||
{{ $t('dataset.cancel') }}
|
||||
</el-button>
|
||||
<el-button size="mini" type="primary">
|
||||
{{ $t('dataset.confirm') }}
|
||||
</el-button>
|
||||
</el-row>
|
||||
</el-row>
|
||||
<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">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
</el-row>
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { post, listDatasource } from '@/api/dataset/dataset'
|
||||
|
||||
export default {
|
||||
name: 'AddSQL',
|
||||
props: {
|
||||
param: Object
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dataSource: '',
|
||||
options: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initDataSource()
|
||||
},
|
||||
watch: {},
|
||||
methods: {
|
||||
initDataSource() {
|
||||
listDatasource().then(response => {
|
||||
this.options = response.data
|
||||
})
|
||||
},
|
||||
cancel() {
|
||||
// this.dataReset()
|
||||
this.$emit('switchComponent', { name: '' })
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.el-divider--horizontal {
|
||||
margin: 12px 0;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.el-checkbox {
|
||||
margin-bottom: 14px;
|
||||
margin-left: 0;
|
||||
margin-right: 14px;
|
||||
}
|
||||
|
||||
.el-checkbox.is-bordered + .el-checkbox.is-bordered {
|
||||
margin-left: 0;
|
||||
}
|
||||
</style>
|
@ -29,6 +29,17 @@
|
||||
:label="$t('dataset.status')"
|
||||
/>
|
||||
</el-table>
|
||||
<el-row style="margin-top: 10px;text-align: right;">
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="currentPage"
|
||||
:page-sizes="[100, 200, 300, 400]"
|
||||
:page-size="100"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="1000">
|
||||
</el-pagination>
|
||||
</el-row>
|
||||
</el-row>
|
||||
|
||||
<el-dialog
|
||||
@ -195,6 +206,7 @@ export default {
|
||||
return {
|
||||
update_setting: false,
|
||||
update_task: false,
|
||||
currentPage: 1,
|
||||
taskForm: {
|
||||
name: '',
|
||||
type: '0',
|
||||
@ -322,8 +334,16 @@ export default {
|
||||
onRateChange() {
|
||||
if (this.taskForm.rate === '0') {
|
||||
this.taskForm.end = '0'
|
||||
this.taskForm.endTime = ''
|
||||
this.taskForm.cron = ''
|
||||
}
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
console.log(`每页 ${val} 条`)
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
console.log(`当前页: ${val}`)
|
||||
},
|
||||
resetTaskForm() {
|
||||
this.taskForm = {
|
||||
name: '',
|
||||
|
@ -311,7 +311,7 @@ export default {
|
||||
},
|
||||
|
||||
clickMore(param) {
|
||||
console.log(param)
|
||||
// console.log(param)
|
||||
switch (param.type) {
|
||||
case 'rename':
|
||||
this.add(param.data.type)
|
||||
@ -515,10 +515,10 @@ export default {
|
||||
// console.log(param);
|
||||
switch (param.type) {
|
||||
case 'db':
|
||||
this.addDB()
|
||||
this.addData('AddDB')
|
||||
break
|
||||
case 'sql':
|
||||
this.$message(param.type)
|
||||
this.addData('AddSQL')
|
||||
break
|
||||
case 'excel':
|
||||
this.$message(param.type)
|
||||
@ -535,14 +535,8 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
addDB() {
|
||||
// this.$router.push({
|
||||
// name: 'add_db',
|
||||
// params: {
|
||||
// scene: this.currGroup
|
||||
// }
|
||||
// })
|
||||
this.$emit('switchComponent', { name: 'AddDB', param: this.currGroup })
|
||||
addData(name) {
|
||||
this.$emit('switchComponent', { name: name, param: this.currGroup })
|
||||
},
|
||||
|
||||
sceneClick(data, node) {
|
||||
|
@ -21,10 +21,11 @@ import Group from './group/Group'
|
||||
import DataHome from './data/DataHome'
|
||||
import ViewTable from './data/ViewTable'
|
||||
import AddDB from './add/AddDB'
|
||||
import AddSQL from './add/AddSQL'
|
||||
|
||||
export default {
|
||||
name: 'DataSet',
|
||||
components: { MsMainContainer, MsContainer, MsAsideContainer, Group, DataHome, ViewTable, AddDB },
|
||||
components: { MsMainContainer, MsContainer, MsAsideContainer, Group, DataHome, ViewTable, AddDB, AddSQL },
|
||||
data() {
|
||||
return {
|
||||
component: DataHome,
|
||||
@ -42,6 +43,9 @@ export default {
|
||||
case 'AddDB':
|
||||
this.component = AddDB
|
||||
break
|
||||
case 'AddSQL':
|
||||
this.component = AddSQL
|
||||
break
|
||||
default:
|
||||
this.component = DataHome
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user