datePicker 适应语言变化

feature/price_manager
Lei OT 1 year ago
parent 75fa47cfe0
commit 2aa20577d5

@ -5,39 +5,6 @@ export const PROJECT_NAME = "GHHub";
export const HT_HOST = import.meta.env.PROD ? "https://p9axztuwd7x8a7.mycht.cn" :"http://202.103.68.144:890"; //"http://202.103.68.231:889";
export const DATE_FORMAT = "YYYY-MM-DD";
export const DATE_FORMAT_MONTH = "YYYY-MM";
export const DATE_PRESETS = [
{
label: "This Week",
value: [dayjs().startOf("w"), dayjs().endOf("w")],
},
{
label: "Last Week",
value: [dayjs().startOf("w").subtract(7, "days"), dayjs().endOf("w").subtract(7, "days")],
},
{
label: "This Month",
value: [dayjs().startOf("M"), dayjs().endOf("M")],
},
{
label: "Last Month",
value: [dayjs().subtract(1, "M").startOf("M"), dayjs().subtract(1, "M").endOf("M")],
},
{
label: "Last Three Month",
value: [dayjs().subtract(2, "M").startOf("M"), dayjs().endOf("M")],
},
{
label: "This Year",
value: [dayjs().startOf("y"), dayjs().endOf("y")],
},
// 本月: [dayjs().startOf("month"), moment().endOf("month")],
// 上个月: [dayjs().subtract(1, "months").startOf("month"), moment(new Date()).subtract(1, "months").endOf("month")],
// 近7天: [dayjs().add(-7, "days"), dayjs()],
// 近30天: [dayjs().subtract(30, "days"), moment()],
// 近三个月: [dayjs().subtract(2, "month").startOf("month"), moment().endOf("month")],
// 今年: [dayjs().startOf("year"), moment().endOf("year")],
// 去年: [dayjs().subtract(1, "year").startOf("year"), moment().subtract(1, "year").endOf("year")],
];
export const arrManager = ["testzp","testzac","testycc","testlyj","testqqs","testjjh","testhn"];//特定账号加修改所属供应商的菜单 zp
const __BUILD_VERSION__ = `__BUILD_VERSION__`.replace(/"/g, '')

@ -5,6 +5,7 @@ import { toJS } from "mobx";
import { Row, Col, Space, Button, Table, Input, Typography, DatePicker, App } from "antd";
import { useStore } from "@/stores/StoreContext.js";
import * as config from "@/config";
import usePresets from '@/hooks/usePresets';
const { Title } = Typography;
const feedbackListColumns = [
@ -80,7 +81,7 @@ function Index() {
allowClear={false}
style={{ width: "100%" }}
value={[search_date_start, search_date_end]}
presets={config.DATE_PRESETS}
presets={usePresets()}
onChange={feedbackStore.onDateRangeChange}
/>
</Space>

@ -7,6 +7,7 @@ import { useStore } from "@/stores/StoreContext.js";
import * as config from "@/config";
import { formatDate, isNotEmpty } from "@/utils/commons";
import { AuditOutlined, SmileOutlined, SolutionOutlined, EditOutlined } from "@ant-design/icons";
import usePresets from '@/hooks/usePresets';
const { Title } = Typography;
@ -124,7 +125,7 @@ function Index() {
<Col md={24} lg={8} xxl={6}>
<Space direction="horizontal">
Arrival Date
<DatePicker.RangePicker format={config.DATE_FORMAT} allowClear={true} style={{ width: "100%" }} defaultValue={[search_date_start, search_date_end]} presets={config.DATE_PRESETS} onChange={invoiceStore.onDateRangeChange} allowEmpty={true} />
<DatePicker.RangePicker format={config.DATE_FORMAT} allowClear={true} style={{ width: "100%" }} defaultValue={[search_date_start, search_date_end]} presets={usePresets()} onChange={invoiceStore.onDateRangeChange} allowEmpty={true} />
</Space>
</Col>
<Col md={24} lg={4} xxl={4}>

@ -6,6 +6,7 @@ import { Row, Col, Space, Button, Table, Input, DatePicker, Typography, App, Ima
import { useStore } from "@/stores/StoreContext.js";
import * as config from "@/config";
import { formatDate, isNotEmpty } from "@/utils/commons";
import usePresets from '@/hooks/usePresets';
const { Title } = Typography;
function Paid(){
@ -66,7 +67,7 @@ function Paid(){
}else{
return "";
}
}
@ -95,7 +96,7 @@ function Paid(){
<Col md={24} lg={8} xxl={6}>
<Space direction="horizontal">
Date
<DatePicker.RangePicker format={config.DATE_FORMAT} allowClear={false} style={{ width: "100%" }} value={[search_date_start, search_date_end]} presets={config.DATE_PRESETS} onChange={invoiceStore.onDateRangeChange} />
<DatePicker.RangePicker format={config.DATE_FORMAT} allowClear={false} style={{ width: "100%" }} value={[search_date_start, search_date_end]} presets={usePresets()} onChange={invoiceStore.onDateRangeChange} />
</Space>
</Col>
<Col md={24} lg={4} xxl={4}>

@ -2,11 +2,10 @@ import { NavLink, useLocation } from "react-router-dom";
import { useState, useEffect } from 'react';
import { observer } from "mobx-react";
import { toJS } from "mobx";
import { Row, Col, Space, Button, Table, Input, Typography, DatePicker, Radio, Modal, App, Select } from 'antd';
import { Row, Col, Space, Button, Table, Input, Typography, DatePicker, Modal, App, Select } from 'antd';
import dayjs from "dayjs";
import { useStore } from '@/stores/StoreContext.js';
import { DATE_PRESETS } from "@/config";
import { formatDate, isEmpty } from "@/utils/commons";
import { isEmpty } from "@/utils/commons";
import { useTranslation } from 'react-i18next';
import usePresets from '@/hooks/usePresets';

Loading…
Cancel
Save