Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(costcenter):low version can use #5208

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading