diff --git a/spug_web/src/pages/deploy/app/AddSelect.js b/spug_web/src/pages/deploy/app/AddSelect.js index df27540..cafbc21 100644 --- a/spug_web/src/pages/deploy/app/AddSelect.js +++ b/spug_web/src/pages/deploy/app/AddSelect.js @@ -24,6 +24,7 @@ class AddSelect extends React.Component { store.record = { is_audit: false, host_ids: [undefined], + actions: [{}] } }; diff --git a/spug_web/src/pages/deploy/app/Ext2Setup3.js b/spug_web/src/pages/deploy/app/Ext2Setup3.js index 12ea593..cdd3049 100644 --- a/spug_web/src/pages/deploy/app/Ext2Setup3.js +++ b/spug_web/src/pages/deploy/app/Ext2Setup3.js @@ -19,7 +19,8 @@ class Ext2Setup3 extends React.Component { handleSubmit = () => { this.setState({loading: true}); - http.post('/api/app/', {extend: '2', actions: store.actions}) + store.record['extend'] = '2'; + http.post('/api/app/', store.record) .then(res => { message.success('保存成功'); store.ext2Visible = false; @@ -28,9 +29,10 @@ class Ext2Setup3 extends React.Component { }; render() { + const actions = store.record['actions']; return (
- {store.actions.map((item, index) => ( + {actions.map((item, index) => (
item['title'] = e.target.value} placeholder="请输入"/> @@ -45,21 +47,21 @@ class Ext2Setup3 extends React.Component { onChange={v => item['data'] = v} placeholder="请输入要执行的动作"/> - {store.actions.length > 1 && ( -
store.actions.splice(index, 1)}> 1 && ( +
actions.splice(index, 1)}>移除
)}
))} - diff --git a/spug_web/src/pages/deploy/app/store.js b/spug_web/src/pages/deploy/app/store.js index 815bf0c..1afb180 100644 --- a/spug_web/src/pages/deploy/app/store.js +++ b/spug_web/src/pages/deploy/app/store.js @@ -4,7 +4,6 @@ import http from 'libs/http'; class Store { @observable records = []; @observable record = {}; - @observable actions = [{}]; @observable page = 0; @observable isFetching = false; @observable addVisible = false;