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

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

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