短信收尾

- 添加修改,sign 签名下拉选择
- 短信模板 sign 下拉查询
- 添加重置 form 表单
pull/1/head
sin-ning@aliyun.com 2019-05-29 23:30:27 +08:00
parent 780ed5b209
commit 681cd9b2c1
4 changed files with 54 additions and 18 deletions

View File

@ -58,6 +58,7 @@ class SignList extends PureComponent {
visible: true, visible: true,
type: 'add', type: 'add',
title: '', title: '',
sign: {},
}); });
}; };

View File

@ -9,7 +9,8 @@ import styles from '../List/TableList.less';
import TemplateListSearch from './TemplateListSearch'; import TemplateListSearch from './TemplateListSearch';
import TemplateListModal from './TemplateListModal'; import TemplateListModal from './TemplateListModal';
@connect(({ smsTemplateList, loading }) => ({ @connect(({ smsSignList, smsTemplateList, loading }) => ({
smsSignList,
smsTemplateList, smsTemplateList,
loading: loading.models.smsTemplateList, loading: loading.models.smsTemplateList,
})) }))
@ -19,7 +20,7 @@ class TemplateList extends PureComponent {
title: '', // 添加签名 修改签名 title: '', // 添加签名 修改签名
type: 'add', // add update type: 'add', // add update
id: '', id: '',
sign: {}, template: {},
}; };
componentDidMount() { componentDidMount() {
@ -31,8 +32,24 @@ class TemplateList extends PureComponent {
// 查询 page // 查询 page
this.queryPage(); this.queryPage();
// 查询 sign 用于 signList
this.querySignList();
} }
querySignList = () => {
const { dispatch } = this.props;
dispatch({
type: 'smsSignList/page',
payload: {
current: 1,
total: 0,
size: 100,
// ...searchParams,
},
});
};
queryPage = () => { queryPage = () => {
const { dispatch } = this.props; const { dispatch } = this.props;
const { current, total, size, searchParams } = this; const { current, total, size, searchParams } = this;
@ -58,25 +75,26 @@ class TemplateList extends PureComponent {
visible: true, visible: true,
type: 'add', type: 'add',
title: '', title: '',
template: {},
}); });
}; };
handleUpdateShow = sign => { handleUpdateShow = template => {
const { id } = sign; const { id } = template;
this.setState({ this.setState({
visible: true, visible: true,
type: 'update', type: 'update',
title: '', title: '',
id, id,
sign, template,
}); });
}; };
handleDeleted = ({ id, sign }) => { handleDeleted = ({ id, template }) => {
const { dispatch } = this.props; const { dispatch } = this.props;
Modal.confirm({ Modal.confirm({
title: ``, title: ``,
content: ` ${sign} `, content: ` ${template} `,
okText: '', okText: '',
cancelText: '', cancelText: '',
onOk: () => { onOk: () => {
@ -147,9 +165,9 @@ class TemplateList extends PureComponent {
render() { render() {
// props // props
const { loading, smsTemplateList } = this.props; const { loading, smsTemplateList, smsSignList } = this.props;
const { list, total, index, size } = smsTemplateList; const { list, total, index, size } = smsTemplateList;
const { visible, title, type, sign } = this.state; const { visible, title, type, template } = this.state;
const columns = [ const columns = [
{ {
@ -167,7 +185,7 @@ class TemplateList extends PureComponent {
}, },
}, },
{ {
title: '', title: '',
dataIndex: 'template', dataIndex: 'template',
key: 'template', key: 'template',
}, },
@ -237,7 +255,7 @@ class TemplateList extends PureComponent {
<PageHeaderWrapper> <PageHeaderWrapper>
<Card> <Card>
<div className={styles.tableListForm}> <div className={styles.tableListForm}>
<TemplateListSearch handleSearch={this.handleSearch} /> <TemplateListSearch signList={smsSignList.list} handleSearch={this.handleSearch} />
</div> </div>
<br /> <br />
<div> <div>
@ -258,7 +276,8 @@ class TemplateList extends PureComponent {
</Card> </Card>
<TemplateListModal <TemplateListModal
initData={sign} initData={template}
signList={smsSignList.list}
title={title} title={title}
visible={visible} visible={visible}
type={type} type={type}

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { Form, Input, Modal } from 'antd'; import { Form, Input, Modal, Select } from 'antd';
import DictionarySelect from '../../components/Dictionary/DictionarySelect'; import DictionarySelect from '../../components/Dictionary/DictionarySelect';
import dictionary from '../../utils/dictionary'; import dictionary from '../../utils/dictionary';
@ -9,7 +9,7 @@ import dictionary from '../../utils/dictionary';
* @type {React.ComponentClass<RcBaseFormProps & Omit<FormComponentProps, keyof FormComponentProps>>} * @type {React.ComponentClass<RcBaseFormProps & Omit<FormComponentProps, keyof FormComponentProps>>}
*/ */
const SignListModal = Form.create()(props => { const SignListModal = Form.create()(props => {
const { onOk, onCancel, visible, title, form, initData = {} } = props; const { onOk, onCancel, visible, title, form, signList, initData = {} } = props;
const { getFieldDecorator, validateFields } = props.form; const { getFieldDecorator, validateFields } = props.form;
function handleOk(e) { function handleOk(e) {
@ -47,7 +47,15 @@ const SignListModal = Form.create()(props => {
}, },
], ],
initialValue: initData.sign ? initData.sign.id : null, initialValue: initData.sign ? initData.sign.id : null,
})(<Input placeholder="请输入签名" />)} })(
<Select>
{signList.map(item => (
<Select.Option key={item.id} value={item.id}>
{item.sign}
</Select.Option>
))}
</Select>
)}
</Form.Item> </Form.Item>
<Form.Item {...formItemLayout} label="类型"> <Form.Item {...formItemLayout} label="类型">
{getFieldDecorator('smsType', { {getFieldDecorator('smsType', {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { Button, Col, Form, Input, Row } from 'antd'; import { Button, Col, Form, Input, Row, Select } from 'antd';
const FormItem = Form.Item; const FormItem = Form.Item;
@ -9,7 +9,7 @@ const FormItem = Form.Item;
* @type {React.ComponentClass<RcBaseFormProps & Omit<FormComponentProps, keyof FormComponentProps>>} * @type {React.ComponentClass<RcBaseFormProps & Omit<FormComponentProps, keyof FormComponentProps>>}
*/ */
const SignListSearch = Form.create()(props => { const SignListSearch = Form.create()(props => {
const { handleSearch } = props; const { handleSearch, signList } = props;
const { getFieldDecorator, validateFields, form } = props.form; const { getFieldDecorator, validateFields, form } = props.form;
function onSubmit(e) { function onSubmit(e) {
@ -37,7 +37,15 @@ const SignListSearch = Form.create()(props => {
</Col> </Col>
<Col md={8} sm={24}> <Col md={8} sm={24}>
<FormItem label="签名"> <FormItem label="签名">
{getFieldDecorator('smsSignId')(<Input placeholder="请输入签名" />)} {getFieldDecorator('smsSignId')(
<Select>
{signList.map(item => (
<Select.Option key={item.id} value={item.id}>
{item.sign}
</Select.Option>
))}
</Select>
)}
</FormItem> </FormItem>
</Col> </Col>
</Row> </Row>