Skip to content

Commit

Permalink
fix(costcenter):low version can use (labring#5208)
Browse files Browse the repository at this point in the history
  • Loading branch information
xudaotutou authored Nov 15, 2024
1 parent 76c93a6 commit 14a67ec
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -346,14 +346,14 @@ const RechargeModal = forwardRef(
{}
);
const [defaultSteps, ratios, steps, specialBonus] = useMemo(() => {
const defaultSteps = Object.entries(bonuses?.data?.discount.defaultSteps || {}).toSorted(
const defaultSteps = Object.entries(bonuses?.data?.discount.defaultSteps || {}).sort(
(a, b) => +a[0] - +b[0]
);
const ratios = defaultSteps.map(([key, value]) => value);
const steps = defaultSteps.map(([key, value]) => +key);
const specialBonus = Object.entries(
bonuses?.data?.discount.firstRechargeDiscount || {}
).toSorted((a, b) => +a[0] - +b[0]);
const specialBonus = Object.entries(bonuses?.data?.discount.firstRechargeDiscount || {}).sort(
(a, b) => +a[0] - +b[0]
);
const temp: number[] = [];
specialBonus.forEach(([k, v]) => {
const step = +k;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
import ReactEChartsCore from 'echarts-for-react/lib/core';
// Import the echarts core module, which provides the necessary interfaces for using echarts.
import * as echarts from 'echarts/core';
import {
GridComponent,
VisualMapComponent,
MarkLineComponent,
TooltipComponent
} from 'echarts/components';
import { LineChart } from 'echarts/charts';
import { UniversalTransition } from 'echarts/features';
import { CanvasRenderer } from 'echarts/renderers';
import useOverviewStore from '@/stores/overview';
import { Cycle } from '@/types/cycle';
import {
addDays,
addHours,
Expand Down Expand Up @@ -38,9 +30,17 @@ import {
subWeeks,
subYears
} from 'date-fns';
import { LineChart } from 'echarts/charts';
import {
GridComponent,
MarkLineComponent,
TooltipComponent,
VisualMapComponent
} from 'echarts/components';
import * as echarts from 'echarts/core';
import { UniversalTransition } from 'echarts/features';
import { CanvasRenderer } from 'echarts/renderers';
import { useTranslation } from 'next-i18next';
import { Cycle } from '@/types/cycle';
import useOverviewStore from '@/stores/overview';

echarts.use([
GridComponent,
Expand Down Expand Up @@ -76,8 +76,8 @@ export default function Trend({ data, cycle }: { data: [number, string][]; cycle
const startOfTime = methods[1](startTime);
const source = [
// ['date', 'amount'],
...data
.toSorted(([aD], [bD]) => aD - bD)
...[...data]
.sort(([aD], [bD]) => aD - bD)
.reduce<[Date, number][]>(
(pre, [curDate, curVal]) => {
const len = pre.length;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export default function Chart({
const { t } = useTranslation();
const series = data.map(([sourceRaw, seriesName]) => {
const source = [
...sourceRaw
.toSorted(([aDate], [bDate]) => aDate - bDate)
...[...sourceRaw]
.sort(([aDate], [bDate]) => aDate - bDate)
.reduce<[Date, number][]>(
(pre, [curDate, curVal]) => {
const len = pre.length;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export default function Trend({
const series = data.map(([sourceRaw, seriesName]) => {
const source = [
// ['date', 'amount'],
...sourceRaw
.toSorted((a, b) => a[0] - b[0])
...[...sourceRaw]
.sort((a, b) => a[0] - b[0])
.reduce<[Date, number][]>(
(pre, [curDate, curVal]) => {
const len = pre.length;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default async function handler(req: NextApiRequest, resp: NextApiResponse
en: string;
}
]
>((d) => [d.data.toSorted(([aDate], [bDate]) => aDate - bDate), d.region.name]);
>((d) => [d.data.sort(([aDate], [bDate]) => aDate - bDate), d.region.name]);

let pointers: number[] = new Array(someArr.length).fill(0);
const maxPointers = someArr.map((d) => d[0].length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function Valuation() {
}
];
})
.toSorted((a, b) => a.idx - b.idx) || [],
.sort((a, b) => a.idx - b.idx) || [],
[_data, t, cycleIdx]
);
const PriceTableData = useMemo(
Expand Down

0 comments on commit 14a67ec

Please sign in to comment.