Commit b4e046cd authored by zhangwenshuai's avatar zhangwenshuai

update

parent dfb54cbd
......@@ -32,6 +32,7 @@ const Cell = (props: CellProps) => {
cellData.map((item) => {
temp.push({ text: item.text, value: item.value });
});
console.log('cellData',temp)
if (_.isEqual(temp, changedValue)) {
setStatus('detail');
return;
......
......@@ -62,7 +62,7 @@ export const GetFormatter = {
PERCENTAGE: (val) => {
const obj = Array.isArray(val) && val.length > 0 ? val[0] : {};
if (isNumber(obj.value)) {
return obj.value / 100;
return obj.value * 100;
}
return undefined;
},
......
......@@ -63,7 +63,7 @@ export const SetFormatter = {
},
PERCENTAGE: (val) => {
if (!isNumber(val)) return emptyModel;
val = val * 100;
val = val / 100;
return SetFormatter.NUMBER(val);
},
DATE: (val, config) => {
......
......@@ -3,21 +3,21 @@ import s from './index.less';
import { antiAssign } from '@/apollo-table/utils/utils';
interface Props {
value: any;
onEmitChange: Function;
}
interface State {
value: any;
option: any;
}
const CellContainer = (Comp) => {
return class extends React.Component<Props, State> {
export default function CellContainer<P extends Props>(Comp) {
return class extends React.Component<P & Props, State> {
constructor(props) {
super(props);
this.state = {
value: props.value, // 组件的值
option: undefined, // 选择项
option: undefined, // 选择项
};
console.log('props.value',props.value)
}
componentDidMount(): void {
document.addEventListener('click', this.onBlur, false);
......@@ -26,11 +26,13 @@ const CellContainer = (Comp) => {
document.removeEventListener('click', this.onBlur, false);
}
changeValue = (value: any, option: any) => {
console.log('value',value)
this.setState({ value, option });
};
onBlur = () => {
const { onEmitChange } = this.props;
const { value, option } = this.state;
console.log('state.value',value)
if (typeof onEmitChange === 'function') {
onEmitChange(value, option);
}
......@@ -49,5 +51,4 @@ const CellContainer = (Comp) => {
);
}
};
};
export default CellContainer;
}
......@@ -40,9 +40,7 @@ export interface ApolloSelectProps extends SelectProps, CommonProps {
options?: any[];
}
export interface ApolloNumberProps extends InputNumberProps, CommonProps {}
export interface ApolloDateProps extends DatePickerProps, CommonProps {
ref?: any;
}
export interface ApolloDateProps extends DatePickerProps, CommonProps {}
export interface ApolloCheckboxProps extends CheckboxProps, CommonProps {
label: string;
}
......
import React from 'react';
import { ApolloNumberProps } from '../editInterface';
import ApolloNumber from '@/apollo-table/component/base/edit/number';
import { isNumber } from '@/apollo-table/utils/utils';
import CellContainer from '../container';
const ApolloPercentage = (props: ApolloNumberProps) => {
const ApolloPercentage = (props) => {
return (
<ApolloNumber
{...props}
......@@ -24,4 +22,4 @@ const ApolloPercentage = (props: ApolloNumberProps) => {
);
};
export default CellContainer(ApolloPercentage);
export default ApolloPercentage;
......@@ -71,7 +71,9 @@ export const getComponent = (type: string) => {
onEmitChange = (changedValue: any, option: any) => {
const { columnConfig } = this.state;
const { onEmitChange } = this.props;
console.log('changedValue',changedValue)
let value = setFormat(columnConfig, changedValue, option);
console.log('formatValue',value)
if (typeof onEmitChange === 'function') {
onEmitChange(value, option);
}
......
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