From d6872d8d0ecd906cf1634f2c8ab5594a81df3f62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E4=BB=BB=E5=B9=B3?= Date: Tue, 15 Dec 2020 16:33:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=AE=9A=E4=B9=89cr?= =?UTF-8?q?on=E8=A1=A8=E8=BE=BE=E5=BC=8F=E8=BE=93=E5=85=A5=E6=A1=86?= =?UTF-8?q?=EF=BC=8C=E4=BE=BF=E4=BA=8E=E7=94=A8=E6=88=B7=E8=87=AA=E8=A1=8C?= =?UTF-8?q?=E6=8B=93=E5=B1=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/TaskForm/Timing.js | 13 ++++++++++--- insight-front-end/src/stores/TaskStore.js | 18 +++++++++++++++++- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/insight-front-end/src/components/TaskForm/Timing.js b/insight-front-end/src/components/TaskForm/Timing.js index ac2c80397..abb89fdae 100644 --- a/insight-front-end/src/components/TaskForm/Timing.js +++ b/insight-front-end/src/components/TaskForm/Timing.js @@ -3,7 +3,7 @@ */ import React from 'react'; import { inject, observer } from 'mobx-react'; -import { Select, Switch } from 'antd'; +import { Select, Switch, Input, Icon, Tooltip } from 'antd'; const { Option } = Select; @@ -42,7 +42,7 @@ class Timing extends React.Component { const { - hourValue, minuteValue, secondValue, weekList, publishCronText, publishIsWorkday, + hourValue, minuteValue, secondValue, weekList, publishCronText, publishIsWorkday, publishIsCustomizeCron, publishCustomizeCron, } = this.props.TaskStore; return ( @@ -88,7 +88,6 @@ class Timing extends React.Component { secondOption.map((item, index) => { return (); }) } -
{weekOption.map((item, index) => { @@ -100,6 +99,14 @@ class Timing extends React.Component { { return this.props.TaskStore.handleSwitchChange('publishIsWorkday', e); }} /> 工作日(智能跳过节假日)
+
+ { return this.props.TaskStore.handleSwitchChange('publishIsCustomizeCron', e); }} /> + 自定义cron表达式 + + + + { return this.props.TaskStore.handleTextChange('publishCustomizeCron', e); }}> +
{publishCronText}
diff --git a/insight-front-end/src/stores/TaskStore.js b/insight-front-end/src/stores/TaskStore.js index d6a723701..b0bb0e9c0 100644 --- a/insight-front-end/src/stores/TaskStore.js +++ b/insight-front-end/src/stores/TaskStore.js @@ -27,6 +27,10 @@ class TaskStore { @observable publishIsWorkday = false // 发布是否是工作日 + @observable publishIsCustomizeCron = false // 发布是否自定义cron表达式 + + @observable publishCustomizeCron = '' // 发布自定义cron表达式 + @observable publishModel = 0 // 发布模式 0: 即时消息 1:定时消息 @observable publishMentionValue = '' // 发布提醒列表字段 @@ -111,6 +115,11 @@ class TaskStore { publishCronText = `每个工作日 ${time} 执行`; } + // 开启自定义cron表达式模式(前端输入自定义cron表达式) + if (this.publishIsCustomizeCron) { + publishCron = this.publishCustomizeCron; + publishCronText = `按自定义cron表达式${publishCron}执行`; + } this.publishCron = publishCron; this.publishCronText = publishCronText; @@ -132,6 +141,8 @@ class TaskStore { this.publishCron = ''; this.publishCronText = ''; this.publishIsWorkday = false; + this.publishIsCustomizeCron = false; + this.publishCustomizeCron = ''; this.publishMentionValue = ''; this.publishTextContent = ''; @@ -172,6 +183,11 @@ class TaskStore { @action handleTextChange = (name, e) => { const content = (e.target.value).trim(); this[name] = content; + + if (name === 'publishCustomizeCron') { + this[name] = e.target.value; + this.getCron(); + } } // 处理通用下拉类数据变化 @@ -190,8 +206,8 @@ class TaskStore { // 更新工作日 则重置星期 if (name === 'publishIsWorkday') { this.weekList = []; - this.getCron(); } + this.getCron(); } }