Unverified 提交 051ce44e authored 作者: fit2cloud-chenyw's avatar fit2cloud-chenyw 提交者: GitHub

Merge pull request #343 from dataease/pr@v1.1@fix_解决跳转任务执行记录延时

fix: 跳转任务消息延时
...@@ -29,10 +29,6 @@ import org.apache.commons.lang3.StringUtils; ...@@ -29,10 +29,6 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.pentaho.di.cluster.SlaveServer; import org.pentaho.di.cluster.SlaveServer;
import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.database.DatabaseMeta;
import org.pentaho.di.core.row.ValueMetaInterface; import org.pentaho.di.core.row.ValueMetaInterface;
...@@ -66,8 +62,6 @@ import org.springframework.context.annotation.Lazy; ...@@ -66,8 +62,6 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.InetAddress; import java.net.InetAddress;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -295,7 +289,7 @@ public class ExtractDataService { ...@@ -295,7 +289,7 @@ public class ExtractDataService {
replaceTable(DorisTableUtils.dorisName(datasetTableId)); replaceTable(DorisTableUtils.dorisName(datasetTableId));
saveSucessLog(datasetTableTaskLog); saveSucessLog(datasetTableTaskLog);
sendWebMsg(datasetTable, datasetTableTask, true); sendWebMsg(datasetTable, datasetTableTask, datasetTableTaskLog, true);
deleteFile("all_scope", datasetTableId); deleteFile("all_scope", datasetTableId);
...@@ -308,7 +302,7 @@ public class ExtractDataService { ...@@ -308,7 +302,7 @@ public class ExtractDataService {
dataSetTableTaskService.updateTaskStatus(datasetTableTask, JobStatus.Error); dataSetTableTaskService.updateTaskStatus(datasetTableTask, JobStatus.Error);
sendWebMsg(datasetTable, datasetTableTask, false); sendWebMsg(datasetTable, datasetTableTask, datasetTableTaskLog,false);
updateTableStatus(datasetTableId, datasetTable, JobStatus.Error, null); updateTableStatus(datasetTableId, datasetTable, JobStatus.Error, null);
dropDorisTable(DorisTableUtils.dorisTmpName(DorisTableUtils.dorisName(datasetTableId))); dropDorisTable(DorisTableUtils.dorisTmpName(DorisTableUtils.dorisName(datasetTableId)));
deleteFile("all_scope", datasetTableId); deleteFile("all_scope", datasetTableId);
...@@ -350,7 +344,7 @@ public class ExtractDataService { ...@@ -350,7 +344,7 @@ public class ExtractDataService {
} }
saveSucessLog(datasetTableTaskLog); saveSucessLog(datasetTableTaskLog);
sendWebMsg(datasetTable, datasetTableTask, true); sendWebMsg(datasetTable, datasetTableTask, datasetTableTaskLog,true);
deleteFile("incremental_add", datasetTableId); deleteFile("incremental_add", datasetTableId);
deleteFile("incremental_delete", datasetTableId); deleteFile("incremental_delete", datasetTableId);
...@@ -360,7 +354,7 @@ public class ExtractDataService { ...@@ -360,7 +354,7 @@ public class ExtractDataService {
dataSetTableTaskService.updateTaskStatus(datasetTableTask, JobStatus.Completed); dataSetTableTaskService.updateTaskStatus(datasetTableTask, JobStatus.Completed);
} catch (Exception e) { } catch (Exception e) {
saveErrorLog(datasetTableId, taskId, e); saveErrorLog(datasetTableId, taskId, e);
sendWebMsg(datasetTable, datasetTableTask, false); sendWebMsg(datasetTable, datasetTableTask, datasetTableTaskLog,false);
updateTableStatus(datasetTableId, datasetTable, JobStatus.Error, null); updateTableStatus(datasetTableId, datasetTable, JobStatus.Error, null);
dataSetTableTaskService.updateTaskStatus(datasetTableTask, JobStatus.Error); dataSetTableTaskService.updateTaskStatus(datasetTableTask, JobStatus.Error);
...@@ -381,13 +375,14 @@ public class ExtractDataService { ...@@ -381,13 +375,14 @@ public class ExtractDataService {
} }
private void sendWebMsg(DatasetTable datasetTable, DatasetTableTask datasetTableTask, Boolean status) { private void sendWebMsg(DatasetTable datasetTable, DatasetTableTask datasetTableTask, DatasetTableTaskLog datasetTableTaskLog, Boolean status) {
String taskId = datasetTableTask.getId(); String taskId = datasetTableTask.getId();
String msg = status ? "成功" : "失败"; String msg = status ? "成功" : "失败";
Long typeId = status ? 5L : 6L; Long typeId = status ? 5L : 6L;
String id = datasetTable.getId(); String id = datasetTable.getId();
AuthURD authURD = AuthUtils.authURDR(id); AuthURD authURD = AuthUtils.authURDR(id);
Set<Long> userIds = AuthUtils.userIdsByURD(authURD); Set<Long> userIds = AuthUtils.userIdsByURD(authURD);
Gson gson = new Gson(); Gson gson = new Gson();
userIds.forEach(userId -> { userIds.forEach(userId -> {
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
...@@ -395,6 +390,10 @@ public class ExtractDataService { ...@@ -395,6 +390,10 @@ public class ExtractDataService {
if (StringUtils.isNotEmpty(taskId)) { if (StringUtils.isNotEmpty(taskId)) {
param.put("taskId", taskId); param.put("taskId", taskId);
} }
if (ObjectUtils.isNotEmpty(datasetTableTaskLog) && StringUtils.isNotEmpty(datasetTableTaskLog.getId())) {
param.put("logId", datasetTableTaskLog.getId());
}
String content = "数据集【" + datasetTable.getName() + "】同步" + msg; String content = "数据集【" + datasetTable.getName() + "】同步" + msg;
if (ObjectUtils.isNotEmpty(datasetTableTask) && ObjectUtils.isNotEmpty(datasetTableTask.getName())) { if (ObjectUtils.isNotEmpty(datasetTableTask) && ObjectUtils.isNotEmpty(datasetTableTask.getName())) {
content += " 任务名称【" + datasetTableTask.getName() + "】"; content += " 任务名称【" + datasetTableTask.getName() + "】";
......
...@@ -181,7 +181,7 @@ public class SysMsgService { ...@@ -181,7 +181,7 @@ public class SysMsgService {
} }
public List<SysMsgSetting> defaultSettings() { public List<SysMsgSetting> defaultSettings() {
Long userId = AuthUtils.getUser().getUserId(); // Long userId = AuthUtils.getUser().getUserId();
SysMsgSetting sysMsgSetting1 = new SysMsgSetting(); SysMsgSetting sysMsgSetting1 = new SysMsgSetting();
sysMsgSetting1.setTypeId(2L); sysMsgSetting1.setTypeId(2L);
sysMsgSetting1.setChannelId(1L); sysMsgSetting1.setChannelId(1L);
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
<el-row style="margin-top: 10px;"> <el-row style="margin-top: 10px;">
<complex-table :data="data" :columns="columns" local-key="datasetTask" :search-config="searchConfig" :pagination-config="paginationConfig" @select="select" @search="search" @sort-change="sortChange"> <complex-table :data="data" :columns="columns" local-key="datasetTask" :search-config="searchConfig" :pagination-config="paginationConfig" @select="select" @search="search" @sort-change="sortChange">
<template #toolbar> <template #toolbar>
<el-button icon="el-icon-circle-plus-outline" @click="selectDataset">{{ $t('dataset.task.create') }}</el-button> <el-button icon="el-icon-circle-plus-outline" @click="selectDataset">{{ $t('dataset.task.create') }}</el-button>
</template> </template>
<el-table-column prop="name" :label="$t('dataset.task_name')" > <el-table-column prop="name" :label="$t('dataset.task_name')">
<template slot-scope="scope"> <template slot-scope="scope">
<span> <span>
<el-link style="font-size: 12px" @click="jumpTaskRecord(scope.row)">{{ scope.row.name }}</el-link> <el-link style="font-size: 12px" @click="jumpTaskRecord(scope.row)">{{ scope.row.name }}</el-link>
...@@ -23,20 +23,20 @@ ...@@ -23,20 +23,20 @@
</el-table-column> </el-table-column>
<el-table-column prop="lastExecTime" :label="$t('dataset.task.last_exec_time')"> <el-table-column prop="lastExecTime" :label="$t('dataset.task.last_exec_time')">
<template slot-scope="scope" > <template slot-scope="scope">
<span v-if="scope.row.lastExecTime && scope.row.lastExecTime != -1"> <span v-if="scope.row.lastExecTime && scope.row.lastExecTime != -1">
{{ scope.row.lastExecTime | timestampFormatDate }} {{ scope.row.lastExecTime | timestampFormatDate }}
</span> </span>
<span v-if="scope.row.lastExecTime === -1"></span> <span v-if="scope.row.lastExecTime === -1" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="lastExecStatus" :label="$t('dataset.task.last_exec_status')" > <el-table-column prop="lastExecStatus" :label="$t('dataset.task.last_exec_status')">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.lastExecStatus === 'Completed'" style="color: green">{{ $t('dataset.completed') }}</span> <span v-if="scope.row.lastExecStatus === 'Completed'" style="color: green">{{ $t('dataset.completed') }}</span>
<span v-if="scope.row.lastExecStatus === 'Underway'" style="color: blue"> <span v-if="scope.row.lastExecStatus === 'Underway'" style="color: blue">
<i class="el-icon-loading" /> <i class="el-icon-loading" />
{{ $t('dataset.underway') }} {{ $t('dataset.underway') }}
</span> </span>
<span v-if="scope.row.lastExecStatus === 'Error'" style="color: red"> <span v-if="scope.row.lastExecStatus === 'Error'" style="color: red">
<el-link type="danger" style="font-size: 12px" @click="showErrorMassage(scope.row.msg)">{{ $t('dataset.error') }}</el-link> <el-link type="danger" style="font-size: 12px" @click="showErrorMassage(scope.row.msg)">{{ $t('dataset.error') }}</el-link>
...@@ -46,11 +46,11 @@ ...@@ -46,11 +46,11 @@
</el-table-column> </el-table-column>
<el-table-column prop="nextExecTime" :label="$t('dataset.task.next_exec_time')"> <el-table-column prop="nextExecTime" :label="$t('dataset.task.next_exec_time')">
<template slot-scope="scope" > <template slot-scope="scope">
<span v-if="scope.row.nextExecTime && scope.row.nextExecTime !== -1 && scope.row.rate !== 'SIMPLE'"> <span v-if="scope.row.nextExecTime && scope.row.nextExecTime !== -1 && scope.row.rate !== 'SIMPLE'">
{{ scope.row.nextExecTime | timestampFormatDate }} {{ scope.row.nextExecTime | timestampFormatDate }}
</span> </span>
<span v-if="!scope.row.nextExecTime || scope.row.rate === 'SIMPLE'"></span> <span v-if="!scope.row.nextExecTime || scope.row.rate === 'SIMPLE'" />
</template> </template>
</el-table-column> </el-table-column>
...@@ -67,13 +67,12 @@ ...@@ -67,13 +67,12 @@
<el-link type="primary" style="font-size: 12px" @click="changeTaskStatus(scope.row)">{{ $t('dataset.task.pending') }}</el-link> <el-link type="primary" style="font-size: 12px" @click="changeTaskStatus(scope.row)">{{ $t('dataset.task.pending') }}</el-link>
</span> </span>
<span v-if="scope.row.status === 'Exec'" style="color: blue"> <span v-if="scope.row.status === 'Exec'" style="color: blue">
<i class="el-icon-loading" /> <i class="el-icon-loading" />
{{ $t('dataset.underway') }} {{ $t('dataset.underway') }}
</span> </span>
</template> </template>
</el-table-column> </el-table-column>
<fu-table-operations :buttons="buttons" :label="$t('commons.operating')" fix /> <fu-table-operations :buttons="buttons" :label="$t('commons.operating')" fix />
</complex-table> </complex-table>
</el-row> </el-row>
...@@ -82,19 +81,19 @@ ...@@ -82,19 +81,19 @@
<el-col> <el-col>
<el-form :form="taskForm" label-width="100px" size="mini"> <el-form :form="taskForm" label-width="100px" size="mini">
<el-form-item :label="$t('dataset.task_name')" prop="name"> <el-form-item :label="$t('dataset.task_name')" prop="name">
<el-input v-model="taskForm.name" size="mini" style="width: 50%" :placeholder="$t('dataset.task_name')"/> <el-input v-model="taskForm.name" size="mini" style="width: 50%" :placeholder="$t('dataset.task_name')" />
</el-form-item> </el-form-item>
<el-form-item :label="$t('dataset.update_type')" prop="type"> <el-form-item :label="$t('dataset.update_type')" prop="type">
<el-select v-model="taskForm.type" size="mini"> <el-select v-model="taskForm.type" size="mini">
<el-option :label="$t('dataset.all_scope')" value="all_scope"/> <el-option :label="$t('dataset.all_scope')" value="all_scope" />
<el-option :label="$t('dataset.add_scope')" value="add_scope"/> <el-option :label="$t('dataset.add_scope')" value="add_scope" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="$t('dataset.execute_rate')" prop="rate"> <el-form-item :label="$t('dataset.execute_rate')" prop="rate">
<el-select v-model="taskForm.rate" size="mini" @change="onRateChange"> <el-select v-model="taskForm.rate" size="mini" @change="onRateChange">
<el-option :label="$t('dataset.execute_once')" value="SIMPLE"/> <el-option :label="$t('dataset.execute_once')" value="SIMPLE" />
<el-option :label="$t('dataset.cron_config')" value="CRON"/> <el-option :label="$t('dataset.cron_config')" value="CRON" />
<el-option :label="$t('dataset.simple_cron')" value="SIMPLE_CRON"/> <el-option :label="$t('dataset.simple_cron')" value="SIMPLE_CRON" />
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -107,34 +106,33 @@ ...@@ -107,34 +106,33 @@
<el-form-item v-if="taskForm.rate === 'SIMPLE_CRON'" label=""> <el-form-item v-if="taskForm.rate === 'SIMPLE_CRON'" label="">
<el-form :inline="true"> <el-form :inline="true">
<el-form-item :label="$t('cron.every')" > <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-input v-model="taskForm.extraData.simple_cron_value" size="mini" type="number" min="1" @change="onSimpleCronChange()" />
</el-form-item> </el-form-item>
<el-form-item class="form-item"> <el-form-item class="form-item">
<el-select v-model="taskForm.extraData.simple_cron_type" filterable size="mini" @change="onSimpleCronChange()" > <el-select v-model="taskForm.extraData.simple_cron_type" filterable size="mini" @change="onSimpleCronChange()">
<el-option :label="$t('cron.minute_default')" value="minute" /> <el-option :label="$t('cron.minute_default')" value="minute" />
<el-option :label="$t('cron.hour_default')" value="hour" /> <el-option :label="$t('cron.hour_default')" value="hour" />
<el-option :label="$t('cron.day_default')" value="day" /> <el-option :label="$t('cron.day_default')" value="day" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item class="form-item" :label="$t('cron.every_exec')"> <el-form-item class="form-item" :label="$t('cron.every_exec')" />
</el-form-item>
</el-form> </el-form>
</el-form-item> </el-form-item>
<el-form-item v-if="taskForm.rate !== 'SIMPLE'" :label="$t('dataset.start_time')" prop="startTime"> <el-form-item v-if="taskForm.rate !== 'SIMPLE'" :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-date-picker v-model="taskForm.startTime" type="datetime" :placeholder="$t('dataset.select_data_time')" size="mini" />
</el-form-item> </el-form-item>
<el-form-item v-if="taskForm.rate !== 'SIMPLE'" :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-select v-model="taskForm.end" size="mini">
<el-option :label="$t('dataset.no_limit')" value="0"/> <el-option :label="$t('dataset.no_limit')" value="0" />
<el-option :label="$t('dataset.set_end_time')" value="1"/> <el-option :label="$t('dataset.set_end_time')" value="1" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item v-if="taskForm.end === '1'" label=""> <el-form-item v-if="taskForm.end === '1'" label="">
<el-date-picker v-model="taskForm.endTime" type="datetime" :placeholder="$t('dataset.select_data_time')" size="mini"/> <el-date-picker v-model="taskForm.endTime" type="datetime" :placeholder="$t('dataset.select_data_time')" size="mini" />
</el-form-item> </el-form-item>
<el-form-item v-if="taskForm.type === 'add_scope'" :label="$t('dataset.incremental_update_type')"> <el-form-item v-if="taskForm.type === 'add_scope'" :label="$t('dataset.incremental_update_type')">
...@@ -150,7 +148,8 @@ ...@@ -150,7 +148,8 @@
<el-button type="text" size="mini" @click="insertParamToCodeMirror('${__current_update_time__}')">{{ $t('dataset.current_update_time') }}</el-button> <el-button type="text" size="mini" @click="insertParamToCodeMirror('${__current_update_time__}')">{{ $t('dataset.current_update_time') }}</el-button>
</el-form-item> </el-form-item>
<codemirror v-if="taskForm.type === 'add_scope'" <codemirror
v-if="taskForm.type === 'add_scope'"
ref="myCm" ref="myCm"
v-model="sql" v-model="sql"
class="codemirror" class="codemirror"
...@@ -169,7 +168,7 @@ ...@@ -169,7 +168,7 @@
<!--添加任务-选择数据集--> <!--添加任务-选择数据集-->
<el-dialog v-dialogDrag :title="$t('dataset.task.create')" :visible="selectDatasetFlag" :show-close="false" width="70%" class="dialog-css" :destroy-on-close="true"> <el-dialog v-dialogDrag :title="$t('dataset.task.create')" :visible="selectDatasetFlag" :show-close="false" width="70%" class="dialog-css" :destroy-on-close="true">
<table-selector @getTable="getTable" :mode="1" type="db" showMode="datasetTask"/> <table-selector :mode="1" type="db" show-mode="datasetTask" @getTable="getTable" />
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button size="mini" @click="closeCreateTask">{{ $t('chart.cancel') }}</el-button> <el-button size="mini" @click="closeCreateTask">{{ $t('chart.cancel') }}</el-button>
<el-button type="primary" size="mini" :disabled="!table.id" @click="create(undefined)">{{ $t('chart.confirm') }}</el-button> <el-button type="primary" size="mini" :disabled="!table.id" @click="create(undefined)">{{ $t('chart.confirm') }}</el-button>
...@@ -196,7 +195,7 @@ ...@@ -196,7 +195,7 @@
import ComplexTable from '@/components/business/complex-table' import ComplexTable from '@/components/business/complex-table'
import { formatCondition, formatQuickCondition, addOrder, formatOrders } from '@/utils/index' import { formatCondition, formatQuickCondition, addOrder, formatOrders } from '@/utils/index'
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import {datasetTaskList, post} from '@/api/dataset/dataset' import { datasetTaskList, post } from '@/api/dataset/dataset'
import { codemirror } from 'vue-codemirror' import { codemirror } from 'vue-codemirror'
import 'codemirror/lib/codemirror.css' import 'codemirror/lib/codemirror.css'
import 'codemirror/theme/solarized.css' import 'codemirror/theme/solarized.css'
...@@ -217,7 +216,6 @@ import 'codemirror/addon/hint/show-hint' ...@@ -217,7 +216,6 @@ import 'codemirror/addon/hint/show-hint'
import cron from '@/components/cron/cron' import cron from '@/components/cron/cron'
import TableSelector from '@/views/chart/view/TableSelector' import TableSelector from '@/views/chart/view/TableSelector'
export default { export default {
name: 'DatasetTaskList', name: 'DatasetTaskList',
components: { ComplexTable, cron, codemirror, TableSelector }, components: { ComplexTable, cron, codemirror, TableSelector },
...@@ -326,14 +324,14 @@ export default { ...@@ -326,14 +324,14 @@ export default {
} }
}, },
created() { created() {
if(this.param == null){ if (this.param == null) {
this.last_condition = {} this.last_condition = {}
this.search() this.search()
}else { } else {
this.last_condition = { this.last_condition = {
'dataset_table_task.name': { 'dataset_table_task.name': {
field: "dataset_table_task.name", field: 'dataset_table_task.name',
operator: "eq", operator: 'eq',
value: this.param.name value: this.param.name
} }
} }
...@@ -347,7 +345,7 @@ export default { ...@@ -347,7 +345,7 @@ export default {
clearInterval(this.timer) clearInterval(this.timer)
}, },
methods: { methods: {
sortChange( { column, prop, order } ) { sortChange({ column, prop, order }) {
this.orderConditions = [] this.orderConditions = []
if (!order) { if (!order) {
this.search(this.last_condition) this.search(this.last_condition)
...@@ -382,10 +380,10 @@ export default { ...@@ -382,10 +380,10 @@ export default {
}, },
taskStatus(item) { taskStatus(item) {
post('/dataset/task/lastExecStatus', item, false).then(response => { post('/dataset/task/lastExecStatus', item, false).then(response => {
if(!item.lastExecStatus) { if (!item.lastExecStatus) {
item.lastExecStatus = response.data.lastExecStatus item.lastExecStatus = response.data.lastExecStatus
} }
if(!item.lastExecTime) { if (!item.lastExecTime) {
item.lastExecTime = response.data.lastExecTime item.lastExecTime = response.data.lastExecTime
} }
item.msg = response.data.msg item.msg = response.data.msg
...@@ -405,11 +403,11 @@ export default { ...@@ -405,11 +403,11 @@ export default {
} }
this.update_task = true this.update_task = true
}, },
changeTaskStatus(task){ changeTaskStatus(task) {
const param = task; const param = task
param.status = task.status === 'Underway' ? 'Pending' : 'Underway' param.status = task.status === 'Underway' ? 'Pending' : 'Underway'
post('/dataset/task/updateStatus', task).then(response => { post('/dataset/task/updateStatus', task).then(response => {
task.status = param.status; task.status = param.status
this.$message({ this.$message({
message: this.$t('dataset.task.change_success'), message: this.$t('dataset.task.change_success'),
type: 'success', type: 'success',
...@@ -417,7 +415,7 @@ export default { ...@@ -417,7 +415,7 @@ export default {
}) })
}) })
}, },
execTask(task){ execTask(task) {
this.$confirm(this.$t('dataset.task.confirm_exec'), this.$t('dataset.tips'), { this.$confirm(this.$t('dataset.task.confirm_exec'), this.$t('dataset.tips'), {
confirmButtonText: this.$t('dataset.confirm'), confirmButtonText: this.$t('dataset.confirm'),
cancelButtonText: this.$t('dataset.cancel'), cancelButtonText: this.$t('dataset.cancel'),
...@@ -455,27 +453,27 @@ export default { ...@@ -455,27 +453,27 @@ export default {
}, },
onSimpleCronChange() { onSimpleCronChange() {
if (this.taskForm.extraData.simple_cron_type === 'minute') { if (this.taskForm.extraData.simple_cron_type === 'minute') {
if(this.taskForm.extraData.simple_cron_value < 1 || this.taskForm.extraData.simple_cron_value > 59){ 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.$message({ message: this.$t('cron.minute_limit'), type: 'warning', showClose: true })
this.taskForm.extraData.simple_cron_value = 59 this.taskForm.extraData.simple_cron_value = 59
} }
this.taskForm.cron = '0 0/'+ this.taskForm.extraData.simple_cron_value + ' * * * ? *' this.taskForm.cron = '0 0/' + this.taskForm.extraData.simple_cron_value + ' * * * ? *'
return return
} }
if (this.taskForm.extraData.simple_cron_type === 'hour') { if (this.taskForm.extraData.simple_cron_type === 'hour') {
if(this.taskForm.extraData.simple_cron_value < 1 || this.taskForm.extraData.simple_cron_value > 23){ 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.$message({ message: this.$t('cron.hour_limit'), type: 'warning', showClose: true })
this.taskForm.extraData.simple_cron_value = 23 this.taskForm.extraData.simple_cron_value = 23
} }
this.taskForm.cron = '0 0 0/'+ this.taskForm.extraData.simple_cron_value + ' * * ? *' this.taskForm.cron = '0 0 0/' + this.taskForm.extraData.simple_cron_value + ' * * ? *'
return return
} }
if (this.taskForm.extraData.simple_cron_type === 'day') { if (this.taskForm.extraData.simple_cron_type === 'day') {
if(this.taskForm.extraData.simple_cron_value < 1 || this.taskForm.extraData.simple_cron_value > 31){ 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.$message({ message: this.$t('cron.day_limit'), type: 'warning', showClose: true })
this.taskForm.extraData.simple_cron_value = 31 this.taskForm.extraData.simple_cron_value = 31
} }
this.taskForm.cron = '0 0 0 1/'+ this.taskForm.extraData.simple_cron_value + ' * ? *' this.taskForm.cron = '0 0 0 1/' + this.taskForm.extraData.simple_cron_value + ' * ? *'
return return
} }
}, },
...@@ -485,10 +483,10 @@ export default { ...@@ -485,10 +483,10 @@ export default {
this.taskForm.endTime = '' this.taskForm.endTime = ''
this.taskForm.cron = '' this.taskForm.cron = ''
} }
if (this.taskForm.rate === 'SIMPLE_CRON'){ if (this.taskForm.rate === 'SIMPLE_CRON') {
this.taskForm.cron = '0 0 0/1 * * ? *' this.taskForm.cron = '0 0 0/1 * * ? *'
} }
if (this.taskForm.rate === 'CRON'){ if (this.taskForm.rate === 'CRON') {
this.taskForm.cron = '00 00 * ? * * *' this.taskForm.cron = '00 00 * ? * * *'
} }
}, },
...@@ -597,7 +595,7 @@ export default { ...@@ -597,7 +595,7 @@ export default {
this.show_error_massage = true this.show_error_massage = true
this.error_massage = massage this.error_massage = massage
}, },
jumpTaskRecord(item){ jumpTaskRecord(item) {
this.$emit('jumpTaskRecord', item) this.$emit('jumpTaskRecord', item)
}, },
saveTask(task) { saveTask(task) {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<el-table-column prop="name" :label="$t('dataset.task_name')"> <el-table-column prop="name" :label="$t('dataset.task_name')">
<template slot-scope="scope"> <template slot-scope="scope">
<span> <span>
<el-link style="font-size: 12px" @click="jumpTask(scope.row)">{{ scope.row.name }}</el-link> <el-link :type="matchLogId && scope.row.id === matchLogId ? 'danger': ''" style="font-size: 12px" @click="jumpTask(scope.row)">{{ scope.row.name }}</el-link>
</span> </span>
</template> </template>
</el-table-column> </el-table-column>
...@@ -51,17 +51,14 @@ ...@@ -51,17 +51,14 @@
</template> </template>
<script> <script>
import LayoutContent from '@/components/business/LayoutContent'
import ComplexTable from '@/components/business/complex-table' import ComplexTable from '@/components/business/complex-table'
import { formatCondition, formatQuickCondition, addOrder, formatOrders } from '@/utils/index' import { formatCondition, formatQuickCondition, addOrder, formatOrders } from '@/utils/index'
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { post } from '@/api/dataset/dataset' import { post } from '@/api/dataset/dataset'
import cron from '@/components/cron/cron'
import TableSelector from '@/views/chart/view/TableSelector'
export default { export default {
name: 'TaskRecord', name: 'TaskRecord',
components: { ComplexTable, LayoutContent, cron, TableSelector }, components: { ComplexTable },
props: { props: {
param: { param: {
type: Object, type: Object,
...@@ -112,7 +109,8 @@ export default { ...@@ -112,7 +109,8 @@ export default {
orderConditions: [], orderConditions: [],
last_condition: null, last_condition: null,
show_error_massage: false, show_error_massage: false,
error_massage: '' error_massage: '',
matchLogId: null
} }
}, },
computed: { computed: {
...@@ -121,7 +119,7 @@ export default { ...@@ -121,7 +119,7 @@ export default {
if (this.param == null) { if (this.param == null) {
this.last_condition = {} this.last_condition = {}
this.search() this.search()
} else { } else if (this.param.name) {
this.last_condition = { this.last_condition = {
'dataset_table_task.name': { 'dataset_table_task.name': {
field: 'dataset_table_task.name', field: 'dataset_table_task.name',
...@@ -130,6 +128,16 @@ export default { ...@@ -130,6 +128,16 @@ export default {
} }
} }
this.search(this.last_condition) this.search(this.last_condition)
} else if (this.param.taskId) {
this.matchLogId = this.param.logId || this.matchLogId
this.last_condition = {
'dataset_table_task.id': {
field: 'dataset_table_task.id',
operator: 'eq',
value: this.param.taskId
}
}
this.search(this.last_condition)
} }
// this.timer = setInterval(() => { // this.timer = setInterval(() => {
...@@ -155,25 +163,25 @@ export default { ...@@ -155,25 +163,25 @@ export default {
this.timer = null this.timer = null
} }
}, },
msg2Current(routerParam) { // msg2Current(routerParam) {
if (!routerParam || !routerParam.taskId) return // if (!routerParam || !routerParam.taskId) return
const taskId = routerParam.taskId // const taskId = routerParam.taskId
// console.log(taskId) // // console.log(taskId)
const current_condition = { // const current_condition = {
'dataset_table_task.id': { // 'dataset_table_task.id': {
field: 'dataset_table_task.id', // field: 'dataset_table_task.id',
operator: 'eq', // operator: 'eq',
value: taskId // value: taskId
} // }
} // }
// 先把定时器干掉 否则会阻塞下面的search // // 先把定时器干掉 否则会阻塞下面的search
this.destroyTimer() // this.destroyTimer()
this.search(current_condition) // this.search(current_condition)
// 查询完再开启定时器 // // 查询完再开启定时器
this.createTimer() // this.createTimer()
}, // },
sortChange({ column, prop, order }) { sortChange({ column, prop, order }) {
this.orderConditions = [] this.orderConditions = []
if (!order) { if (!order) {
...@@ -209,6 +217,12 @@ export default { ...@@ -209,6 +217,12 @@ export default {
}, },
jumpTask(item) { jumpTask(item) {
this.$emit('jumpTask', item) this.$emit('jumpTask', item)
},
rowClassMethod({ row, rowIndex }) {
if (this.matchLogId && this.matchLogId === row.id) {
return 'row-match-class'
}
return ''
} }
} }
} }
......
...@@ -17,17 +17,14 @@ ...@@ -17,17 +17,14 @@
<script> <script>
import LayoutContent from '@/components/business/LayoutContent' import LayoutContent from '@/components/business/LayoutContent'
import ComplexTable from '@/components/business/complex-table'
import UnionView from '@/views/dataset/data/UnionView'
import UpdateInfo from '@/views/dataset/data/UpdateInfo'
import DatasetTaskList from '@/views/system/task/DatasetTaskList' import DatasetTaskList from '@/views/system/task/DatasetTaskList'
import TaskRecord from '@/views/system/task/TaskRecord' import TaskRecord from '@/views/system/task/TaskRecord'
import TabDataPreview from '@/views/dataset/data/TabDataPreview'
import DatasetTableData from '@/views/dataset/common/DatasetTableData'
import bus from '@/utils/bus' import bus from '@/utils/bus'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
export default { export default {
components: { DatasetTableData, LayoutContent, ComplexTable, UnionView, UpdateInfo, TabDataPreview, DatasetTaskList, TaskRecord }, components: { LayoutContent, DatasetTaskList, TaskRecord },
data() { data() {
return { return {
task: null, task: null,
...@@ -74,9 +71,12 @@ export default { ...@@ -74,9 +71,12 @@ export default {
try { try {
const msgParam = JSON.parse(routerParam.sourceParam) const msgParam = JSON.parse(routerParam.sourceParam)
// this.param = msgParam.tableId // this.param = msgParam.tableId
this.tabActive = 'TaskRecord'
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.task_record && this.$refs.task_record.msg2Current && this.$refs.task_record.msg2Current(msgParam) // 目标组件存在定时器 这种方式会被定时器阻塞
// this.$refs.task_record && this.$refs.task_record.msg2Current && this.$refs.task_record.msg2Current(msgParam)
this.task = msgParam
this.tabActive = 'TaskRecord'
}) })
} catch (error) { } catch (error) {
console.error(error) console.error(error)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论