Commit de226945 by zhaochengxiang

bug fix

parent 48bcae95
import React, { useState, useCallback, useRef, useEffect, useContext, useMemo } from 'react';
import { Input, Form, Typography, Button, Select, Row, Col, Popover, Checkbox, Tooltip, Table, Space } from 'antd';
import { DeleteOutlined, CloseOutlined, CheckOutlined, PlusOutlined, QuestionCircleOutlined } from '@ant-design/icons';
import { DeleteOutlined, CloseOutlined, CheckOutlined, PlusOutlined, QuestionCircleOutlined, DownOutlined, UpOutlined } from '@ant-design/icons';
import { DndProvider, useDrag, useDrop } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend';
import update from 'immutability-helper';
......@@ -352,6 +352,7 @@ const ImportActionIndex = (props) => {
const [ filterData, setFilterData ] = useState([]);
const [ insertIndex, setInsertIndex ] = useState(0);
const [ currentItem, setCurrentItem ] = useState(null);
const [isCollapse, setCollapse] = React.useState(true)
const { indexIsEditingFunction } = useContext(EditModelContext);
......@@ -818,6 +819,13 @@ const ImportActionIndex = (props) => {
<QuestionCircleOutlined className='pointer' />
</Popover>
}
{
isCollapse ? <Button type='primary' size='small' onClick={() => {
setCollapse(!isCollapse)
}}>展开<DownOutlined /></Button> : <Button type='primary' size='small' onClick={() => {
setCollapse(!isCollapse)
}}>收起<UpOutlined /></Button>
}
</Space>
<Space>
{
......@@ -836,68 +844,69 @@ const ImportActionIndex = (props) => {
</div>
</Space>
</div>
<div className='mb-3' id="containerId" ref={tableRef}>
<DndProvider backend={HTML5Backend} >
<Form form={form} component={false} onValuesChange={onValuesChange}>
<Table
components={{
body: {
cell: EditableCell,
//编辑或者搜索状态下不允许拖动
row: (editable&&editingKey===null&&keyword==='')?DragableBodyRow:null,
},
}}
onRow={(record, index) => {
let rowParams = {
index,
};
if (editable) {
rowParams = {...rowParams, onContextMenu: event => {
setCurrentItem(record);
displayMenu(event);
}
{
!isCollapse && <div className='mb-3' id="containerId" ref={tableRef}>
<DndProvider backend={HTML5Backend} >
<Form form={form} component={false} onValuesChange={onValuesChange}>
<Table
components={{
body: {
cell: EditableCell,
//编辑或者搜索状态下不允许拖动
row: (editable&&editingKey===null&&keyword==='')?DragableBodyRow:null,
},
}}
onRow={(record, index) => {
let rowParams = {
index,
};
if (!isEditing(record)) {
rowParams = {...rowParams, onClick: (event) => {
event.stopPropagation();
edit(record);
if (editable) {
rowParams = {...rowParams, onContextMenu: event => {
setCurrentItem(record);
displayMenu(event);
}
};
if (!isEditing(record)) {
rowParams = {...rowParams, onClick: (event) => {
event.stopPropagation();
edit(record);
}
}
}
if (keyword.length===0) {
rowParams = {...rowParams, moveRow};
if (keyword.length===0) {
rowParams = {...rowParams, moveRow};
}
}
}
}
return rowParams;
}}
dataSource={filterData||[]}
columns={mergedColumns()}
size='small'
rowKey='name'
rowClassName="editable-row"
pagination={false}
sticky
scroll={{
x: 1200
}}
/>
</Form>
</DndProvider>
<RcMenu id={MENU_ID} >
{
(menuData??[]).map(item => (
<RcItem key={item.key} id={item.key} onClick={handleItemClick}>
{item.title}
</RcItem>
))
}
</RcMenu>
</div>
return rowParams;
}}
dataSource={filterData||[]}
columns={mergedColumns()}
size='small'
rowKey='name'
rowClassName="editable-row"
pagination={false}
sticky
scroll={{
x: 1200
}}
/>
</Form>
</DndProvider>
</div>
}
<RcMenu id={MENU_ID} >
{
(menuData??[]).map(item => (
<RcItem key={item.key} id={item.key} onClick={handleItemClick}>
{item.title}
</RcItem>
))
}
</RcMenu>
</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