Commit 188ff0f1 authored by 涂伟's avatar 涂伟

fix: '表单设计按钮优化'

parent cb260aac
Pipeline #68626 passed with stages
/* eslint-disable no-shadow */ /* eslint-disable no-shadow */
/* eslint-disable react/jsx-boolean-value */ /* eslint-disable react/jsx-boolean-value */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import { import {
Form, Form,
Modal, Modal,
...@@ -74,6 +74,8 @@ const AddModal = props => { ...@@ -74,6 +74,8 @@ const AddModal = props => {
const [perviewPrase, setPerViewPrase] = useState(false); const [perviewPrase, setPerViewPrase] = useState(false);
const [tablesSchema, setTablesSchema] = useState(null); // 存储parseForm组件需要的数据格式 const [tablesSchema, setTablesSchema] = useState(null); // 存储parseForm组件需要的数据格式
const formRef = useRef(null);
const getField = () => { const getField = () => {
loadUnattachedTables().then(res => { loadUnattachedTables().then(res => {
if (res.data.root && res.data.root.length) { if (res.data.root && res.data.root.length) {
...@@ -480,9 +482,30 @@ const AddModal = props => { ...@@ -480,9 +482,30 @@ const AddModal = props => {
</TreeSelect> </TreeSelect>
</div> */} </div> */}
<div className={styles.btn}> <div className={styles.btn}>
<Button type="primary" icon={<PlusSquareOutlined />} onClick={add}> {/* <Button
附加 type="primary"
icon={<PlusSquareOutlined />}
onClick={() => formRef.current.clear()}
>
清除
</Button> */}
<Button
type="primary"
// icon={<PlusSquareOutlined />}
onClick={() => formRef.current.submit()}
>
提交
</Button>
<Button
type="primary"
// icon={<PlusSquareOutlined />}
onClick={() => formRef.current.preview()}
>
预览
</Button> </Button>
{/* <Button type="primary" icon={<PlusSquareOutlined />} onClick={add}>
附加
</Button> */}
<Button <Button
type="primary" type="primary"
icon={<RollbackOutlined />} icon={<RollbackOutlined />}
...@@ -495,7 +518,7 @@ const AddModal = props => { ...@@ -495,7 +518,7 @@ const AddModal = props => {
</div> </div>
</div> </div>
<div style={{ width: '100%', height: 'calc(100% - 63px)', padding: '10px' }}> <div style={{ width: '100%', height: 'calc(100% - 63px)', padding: '10px' }}>
{formObj && <FormDesigner tableName={formObj} />} {formObj && <FormDesigner ref={formRef} tableName={formObj} />}
</div> </div>
</div> </div>
</Spin> </Spin>
......
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