From ca0f41c10f57b2c42260efe3a1813144768b8e68 Mon Sep 17 00:00:00 2001 From: Amy0104 <97265214+Amy0104@users.noreply.github.com> Date: Thu, 12 May 2022 15:27:55 +0800 Subject: [PATCH] [Fix][UI] Fix the task name validator error. (#10008) (cherry picked from commit 00f102959b5a07f56cb2d6f8973949cc4eee22b0) --- .../task/components/node/fields/use-dependent.ts | 12 +++++++----- .../src/views/projects/task/components/node/types.ts | 4 +++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-dependent.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-dependent.ts index 1a149484f9..c650a815f0 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-dependent.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-dependent.ts @@ -31,7 +31,8 @@ import type { IJsonItem, IDependpendItem, IDependTask, - ITaskState + ITaskState, + IDateType } from '../types' export function useDependent(model: { [field: string]: any }): IJsonItem[] { @@ -172,7 +173,7 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] { label: t('project.node.last_month_end') } ] - } + } as { [key in IDateType]: { value: string; label: string }[] } const getProjectList = async () => { const result = await queryAllProjectList() @@ -338,8 +339,8 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] { rule: { required: true, trigger: ['input', 'blur'], - validator(validate: any, value: string) { - if (!value) { + validator(validate: any, value: number) { + if (!value && value !== 0) { return Error(t('project.node.task_name_tips')) } } @@ -351,9 +352,10 @@ export function useDependent(model: { [field: string]: any }): IJsonItem[] { span: 10, name: t('project.node.cycle_time'), props: { - onUpdateValue: (value: 'month') => { + onUpdateValue: (value: IDateType) => { model.dependTaskList[i].dependItemList[j].dateOptions = DATE_LSIT[value] + model.dependTaskList[i].dependItemList[j].dateValue = null } }, options: CYCLE_LIST, diff --git a/dolphinscheduler-ui/src/views/projects/task/components/node/types.ts b/dolphinscheduler-ui/src/views/projects/task/components/node/types.ts index 368125f20f..6750d84fc9 100644 --- a/dolphinscheduler-ui/src/views/projects/task/components/node/types.ts +++ b/dolphinscheduler-ui/src/views/projects/task/components/node/types.ts @@ -37,6 +37,7 @@ type SourceType = 'MYSQL' | 'HDFS' | 'HIVE' type ModelType = 'import' | 'export' type RelationType = 'AND' | 'OR' type ITaskType = TaskType +type IDateType = 'hour' | 'day' | 'week' | 'month' interface IOption { label: string @@ -383,5 +384,6 @@ export { IJsonItem, FormRules, IJsonItemParams, - IResponseJsonItem + IResponseJsonItem, + IDateType }