Commit 789ff5fd by zhaochengxiang

模型ji基本信息展开

parent 006f8d94
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Form, Input, Row, Col, Descriptions, Select, AutoComplete, Checkbox } from 'antd'; import { Form, Input, Row, Col, Descriptions, Select, AutoComplete, Checkbox, Button } from 'antd';
import { DownOutlined, UpOutlined } from '@ant-design/icons';
import { highlightSearchContentByTerms, generateUUID } from '../../../../util'; import { highlightSearchContentByTerms, generateUUID } from '../../../../util';
import { dispatchLatest } from '../../../../model'; import { dispatchLatest } from '../../../../model';
...@@ -423,8 +424,8 @@ const ImportActionHeader = (props) => { ...@@ -423,8 +424,8 @@ const ImportActionHeader = (props) => {
} }
} }
const onOnlyShowRequireChange = (e) => { const onOnlyShowRequireChange = () => {
setOnlyShowRequireChange(e.target.checked); setOnlyShowRequireChange(!onlyShowRequireChange);
} }
let distributionDescription = '', primaryDescription = '', partitionsDescription = '', semiPrimaryDescription = ''; let distributionDescription = '', primaryDescription = '', partitionsDescription = '', semiPrimaryDescription = '';
...@@ -488,7 +489,9 @@ const ImportActionHeader = (props) => { ...@@ -488,7 +489,9 @@ const ImportActionHeader = (props) => {
}} }}
> >
<h2>基本信息</h2> <h2>基本信息</h2>
<Checkbox onChange={onOnlyShowRequireChange} defaultChecked={onlyShowRequireChange} value={onlyShowRequireChange}>仅显示必填项</Checkbox> {
onlyShowRequireChange ? <Button type='text' style={{ padding: 0, color: '#0069AC' }} onClick={onOnlyShowRequireChange}>展开<DownOutlined /></Button> : <Button type='text' style={{ padding: 0, color: '#0069AC' }} onClick={onOnlyShowRequireChange}>收起<UpOutlined /></Button>
}
</div> </div>
{ {
editable ? ( editable ? (
......
.model-import-action-header { .model-import-action-header {
.yy-form-item { .yy-form-item:nth-last-col {
margin-bottom: 24px; margin-bottom: 24px;
} }
......
...@@ -118,6 +118,7 @@ const ModelTable = (props) => { ...@@ -118,6 +118,7 @@ const ModelTable = (props) => {
id: MENU_ID, id: MENU_ID,
}); });
const [ tableWidth, setTableWidth ] = useState(0);
const [ selectedRowKeys, setSelectedRowKeys ] = useState([]); const [ selectedRowKeys, setSelectedRowKeys ] = useState([]);
const [ subSelectedRowKeys, setSubSelectedRowKeys ] = useState([]); const [ subSelectedRowKeys, setSubSelectedRowKeys ] = useState([]);
// const [ mouseEnterKey, setMouseEnterKey ] = useState(null); // const [ mouseEnterKey, setMouseEnterKey ] = useState(null);
...@@ -620,6 +621,9 @@ const ModelTable = (props) => { ...@@ -620,6 +621,9 @@ const ModelTable = (props) => {
<div className={classes}> <div className={classes}>
<ResizeObserver <ResizeObserver
onResize={({ width }) => { onResize={({ width }) => {
if (tableWidth !== width) {
setTableWidth(width);
let newColumns = [...cols]; let newColumns = [...cols];
if ((modelId||'') !== '') { if ((modelId||'') !== '') {
...@@ -645,6 +649,7 @@ const ModelTable = (props) => { ...@@ -645,6 +649,7 @@ const ModelTable = (props) => {
}); });
setColumns(newColumns); setColumns(newColumns);
}
}} }}
> >
<Table <Table
......
...@@ -41,6 +41,7 @@ const ResizeableHeaderCell = props => { ...@@ -41,6 +41,7 @@ const ResizeableHeaderCell = props => {
const SuggestTable = (props) => { const SuggestTable = (props) => {
const { suggests, onSelect } = props; const { suggests, onSelect } = props;
const [ tableWidth, setTableWidth ] = useState(0);
const cols = [ const cols = [
{ {
...@@ -174,6 +175,8 @@ const SuggestTable = (props) => { ...@@ -174,6 +175,8 @@ const SuggestTable = (props) => {
<ResizeObserver <ResizeObserver
onResize={({ width }) => { onResize={({ width }) => {
if (tableWidth !== width) {
setTableWidth(width);
let newColumns = [...cols]; let newColumns = [...cols];
newColumns.forEach((column, index) => { newColumns.forEach((column, index) => {
...@@ -191,6 +194,7 @@ const SuggestTable = (props) => { ...@@ -191,6 +194,7 @@ const SuggestTable = (props) => {
}); });
setColumns(newColumns); setColumns(newColumns);
}
}} }}
> >
<Table <Table
......
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