Commit 76b93f18 authored by zhangwenshuai's avatar zhangwenshuai

merge master

parents 18f321d0 83e120f5
...@@ -173,7 +173,7 @@ const Cell = (props: CellProps) => { ...@@ -173,7 +173,7 @@ const Cell = (props: CellProps) => {
{showExpand && columnIndex === 0 && ( {showExpand && columnIndex === 0 && (
<div className={s.expand}> <div className={s.expand}>
<img <img
onClick={showExpand.bind(null, { rowId: record.id })} onClick={showExpand.bind(null, { rowId: record.id, historyGroupId: record.historyGroupId })}
className={s.expandIcon} className={s.expandIcon}
alt="" alt=""
src={expandIcon} src={expandIcon}
...@@ -213,11 +213,8 @@ const Cell = (props: CellProps) => { ...@@ -213,11 +213,8 @@ const Cell = (props: CellProps) => {
const transferColumn = transferAttr(columnType, newProps); const transferColumn = transferAttr(columnType, newProps);
const style: any = {}; const style: any = {};
if (columnIndex === 0 && (rowSelection || showExpand || showIndex)) {
style.paddingLeft = 0;
}
const { dynamicCellConfigDTO } = columnData; const { dynamicCellConfigDTO } = columnData || {};
const detail = ( const detail = (
<div <div
className={s.detailCell} className={s.detailCell}
...@@ -337,6 +334,7 @@ const Cell = (props: CellProps) => { ...@@ -337,6 +334,7 @@ const Cell = (props: CellProps) => {
const value = setFormat(editConfig, columnConfig, changedValue, optionValue); const value = setFormat(editConfig, columnConfig, changedValue, optionValue);
emitChangeCellData(value, optionValue); emitChangeCellData(value, optionValue);
}} }}
cellRenderProps={cellRenderProps}
style={{ style={{
minHeight: cellStyle.height, minHeight: cellStyle.height,
borderRadius: 0, borderRadius: 0,
......
...@@ -85,7 +85,7 @@ export default class TableColumn extends PureComponent<ColumnProps> { ...@@ -85,7 +85,7 @@ export default class TableColumn extends PureComponent<ColumnProps> {
return ( return (
<div className={s.colContainer}> <div className={s.colContainer}>
{rowSelection && columnIndex === 0 && <div className={s.checkbox}>{this.getCheckbox()}</div>} {rowSelection && columnIndex === 0 && <div className={s.checkbox}>{this.getCheckbox()}</div>}
<div className={s.colBrief} style={{ marginLeft: showIndex && columnIndex === 0 ? '40px' : 0 }}> <div className={s.colBrief} style={{ marginLeft: showIndex && columnIndex === 0 ? '56px' : 0 }}>
{icon && <div className={s.colIcon}>{icon()}</div>} {icon && <div className={s.colIcon}>{icon()}</div>}
<span className={required ? classNames(s.colTitle, s.required) : s.colTitle}> <span className={required ? classNames(s.colTitle, s.required) : s.colTitle}>
{columnChsName} {columnChsName}
......
...@@ -55,11 +55,9 @@ export default class AirTable extends Component<TableProps, TableState> { ...@@ -55,11 +55,9 @@ export default class AirTable extends Component<TableProps, TableState> {
}; };
if (JSON.stringify(dataSource) !== JSON.stringify(nextProps.dataSource)) { if (JSON.stringify(dataSource) !== JSON.stringify(nextProps.dataSource)) {
nextState.dataSource = nextProps.dataSource; nextState.dataSource = nextProps.dataSource;
nextState.selectedCell = null;
} }
if (JSON.stringify(columns) !== JSON.stringify(nextProps.columns)) { if (JSON.stringify(columns) !== JSON.stringify(nextProps.columns)) {
nextState.columns = nextProps.columns; nextState.columns = nextProps.columns;
nextState.selectedCell = null;
} }
return nextState; return nextState;
} }
...@@ -72,7 +70,6 @@ export default class AirTable extends Component<TableProps, TableState> { ...@@ -72,7 +70,6 @@ export default class AirTable extends Component<TableProps, TableState> {
dataSource, dataSource,
tableWidth: width, tableWidth: width,
tableHeight: height, tableHeight: height,
selectedCell: null,
}; };
this.config = { this.config = {
overscanColumnCount: 5, overscanColumnCount: 5,
...@@ -216,12 +213,6 @@ export default class AirTable extends Component<TableProps, TableState> { ...@@ -216,12 +213,6 @@ export default class AirTable extends Component<TableProps, TableState> {
} }
}; };
changeSelectedCell = (key) => {
this.setState({
selectedCell: key,
});
};
// 列伸缩回调 // 列伸缩回调
onResizeWidth = (e) => { onResizeWidth = (e) => {
const originLeft = (this.tableContainer && this.tableContainer.getBoundingClientRect().x) || 0; const originLeft = (this.tableContainer && this.tableContainer.getBoundingClientRect().x) || 0;
...@@ -312,10 +303,10 @@ export default class AirTable extends Component<TableProps, TableState> { ...@@ -312,10 +303,10 @@ export default class AirTable extends Component<TableProps, TableState> {
} }
}; };
// 拖拽排序回调 // 拖拽排序回调
onDragSorted = (dragColumn:any, dropColumn:any) => { onDragSorted = (dragColumn: any, dropColumn: any) => {
const { onDragSorted } = this.props; const { onDragSorted } = this.props;
const { columns } = this.state; const { columns } = this.state;
const newColumns:any[] = []; const newColumns: any[] = [];
columns.map((item) => { columns.map((item) => {
if (dragColumn.orderNo > dropColumn.orderNo) { if (dragColumn.orderNo > dropColumn.orderNo) {
if (item.orderNo >= dropColumn.orderNo && item.orderNo <= dragColumn.orderNo) { if (item.orderNo >= dropColumn.orderNo && item.orderNo <= dragColumn.orderNo) {
...@@ -387,6 +378,7 @@ export default class AirTable extends Component<TableProps, TableState> { ...@@ -387,6 +378,7 @@ export default class AirTable extends Component<TableProps, TableState> {
> >
<ResizableBox <ResizableBox
width={style.width} width={style.width}
height={style.height}
handle={ handle={
<span <span
className={styles.handleWidth} className={styles.handleWidth}
...@@ -430,7 +422,7 @@ export default class AirTable extends Component<TableProps, TableState> { ...@@ -430,7 +422,7 @@ export default class AirTable extends Component<TableProps, TableState> {
}: { showColumns: ColumnProps[]; showData: RowProps; position?: string }, }: { showColumns: ColumnProps[]; showData: RowProps; position?: string },
{ columnIndex, key, rowIndex, style }: any, { columnIndex, key, rowIndex, style }: any,
) => { ) => {
const { columns, dataSource, selectedCell } = this.state; const { columns, dataSource } = this.state;
const { const {
emitChangeCell, emitChangeCell,
paginationConfig, paginationConfig,
...@@ -507,8 +499,6 @@ export default class AirTable extends Component<TableProps, TableState> { ...@@ -507,8 +499,6 @@ export default class AirTable extends Component<TableProps, TableState> {
cellEditable={cellEditable} cellEditable={cellEditable}
rowSelection={position === 'right' ? false : rowSelection} rowSelection={position === 'right' ? false : rowSelection}
contentMenu={contentMenu} contentMenu={contentMenu}
selectedCell={selectedCell}
changeSelectedCell={this.changeSelectedCell}
cellKey={key} cellKey={key}
position={position} position={position}
/> />
...@@ -759,7 +749,7 @@ export default class AirTable extends Component<TableProps, TableState> { ...@@ -759,7 +749,7 @@ export default class AirTable extends Component<TableProps, TableState> {
style={{ style={{
width: `${rightWidth}px`, width: `${rightWidth}px`,
height: `${totalHeight - scrollbarWidth + headerHeight}px`, height: `${totalHeight - scrollbarWidth + headerHeight}px`,
right: scrollbarWidth, right: paddingRight,
}} }}
> >
{ {
......
...@@ -95,8 +95,10 @@ export const SetFormatter = { ...@@ -95,8 +95,10 @@ export const SetFormatter = {
PERCENTAGE: (val, config) => { PERCENTAGE: (val, config) => {
val = `${val}`.replace('%', ''); val = `${val}`.replace('%', '');
if (!isNumber(val)) return emptyModel; if (!isNumber(val)) return emptyModel;
const { precision } = config || {}; // 设置单位
val = accDiv(val, 100); val = accDiv(val, 100);
return SetFormatter.NUMBER(val, config); val = Number(val).toFixed(precision + 2);
return [{ value: val, text: val }];
}, },
DATE: (val, config) => { DATE: (val, config) => {
if (!val) return emptyModel; if (!val) return emptyModel;
......
...@@ -5,7 +5,7 @@ import styles from './index.less'; ...@@ -5,7 +5,7 @@ import styles from './index.less';
import { InputProps } from '../detailInterface'; import { InputProps } from '../detailInterface';
export const ApolloInputDetail = (props: InputProps) => { export const ApolloInputDetail = (props: InputProps) => {
const { className, origin } = props; const { className, origin, columnConfig } = props;
const value = props.formatter ? props.formatter(props.value) : props.value; const value = props.formatter ? props.formatter(props.value) : props.value;
if (!value) { if (!value) {
return null; return null;
...@@ -13,17 +13,22 @@ export const ApolloInputDetail = (props: InputProps) => { ...@@ -13,17 +13,22 @@ export const ApolloInputDetail = (props: InputProps) => {
const [dotVisible, setDotVisible] = useState(false); const [dotVisible, setDotVisible] = useState(false);
const container = useRef(null); const container = useRef(null);
const dom = useRef(null); const dom = useRef(null);
const detaWidth = useRef(columnConfig.width || 0);
useEffect(() => { useEffect(() => {
const containerTarget: any = container.current; const containerTarget: any = container.current;
const target: any = dom.current; const target: any = dom.current;
const deta = columnConfig.width - detaWidth.current;
if (containerTarget && target) { if (containerTarget && target) {
if (target.clientWidth > containerTarget.clientWidth) { if (target.clientWidth > containerTarget.clientWidth + deta) {
setDotVisible(true); setDotVisible(true);
} else { } else {
setDotVisible(false); setDotVisible(false);
} }
} }
}, [value]); if (deta !== 0) {
detaWidth.current = columnConfig.width;
}
}, [value, columnConfig.width]);
if (origin === 'detailForm') { if (origin === 'detailForm') {
return <div className={classNames(styles.text, className)}>{value}</div>; return <div className={classNames(styles.text, className)}>{value}</div>;
......
...@@ -3,34 +3,41 @@ import { Popover } from 'antd'; ...@@ -3,34 +3,41 @@ import { Popover } from 'antd';
import classNames from 'classnames'; import classNames from 'classnames';
import s from './index.less'; import s from './index.less';
const getColor = (item: any, options: any[]) => {
let color = '';
if (item.text === item.value) {
return 'transparent';
}
if (options && Array.isArray(options) && options.length > 0) {
const obj =
options.find((ls) => {
return String(ls.id) === String(item.value);
}) || {};
color = obj.color || 'e9eef9';
}
return `#${color}`;
};
export const Tags = (props: any) => { export const Tags = (props: any) => {
const { value, origin, componentAttr } = props; const { value, origin, componentAttr, columnConfig } = props;
if (!Array.isArray(value) || value.length === 0) return null; if (!Array.isArray(value) || value.length === 0) return null;
if (value.length === 1 && !value[0].text && !value[0].value) {
return null;
}
const { options, mode } = componentAttr || {}; const { options, mode } = componentAttr || {};
const outStyle: any = {}; const outStyle: any = {};
const innerStyle: any = {}; const innerStyle: any = {};
const itemStyle: any = {}; const itemStyle: any = {};
if (origin === 'detailForm') { if (origin === 'detailForm' || origin === 'editForm') {
outStyle.width = 'auto'; outStyle.width = 'auto';
innerStyle.flexWrap = 'wrap'; innerStyle.flexWrap = 'wrap';
itemStyle.marginBottom = '5px'; itemStyle.marginBottom = '5px';
} }
const getColor = (item: any) => {
let color = '';
if (options && Array.isArray(options) && options.length > 0) {
const obj = options.find((ls) => {
return String(ls.id) === String(item.value);
}) || {};
color = obj.color || 'e9eef9';
}
return color;
};
if (mode !== 'multiple') { if (mode !== 'multiple') {
// 单选 // 单选
return ( return (
<div className={s.container} style={{ overflow: 'hidden' }}> <div className={s.container} style={{ overflow: 'hidden' }}>
<span className={s.item} style={{ ...itemStyle, background: `#${getColor(value[0])}` }}> <span className={s.item} style={{ ...itemStyle, background: getColor(value[0], options) }}>
<div className={s.itemBgTxt}>{value[0].text}</div> <div className={s.itemBgTxt}>{value[0].text}</div>
</span> </span>
</div> </div>
...@@ -40,19 +47,24 @@ export const Tags = (props: any) => { ...@@ -40,19 +47,24 @@ export const Tags = (props: any) => {
const [dotVisible, setDotVisible] = useState(false); const [dotVisible, setDotVisible] = useState(false);
const outer = useRef(null); const outer = useRef(null);
const inner = useRef(null); const inner = useRef(null);
const detaWidth = useRef(columnConfig.width || 0);
useEffect(() => { useEffect(() => {
const outerTarget: any = outer.current; const outerTarget: any = outer.current;
const innerTarget: any = inner.current; const innerTarget: any = inner.current;
let visible = false; let visible = false;
const deta = columnConfig.width - detaWidth.current;
if (outerTarget && innerTarget && origin !== 'detailForm') { if (outerTarget && innerTarget && origin !== 'detailForm') {
if (innerTarget.clientWidth > outerTarget.clientWidth) { if (innerTarget.clientWidth > outerTarget.clientWidth + deta) {
visible = true; visible = true;
} else { } else {
visible = false; visible = false;
} }
} }
if (deta !== 0) {
detaWidth.current = columnConfig.width;
}
setDotVisible(visible); setDotVisible(visible);
}, [value]); }, [value, columnConfig.width]);
return ( return (
<div className={s.container}> <div className={s.container}>
...@@ -69,7 +81,7 @@ export const Tags = (props: any) => { ...@@ -69,7 +81,7 @@ export const Tags = (props: any) => {
<span <span
className={s.popItem} className={s.popItem}
key={index} key={index}
style={{ background: `#${getColor(item)}` }} style={{ background: getColor(item, options) }}
> >
<div className={s.popItemBgTxt}>{item.text}</div> <div className={s.popItemBgTxt}>{item.text}</div>
</span> </span>
...@@ -84,7 +96,7 @@ export const Tags = (props: any) => { ...@@ -84,7 +96,7 @@ export const Tags = (props: any) => {
<span <span
key={index} key={index}
className={classNames(s.item, s.multi)} className={classNames(s.item, s.multi)}
style={{ ...itemStyle, background: `#${getColor(item)}` }} style={{ ...itemStyle, background: getColor(item, options) }}
> >
<div className={s.itemBgTxt}>{item.text}</div> <div className={s.itemBgTxt}>{item.text}</div>
</span> </span>
...@@ -99,7 +111,7 @@ export const Tags = (props: any) => { ...@@ -99,7 +111,7 @@ export const Tags = (props: any) => {
<span <span
key={index} key={index}
className={classNames(s.item, s.multi)} className={classNames(s.item, s.multi)}
style={{ ...itemStyle, background: `#${getColor(item)}` }} style={{ ...itemStyle, background: getColor(item, options) }}
> >
<div className={s.itemBgTxt}>{item.text}</div> <div className={s.itemBgTxt}>{item.text}</div>
</span> </span>
......
...@@ -5,7 +5,7 @@ import s from './index.less'; ...@@ -5,7 +5,7 @@ import s from './index.less';
import IconFont from '@/submodule/components/IconFont'; import IconFont from '@/submodule/components/IconFont';
export const ApolloTextLinkDetail = (props: any) => { export const ApolloTextLinkDetail = (props: any) => {
const { value, origin, formatter, changeEdit } = props; const { value, origin, formatter, changeEdit, columnConfig } = props;
const newValue = formatter ? formatter(value) : value; const newValue = formatter ? formatter(value) : value;
if (!newValue) return null; if (!newValue) return null;
// 以逗号分隔 // 以逗号分隔
...@@ -13,17 +13,22 @@ export const ApolloTextLinkDetail = (props: any) => { ...@@ -13,17 +13,22 @@ export const ApolloTextLinkDetail = (props: any) => {
const [dotVisible, setDotVisible] = useState(false); const [dotVisible, setDotVisible] = useState(false);
const outer = useRef(null); const outer = useRef(null);
const inner = useRef(null); const inner = useRef(null);
const detaWidth = useRef(columnConfig.width || 0);
useEffect(() => { useEffect(() => {
const outerTarget: any = outer.current; const outerTarget: any = outer.current;
const innerTarget: any = inner.current; const innerTarget: any = inner.current;
const deta = columnConfig.width - detaWidth.current;
if (outerTarget && innerTarget && origin !== 'detailForm') { if (outerTarget && innerTarget && origin !== 'detailForm') {
if (innerTarget.clientWidth > outerTarget.clientWidth) { if (innerTarget.clientWidth > outerTarget.clientWidth + deta) {
setDotVisible(true); setDotVisible(true);
} else { } else {
setDotVisible(false); setDotVisible(false);
} }
} }
}, [value]); if (deta !== 0) {
detaWidth.current = columnConfig.width;
}
}, [value, columnConfig.width]);
const outStyle: any = {}; const outStyle: any = {};
const innerStyle: any = {}; const innerStyle: any = {};
...@@ -118,14 +123,16 @@ export const ApolloTextLinkDetail = (props: any) => { ...@@ -118,14 +123,16 @@ export const ApolloTextLinkDetail = (props: any) => {
)} )}
</div> </div>
</div> </div>
<div {origin !== 'detailForm' && (
className={s.moreBtn} <div
onClick={() => { className={s.moreBtn}
changeEdit(); onClick={() => {
}} changeEdit();
> }}
<IconFont type="iconzhankai1" /> >
</div> <IconFont type="iconzhankai1" />
</div>
)}
</div> </div>
); );
}; };
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
} }
.tooltipTitle { .tooltipTitle {
//min-width: 500px; //min-width: 500px;
max-height: 300px;
overflow: auto;
.more { .more {
margin-left: @marginGen; margin-left: @marginGen;
color: @primaryColor; color: @primaryColor;
......
import React, { useEffect, useRef, useState } from 'react'; import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import { Tooltip } from 'antd'; import { Tooltip } from 'antd';
import styles from './index.less'; import styles from './index.less';
import { TextAreaProps } from '../detailInterface'; import { TextAreaProps } from '../detailInterface';
export const ApolloTextAreaDetail = (props: TextAreaProps) => { export const ApolloTextAreaDetail = (props: TextAreaProps) => {
const { className, origin, componentAttr, rowData, formatter } = props; const { className, origin, componentAttr, rowData, formatter, columnConfig } = props;
const formatValue = formatter ? formatter(props.value) : props.value; const formatValue = formatter ? formatter(props.value) : props.value;
if (!formatValue) { if (!formatValue) {
return null; return null;
...@@ -18,17 +18,23 @@ export const ApolloTextAreaDetail = (props: TextAreaProps) => { ...@@ -18,17 +18,23 @@ export const ApolloTextAreaDetail = (props: TextAreaProps) => {
const [dotVisible, setDotVisible] = useState(false); const [dotVisible, setDotVisible] = useState(false);
const container = useRef(null); const container = useRef(null);
const dom = useRef(null); const dom = useRef(null);
const detaWidth = useRef(columnConfig.width || 0);
useEffect(() => { useEffect(() => {
const containerTarget: any = container.current; const containerTarget: any = container.current;
const target: any = dom.current; const target: any = dom.current;
const deta = columnConfig.width - detaWidth.current;
if (containerTarget && target) { if (containerTarget && target) {
if (target.clientWidth > containerTarget.clientWidth) { if (target.clientWidth > containerTarget.clientWidth + deta) {
setDotVisible(true); setDotVisible(true);
} else { } else {
setDotVisible(false); setDotVisible(false);
} }
} }
}, [value]); if (deta !== 0) {
detaWidth.current = columnConfig.width;
}
}, [value, columnConfig.width]);
const getMore = async () => { const getMore = async () => {
let newValue = await getDetail({ rowId: rowData.id }); let newValue = await getDetail({ rowId: rowData.id });
...@@ -47,7 +53,7 @@ export const ApolloTextAreaDetail = (props: TextAreaProps) => { ...@@ -47,7 +53,7 @@ export const ApolloTextAreaDetail = (props: TextAreaProps) => {
<div className={styles.container} ref={container}> <div className={styles.container} ref={container}>
{dotVisible ? ( {dotVisible ? (
<Tooltip <Tooltip
overlayClassName={styles.tooltip} // overlayClassName={styles.tooltip}
title={ title={
<div className={styles.tooltipTitle}> <div className={styles.tooltipTitle}>
{value} {value}
......
...@@ -31,7 +31,7 @@ export default function CellContainer<P extends Props>(Comp) { ...@@ -31,7 +31,7 @@ export default function CellContainer<P extends Props>(Comp) {
}; };
onBlur = (e: any) => { onBlur = (e: any) => {
let currTarget = e.target; let currTarget = e.target;
while (currTarget != document) { while (currTarget && currTarget != document) {
let editing = currTarget.getAttribute('data-editing-cell'); let editing = currTarget.getAttribute('data-editing-cell');
// 当前点击div是正在编辑的cell时,阻止修改回调 // 当前点击div是正在编辑的cell时,阻止修改回调
if (editing === '1') { if (editing === '1') {
......
...@@ -6,7 +6,7 @@ import { onBlurFn } from '../onBlurFn'; ...@@ -6,7 +6,7 @@ import { onBlurFn } from '../onBlurFn';
import s from './index.less'; import s from './index.less';
export const ApolloInputSearch = (props: ApolloInputSearchProps) => { export const ApolloInputSearch = (props: ApolloInputSearchProps) => {
const { onChange, request, type } = props; const { onChange, request } = props;
const selfProps = antiAssign(props, ['columnConfig', 'onChange', 'request']); const selfProps = antiAssign(props, ['columnConfig', 'onChange', 'request']);
const isOpen = useRef(); const isOpen = useRef();
const changeValue = (value: any) => { const changeValue = (value: any) => {
...@@ -23,7 +23,7 @@ export const ApolloInputSearch = (props: ApolloInputSearchProps) => { ...@@ -23,7 +23,7 @@ export const ApolloInputSearch = (props: ApolloInputSearchProps) => {
return ( return (
<InputSearch <InputSearch
className={s.select} className={s.select}
request={(val) => { return request({ name: val, fieldValueName: type }); }} request={request}
fieldNames={{ value: 'fieldValueValue', label: 'fieldValueName' }} fieldNames={{ value: 'fieldValueValue', label: 'fieldValueName' }}
{...selfProps} {...selfProps}
onDropdownVisibleChange={singleBlurFn} onDropdownVisibleChange={singleBlurFn}
......
...@@ -137,7 +137,11 @@ class TextSelect extends React.Component<Props, State> { ...@@ -137,7 +137,11 @@ class TextSelect extends React.Component<Props, State> {
onChange = (obj) => { onChange = (obj) => {
const { onChange } = this.props; const { onChange } = this.props;
if (typeof onChange === 'function') { if (typeof onChange === 'function') {
onChange(obj); if (!obj || (!obj.label && !obj.value)) {
onChange(undefined);
} else {
onChange(obj);
}
} }
}; };
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
} }
.overlayClassName { .overlayClassName {
max-height: 300px; max-height: 300px;
//overflow: auto; overflow: auto;
margin-top: 20px; margin-top: 20px;
:global(.ant-dropdown-menu) { :global(.ant-dropdown-menu) {
width: auto !important; width: auto !important;
......
...@@ -58,6 +58,7 @@ class AirTable extends React.Component<CommonProps, CommonState> { ...@@ -58,6 +58,7 @@ class AirTable extends React.Component<CommonProps, CommonState> {
const { columns, dataSource } = this.state; const { columns, dataSource } = this.state;
const { const {
className, className,
tableClassName,
rowStyle, rowStyle,
rowClassName, rowClassName,
distanceToLoad, distanceToLoad,
...@@ -105,7 +106,11 @@ class AirTable extends React.Component<CommonProps, CommonState> { ...@@ -105,7 +106,11 @@ class AirTable extends React.Component<CommonProps, CommonState> {
<OperateConfig columns={columns} operateConfig={operateConfig} showCondition={showCondition} /> <OperateConfig columns={columns} operateConfig={operateConfig} showCondition={showCondition} />
)} )}
<div <div
className={onScroll ? classNames(styles.tableContainer, styles.scroll) : styles.tableContainer} className={
onScroll
? classNames(styles.tableContainer, styles.scroll, tableClassName)
: classNames(styles.tableContainer, tableClassName)
}
> >
{tableOperateConfig && ( {tableOperateConfig && (
<div className={styles.tableOperateContainer}> <div className={styles.tableOperateContainer}>
......
...@@ -83,7 +83,6 @@ export interface TableState { ...@@ -83,7 +83,6 @@ export interface TableState {
dataSource: RowProps[]; dataSource: RowProps[];
tableHeight?: number; tableHeight?: number;
tableWidth?: number; tableWidth?: number;
selectedCell?: any;
} }
export interface CommonProps extends TableProps { export interface CommonProps extends TableProps {
operateConfig?: OperateConfigProps; operateConfig?: OperateConfigProps;
...@@ -91,6 +90,7 @@ export interface CommonProps extends TableProps { ...@@ -91,6 +90,7 @@ export interface CommonProps extends TableProps {
paginationConfig?: any; paginationConfig?: any;
locale?: any; locale?: any;
className?: string; className?: string;
tableClassName?: string;
showCondition?: boolean; showCondition?: boolean;
id?:string; id?:string;
} }
......
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
* 监听表单值发生变化是的回掉:onValuesChange:Function * 监听表单值发生变化是的回掉:onValuesChange:Function
* *
* 样式:propClass:object * 样式:propClass:object
* *
* 增加字段:hideOperateBtn,有该字段,隐藏表单底部操作按钮 * 增加字段:hideOperateBtn,有该字段,隐藏表单底部操作按钮
* *
* 失去焦点:onBlurFn * 失去焦点:onBlurFn
* */ * */
import React, { Component } from 'react'; import React, { Component } from 'react';
...@@ -27,10 +27,11 @@ import _ from 'lodash'; ...@@ -27,10 +27,11 @@ import _ from 'lodash';
const FormItem = Form.Item; const FormItem = Form.Item;
class FormWrap extends Component { class FormWrap extends Component {
wrapDom:any;
handleSubmit = (e) => { handleSubmit = (e) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
const { rowId, form, handleSubmit, data, rowData } = this.props; const { rowId, form, handleSubmit, data, rowData, detailType } = this.props;
form.validateFieldsAndScroll((err, values) => { form.validateFieldsAndScroll((err, values) => {
console.log(data, 8888) console.log(data, 8888)
if (!err) { if (!err) {
...@@ -39,7 +40,7 @@ class FormWrap extends Component { ...@@ -39,7 +40,7 @@ class FormWrap extends Component {
const item = data.find((temp: any) => { const item = data.find((temp: any) => {
return temp.columnName === key; return temp.columnName === key;
}); });
const { columnType, renderEditForm, readOnlyFlag, dynamicCellConfigDTO } = item; const { columnType, columnAttrObj, renderEditForm, readOnlyFlag, dynamicCellConfigDTO } = item;
if (readOnlyFlag || (dynamicCellConfigDTO && dynamicCellConfigDTO.readonlyFlag)) { if (readOnlyFlag || (dynamicCellConfigDTO && dynamicCellConfigDTO.readonlyFlag)) {
return; return;
} }
...@@ -50,13 +51,15 @@ class FormWrap extends Component { ...@@ -50,13 +51,15 @@ class FormWrap extends Component {
detailConfig = config[String(columnType)] || config['1']; detailConfig = config[String(columnType)] || config['1'];
} }
const cellValueList = setFormat(detailConfig, item, values[key]); const cellValueList = setFormat(detailConfig, item, values[key]);
newValues.push({ const newData: any = {
columnCode: key, columnCode: key,
cellValueList, cellValueList,
}); };
newValues.push(newData);
}); });
if (typeof handleSubmit === 'function') { if (typeof handleSubmit === 'function') {
handleSubmit({ data: { value: newValues } }); handleSubmit({ data: { value: newValues }, formValues: values, detailType });
} }
} }
}); });
...@@ -88,7 +91,7 @@ class FormWrap extends Component { ...@@ -88,7 +91,7 @@ class FormWrap extends Component {
renderEditForm = (item) => { renderEditForm = (item) => {
const { getFieldDecorator } = this.props.form; const { getFieldDecorator } = this.props.form;
const { rowData, onBlurFn, rowId } = this.props; const { rowData, rowId, getInstanceDetail, onBlurFn } = this.props;
const { const {
columnType, columnType,
columnName, columnName,
...@@ -100,6 +103,7 @@ class FormWrap extends Component { ...@@ -100,6 +103,7 @@ class FormWrap extends Component {
validateFirst = true, validateFirst = true,
validateTrigger = 'onChange', validateTrigger = 'onChange',
dynamicCellConfigDTO, dynamicCellConfigDTO,
cellRenderProps,
} = item; } = item;
let detailConfig: any; let detailConfig: any;
if (typeof renderEditForm === 'function') { if (typeof renderEditForm === 'function') {
...@@ -146,9 +150,18 @@ class FormWrap extends Component { ...@@ -146,9 +150,18 @@ class FormWrap extends Component {
columnConfig={item} columnConfig={item}
disabled={disabled} disabled={disabled}
rowId={rowId} rowId={rowId}
onBlurFn={onBlurFn1}
rowData={{ id: rowId, rowData }}
cellRenderProps={cellRenderProps}
origin="editForm" origin="editForm"
form={this.props.form} form={this.props.form}
onBlurFn={onBlurFn1} getInstanceDetail={getInstanceDetail}
getCalendarContainer={() => {
return this.wrapDom;
}}
getPopupContainer={() => {
return this.wrapDom;
}}
/>, />,
)} )}
</FormItem> </FormItem>
......
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