Commit 8d3743a2 authored by 田翔's avatar 田翔

fix: 测试提交增加提示

parent e54cb6dc
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "3.0.1", "version": "3.0.2",
"description": "3.0.1: 验证方法修改", "description": "3.0.2: 测试提交增加提示 ",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -29,6 +29,7 @@ const FormDesigner = (props, ref) => { ...@@ -29,6 +29,7 @@ const FormDesigner = (props, ref) => {
const [visible, setVisible] = useState(false) const [visible, setVisible] = useState(false)
const [schema, setSchema] = useState({}) const [schema, setSchema] = useState({})
const [fieldName, setFieldName] = useState([]) const [fieldName, setFieldName] = useState([])
const [textShow, setTextShow] = useState(false)
const designerRef = useRef(null) const designerRef = useRef(null)
const formRenderRef = useRef(null) const formRenderRef = useRef(null)
...@@ -155,6 +156,7 @@ const FormDesigner = (props, ref) => { ...@@ -155,6 +156,7 @@ const FormDesigner = (props, ref) => {
let json = getJSON(designerRef.current.getValue(), fieldName) let json = getJSON(designerRef.current.getValue(), fieldName)
let verify = getVerify(json) let verify = getVerify(json)
if (verify === true) { if (verify === true) {
setTextShow(false)
setVisible(true) setVisible(true)
setSchema(json) setSchema(json)
designerRef.current.setValue(json) designerRef.current.setValue(json)
...@@ -257,6 +259,8 @@ const FormDesigner = (props, ref) => { ...@@ -257,6 +259,8 @@ const FormDesigner = (props, ref) => {
const { formValue, relationForm, errors } = await formRenderRef?.current?.getValues() const { formValue, relationForm, errors } = await formRenderRef?.current?.getValues()
if (errors.length) { if (errors.length) {
return message.error('表单校验未通过!') return message.error('表单校验未通过!')
} else {
setTextShow(true)
} }
} }
...@@ -308,8 +312,9 @@ const FormDesigner = (props, ref) => { ...@@ -308,8 +312,9 @@ const FormDesigner = (props, ref) => {
destroyOnClose destroyOnClose
footer={ footer={
<div> <div>
<span style={{ color: '#18b918', fontSize: '14px', paddingRight: '10px', display: textShow ? 'inline-block' : 'none' }}>该表单内容校验通过,可正常使用!</span>
<Button onClick={() => setVisible(false)}>取消</Button> <Button onClick={() => setVisible(false)}>取消</Button>
<Button onClick={testSubmit}>测试提交</Button> <Button type='primary' onClick={testSubmit}>测试提交</Button>
</div> </div>
} }
> >
......
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