短信收尾

- 添加修改,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,
type: 'add',
title: '',
sign: {},
});
};

View File

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

View File

@ -1,5 +1,5 @@
import React from 'react';
import { Form, Input, Modal } from 'antd';
import { Form, Input, Modal, Select } from 'antd';
import DictionarySelect from '../../components/Dictionary/DictionarySelect';
import dictionary from '../../utils/dictionary';
@ -9,7 +9,7 @@ import dictionary from '../../utils/dictionary';
* @type {React.ComponentClass<RcBaseFormProps & Omit<FormComponentProps, keyof FormComponentProps>>}
*/
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;
function handleOk(e) {
@ -47,7 +47,15 @@ const SignListModal = Form.create()(props => {
},
],
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 {...formItemLayout} label="类型">
{getFieldDecorator('smsType', {

View File

@ -1,5 +1,5 @@
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;
@ -9,7 +9,7 @@ const FormItem = Form.Item;
* @type {React.ComponentClass<RcBaseFormProps & Omit<FormComponentProps, keyof FormComponentProps>>}
*/
const SignListSearch = Form.create()(props => {
const { handleSearch } = props;
const { handleSearch, signList } = props;
const { getFieldDecorator, validateFields, form } = props.form;
function onSubmit(e) {
@ -37,7 +37,15 @@ const SignListSearch = Form.create()(props => {
</Col>
<Col md={8} sm={24}>
<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>
</Col>
</Row>