diff --git a/src/apollo-table/component/Cell.tsx b/src/apollo-table/component/Cell.tsx index c71dfa7a5a476a23e44100e0b142268461a5bd09..3b2ff36471adf480e9853fad79f42b03e0883aba 100644 --- a/src/apollo-table/component/Cell.tsx +++ b/src/apollo-table/component/Cell.tsx @@ -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; diff --git a/src/apollo-table/component/base/_utils/getFormatter.tsx b/src/apollo-table/component/base/_utils/getFormatter.tsx index a291e524b1a2b60c950bb2f4a0787cc12ec60e78..2e19d4f1bceb16589d053323d8d6bb8a69c8f8cb 100644 --- a/src/apollo-table/component/base/_utils/getFormatter.tsx +++ b/src/apollo-table/component/base/_utils/getFormatter.tsx @@ -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; }, diff --git a/src/apollo-table/component/base/_utils/setFormatter.tsx b/src/apollo-table/component/base/_utils/setFormatter.tsx index 975672dde95abac75b06e1d61c12d9a9dbe25bca..9e12bd94ac1032def38be0c1834f6f98c61f49a6 100644 --- a/src/apollo-table/component/base/_utils/setFormatter.tsx +++ b/src/apollo-table/component/base/_utils/setFormatter.tsx @@ -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) => { diff --git a/src/apollo-table/component/base/edit/container/index.tsx b/src/apollo-table/component/base/edit/container/index.tsx index ecf04bae5f611842787082066a84ec09e33cd596..0055a1a0d12ddebc4983faa4652fa9c853a7b028 100644 --- a/src/apollo-table/component/base/edit/container/index.tsx +++ b/src/apollo-table/component/base/edit/container/index.tsx @@ -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 { +export default function CellContainer

(Comp) { + return class extends React.Component

{ 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; +} diff --git a/src/apollo-table/component/base/edit/editInterface.tsx b/src/apollo-table/component/base/edit/editInterface.tsx index 05287bd0801ef77078713a1a197e2dddee51e3b4..da06444e54cfaf2e7e9689cfdccf702c4ec5b242 100644 --- a/src/apollo-table/component/base/edit/editInterface.tsx +++ b/src/apollo-table/component/base/edit/editInterface.tsx @@ -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; } diff --git a/src/apollo-table/component/base/edit/percentage/index.tsx b/src/apollo-table/component/base/edit/percentage/index.tsx index c4d04e6e1f38389952af81efc196902d54dc0a96..727c15281568d6eed5eb3e24e8d2818e5aceca2c 100644 --- a/src/apollo-table/component/base/edit/percentage/index.tsx +++ b/src/apollo-table/component/base/edit/percentage/index.tsx @@ -1,10 +1,8 @@ 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 ( { ); }; -export default CellContainer(ApolloPercentage); +export default ApolloPercentage; diff --git a/src/apollo-table/component/base/index.tsx b/src/apollo-table/component/base/index.tsx index 6c7c6acc3666241a5865cbd1c6fb03778952f64d..dbf56c8acba524ef2b2385012d6cd01676f5a54d 100644 --- a/src/apollo-table/component/base/index.tsx +++ b/src/apollo-table/component/base/index.tsx @@ -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); }