From 34616970ca3ea71673fe8dde30f7de7bac2851bd Mon Sep 17 00:00:00 2001 From: vapao Date: Sun, 15 May 2022 15:09:07 +0800 Subject: [PATCH] F fix issue --- spug_web/src/pages/schedule/Step1.js | 20 +++++++++++++++----- spug_web/src/pages/schedule/store.js | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/spug_web/src/pages/schedule/Step1.js b/spug_web/src/pages/schedule/Step1.js index 368a18f..516533c 100644 --- a/spug_web/src/pages/schedule/Step1.js +++ b/spug_web/src/pages/schedule/Step1.js @@ -11,7 +11,6 @@ export default observer(function () { const [form] = Form.useForm(); const [showTmp, setShowTmp] = useState(false); const [command, setCommand] = useState(store.record.command || ''); - const [interpreter, setInterpreter] = useState(store.record.interpreter || 'sh'); function handleAddZone() { let type; @@ -44,6 +43,12 @@ export default observer(function () { Object.assign(store.record, form.getFieldsValue(), {command: cleanCommand(command)}) } + function handleSelect(tpl) { + const {interpreter, body} = tpl; + setCommand(body) + form.setFieldsValue({interpreter}) + } + let modePlaceholder; switch (store.record.rst_notify.mode) { case '0': @@ -80,13 +85,18 @@ export default observer(function () { setShowTmp(true)}>从模板添加}> - - setInterpreter(e.target.value)}> + + Shell Python - + + {({getFieldValue}) => ( + + )} + @@ -116,7 +126,7 @@ export default observer(function () { {() => } - {showTmp && setCommand(body)} onCancel={() => setShowTmp(false)}/>} + {showTmp && setShowTmp(false)}/>} ) }) \ No newline at end of file diff --git a/spug_web/src/pages/schedule/store.js b/spug_web/src/pages/schedule/store.js index d90910c..cd4c864 100644 --- a/spug_web/src/pages/schedule/store.js +++ b/spug_web/src/pages/schedule/store.js @@ -56,7 +56,7 @@ class Store { showForm = (info) => { this.page = 0; - this.record = info || {rst_notify: {mode: '0'}, trigger: 'interval'}; + this.record = info || {interpreter: 'sh', rst_notify: {mode: '0'}, trigger: 'interval'}; this.formVisible = true };