Commit db608237 authored by 皮倩雯's avatar 皮倩雯

解决消息平台推送毛板配置编辑模态显示信息错误问题

parent ef05c932
Pipeline #38628 skipped with stages
......@@ -64,7 +64,7 @@ const AddModal = props => {
title="模板添加"
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: 200, borderRadius: '20px' }}
width="800px"
width="820px"
destroyOnClose
cancelText="取消"
okText="确认"
......@@ -233,12 +233,6 @@ const AddModal = props => {
label="解析规则"
name="analysis_params"
labelCol={{ span: 6 }}
rules={[
{
required: true,
message: '请输入解析规则',
},
]}
>
<TextArea rows={2} style={{ width: '96%' }} placeholder="param1|param2|param3|param4" />
</Item>
......
......@@ -6,15 +6,15 @@ import { Form, Input, notification, Select, Row, Col } from 'antd'
const { Item } = Form;
const { TextArea } = Input;
const EditModal = props => {
const { option } = props;
const { option, visible } = props;
const [form] = Form.useForm();
const [templateName, setTemplateName] = useState([]);
const [loading, setLoading] = useState(false);
const [flag, setFlag] = useState(0)
const onSubmit = () => {
form.submit()
}
const onSubmitSuccess = () => {
const result = form.getFieldValue()
......@@ -22,20 +22,36 @@ const EditModal = props => {
}
useEffect(() => {
// console.log(props)
// if(props.template.type=='企业微信'){
// form.setFieldsValue({type:'企业微信'})
// }
// let aa
// if(props.template.third_id==null){
// aa=props.template.weixin
// }
// if(props.template.weixin==null){
// aa=props.template.third_id
// }
form.setFieldsValue({
name: props.template.name,
type: props.template.type,
third_name: props.template.third_name,
third_id: props.template.third_id || props.template.weixin,
third_id: props.template.third_id,
weixin:props.template.weixin,
params: props.template.template_params1,
param1: props.template.template_params2,
desc: props.template.desc,
analysis_params: props.template.analysis_params,
})
console.log(form.getFieldsValue().type)
if (option) {
setTemplateName(option.filter(item => item.Type === props.template.type))
}
}, [props.template])
const layout = {
......@@ -65,13 +81,14 @@ const EditModal = props => {
third_id: value
})
}
return (
<SiteModal
{...props}
title="模板编辑"
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: 200, borderRadius: '20px' }}
width="800px"
width="820px"
destroyOnClose
cancelText="取消"
okText="确认"
......@@ -114,9 +131,7 @@ const EditModal = props => {
</Item>
</Col>
</Row>
{form.getFieldsValue().type !== '企业微信' ?
{form.getFieldsValue().type == '企业微信'||props.template.type=='企业微信' ?
<>
<Row gutter={24}>
<Col span={11}>
......@@ -130,39 +145,33 @@ const EditModal = props => {
},
]}
>
<Select
placeholder="请选择模板名称"
onChange={(value, option) => onChange(value, option)}
>
{templateName &&
templateName.length > 0 &&
templateName.map((item, index) => (
<Option value={item.Name} key={item.Name + index} code={item.Code}>
{item.Name}
</Option>
))}
<Select style={{ width: '11.5rem' }} onChange={(value) => onChangeType1(value)} placeholder="请选择模板名称" >
<Select.Option value="普通文本">普通文本</Select.Option>
<Select.Option value="文字卡片">文字卡片</Select.Option>
<Select.Option value="图片消息">图片消息</Select.Option>
<Select.Option value="图片">图片</Select.Option>
</Select>
</Item>
</Col>
<Col span={11}>
<Item
label="第三方模板编号"
name="third_id"
label="企业微信应用id"
// labelCol={{ span: 11 }}
name="weixin"
rules={[
{
required: true,
message: '请输入第三方模板编号',
message: '请输入企业微信号',
},
]}
>
<Input placeholder="请输入模板名称" />
<Input placeholder="请输入企业微信号" />
</Item>
</Col>
</Row>
</> :
<>
<Row gutter={24}>
<Row gutter={24}>
<Col span={11}>
<Item
label="第三方模板名称"
......@@ -174,30 +183,37 @@ const EditModal = props => {
},
]}
>
<Select style={{ width: '12rem' }} onChange={(value) => onChangeType1(value)} placeholder="请选择模板名称" >
<Select.Option value="普通文本">普通文本</Select.Option>
<Select.Option value="文字卡片">文字卡片</Select.Option>
<Select.Option value="图片消息">图片消息</Select.Option>
<Select.Option value="图片">图片</Select.Option>
<Select
placeholder="请选择模板名称"
onChange={(value, option) => onChange(value, option)}
>
{templateName &&
templateName.length > 0 &&
templateName.map((item, index) => (
<Option value={item.Name} key={item.Name + index} code={item.Code}>
{item.Name}
</Option>
))}
</Select>
</Item>
</Col>
<Col span={11}>
<Item
label="企业微信应用id"
labelCol={{ span: 11 }}
name="weixin"
label="第三方模板编号"
name="third_id"
rules={[
{
required: true,
message: '请输入企业微信号',
message: '请输入第三方模板编号',
},
]}
>
<Input placeholder="请输入企业微信号" />
<Input placeholder="请输入模板名称" />
</Item>
</Col>
</Row>
</>
}
<Row gutter={24}>
......@@ -255,12 +271,6 @@ const EditModal = props => {
labelCol={{ span: 3 }}
style={{ marginLeft: '1.4rem' }}
name="analysis_params"
rules={[
{
required: true,
message: '请输入参数解析',
},
]}
>
<TextArea rows={2} placeholder="param1|param2|param3|param4" />
</Item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment