Merge pull request #2937 from dataease/pr@dev_station_msg

Pr@dev station msg
This commit is contained in:
dataeaseShu 2022-08-25 11:26:41 +08:00 committed by GitHub
commit 95dbfd14a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 56 additions and 26 deletions

View File

@ -75,6 +75,7 @@ import day from './cron/day'
import month from './cron/month' import month from './cron/month'
import week from './cron/week' import week from './cron/week'
import year from './cron/year' import year from './cron/year'
import { log } from '@antv/g2plot/lib/utils'
export default { export default {
components: { components: {
SecondAndMinute, hour, day, month, week, year SecondAndMinute, hour, day, month, week, year
@ -82,6 +83,9 @@ export default {
props: { props: {
value: { value: {
type: String type: String
},
isRate: {
type: Boolean,
} }
}, },
data() { data() {
@ -110,6 +114,7 @@ export default {
}] }]
}, },
value_() { value_() {
console.log(9, this.weekVal, this.dVal, this.value)
if (!this.dVal && !this.weekVal) { if (!this.dVal && !this.weekVal) {
return '' return ''
} }
@ -133,12 +138,13 @@ export default {
} }
}, },
watch: { watch: {
'value'(a, b) { value: {
this.updateVal() handler() {
} if (!this.isRate) return;
this.updateVal();
},
immediate: true,
}, },
created() {
this.updateVal()
}, },
methods: { methods: {
updateVal() { updateVal() {

View File

@ -194,8 +194,6 @@ export default {
}); });
}, },
init() { init() {
this.tableName = "";
this.tableId = "";
this.selectDatasetFlag = true; this.selectDatasetFlag = true;
}, },
setIdName() { setIdName() {

View File

@ -1,5 +1,5 @@
<template> <template>
<de-layout-content> <de-layout-content :header="header" backPath="/system/system-task/dataset">
<div class="dataset-editer-form"> <div class="dataset-editer-form">
<div class="w600"> <div class="w600">
<el-form <el-form
@ -41,7 +41,10 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<div class="add-scope-cont" v-if="taskForm.type === 'add_scope'"> <div class="add-scope-cont" v-if="taskForm.type === 'add_scope'">
<el-form-item :label="$t('dataset.incremental_update_type')"> <el-form-item
prop=""
:label="$t('dataset.incremental_update_type')"
>
<el-radio-group <el-radio-group
v-model="incrementalUpdateType" v-model="incrementalUpdateType"
size="small" size="small"
@ -118,10 +121,7 @@
size="small" size="small"
@change="onSimpleCronChange()" @change="onSimpleCronChange()"
> >
<el-option <el-option :label="$t('分钟')" value="minute" />
:label="$t('分钟')"
value="minute"
/>
<el-option :label="$t('小时')" value="hour" /> <el-option :label="$t('小时')" value="hour" />
<el-option :label="$t('天')" value="day" /> <el-option :label="$t('天')" value="day" />
</el-select> </el-select>
@ -130,11 +130,15 @@
</el-form-item> </el-form-item>
<el-form-item <el-form-item
prop="cron" prop="cron"
v-if="taskForm.rate === 'CRON'" v-if="taskForm.rate === 'CRON' && showCron"
:label="$t('emailtask.cron_exp')" :label="$t('emailtask.cron_exp')"
> >
<el-popover v-model="cronEdit"> <el-popover v-model="cronEdit">
<cron v-model="taskForm.cron" @close="cronEdit = false" /> <cron
:isRate="taskForm.rate === 'CRON'"
v-model="taskForm.cron"
@close="cronEdit = false"
/>
<el-input <el-input
slot="reference" slot="reference"
v-model="taskForm.cron" v-model="taskForm.cron"
@ -186,10 +190,10 @@
show-mode="datasetTask" show-mode="datasetTask"
/> />
</div> </div>
<div class="de-foot-layout"> <div v-if="!disableForm" class="de-foot-layout">
<div class="cont"> <div class="cont">
<deBtn secondary @click="closeTask">{{ $t("dataset.cancel") }}</deBtn> <deBtn secondary @click="closeTask">{{ $t("dataset.cancel") }}</deBtn>
<deBtn v-if="!disableForm" type="primary" @click="saveTask(taskForm)">{{ <deBtn type="primary" @click="saveTask(taskForm)">{{
$t("dataset.confirm") $t("dataset.confirm")
}}</deBtn> }}</deBtn>
</div> </div>
@ -223,6 +227,7 @@ import "codemirror/addon/hint/show-hint.css";
import "codemirror/addon/hint/sql-hint"; import "codemirror/addon/hint/sql-hint";
import "codemirror/addon/hint/show-hint"; import "codemirror/addon/hint/show-hint";
import TableSelector from "./TableSelector"; import TableSelector from "./TableSelector";
import { log } from "@antv/g2plot/lib/utils";
export default { export default {
components: { cron, codemirror, TableSelector, DeLayoutContent }, components: { cron, codemirror, TableSelector, DeLayoutContent },
@ -234,6 +239,7 @@ export default {
name: "", name: "",
id: "", id: "",
}, },
showCron: false,
taskForm: { taskForm: {
name: "", name: "",
type: "all_scope", type: "all_scope",
@ -300,6 +306,7 @@ export default {
datasetName: [ datasetName: [
{ {
required: true, required: true,
message: this.$t("数据集必填"),
trigger: "change", trigger: "change",
}, },
], ],
@ -322,6 +329,15 @@ export default {
incrementalUpdateType: "incrementalAdd", incrementalUpdateType: "incrementalAdd",
}; };
}, },
computed: {
header() {
return this.disableForm
? "查看任务"
: this.taskDetail.id
? "编辑任务"
: "添加任务";
},
},
created() { created() {
const { datasetName, id } = this.$route.query; const { datasetName, id } = this.$route.query;
this.taskDetail = { datasetName, id }; this.taskDetail = { datasetName, id };
@ -332,7 +348,7 @@ export default {
getTaskDetail(id) { getTaskDetail(id) {
post(`/dataset/task/detail/${id}`, {}).then((res) => { post(`/dataset/task/detail/${id}`, {}).then((res) => {
if (res.data.extraData) { if (res.data.extraData) {
res.data.extraData = JSON.parse(res.data.extraData) res.data.extraData = JSON.parse(res.data.extraData);
} }
this.taskForm = res.data; this.taskForm = res.data;
this.disableForm = this.disableEdit(); this.disableForm = this.disableEdit();
@ -344,19 +360,24 @@ export default {
}, },
getTableId(id, name) { getTableId(id, name) {
this.taskForm.tableId = id; this.taskForm.tableId = id;
this.taskForm.datasetName = name; this.$set(this.taskForm, "datasetName", name);
}, },
onRateChange() { onRateChange() {
if (this.taskForm.rate === "SIMPLE") { if (this.taskForm.rate === "SIMPLE") {
this.taskForm.end = "0"; this.taskForm.end = "0";
this.taskForm.endTime = ""; this.taskForm.endTime = "";
this.taskForm.cron = ""; this.taskForm.cron = "";
this.showCron = false;
} }
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 * * ? *";
this.showCron = false;
} }
if (this.taskForm.rate === "CRON") { if (this.taskForm.rate === "CRON") {
this.taskForm.cron = "00 00 * ? * * *"; this.taskForm.cron = "00 00 * ? * * *";
this.$nextTick(() => {
this.showCron = true;
});
} }
}, },
disableEdit() { disableEdit() {
@ -540,6 +561,10 @@ export default {
.el-select { .el-select {
width: 140px; width: 140px;
margin-left: 8px; margin-left: 8px;
.el-input__inner {
text-align: left;
}
} }
.el-select { .el-select {
@ -568,6 +593,7 @@ export default {
width: 100%; width: 100%;
border-radius: 4px; border-radius: 4px;
padding: 20px; padding: 20px;
background: #f5f6f7;
.param-title { .param-title {
width: 100%; width: 100%;