parent
c3206ec5f4
commit
5c68383abb
@ -0,0 +1,56 @@
|
||||
import { pageTemplate, addTemplate, updateTemplate, deletedTemplate } from '../../services/sms';
|
||||
|
||||
export default {
|
||||
namespace: 'smsTemplateList',
|
||||
|
||||
state: {
|
||||
list: [],
|
||||
},
|
||||
|
||||
effects: {
|
||||
*page({ payload }, { call, put }) {
|
||||
const response = yield call(pageTemplate, payload);
|
||||
if (response.code === 0) {
|
||||
yield put({
|
||||
type: 'pageSuccess',
|
||||
payload: response.data,
|
||||
});
|
||||
}
|
||||
},
|
||||
*add({ payload }, { call }) {
|
||||
const { params, callback } = payload;
|
||||
const response = yield call(addTemplate, params);
|
||||
if (response.code === 0) {
|
||||
if (callback) {
|
||||
callback(response);
|
||||
}
|
||||
}
|
||||
},
|
||||
*update({ payload }, { call }) {
|
||||
const { params, callback } = payload;
|
||||
const response = yield call(updateTemplate, params);
|
||||
if (response.code === 0) {
|
||||
if (callback) {
|
||||
callback(response);
|
||||
}
|
||||
}
|
||||
},
|
||||
*deleted({ payload }, { call }) {
|
||||
const { params, callback } = payload;
|
||||
const response = yield call(deletedTemplate, params);
|
||||
if (callback) {
|
||||
callback(response);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
reducers: {
|
||||
pageSuccess(state, { payload }) {
|
||||
const { data } = payload;
|
||||
return {
|
||||
...state,
|
||||
list: data,
|
||||
};
|
||||
},
|
||||
},
|
||||
};
|
||||
@ -0,0 +1,101 @@
|
||||
import React from 'react';
|
||||
import { Form, Input, Modal } from 'antd';
|
||||
import DictionarySelect from '../../components/Dictionary/DictionarySelect';
|
||||
import dictionary from '../../utils/dictionary';
|
||||
|
||||
/**
|
||||
* table 查询
|
||||
*
|
||||
* @type {React.ComponentClass<RcBaseFormProps & Omit<FormComponentProps, keyof FormComponentProps>>}
|
||||
*/
|
||||
const SignListModal = Form.create()(props => {
|
||||
const { onOk, onCancel, visible, title, form, initData = {} } = props;
|
||||
const { getFieldDecorator, validateFields } = props.form;
|
||||
|
||||
function handleOk(e) {
|
||||
e.preventDefault();
|
||||
|
||||
validateFields((err, fields) => {
|
||||
const searchParams = fields;
|
||||
if (onOk) {
|
||||
onOk(searchParams);
|
||||
form.resetFields();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function handleCancel() {
|
||||
if (onCancel) {
|
||||
onCancel();
|
||||
}
|
||||
}
|
||||
|
||||
const formItemLayout = {
|
||||
labelCol: { span: 4 },
|
||||
wrapperCol: { span: 18 },
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal title={title} visible={visible} onOk={handleOk} onCancel={handleCancel}>
|
||||
<Form>
|
||||
<Form.Item {...formItemLayout} label="签名">
|
||||
{getFieldDecorator('smsSignId', {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入签名',
|
||||
},
|
||||
],
|
||||
initialValue: initData.sign ? initData.sign.id : null,
|
||||
})(<Input placeholder="请输入签名" />)}
|
||||
</Form.Item>
|
||||
<Form.Item {...formItemLayout} label="类型">
|
||||
{getFieldDecorator('smsType', {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择短信类型',
|
||||
},
|
||||
],
|
||||
initialValue: initData.smsType,
|
||||
})(<DictionarySelect placeholder="请选择短信类型" dicKey={dictionary.SMS_TYPE} />)}
|
||||
</Form.Item>
|
||||
<Form.Item {...formItemLayout} label="平台">
|
||||
{getFieldDecorator('platform', {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择平台',
|
||||
},
|
||||
],
|
||||
initialValue: initData.platform,
|
||||
})(<DictionarySelect placeholder="请选择平台" dicKey={dictionary.SMS_PLATFORM} />)}
|
||||
</Form.Item>
|
||||
<Form.Item {...formItemLayout} label="模板Code">
|
||||
{getFieldDecorator('templateCode', {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '短信平台的Code',
|
||||
},
|
||||
],
|
||||
initialValue: initData.templateCode,
|
||||
})(<Input placeholder="第三方平台Code" />)}
|
||||
</Form.Item>
|
||||
<Form.Item {...formItemLayout} label="模板">
|
||||
{getFieldDecorator('template', {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入短信模板',
|
||||
},
|
||||
],
|
||||
initialValue: initData.template,
|
||||
})(<Input.TextArea placeholder="请输入模板" rows={4} />)}
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Modal>
|
||||
);
|
||||
});
|
||||
|
||||
export default SignListModal;
|
||||
@ -0,0 +1,61 @@
|
||||
import React from 'react';
|
||||
import { Button, Col, Form, Input, Row } from 'antd';
|
||||
|
||||
const FormItem = Form.Item;
|
||||
|
||||
/**
|
||||
* table 查询
|
||||
*
|
||||
* @type {React.ComponentClass<RcBaseFormProps & Omit<FormComponentProps, keyof FormComponentProps>>}
|
||||
*/
|
||||
const SignListSearch = Form.create()(props => {
|
||||
const { handleSearch } = props;
|
||||
const { getFieldDecorator, validateFields, form } = props.form;
|
||||
|
||||
function onSubmit(e) {
|
||||
e.preventDefault();
|
||||
|
||||
validateFields((err, fields) => {
|
||||
const searchParams = fields;
|
||||
if (handleSearch) {
|
||||
handleSearch(searchParams);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function handleFormReset() {
|
||||
form.resetFields();
|
||||
}
|
||||
|
||||
return (
|
||||
<Form onSubmit={onSubmit} layout="inline">
|
||||
<Row gutter={{ md: 8, lg: 24, xl: 48 }}>
|
||||
<Col md={8} sm={24}>
|
||||
<FormItem label="编号">
|
||||
{getFieldDecorator('id')(<Input placeholder="请输入ID" />)}
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col md={8} sm={24}>
|
||||
<FormItem label="签名">
|
||||
{getFieldDecorator('smsSignId')(<Input placeholder="请输入签名" />)}
|
||||
</FormItem>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<Row gutter={{ md: 8, lg: 24, xl: 48 }}>
|
||||
<Col md={8} sm={24}>
|
||||
<span>
|
||||
<Button type="primary" htmlType="submit">
|
||||
查询
|
||||
</Button>
|
||||
<Button style={{ marginLeft: 8 }} onClick={handleFormReset}>
|
||||
重置
|
||||
</Button>
|
||||
</span>
|
||||
</Col>
|
||||
</Row>
|
||||
</Form>
|
||||
);
|
||||
});
|
||||
|
||||
export default SignListSearch;
|
||||
Loading…
Reference in new issue