Commit b4e046cd authored by zhangwenshuai's avatar zhangwenshuai

update

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