Commit ca6a0439 authored by 涂伟's avatar 涂伟

fix: '代码回滚'

parent b82570fc
/* eslint-disable no-shadow */ /* eslint-disable no-shadow */
/* eslint-disable react/jsx-boolean-value */ /* eslint-disable react/jsx-boolean-value */
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect } from 'react';
import { import {
Form, Form,
Modal, Modal,
...@@ -25,8 +25,6 @@ import { ...@@ -25,8 +25,6 @@ import {
RollbackOutlined, RollbackOutlined,
ConsoleSqlOutlined, ConsoleSqlOutlined,
EyeOutlined, EyeOutlined,
ArrowLeftOutlined,
UploadOutlined,
} from '@ant-design/icons'; } from '@ant-design/icons';
import { import {
reloadTableFields, reloadTableFields,
...@@ -40,8 +38,7 @@ import FieldEditor from './fieldEditor'; ...@@ -40,8 +38,7 @@ import FieldEditor from './fieldEditor';
import AffiliateAdd from '../components/Field/affiliateAdd'; import AffiliateAdd from '../components/Field/affiliateAdd';
import LoadGroup from '../components/Field/loadGroupNew'; import LoadGroup from '../components/Field/loadGroupNew';
import styles from './index.less'; import styles from './index.less';
import clearSvg from '@/assets/font/omsfont/clear.svg'; import PerviewPrase from './PerviewPrase';
// import PerviewPrase from './PerviewPrase';
import { LayerSetting } from '@/services/gis/gis'; import { LayerSetting } from '@/services/gis/gis';
const AddModal = props => { const AddModal = props => {
const history = useHistory(); const history = useHistory();
...@@ -52,7 +49,6 @@ const AddModal = props => { ...@@ -52,7 +49,6 @@ const AddModal = props => {
const [tableData, setTableData] = useState([]); const [tableData, setTableData] = useState([]);
const [treeLoading, setTreeLoading] = useState(false); const [treeLoading, setTreeLoading] = useState(false);
const [formObj, setFormObj] = useState(''); const [formObj, setFormObj] = useState('');
const [formName, setFormName] = useState('');
const [flag, setFlag] = useState(0); // 弹窗类型 const [flag, setFlag] = useState(0); // 弹窗类型
const [isVisible, setIsVisible] = useState(false); // 弹窗 const [isVisible, setIsVisible] = useState(false); // 弹窗
const [isType, setIsType] = useState(''); // 弹窗类型 const [isType, setIsType] = useState(''); // 弹窗类型
...@@ -78,8 +74,6 @@ const AddModal = props => { ...@@ -78,8 +74,6 @@ 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) {
...@@ -121,7 +115,6 @@ const AddModal = props => { ...@@ -121,7 +115,6 @@ const AddModal = props => {
if (treeSelectValue) { if (treeSelectValue) {
let ss = treeSelectValue.substring(0, treeSelectValue.lastIndexOf('@')); let ss = treeSelectValue.substring(0, treeSelectValue.lastIndexOf('@'));
setFormObj(treeSelectValue.substring(0, treeSelectValue.lastIndexOf('@'))); setFormObj(treeSelectValue.substring(0, treeSelectValue.lastIndexOf('@')));
setFormName(treeSelectValue.substring(0, treeSelectValue.lastIndexOf('@')));
reloadTableFields({ reloadTableFields({
tableName: treeSelectValue.substring(0, treeSelectValue.lastIndexOf('@')), tableName: treeSelectValue.substring(0, treeSelectValue.lastIndexOf('@')),
}).then(res => { }).then(res => {
...@@ -196,7 +189,6 @@ const AddModal = props => { ...@@ -196,7 +189,6 @@ const AddModal = props => {
} else { } else {
let ss = props.location.state.id; let ss = props.location.state.id;
setFormObj(props.location.state.id); setFormObj(props.location.state.id);
setFormName(props.location.state.name);
reloadTableFields({ reloadTableFields({
tableName: props.location.state.id, tableName: props.location.state.id,
}).then(res => { }).then(res => {
...@@ -459,13 +451,13 @@ const AddModal = props => { ...@@ -459,13 +451,13 @@ const AddModal = props => {
setVisible(false); setVisible(false);
setFlag(flag + 1); setFlag(flag + 1);
}; };
return ( return (
<> <>
{/* <Spin tip="loading..." spinning={treeLoading}> */} <Spin tip="loading..." spinning={treeLoading}>
<div className={styles.containerBox}> <div className={styles.containerBox}>
<div className={styles.config}> <div className={styles.config}>
<ArrowLeftOutlined onClick={back} className={styles.goBack} /> <div className={styles.title}> 字段配置 【{formObj}</div>
<div className={styles.title}> 展示名称 【{formName}</div>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}> <div style={{ display: 'flex', justifyContent: 'flex-end' }}>
{/* <div style={{ lineHeight: '32px', marginRight: '5px' }}>快速切换表:</div> {/* <div style={{ lineHeight: '32px', marginRight: '5px' }}>快速切换表:</div>
<div style={{ width: '350px', marginRight: '10px' }}> <div style={{ width: '350px', marginRight: '10px' }}>
...@@ -488,51 +480,25 @@ const AddModal = props => { ...@@ -488,51 +480,25 @@ const AddModal = props => {
</TreeSelect> </TreeSelect>
</div> */} </div> */}
<div className={styles.btn}> <div className={styles.btn}>
<Button <Button type="primary" icon={<PlusSquareOutlined />} onClick={add}>
type="primary" 附加
// icon={<PlusSquareOutlined />}
ghost
onClick={() => formRef.current.clear()}
>
<img src={clearSvg} style={{ marginRight: '6px' }} alt="" />
清空
</Button>
<Button
type="primary"
ghost
icon={<EyeOutlined />}
onClick={() => formRef.current.preview()}
style={{ marginLeft: '10px' }}
>
预览
</Button> </Button>
<Button <Button
type="primary"
icon={<UploadOutlined />}
onClick={() => formRef.current.submit()}
style={{ marginLeft: '10px' }}
>
提交
</Button>
{/* <Button type="primary" icon={<PlusSquareOutlined />} onClick={add}>
附加
</Button> */}
{/* <Button
type="primary" type="primary"
icon={<RollbackOutlined />} icon={<RollbackOutlined />}
onClick={back} onClick={back}
style={{ marginLeft: '30px' }} style={{ marginLeft: '30px' }}
> >
返回 返回
</Button> */} </Button>
</div> </div>
</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 ref={formRef} tableName={formObj} extra={true} />} {formObj && <FormDesigner tableName={formObj} extra />}
</div> </div>
</div> </div>
{/* </Spin> */} </Spin>
{visible && type === 'affiliateAdd' && ( {visible && type === 'affiliateAdd' && (
<AffiliateAdd <AffiliateAdd
visible={visible} visible={visible}
......
...@@ -119,8 +119,8 @@ ...@@ -119,8 +119,8 @@
padding: 1rem 0 0.5rem 0.5rem; padding: 1rem 0 0.5rem 0.5rem;
justify-content: space-between; justify-content: space-between;
width: calc(100% - 10px); width: calc(100% - 10px);
// position: relative; position: relative;
// padding-left: 50px; padding-left: 50px;
.goBack { .goBack {
position: absolute; position: absolute;
......
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