diff --git a/spug_web/src/pages/deploy/request/Ext2Form.js b/spug_web/src/pages/deploy/request/Ext2Form.js
new file mode 100644
index 0000000..a7b159d
--- /dev/null
+++ b/spug_web/src/pages/deploy/request/Ext2Form.js
@@ -0,0 +1,84 @@
+import React from 'react';
+import { observer } from 'mobx-react';
+import { Modal, Form, Input, Tag, message } from 'antd';
+import hostStore from 'pages/host/store';
+import http from 'libs/http';
+import store from './store';
+import lds from 'lodash';
+
+@observer
+class Ext2Form extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ loading: false,
+ type: null,
+ host_ids: store.record['host_ids'].concat()
+ }
+ }
+
+ handleSubmit = () => {
+ if (this.state.host_ids.length === 0) {
+ return message.error('请至少选择一个要发布的目标主机')
+ }
+ this.setState({loading: true});
+ const formData = this.props.form.getFieldsValue();
+ formData['id'] = store.record.id;
+ formData['body'] = this.state.body;
+ http.post('/api/exec/template/', formData)
+ .then(res => {
+ message.success('操作成功');
+ store.formVisible = false;
+ store.fetchRecords()
+ }, () => this.setState({loading: false}))
+ };
+
+ handleChange = (id, v) => {
+ const host_ids = this.state.host_ids;
+ const index = host_ids.indexOf(id);
+ if (index === -1) {
+ this.setState({host_ids: [id, ...host_ids]})
+ } else {
+ host_ids.splice(index, 1);
+ this.setState({host_ids})
+ }
+ };
+
+ render() {
+ const info = store.record;
+ const {host_ids} = this.state;
+ const {getFieldDecorator} = this.props.form;
+ return (
+ store.ext2Visible = false}
+ confirmLoading={this.state.loading}
+ onOk={this.handleSubmit}>
+
+ {getFieldDecorator('name', {initialValue: info['name']})(
+
+ )}
+
+
+ {getFieldDecorator('desc', {initialValue: info['desc']})(
+
+ )}
+
+
+ {info['host_ids'].map(id => (
+ this.handleChange(id, v)}>
+ {lds.get(hostStore.idMap, `${id}.name`)}({lds.get(hostStore.idMap, `${id}.hostname`)}:{lds.get(hostStore.idMap, `${id}.port`)})
+
+ ))}
+
+
+
+ )
+ }
+}
+
+export default Form.create()(Ext2Form)
\ No newline at end of file
diff --git a/spug_web/src/pages/deploy/request/SelectApp.js b/spug_web/src/pages/deploy/request/SelectApp.js
index d30da5e..093dea1 100644
--- a/spug_web/src/pages/deploy/request/SelectApp.js
+++ b/spug_web/src/pages/deploy/request/SelectApp.js
@@ -44,6 +44,7 @@ class SelectApp extends React.Component {
} else {
store.ext2Visible = true
}
+ store.addVisible = false
};
render() {
diff --git a/spug_web/src/pages/deploy/request/index.js b/spug_web/src/pages/deploy/request/index.js
index f991a81..e7b77de 100644
--- a/spug_web/src/pages/deploy/request/index.js
+++ b/spug_web/src/pages/deploy/request/index.js
@@ -4,6 +4,7 @@ import { Card, Input, Select, Button } from 'antd';
import { SearchForm } from 'components';
import SelectApp from './SelectApp';
import Ext1Form from './Ext1Form';
+import Ext2Form from './Ext2Form';
import ComTable from './Table';
import store from './store';
@@ -31,6 +32,7 @@ export default observer(function () {
{store.addVisible && }
{store.ext1Visible && }
+ {store.ext2Visible && }
)
})
\ No newline at end of file