Commit 2f66a49f authored by 皮倩雯's avatar 皮倩雯

fix: '关联表单形态映射字段切换提交增加验证'

parent f600299e
Pipeline #62962 passed with stages
...@@ -49,6 +49,7 @@ import { ...@@ -49,6 +49,7 @@ import {
InfoCircleOutlined, InfoCircleOutlined,
MinusCircleOutlined, MinusCircleOutlined,
PlusOutlined, PlusOutlined,
SwapOutlined,
} from '@ant-design/icons'; } from '@ant-design/icons';
import styles from './index.less'; import styles from './index.less';
import VerifyModal from './VerifyModal'; import VerifyModal from './VerifyModal';
...@@ -215,6 +216,8 @@ const AddModal = props => { ...@@ -215,6 +216,8 @@ const AddModal = props => {
// 不切换树 // 不切换树
if (valueData.length == 0) { if (valueData.length == 0) {
console.log(pramData); console.log(pramData);
formAdd.validateFields().then(validate1 => {
if (validate1) {
form.validateFields().then(validate => { form.validateFields().then(validate => {
if (validate) { if (validate) {
setLoading(true); setLoading(true);
...@@ -442,9 +445,16 @@ const AddModal = props => { ...@@ -442,9 +445,16 @@ const AddModal = props => {
}); });
} }
}); });
}
});
} else { } else {
formAdd.validateFields().then(validate => {
if (validate) {
onSelect(1.14, keep); onSelect(1.14, keep);
} }
});
}
}; };
useEffect(() => { useEffect(() => {
...@@ -1230,7 +1240,8 @@ const AddModal = props => { ...@@ -1230,7 +1240,8 @@ const AddModal = props => {
value == '图片' || value == '图片' ||
value == '可预览图片' || value == '可预览图片' ||
value == '录音' || value == '录音' ||
value == '视频' value == '视频'||
value == '关联表单'
) { ) {
form.setFieldsValue({ RowSpan: 6 }); form.setFieldsValue({ RowSpan: 6 });
} else { } else {
...@@ -2319,6 +2330,8 @@ const AddModal = props => { ...@@ -2319,6 +2330,8 @@ const AddModal = props => {
} }
} }
// formAdd.validateFields().then(validate1 => {
// if(validate1){
form.validateFields().then(validate => { form.validateFields().then(validate => {
if (validate) { if (validate) {
setLoading(true); setLoading(true);
...@@ -2458,7 +2471,18 @@ const AddModal = props => { ...@@ -2458,7 +2471,18 @@ const AddModal = props => {
} }
console.log(lii); console.log(lii);
lii.push(arrlist); lii.push(arrlist);
aalist.映射字段 = lii; let lia = [];
lii.length>0 &&lii.map(i=>{
if(i){
if(i.key&&i.value){
lia.push(i)
}
}
})
console.log(lia)
aalist.映射字段 = lia;
console.log(aalist);
data[0].Config = JSON.stringify(aalist); data[0].Config = JSON.stringify(aalist);
break; break;
case '选择器': case '选择器':
...@@ -2607,6 +2631,11 @@ const AddModal = props => { ...@@ -2607,6 +2631,11 @@ const AddModal = props => {
} }
} }
}); });
// }
// });
}; };
const onChange2 = e => { const onChange2 = e => {
...@@ -3296,19 +3325,20 @@ const AddModal = props => { ...@@ -3296,19 +3325,20 @@ const AddModal = props => {
<Col span={11}> <Col span={11}>
<Item <Item
name="workOrder" name="workOrder"
rules={[{ required: true, message: '请输入映射名' }]} rules={[{ required: true, message: '请输入字段名' }]}
style={{ marginBottom:0}} style={{ marginBottom:0}}
> >
<Input placeholder="请输入映射名" /> <Input placeholder="请输入字段名" />
</Item> </Item>
</Col> </Col>
<Col span={2} style={{paddingTop:'3px'}}><SwapOutlined style={{marginLeft:'14px'}}/></Col>
<Col span={11}> <Col span={11}>
<Item <Item
name="eventOrder" name="eventOrder"
rules={[{ required: true, message: '请输入映射' }]} rules={[{ required: true, message: '请输入映射字段名' }]}
style={{ marginBottom:0}} style={{ marginBottom:0}}
> >
<Input placeholder="请输入映射值" style={{marginLeft:'41px', width:'189px'}}/> <Input placeholder="请输入映射字段名" style={{ width:'189px'}}/>
</Item> </Item>
</Col> </Col>
</Row> </Row>
...@@ -3334,32 +3364,37 @@ const AddModal = props => { ...@@ -3334,32 +3364,37 @@ const AddModal = props => {
fieldKey={[fieldKey, 'key']} fieldKey={[fieldKey, 'key']}
validateTrigger={['onChange', 'onBlur']} validateTrigger={['onChange', 'onBlur']}
rules={[ rules={[
{ required: true, message: '请填写映射名' }, { required: true, message: '请填写字段名' },
// { {
// validator: () => { validator: () => {
// // 验证参数名不能重复 let aa = formAdd.getFieldsValue().parmars
// const allKey = form let data =[];
// .getFieldsValue() aa.length >0 && aa.map(i=>{
// .parmars.map(item => (item ? item.key : '')); if(i){
// const repeatKey = new Set(allKey); data.push(i.key)
// if (repeatKey.size !== allKey.length) { }
// return Promise.reject(new Error('参数名重复')); })
// } let list = new Set(data);
// return Promise.resolve(); let ee = form.getFieldsValue().workOrder;
// }, if (list.size !== data.length || data.indexOf(ee) != -1) {
// }, return Promise.reject(new Error('字段名重复'));
}
return Promise.resolve();
},
},
]} ]}
> >
<Input placeholder="请填写映射名" style={{ width:'227px', marginLeft:'98px'}}/> <Input placeholder="请填写字段名" style={{ width:'227px', marginLeft:'98px'}}/>
</Form.Item> </Form.Item>
<SwapOutlined style={{marginLeft:'6px'}}/>
<Form.Item <Form.Item
{...restField} {...restField}
style={{ marginBottom: '5px' }} style={{ marginBottom: '5px' }}
name={[name, 'value']} name={[name, 'value']}
fieldKey={[fieldKey, 'value']} fieldKey={[fieldKey, 'value']}
rules={[{ required: true, message: '请填写映射'}]} rules={[{ required: true, message: '请填写映射字段名'}]}
> >
<Input placeholder="请填写映射值" style={{ width:'188px', marginLeft:'32px'}}/> <Input placeholder="请填写映射字段名" style={{ width:'188px', marginLeft:'6px'}}/>
</Form.Item> </Form.Item>
<MinusCircleOutlined <MinusCircleOutlined
onClick={() => remove(name)} onClick={() => remove(name)}
...@@ -3369,7 +3404,7 @@ const AddModal = props => { ...@@ -3369,7 +3404,7 @@ const AddModal = props => {
))} ))}
<Form.Item> <Form.Item>
<Button <Button
style={{ width: '494px', marginLeft: '100px' }} style={{ width: '456px', marginLeft: '100px' }}
type="dashed" type="dashed"
onClick={() => add()} onClick={() => add()}
block block
...@@ -3397,7 +3432,7 @@ const AddModal = props => { ...@@ -3397,7 +3432,7 @@ const AddModal = props => {
labelCol={{ span: 4 }} labelCol={{ span: 4 }}
rules={[{ required: true, message: '请输入控制规则' }]} rules={[{ required: true, message: '请输入控制规则' }]}
> >
<TextArea placeholder="示例:部门='研发一部'{表名.是否缴费} = ‘是’ and {表名.缴费金额} > 1000" /> <TextArea placeholder="示例:{表名.是否缴费} = ‘是’ and {表名.缴费金额} > 1000" />
</Item> </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