From ed587a4286c7f786913e9c39d18727548090d063 Mon Sep 17 00:00:00 2001 From: dataeaseShu <106045316+dataeaseShu@users.noreply.github.com> Date: Thu, 25 Aug 2022 11:22:02 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BB=BB=E5=8A=A1=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/cron/cron.vue | 18 ++++-- .../src/views/system/task/TableSelector.vue | 2 - frontend/src/views/system/task/form.vue | 62 +++++++++++++------ 3 files changed, 56 insertions(+), 26 deletions(-) diff --git a/frontend/src/components/cron/cron.vue b/frontend/src/components/cron/cron.vue index 56e9df57cc..9a740e7fc2 100644 --- a/frontend/src/components/cron/cron.vue +++ b/frontend/src/components/cron/cron.vue @@ -75,6 +75,7 @@ import day from './cron/day' import month from './cron/month' import week from './cron/week' import year from './cron/year' +import { log } from '@antv/g2plot/lib/utils' export default { components: { SecondAndMinute, hour, day, month, week, year @@ -82,6 +83,9 @@ export default { props: { value: { type: String + }, + isRate: { + type: Boolean, } }, data() { @@ -110,6 +114,7 @@ export default { }] }, value_() { + console.log(9, this.weekVal, this.dVal, this.value) if (!this.dVal && !this.weekVal) { return '' } @@ -133,12 +138,13 @@ export default { } }, watch: { - 'value'(a, b) { - this.updateVal() - } - }, - created() { - this.updateVal() + value: { + handler() { + if (!this.isRate) return; + this.updateVal(); + }, + immediate: true, + }, }, methods: { updateVal() { diff --git a/frontend/src/views/system/task/TableSelector.vue b/frontend/src/views/system/task/TableSelector.vue index d073dc7b03..ae94be6a74 100644 --- a/frontend/src/views/system/task/TableSelector.vue +++ b/frontend/src/views/system/task/TableSelector.vue @@ -194,8 +194,6 @@ export default { }); }, init() { - this.tableName = ""; - this.tableId = ""; this.selectDatasetFlag = true; }, setIdName() { diff --git a/frontend/src/views/system/task/form.vue b/frontend/src/views/system/task/form.vue index 16f66addfb..84494311cd 100644 --- a/frontend/src/views/system/task/form.vue +++ b/frontend/src/views/system/task/form.vue @@ -1,5 +1,5 @@ @@ -223,6 +227,7 @@ import "codemirror/addon/hint/show-hint.css"; import "codemirror/addon/hint/sql-hint"; import "codemirror/addon/hint/show-hint"; import TableSelector from "./TableSelector"; +import { log } from "@antv/g2plot/lib/utils"; export default { components: { cron, codemirror, TableSelector, DeLayoutContent }, @@ -234,6 +239,7 @@ export default { name: "", id: "", }, + showCron: false, taskForm: { name: "", type: "all_scope", @@ -300,6 +306,7 @@ export default { datasetName: [ { required: true, + message: this.$t("数据集必填"), trigger: "change", }, ], @@ -322,6 +329,15 @@ export default { incrementalUpdateType: "incrementalAdd", }; }, + computed: { + header() { + return this.disableForm + ? "查看任务" + : this.taskDetail.id + ? "编辑任务" + : "添加任务"; + }, + }, created() { const { datasetName, id } = this.$route.query; this.taskDetail = { datasetName, id }; @@ -331,8 +347,8 @@ export default { methods: { getTaskDetail(id) { post(`/dataset/task/detail/${id}`, {}).then((res) => { - if(res.data.extraData) { - res.data.extraData = JSON.parse(res.data.extraData) + if (res.data.extraData) { + res.data.extraData = JSON.parse(res.data.extraData); } this.taskForm = res.data; this.disableForm = this.disableEdit(); @@ -344,19 +360,24 @@ export default { }, getTableId(id, name) { this.taskForm.tableId = id; - this.taskForm.datasetName = name; + this.$set(this.taskForm, "datasetName", name); }, onRateChange() { if (this.taskForm.rate === "SIMPLE") { this.taskForm.end = "0"; this.taskForm.endTime = ""; this.taskForm.cron = ""; + this.showCron = false; } if (this.taskForm.rate === "SIMPLE_CRON") { this.taskForm.cron = "0 0 0/1 * * ? *"; + this.showCron = false; } if (this.taskForm.rate === "CRON") { this.taskForm.cron = "00 00 * ? * * *"; + this.$nextTick(() => { + this.showCron = true; + }); } }, disableEdit() { @@ -540,6 +561,10 @@ export default { .el-select { width: 140px; margin-left: 8px; + + .el-input__inner { + text-align: left; + } } .el-select { @@ -568,6 +593,7 @@ export default { width: 100%; border-radius: 4px; padding: 20px; + background: #f5f6f7; .param-title { width: 100%; From 4c31d9a6bd670a06703bcd90f283b07b00eb1def Mon Sep 17 00:00:00 2001 From: dataeaseShu <106045316+dataeaseShu@users.noreply.github.com> Date: Thu, 25 Aug 2022 11:22:02 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E4=BB=BB=E5=8A=A1=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/cron/cron.vue | 18 ++++-- .../src/views/system/task/TableSelector.vue | 2 - frontend/src/views/system/task/form.vue | 62 +++++++++++++------ 3 files changed, 56 insertions(+), 26 deletions(-) diff --git a/frontend/src/components/cron/cron.vue b/frontend/src/components/cron/cron.vue index 56e9df57cc..9a740e7fc2 100644 --- a/frontend/src/components/cron/cron.vue +++ b/frontend/src/components/cron/cron.vue @@ -75,6 +75,7 @@ import day from './cron/day' import month from './cron/month' import week from './cron/week' import year from './cron/year' +import { log } from '@antv/g2plot/lib/utils' export default { components: { SecondAndMinute, hour, day, month, week, year @@ -82,6 +83,9 @@ export default { props: { value: { type: String + }, + isRate: { + type: Boolean, } }, data() { @@ -110,6 +114,7 @@ export default { }] }, value_() { + console.log(9, this.weekVal, this.dVal, this.value) if (!this.dVal && !this.weekVal) { return '' } @@ -133,12 +138,13 @@ export default { } }, watch: { - 'value'(a, b) { - this.updateVal() - } - }, - created() { - this.updateVal() + value: { + handler() { + if (!this.isRate) return; + this.updateVal(); + }, + immediate: true, + }, }, methods: { updateVal() { diff --git a/frontend/src/views/system/task/TableSelector.vue b/frontend/src/views/system/task/TableSelector.vue index d073dc7b03..ae94be6a74 100644 --- a/frontend/src/views/system/task/TableSelector.vue +++ b/frontend/src/views/system/task/TableSelector.vue @@ -194,8 +194,6 @@ export default { }); }, init() { - this.tableName = ""; - this.tableId = ""; this.selectDatasetFlag = true; }, setIdName() { diff --git a/frontend/src/views/system/task/form.vue b/frontend/src/views/system/task/form.vue index 16f66addfb..84494311cd 100644 --- a/frontend/src/views/system/task/form.vue +++ b/frontend/src/views/system/task/form.vue @@ -1,5 +1,5 @@ @@ -223,6 +227,7 @@ import "codemirror/addon/hint/show-hint.css"; import "codemirror/addon/hint/sql-hint"; import "codemirror/addon/hint/show-hint"; import TableSelector from "./TableSelector"; +import { log } from "@antv/g2plot/lib/utils"; export default { components: { cron, codemirror, TableSelector, DeLayoutContent }, @@ -234,6 +239,7 @@ export default { name: "", id: "", }, + showCron: false, taskForm: { name: "", type: "all_scope", @@ -300,6 +306,7 @@ export default { datasetName: [ { required: true, + message: this.$t("数据集必填"), trigger: "change", }, ], @@ -322,6 +329,15 @@ export default { incrementalUpdateType: "incrementalAdd", }; }, + computed: { + header() { + return this.disableForm + ? "查看任务" + : this.taskDetail.id + ? "编辑任务" + : "添加任务"; + }, + }, created() { const { datasetName, id } = this.$route.query; this.taskDetail = { datasetName, id }; @@ -331,8 +347,8 @@ export default { methods: { getTaskDetail(id) { post(`/dataset/task/detail/${id}`, {}).then((res) => { - if(res.data.extraData) { - res.data.extraData = JSON.parse(res.data.extraData) + if (res.data.extraData) { + res.data.extraData = JSON.parse(res.data.extraData); } this.taskForm = res.data; this.disableForm = this.disableEdit(); @@ -344,19 +360,24 @@ export default { }, getTableId(id, name) { this.taskForm.tableId = id; - this.taskForm.datasetName = name; + this.$set(this.taskForm, "datasetName", name); }, onRateChange() { if (this.taskForm.rate === "SIMPLE") { this.taskForm.end = "0"; this.taskForm.endTime = ""; this.taskForm.cron = ""; + this.showCron = false; } if (this.taskForm.rate === "SIMPLE_CRON") { this.taskForm.cron = "0 0 0/1 * * ? *"; + this.showCron = false; } if (this.taskForm.rate === "CRON") { this.taskForm.cron = "00 00 * ? * * *"; + this.$nextTick(() => { + this.showCron = true; + }); } }, disableEdit() { @@ -540,6 +561,10 @@ export default { .el-select { width: 140px; margin-left: 8px; + + .el-input__inner { + text-align: left; + } } .el-select { @@ -568,6 +593,7 @@ export default { width: 100%; border-radius: 4px; padding: 20px; + background: #f5f6f7; .param-title { width: 100%;