From 9c4a9bf24c562ee17b6d8345156311058291c433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E4=BA=8C=E7=8C=9B?= Date: Fri, 29 Nov 2019 19:43:53 +0800 Subject: [PATCH] A web fix --- spug_web/src/pages/schedule/Form.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/spug_web/src/pages/schedule/Form.js b/spug_web/src/pages/schedule/Form.js index 41e2db6..75a92b5 100644 --- a/spug_web/src/pages/schedule/Form.js +++ b/spug_web/src/pages/schedule/Form.js @@ -13,6 +13,7 @@ import moment from 'moment'; class ComForm extends React.Component { constructor(props) { super(props); + this.isFirstRender = true; this.state = { loading: false, type: null, @@ -85,9 +86,13 @@ class ComForm extends React.Component { verifyButtonStatus = () => { const data = this.props.form.getFieldsValue(); - const b1 = data['type'] && data['name'] && this.state.command; + let b1 = data['type'] && data['name'] && this.state.command; const b2 = store.targets.filter(x => x).length > 0; const b3 = this.state.args[data['trigger']]; + if (!b1 && this.isFirstRender && store.record.id) { + this.isFirstRender = false; + b1 = true + } return [b1, b2, b3]; }; @@ -229,7 +234,7 @@ class ComForm extends React.Component { {showTmp && this.setState({command})} - onCancel={() => this.setState({showTmp: false})} />} + onCancel={() => this.setState({showTmp: false})}/>} ) }