From 7fe02588cd14e56093ff4c86e43e51d997ad5243 Mon Sep 17 00:00:00 2001 From: YCC Date: Mon, 24 Apr 2023 17:30:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E6=9C=9F=E9=A2=84=E9=80=89,=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config.js | 24 ++++- src/stores/Feedback.js | 64 +------------ src/views/feedback/Detail.jsx | 172 +++++++++++++++++----------------- src/views/feedback/Index.jsx | 69 +++++++------- 4 files changed, 150 insertions(+), 179 deletions(-) diff --git a/src/config.js b/src/config.js index b5b178d..3d8d615 100644 --- a/src/config.js +++ b/src/config.js @@ -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"; \ No newline at end of file +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"; diff --git a/src/stores/Feedback.js b/src/stores/Feedback.js index df4fd97..a2c162d 100644 --- a/src/stores/Feedback.js +++ b/src/stores/Feedback.js @@ -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; diff --git a/src/views/feedback/Detail.jsx b/src/views/feedback/Detail.jsx index 87bc16e..7018bfe 100644 --- a/src/views/feedback/Detail.jsx +++ b/src/views/feedback/Detail.jsx @@ -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 ( - - - - Reservation Detail 中华游111029-N111025076 - - - - - - - - - - - - ); + return ( + + + + Reservation Detail 中华游111029-N111025076 + + + + + + + +
+ + + + ); } -export default observer(Detail); \ No newline at end of file +export default observer(Detail); diff --git a/src/views/feedback/Index.jsx b/src/views/feedback/Index.jsx index f6a5fb9..901fafa 100644 --- a/src/views/feedback/Index.jsx +++ b/src/views/feedback/Index.jsx @@ -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) => {text}, + dataIndex: "EOI_Group_Name", + // render: (text, record) => {text}, }, { 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) => 查看, }, ]; 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() { 反馈表 - - + + { + onNumberChange(e.target.value); + }} + /> - - + + { + onDateRangeChange(dateRange); + }} + /> - -
+