forked from github/dataease
feat(數據集): 数据集任务,增加简单重复执行的功能
This commit is contained in:
parent
38487c5b58
commit
d1174fed5c
@ -31,5 +31,7 @@ public class DatasetTableTask implements Serializable {
|
||||
|
||||
private String lastExecStatus;
|
||||
|
||||
private String extraData;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -973,6 +973,76 @@ public class DatasetTableTaskExample {
|
||||
addCriterion("last_exec_status not between", value1, value2, "lastExecStatus");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExtraDataIsNull() {
|
||||
addCriterion("extra_data is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExtraDataIsNotNull() {
|
||||
addCriterion("extra_data is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExtraDataEqualTo(String value) {
|
||||
addCriterion("extra_data =", value, "extraData");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExtraDataNotEqualTo(String value) {
|
||||
addCriterion("extra_data <>", value, "extraData");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExtraDataGreaterThan(String value) {
|
||||
addCriterion("extra_data >", value, "extraData");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExtraDataGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("extra_data >=", value, "extraData");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExtraDataLessThan(String value) {
|
||||
addCriterion("extra_data <", value, "extraData");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExtraDataLessThanOrEqualTo(String value) {
|
||||
addCriterion("extra_data <=", value, "extraData");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExtraDataLike(String value) {
|
||||
addCriterion("extra_data like", value, "extraData");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExtraDataNotLike(String value) {
|
||||
addCriterion("extra_data not like", value, "extraData");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExtraDataIn(List<String> values) {
|
||||
addCriterion("extra_data in", values, "extraData");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExtraDataNotIn(List<String> values) {
|
||||
addCriterion("extra_data not in", values, "extraData");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExtraDataBetween(String value1, String value2) {
|
||||
addCriterion("extra_data between", value1, value2, "extraData");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExtraDataNotBetween(String value1, String value2) {
|
||||
addCriterion("extra_data not between", value1, value2, "extraData");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
@ -15,6 +15,7 @@
|
||||
<result column="last_exec_time" jdbcType="BIGINT" property="lastExecTime" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
<result column="last_exec_status" jdbcType="VARCHAR" property="lastExecStatus" />
|
||||
<result column="extra_data" jdbcType="VARCHAR" property="extraData" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
@ -76,7 +77,7 @@
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, table_id, `name`, `type`, start_time, rate, cron, `end`, end_time, create_time,
|
||||
last_exec_time, `status`, last_exec_status
|
||||
last_exec_time, `status`, last_exec_status, extra_data
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.dataease.base.domain.DatasetTableTaskExample" resultMap="BaseResultMap">
|
||||
select
|
||||
@ -113,12 +114,12 @@
|
||||
`type`, start_time, rate,
|
||||
cron, `end`, end_time,
|
||||
create_time, last_exec_time, `status`,
|
||||
last_exec_status)
|
||||
last_exec_status, extra_data)
|
||||
values (#{id,jdbcType=VARCHAR}, #{tableId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
||||
#{type,jdbcType=VARCHAR}, #{startTime,jdbcType=BIGINT}, #{rate,jdbcType=VARCHAR},
|
||||
#{cron,jdbcType=VARCHAR}, #{end,jdbcType=VARCHAR}, #{endTime,jdbcType=BIGINT},
|
||||
#{createTime,jdbcType=BIGINT}, #{lastExecTime,jdbcType=BIGINT}, #{status,jdbcType=VARCHAR},
|
||||
#{lastExecStatus,jdbcType=VARCHAR})
|
||||
#{lastExecStatus,jdbcType=VARCHAR}, #{extraData,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.dataease.base.domain.DatasetTableTask">
|
||||
insert into dataset_table_task
|
||||
@ -162,6 +163,9 @@
|
||||
<if test="lastExecStatus != null">
|
||||
last_exec_status,
|
||||
</if>
|
||||
<if test="extraData != null">
|
||||
extra_data,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
@ -203,6 +207,9 @@
|
||||
<if test="lastExecStatus != null">
|
||||
#{lastExecStatus,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="extraData != null">
|
||||
#{extraData,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.dataease.base.domain.DatasetTableTaskExample" resultType="java.lang.Long">
|
||||
@ -253,6 +260,9 @@
|
||||
<if test="record.lastExecStatus != null">
|
||||
last_exec_status = #{record.lastExecStatus,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.extraData != null">
|
||||
extra_data = #{record.extraData,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
@ -272,7 +282,8 @@
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
last_exec_time = #{record.lastExecTime,jdbcType=BIGINT},
|
||||
`status` = #{record.status,jdbcType=VARCHAR},
|
||||
last_exec_status = #{record.lastExecStatus,jdbcType=VARCHAR}
|
||||
last_exec_status = #{record.lastExecStatus,jdbcType=VARCHAR},
|
||||
extra_data = #{record.extraData,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
@ -316,6 +327,9 @@
|
||||
<if test="lastExecStatus != null">
|
||||
last_exec_status = #{lastExecStatus,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="extraData != null">
|
||||
extra_data = #{extraData,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
@ -332,7 +346,8 @@
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
last_exec_time = #{lastExecTime,jdbcType=BIGINT},
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
last_exec_status = #{lastExecStatus,jdbcType=VARCHAR}
|
||||
last_exec_status = #{lastExecStatus,jdbcType=VARCHAR},
|
||||
extra_data = #{extraData,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
@ -1,5 +1,5 @@
|
||||
package io.dataease.commons.constants;
|
||||
|
||||
public enum ScheduleType {
|
||||
CRON, SIMPLE
|
||||
CRON, SIMPLE, SIMPLE_CRON
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class AppStartListener implements ApplicationListener<ApplicationReadyEve
|
||||
List<DatasetTableTask> list = dataSetTableTaskService.list(new DatasetTableTask());
|
||||
for (DatasetTableTask task : list) {
|
||||
try {
|
||||
if (StringUtils.equalsIgnoreCase(task.getRate(), ScheduleType.CRON.toString())) {
|
||||
if (!StringUtils.equalsIgnoreCase(task.getRate(), ScheduleType.SIMPLE.toString())) {
|
||||
if (StringUtils.equalsIgnoreCase(task.getEnd(), "1")) {
|
||||
if (task.getEndTime() != null && task.getEndTime() > 0) {
|
||||
if (task.getEndTime() > System.currentTimeMillis()) {
|
||||
|
@ -28,7 +28,7 @@ public class ScheduleService {
|
||||
ExtractDataJob.class,
|
||||
new Date(datasetTableTask.getStartTime()),
|
||||
scheduleManager.getDefaultJobDataMap(datasetTableTask.getTableId(), datasetTableTask.getCron(), datasetTableTask.getId(), datasetTableTask.getType()));
|
||||
} else if (StringUtils.equalsIgnoreCase(datasetTableTask.getRate(), ScheduleType.CRON.toString())) {
|
||||
} else {
|
||||
Date endTime;
|
||||
if (StringUtils.equalsIgnoreCase(datasetTableTask.getEnd(), "1")) {
|
||||
if (datasetTableTask.getEndTime() == null || datasetTableTask.getEndTime() == 0) {
|
||||
|
@ -10,6 +10,7 @@ import io.dataease.base.mapper.ext.ExtDataSetTableMapper;
|
||||
import io.dataease.base.mapper.ext.UtilMapper;
|
||||
import io.dataease.commons.constants.JobStatus;
|
||||
import io.dataease.commons.constants.ScheduleType;
|
||||
import io.dataease.commons.constants.TaskStatus;
|
||||
import io.dataease.commons.utils.*;
|
||||
import io.dataease.controller.request.dataset.DataSetGroupRequest;
|
||||
import io.dataease.controller.request.dataset.DataSetTableRequest;
|
||||
@ -110,6 +111,7 @@ public class DataSetTableService {
|
||||
datasetTableTask.setType("all_scope");
|
||||
datasetTableTask.setName(datasetTable.getName() + " 更新设置");
|
||||
datasetTableTask.setEnd("0");
|
||||
datasetTableTask.setStatus(TaskStatus.Underway.name());
|
||||
datasetTableTask.setStartTime(System.currentTimeMillis());
|
||||
dataSetTaskRequest.setDatasetTableTask(datasetTableTask);
|
||||
dataSetTableTaskService.save(dataSetTaskRequest);
|
||||
|
@ -61,7 +61,7 @@ public class DataSetTableTaskService {
|
||||
dataSetTableService.saveIncrementalConfig(dataSetTaskRequest.getDatasetTableIncrementalConfig());
|
||||
}
|
||||
// check
|
||||
if (StringUtils.equalsIgnoreCase(datasetTableTask.getRate(),"CRON")){
|
||||
if (!StringUtils.equalsIgnoreCase(datasetTableTask.getRate(), ScheduleType.SIMPLE.toString())){
|
||||
if (StringUtils.isNotEmpty(datasetTableTask.getCron())) {
|
||||
if (!CronExpression.isValidExpression(datasetTableTask.getCron())) {
|
||||
throw new RuntimeException(Translator.get("i18n_cron_expression_error"));
|
||||
@ -96,6 +96,7 @@ public class DataSetTableTaskService {
|
||||
scheduleService.addSchedule(datasetTableTask);
|
||||
}else {
|
||||
if(datasetTableTask.getStatus().equalsIgnoreCase(JobStatus.Underway.name())){
|
||||
System.out.println(new Gson().toJson(datasetTableTask));
|
||||
scheduleService.addSchedule(datasetTableTask);
|
||||
}
|
||||
}
|
||||
|
@ -12,3 +12,4 @@ update dataset_table_task set rate='SIMPLE' where rate='SIMPLE_COMPLETE';
|
||||
ALTER TABLE `dataset_table_task_log` ADD COLUMN `trigger_type` VARCHAR(45) NULL AFTER `create_time`;
|
||||
update dataset_table_task_log set trigger_type='Cron';
|
||||
|
||||
ALTER TABLE `dataset_table_task` ADD COLUMN `extra_data` LONGTEXT NULL AFTER `last_exec_status`;
|
||||
|
@ -74,7 +74,9 @@
|
||||
<!-- </table>-->
|
||||
<!-- <table tableName="v_dataset"/>-->
|
||||
<!-- <table tableName="sys_auth_detail"/>-->
|
||||
<table tableName="dataset_table_field"/>
|
||||
<table tableName="dataset_table_task">
|
||||
<columnOverride column="extra_data" javaType="java.lang.String" jdbcType="VARCHAR" />
|
||||
</table>
|
||||
|
||||
|
||||
</context>
|
||||
|
@ -857,6 +857,7 @@ export default {
|
||||
select_data_time: 'Select date time',
|
||||
execute_rate: 'Execution frequency',
|
||||
execute_once: 'Execution Now',
|
||||
simple_cron: 'Simple repeat',
|
||||
cron_config: 'Expression setting',
|
||||
no_limit: 'No limit',
|
||||
set_end_time: 'Set the end time',
|
||||
@ -1213,7 +1214,10 @@ export default {
|
||||
week_start: 'From week',
|
||||
week_end: 'to week',
|
||||
every_year: 'Every year',
|
||||
week_tips: 'Tips:1-7 mapping SUN-SAT'
|
||||
week_tips: 'Tips:1-7 mapping SUN-SAT',
|
||||
minute_limit: 'Minutes cannot be less than 1 and greater than 59',
|
||||
hour_limit: 'Hours cannot be less than 1 and greater than 23',
|
||||
day_limit: 'Days cannot be less than 1 and greater than 31'
|
||||
},
|
||||
dept: {
|
||||
can_not_move_change_sort: 'Cannot move to change sort',
|
||||
|
@ -856,6 +856,7 @@ export default {
|
||||
add_scope: '增量更新',
|
||||
select_data_time: '選擇日期時間',
|
||||
execute_rate: '執行頻率',
|
||||
simple_cron: '簡單重複',
|
||||
execute_once: '立即執行',
|
||||
cron_config: '表達時設定',
|
||||
no_limit: '無限製',
|
||||
@ -1213,7 +1214,10 @@ export default {
|
||||
week_start: '從星期',
|
||||
week_end: '至星期',
|
||||
every_year: '每年',
|
||||
week_tips: '說明:1-7 分別對應 周日-周六'
|
||||
week_tips: '说明:1-7 分别对应 周日-周六',
|
||||
minute_limit: '分鐘不能小於1,大於59',
|
||||
hour_limit: '小時不能小於1,大於523',
|
||||
day_limit: '天不能小於1,大於531'
|
||||
},
|
||||
dept: {
|
||||
can_not_move_change_sort: '不能移動以改變排序',
|
||||
|
@ -857,6 +857,7 @@ export default {
|
||||
select_data_time: '选择日期时间',
|
||||
execute_rate: '执行频率',
|
||||
execute_once: '立即执行',
|
||||
simple_cron: '简单重复',
|
||||
cron_config: '表达式设定',
|
||||
no_limit: '无限制',
|
||||
set_end_time: '设定结束时间',
|
||||
@ -1215,7 +1216,10 @@ export default {
|
||||
week_start: '从星期',
|
||||
week_end: '至星期',
|
||||
every_year: '每年',
|
||||
week_tips: '说明:1-7 分别对应 周日-周六'
|
||||
week_tips: '说明:1-7 分别对应 周日-周六',
|
||||
minute_limit: '分钟不能小于1,大于59',
|
||||
hour_limit: '小时不能小于1,大于23',
|
||||
day_limit: '天不能小于1,大于31'
|
||||
},
|
||||
dept: {
|
||||
can_not_move_change_sort: '不能移动以改变排序',
|
||||
|
@ -122,6 +122,10 @@
|
||||
:label="$t('dataset.execute_once')"
|
||||
value="SIMPLE"
|
||||
/>
|
||||
<el-option
|
||||
:label="$t('dataset.simple_cron')"
|
||||
value="SIMPLE_CRON"
|
||||
/>
|
||||
<el-option
|
||||
:label="$t('dataset.cron_config')"
|
||||
value="CRON"
|
||||
@ -135,7 +139,26 @@
|
||||
<el-input slot="reference" v-model="taskForm.cron" size="mini" style="width: 50%" @click="cronEdit = true" />
|
||||
</el-popover>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="taskForm.rate === 'CRON'" :label="$t('dataset.start_time')" prop="startTime">
|
||||
|
||||
<el-form-item v-if="taskForm.rate === 'SIMPLE_CRON'" label="">
|
||||
<el-form :inline="true">
|
||||
<el-form-item :label="$t('cron.every')" >
|
||||
<el-input v-model="taskForm.extraData.simple_cron_value" size="mini" type="number" min="1" @change="onSimpleCronChange()" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item class="form-item">
|
||||
<el-select v-model="taskForm.extraData.simple_cron_type" filterable size="mini" @change="onSimpleCronChange()" >
|
||||
<el-option :label="$t('cron.minute')" value="minute" />
|
||||
<el-option :label="$t('cron.hour')" value="hour" />
|
||||
<el-option :label="$t('cron.day')" value="day" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item class="form-item" :label="$t('cron.every_exec')">
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="taskForm.rate !== 'SIMPLE'" :label="$t('dataset.start_time')" prop="startTime">
|
||||
<el-date-picker
|
||||
v-model="taskForm.startTime"
|
||||
type="datetime"
|
||||
@ -143,7 +166,7 @@
|
||||
size="mini"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="taskForm.rate === 'CRON'" :label="$t('dataset.end_time')" prop="end">
|
||||
<el-form-item v-if="taskForm.rate !== 'SIMPLE'" :label="$t('dataset.end_time')" prop="end">
|
||||
<el-select v-model="taskForm.end" size="mini">
|
||||
<el-option
|
||||
:label="$t('dataset.no_limit')"
|
||||
@ -193,7 +216,7 @@
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.rate === 'SIMPLE'">{{ $t('dataset.execute_once') }}</span>
|
||||
<span v-if="scope.row.rate === 'SIMPLE_COMPLETE'">{{ $t('dataset.execute_once') }}</span>
|
||||
<span v-if="scope.row.rate === 'SIMPLE_CRON'">{{ $t('dataset.simple_cron') }}</span>
|
||||
<span v-if="scope.row.rate === 'CRON'">{{ $t('dataset.cron_config') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -206,7 +229,7 @@
|
||||
type="primary"
|
||||
icon="el-icon-edit"
|
||||
circle
|
||||
:disabled="scope.row.rate === 'SIMPLE_COMPLETE'"
|
||||
:disabled="scope.row.rate === 'SIMPLE'"
|
||||
@click="addTask(scope.row)"
|
||||
/>
|
||||
<el-button
|
||||
@ -323,7 +346,11 @@ export default {
|
||||
rate: 'SIMPLE',
|
||||
cron: '',
|
||||
endTime: '',
|
||||
end: '0'
|
||||
end: '0',
|
||||
extraData: {
|
||||
simple_cron_type: 'hour',
|
||||
simple_cron_value: 1
|
||||
}
|
||||
},
|
||||
page: {
|
||||
currentPage: 1,
|
||||
@ -459,6 +486,7 @@ export default {
|
||||
} else {
|
||||
// update
|
||||
this.taskForm = JSON.parse(JSON.stringify(task))
|
||||
this.taskForm.extraData = JSON.parse(this.taskForm.extraData)
|
||||
this.update_task_dialog_title = this.$t('dataset.task_edit_title')
|
||||
}
|
||||
this.update_task = true
|
||||
@ -505,8 +533,10 @@ export default {
|
||||
task.startTime = new Date(task.startTime).getTime()
|
||||
task.endTime = new Date(task.endTime).getTime()
|
||||
task.tableId = this.table.id
|
||||
const form = JSON.parse(JSON.stringify(task))
|
||||
form.extraData = JSON.stringify(form.extraData)
|
||||
const dataSetTaskRequest = {
|
||||
datasetTableTask: task,
|
||||
datasetTableTask: form,
|
||||
datasetTableIncrementalConfig: this.incrementalConfig
|
||||
}
|
||||
post('/dataset/task/save', dataSetTaskRequest).then(response => {
|
||||
@ -544,12 +574,42 @@ export default {
|
||||
this.update_task = false
|
||||
this.resetTaskForm()
|
||||
},
|
||||
onSimpleCronChange() {
|
||||
if (this.taskForm.extraData.simple_cron_type === 'minute') {
|
||||
if(this.taskForm.extraData.simple_cron_value < 1 || this.taskForm.extraData.simple_cron_value > 59){
|
||||
this.$message({message: this.$t('cron.minute_limit'), type: 'warning', showClose: true})
|
||||
this.taskForm.extraData.simple_cron_value = 59
|
||||
}
|
||||
this.taskForm.cron = '0 0/'+ this.taskForm.extraData.simple_cron_value + ' * * * ? *'
|
||||
return
|
||||
}
|
||||
if (this.taskForm.extraData.simple_cron_type === 'hour') {
|
||||
if(this.taskForm.extraData.simple_cron_value < 1 || this.taskForm.extraData.simple_cron_value > 23){
|
||||
this.$message({message: this.$t('cron.hour_limit'), type: 'warning', showClose: true})
|
||||
this.taskForm.extraData.simple_cron_value = 23
|
||||
}
|
||||
this.taskForm.cron = '0 0 0/'+ this.taskForm.extraData.simple_cron_value + ' * * ? *'
|
||||
return
|
||||
}
|
||||
if (this.taskForm.extraData.simple_cron_type === 'day') {
|
||||
if(this.taskForm.extraData.simple_cron_value < 1 || this.taskForm.extraData.simple_cron_value > 31){
|
||||
this.$message({message: this.$t('cron.day_limit'), type: 'warning', showClose: true})
|
||||
this.taskForm.extraData.simple_cron_value = 31
|
||||
}
|
||||
this.taskForm.cron = '0 0 0 1/'+ this.taskForm.extraData.simple_cron_value + ' * ? *'
|
||||
return
|
||||
}
|
||||
},
|
||||
onRateChange() {
|
||||
if (this.taskForm.rate === 'SIMPLE') {
|
||||
this.taskForm.end = '0'
|
||||
this.taskForm.endTime = ''
|
||||
this.taskForm.cron = ''
|
||||
} else {
|
||||
}
|
||||
if (this.taskForm.rate === 'SIMPLE_CRON'){
|
||||
this.taskForm.cron = '0 0 0/1 * * ? *'
|
||||
}
|
||||
if (this.taskForm.rate === 'CRON'){
|
||||
this.taskForm.cron = '00 00 * ? * * *'
|
||||
}
|
||||
},
|
||||
@ -575,7 +635,11 @@ export default {
|
||||
startTime: '',
|
||||
rate: 'SIMPLE',
|
||||
endTime: '',
|
||||
end: '0'
|
||||
end: '0',
|
||||
extraData: {
|
||||
simple_cron_type: 'hour',
|
||||
simple_cron_value: 1
|
||||
}
|
||||
}
|
||||
},
|
||||
showSQL(val) {
|
||||
|
@ -11,8 +11,8 @@
|
||||
<el-table-column prop="rate" :label="$t('dataset.execute_rate')">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.rate === 'SIMPLE'">{{ $t('dataset.execute_once') }}</span>
|
||||
<span v-if="scope.row.rate === 'SIMPLE_COMPLETE'">{{ $t('dataset.execute_once') }}</span>
|
||||
<span v-if="scope.row.rate === 'CRON'">{{ $t('dataset.cron_config') }}</span>
|
||||
<span v-if="scope.row.rate === 'SIMPLE_CRON'">{{ $t('dataset.simple_cron') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@ -80,6 +80,7 @@
|
||||
<el-select v-model="taskForm.rate" size="mini" @change="onRateChange">
|
||||
<el-option :label="$t('dataset.execute_once')" value="SIMPLE"/>
|
||||
<el-option :label="$t('dataset.cron_config')" value="CRON"/>
|
||||
<el-option :label="$t('dataset.simple_cron')" value="SIMPLE_CRON"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
@ -89,6 +90,25 @@
|
||||
<el-input slot="reference" v-model="taskForm.cron" size="mini" style="width: 50%" @click="cronEdit = true" />
|
||||
</el-popover>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="taskForm.rate === 'SIMPLE_CRON'" label="">
|
||||
<el-form :inline="true">
|
||||
<el-form-item :label="$t('cron.every')" >
|
||||
<el-input v-model="taskForm.extraData.simple_cron_value" size="mini" type="number" min="1" @change="onSimpleCronChange()" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item class="form-item">
|
||||
<el-select v-model="taskForm.extraData.simple_cron_type" filterable size="mini" @change="onSimpleCronChange()" >
|
||||
<el-option :label="$t('cron.minute')" value="minute" />
|
||||
<el-option :label="$t('cron.hour')" value="hour" />
|
||||
<el-option :label="$t('cron.day')" value="day" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item class="form-item" :label="$t('cron.every_exec')">
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="taskForm.rate === 'CRON'" :label="$t('dataset.start_time')" prop="startTime">
|
||||
<el-date-picker v-model="taskForm.startTime" type="datetime" :placeholder="$t('dataset.select_data_time')" size="mini"/>
|
||||
</el-form-item>
|
||||
@ -182,7 +202,11 @@ export default {
|
||||
rate: 'SIMPLE',
|
||||
cron: '',
|
||||
endTime: '',
|
||||
end: '0'
|
||||
end: '0',
|
||||
extraData: {
|
||||
simple_cron_type: 'hour',
|
||||
simple_cron_value: 1
|
||||
}
|
||||
},
|
||||
update_task: false,
|
||||
header: '',
|
||||
@ -254,7 +278,7 @@ export default {
|
||||
cronEdit: false,
|
||||
lang: this.$store.getters.language === 'en_US' ? 'en' : 'cn',
|
||||
selectDatasetFlag: false,
|
||||
table: {},
|
||||
table: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -370,7 +394,50 @@ export default {
|
||||
startTime: '',
|
||||
rate: 'SIMPLE',
|
||||
endTime: '',
|
||||
end: '0'
|
||||
end: '0',
|
||||
extraData: {
|
||||
simple_cron_type: 'hour',
|
||||
simple_cron_value: 1
|
||||
}
|
||||
}
|
||||
},
|
||||
onSimpleCronChange() {
|
||||
if (this.taskForm.extraData.simple_cron_type === 'minute') {
|
||||
if(this.taskForm.extraData.simple_cron_value < 1 || this.taskForm.extraData.simple_cron_value > 59){
|
||||
this.$message({message: this.$t('cron.minute_limit'), type: 'warning', showClose: true})
|
||||
this.taskForm.extraData.simple_cron_value = 59
|
||||
}
|
||||
this.taskForm.cron = '0 0/'+ this.taskForm.extraData.simple_cron_value + ' * * * ? *'
|
||||
return
|
||||
}
|
||||
if (this.taskForm.extraData.simple_cron_type === 'hour') {
|
||||
if(this.taskForm.extraData.simple_cron_value < 1 || this.taskForm.extraData.simple_cron_value > 23){
|
||||
this.$message({message: this.$t('cron.hour_limit'), type: 'warning', showClose: true})
|
||||
this.taskForm.extraData.simple_cron_value = 23
|
||||
}
|
||||
this.taskForm.cron = '0 0 0/'+ this.taskForm.extraData.simple_cron_value + ' * * ? *'
|
||||
return
|
||||
}
|
||||
if (this.taskForm.extraData.simple_cron_type === 'day') {
|
||||
if(this.taskForm.extraData.simple_cron_value < 1 || this.taskForm.extraData.simple_cron_value > 31){
|
||||
this.$message({message: this.$t('cron.day_limit'), type: 'warning', showClose: true})
|
||||
this.taskForm.extraData.simple_cron_value = 31
|
||||
}
|
||||
this.taskForm.cron = '0 0 0 1/'+ this.taskForm.extraData.simple_cron_value + ' * ? *'
|
||||
return
|
||||
}
|
||||
},
|
||||
onRateChange() {
|
||||
if (this.taskForm.rate === 'SIMPLE') {
|
||||
this.taskForm.end = '0'
|
||||
this.taskForm.endTime = ''
|
||||
this.taskForm.cron = ''
|
||||
}
|
||||
if (this.taskForm.rate === 'SIMPLE_CRON'){
|
||||
this.taskForm.cron = '0 0 0/1 * * ? *'
|
||||
}
|
||||
if (this.taskForm.rate === 'CRON'){
|
||||
this.taskForm.cron = '00 00 * ? * * *'
|
||||
}
|
||||
},
|
||||
incrementalUpdateTypeChange: function() {
|
||||
@ -454,6 +521,7 @@ export default {
|
||||
} else { // update
|
||||
this.getIncrementalConfig(task.tableId)
|
||||
this.taskForm = JSON.parse(JSON.stringify(task))
|
||||
this.taskForm.extraData = JSON.parse(this.taskForm.extraData)
|
||||
this.update_task_dialog_title = this.$t('dataset.task_edit_title')
|
||||
}
|
||||
this.update_task = true
|
||||
@ -484,8 +552,10 @@ export default {
|
||||
}
|
||||
task.startTime = new Date(task.startTime).getTime()
|
||||
task.endTime = new Date(task.endTime).getTime()
|
||||
const form = JSON.parse(JSON.stringify(task))
|
||||
form.extraData = JSON.stringify(form.extraData)
|
||||
const dataSetTaskRequest = {
|
||||
datasetTableTask: task,
|
||||
datasetTableTask: form,
|
||||
datasetTableIncrementalConfig: task.type === 'add_scope' ? this.incrementalConfig : undefined
|
||||
}
|
||||
post('/dataset/task/save', dataSetTaskRequest).then(response => {
|
||||
@ -499,15 +569,6 @@ export default {
|
||||
this.search()
|
||||
})
|
||||
},
|
||||
onRateChange() {
|
||||
if (this.taskForm.rate === 'SIMPLE') {
|
||||
this.taskForm.end = '0'
|
||||
this.taskForm.endTime = ''
|
||||
this.taskForm.cron = ''
|
||||
} else {
|
||||
this.taskForm.cron = '00 00 * ? * * *'
|
||||
}
|
||||
},
|
||||
handleClose() {
|
||||
this.depts = null
|
||||
this.formType = 'add'
|
||||
|
@ -28,6 +28,19 @@
|
||||
</el-table-column>
|
||||
</complex-table>
|
||||
</el-row>
|
||||
<el-dialog
|
||||
v-dialogDrag
|
||||
:title="$t('dataset.detail')"
|
||||
:visible="show_error_massage"
|
||||
:show-close="false"
|
||||
width="50%"
|
||||
class="dialog-css"
|
||||
>
|
||||
<span>{{ error_massage }}</span>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button size="mini" @click="show_error_massage = false">{{ $t('dataset.close') }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
@ -86,6 +99,8 @@ export default {
|
||||
formType: 'add',
|
||||
orderConditions: [],
|
||||
last_condition: null,
|
||||
show_error_massage: false,
|
||||
error_massage: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@ -120,7 +135,6 @@ export default {
|
||||
},
|
||||
search(condition) {
|
||||
this.last_condition = condition
|
||||
console.log(condition)
|
||||
condition = formatQuickCondition(condition, 'dataset_table_task.name')
|
||||
const temp = formatCondition(condition)
|
||||
const param = temp || {}
|
||||
@ -130,22 +144,9 @@ export default {
|
||||
this.paginationConfig.total = response.data.itemCount
|
||||
})
|
||||
},
|
||||
deleteTask(task) {
|
||||
this.$confirm(this.$t('dataset.confirm_delete'), this.$t('dataset.tips'), {
|
||||
confirmButtonText: this.$t('dataset.confirm'),
|
||||
cancelButtonText: this.$t('dataset.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
post('/dataset/task/delete/' + task.id, null).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('dataset.delete_success'),
|
||||
type: 'success',
|
||||
showClose: true
|
||||
})
|
||||
this.search()
|
||||
})
|
||||
}).catch(() => {
|
||||
})
|
||||
showErrorMassage(massage) {
|
||||
this.show_error_massage = true
|
||||
this.error_massage = massage
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user