日期预选,日期格式化

release
YCC 2 years ago
parent 22bff8d5f5
commit 7fe02588cd

@ -1,4 +1,26 @@
import React from "react";
import dayjs from 'dayjs';
export const DATE_FORMAT = "YYYY-MM-DD";
export const HT_HOST = process.env.NODE_ENV == "production" ? "https://p9axztuwd7x8a7.mycht.cn" : "http://202.103.68.100:890";
export const DATE_PRESETS = [
{
label: "本周",
value: [dayjs().startOf("w"), dayjs().endOf("w")],
},
{
label: "上周",
value: [dayjs().startOf("w").subtract(7, "days"), dayjs().endOf("w").subtract(7, "days")],
},
{
label: "本月",
value: [dayjs().startOf("M"), dayjs().endOf("M")],
},
// 本月: [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 HT_HOST = process.env.NODE_ENV == "production" ? "https://p9axztuwd7x8a7.mycht.cn" : "http://202.103.68.100:890";

@ -21,42 +21,10 @@ class Feedback {
fetch(config.HT_HOST + url)
.then(response => response.json())
.then(json => {
result = json.result1;
console.log(result);
console.log(json);
runInAction(() => {
this.groupList = result.Result;
// this.groupList = [
// {
// key: "1",
// id: "1",
// referenceNumber: "中华游111029-N111025076",
// arrivalDate: "2023-04-08",
// pax: "5AD 1CH",
// status: "Confirm",
// reservationDate: "2023-04-08 19:31",
// guide: "Bill",
// },
// {
// key: "2",
// id: "3",
// referenceNumber: "中华游111029-N111025076",
// arrivalDate: "2023-04-08",
// pax: "5AD 1CH",
// status: "Confirm",
// reservationDate: "2023-04-08 19:31",
// guide: "Jim",
// },
// {
// key: "3",
// id: "3",
// referenceNumber: "中华游111029-N111025076",
// arrivalDate: "2023-05-08",
// pax: "3AD",
// status: "Confirm",
// reservationDate: "2023-01-08 19:31",
// guide: "Giffigan",
// },
// ];
this.feedbackList = json.Result;
this.loading = false;
});
})
.catch(error => {
@ -66,31 +34,7 @@ class Feedback {
}
loading = false;
groupList = [
{
EOI_SN: 241147,
EOI_GRI_SN: 331423,
EOI_VEI_SN: 32531,
EOI_ObjSN: 32531,
EOI_Date: "2023-02-02T00:05:31",
EOI_FWks_LastEditTime: "",
EOI_FillWorkers_SN: 0,
EOI_VerifyUser_SN: 0,
EOI_CII_SN: 0,
EOI_VRequestVerify: 0,
TotalCount: 35,
VAS_NewTP: 1,
EOI_FillWorkers_Name: "",
EOI_VerifyUser_Name: "",
GuideMark: 0,
Average: 0,
EOI_Group_Name: "中华游230119-MCJAH221211010(AH)",
City: "胡志明市Ho Chi Minh City",
GriName: "",
PicNum: "0",
FState: "未填写",
},
];
feedbackList = []; //反馈列表
}
export default Feedback;

@ -1,103 +1,105 @@
import { useParams, useNavigate } from "react-router-dom";
import { useEffect } from 'react';
import { useEffect } from "react";
import { observer } from "mobx-react";
import { toJS } from "mobx";
import moment from "moment";
import { Row, Col, Space, Button, Table, Tag, Typography, DatePicker } from 'antd';
import { useStore } from '../../stores/StoreContext.js';
import { Row, Col, Space, Button, Table, Tag, Typography, DatePicker } from "antd";
import { useStore } from "../../stores/StoreContext.js";
const { Title } = Typography;
const dataSource = [
{
key: '1',
name: '2',
age: '二',
address: '5月2日',
},
{
key: '2',
name: '胡彦祖',
age: 42,
address: '西湖区湖底公园1号',
},
{
key: "1",
name: "2",
age: "二",
address: "5月2日",
},
{
key: "2",
name: "胡彦祖",
age: 42,
address: "西湖区湖底公园1号",
},
];
const columns = [
{
title: '天数',
dataIndex: 'name',
key: 'name',
},
{
title: '星期',
dataIndex: 'age',
key: 'age',
},
{
title: '日期',
dataIndex: 'address',
key: 'address',
},
{
title: '始发城市',
dataIndex: 'address',
key: 'address',
},
{
title: '抵达城市',
dataIndex: 'address',
key: 'address',
},
{
title: '交通',
dataIndex: 'address',
key: 'address',
},
{
title: '酒店',
dataIndex: 'address',
key: 'address',
},
{
title: '餐饮 [午、晚]',
dataIndex: 'address',
key: 'address',
},
{
title: '景点及旅游服务安排',
dataIndex: 'address',
key: 'address',
},
{
title: "天数",
dataIndex: "name",
key: "name",
},
{
title: "星期",
dataIndex: "age",
key: "age",
},
{
title: "日期",
dataIndex: "address",
key: "address",
},
{
title: "始发城市",
dataIndex: "address",
key: "address",
},
{
title: "抵达城市",
dataIndex: "address",
key: "address",
},
{
title: "交通",
dataIndex: "address",
key: "address",
},
{
title: "酒店",
dataIndex: "address",
key: "address",
},
{
title: "餐饮 [午、晚]",
dataIndex: "address",
key: "address",
},
{
title: "景点及旅游服务安排",
dataIndex: "address",
key: "address",
},
];
function Detail() {
const navigate = useNavigate();
const { reservationId } = useParams();
const { reservationStore } = useStore();
const { reservationList } = reservationStore;
const navigate = useNavigate();
const { reservationId } = useParams();
const { reservationStore } = useStore();
const { reservationList } = reservationStore;
useEffect(() => {
console.info('Detail.useEffect: ' + reservationId);
}, [reservationId]);
useEffect(() => {
console.info("Detail.useEffect: " + reservationId);
}, [reservationId]);
return (
<Space direction="vertical" style={{ width: '100%' }}>
<Row gutter={{ md: 24 }}>
<Col span={20}>
<Title level={4}>Reservation Detail 中华游111029-N111025076</Title>
</Col>
<Col span={4}>
<Button type="link" onClick={() => navigate('/reservation/newest')}>Return</Button>
</Col>
</Row>
<Row>
<Col span={24}>
<Table dataSource={dataSource} columns={columns} />
</Col>
</Row>
</Space>
);
return (
<Space direction="vertical" style={{ width: "100%" }}>
<Row gutter={{ md: 24 }}>
<Col span={20}>
<Title level={4}>Reservation Detail 中华游111029-N111025076</Title>
</Col>
<Col span={4}>
<Button type="link" onClick={() => navigate("/feedback")}>
Return
</Button>
</Col>
</Row>
<Row>
<Col span={24}>
<Table dataSource={dataSource} columns={columns} />
</Col>
</Row>
</Space>
);
}
export default observer(Detail);
export default observer(Detail);

@ -1,57 +1,47 @@
import { NavLink } from "react-router-dom";
import { useEffect } from "react";
import { useEffect, useState } from "react";
import { observer } from "mobx-react";
import { toJS } from "mobx";
import { Row, Col, Space, Button, Table, Input, Typography, DatePicker, Radio } from "antd";
import { useStore } from "@/stores/StoreContext.js";
import * as config from "@/config";
import dayjs from "dayjs";
const { Title } = Typography;
const groupListColumns = [
const feedbackListColumns = [
{
title: "团名",
dataIndex: "referenceNumber",
key: "Reference number",
render: (text, record) => <NavLink to={`/feedback/${record.EOI_SN}`}>{text}</NavLink>,
dataIndex: "EOI_Group_Name",
// render: (text, record) => <NavLink to={`/feedback/${record.EOI_SN}`}>{text}</NavLink>,
},
{
title: "离团日期",
dataIndex: "arrivalDate",
key: "Arrival date",
dataIndex: "EOI_Date",
},
{
title: "城市",
key: "Pax",
dataIndex: "pax",
},
{
title: "导游",
key: "Status",
dataIndex: "status",
key: "City",
dataIndex: "City",
},
{
title: "平均分",
key: "Reservation date",
dataIndex: "reservationDate",
},
{
title: "图片数",
key: "Guide",
dataIndex: "guide",
title: "评分",
dataIndex: "Average",
},
{
title: "操作",
key: "Guide",
dataIndex: "guide",
dataIndex: "EOI_SN",
render: (text, record) => <NavLink to={`/feedback/${record.EOI_SN}`}>查看</NavLink>,
},
];
function Index() {
const { feedbackStore } = useStore();
const { groupList } = feedbackStore;
const { feedbackList } = feedbackStore;
const [selectedDateRange, onDateRangeChange] = useState([config.DATE_PRESETS[0].value]);
const [referenceNo, onNumberChange] = useState("");
useEffect(() => {
console.info("Newest.useEffect");
console.info("feedback.useEffect");
}, []);
return (
@ -59,21 +49,34 @@ function Index() {
<Title level={3}>反馈表</Title>
<Row gutter={16}>
<Col md={24} lg={4} xxl={4}>
<Input placeholder="团号" />
<Col md={24} lg={6} xxl={4}>
<Input
placeholder="团号"
onChange={e => {
onNumberChange(e.target.value);
}}
/>
</Col>
<Col md={24} lg={4} xxl={4}>
<DatePicker.RangePicker allowClear={true} inputReadOnly={true} placeholder={["离团日期 从", "截止"]} />
<Col md={24} lg={6} xxl={4}>
<DatePicker.RangePicker
format={config.DATE_FORMAT}
allowClear={false}
style={{ width: "100%" }}
presets={config.DATE_PRESETS}
onChange={(date, dateRange) => {
onDateRangeChange(dateRange);
}}
/>
</Col>
<Col md={24} lg={4} xxl={4}>
<Button type="primary" loading={feedbackStore.loading} onClick={() => feedbackStore.searchFeedbackList(32531,'','2023-02-01 00:00','2023-03-30 23:59')}>
<Button type="primary" loading={feedbackStore.loading} onClick={() => feedbackStore.searchFeedbackList(32531, referenceNo, selectedDateRange[0], selectedDateRange[1] + " 23:59")}>
搜索
</Button>
</Col>
</Row>
<Row>
<Col md={24} lg={24} xxl={24}>
<Table bordered={true} columns={groupListColumns} dataSource={groupList} />
<Table bordered={true} columns={feedbackListColumns} dataSource={toJS(feedbackList)} />
</Col>
</Row>
</Space>

Loading…
Cancel
Save