From 948b12ad33c4d51980de8c46cca7220d21e1e7e9 Mon Sep 17 00:00:00 2001 From: YCC Date: Thu, 25 May 2023 15:01:57 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=B4=A6=E5=8D=95=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E9=A1=B5=E6=98=BE=E7=A4=BA=E9=87=91=E9=A2=9D=E5=92=8C=E5=B8=81?= =?UTF-8?q?=E7=A7=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/Invoice.js | 2 + src/views/invoice/Detail.jsx | 637 +++++++++++++++++------------------ src/views/invoice/Index.jsx | 18 +- 3 files changed, 305 insertions(+), 352 deletions(-) diff --git a/src/stores/Invoice.js b/src/stores/Invoice.js index a426288..7ed600b 100644 --- a/src/stores/Invoice.js +++ b/src/stores/Invoice.js @@ -70,6 +70,7 @@ class Invoice { GroupName: data.GroupName, AllMoney: data.AllMoney, PersonNum: data.PersonNum, + GMD_Currency: data.GMD_Currency, VName: data.VName, FKState: data.FKState, }; @@ -239,6 +240,7 @@ class Invoice { GMD_FillWorkers_Name: "", GroupName: " 中华游230501-CA230402033", AllMoney: 3539, + GMD_Currency: "", PersonNum: "1大1小", VName: "", }, diff --git a/src/views/invoice/Detail.jsx b/src/views/invoice/Detail.jsx index 6423deb..fdf9db8 100644 --- a/src/views/invoice/Detail.jsx +++ b/src/views/invoice/Detail.jsx @@ -1,5 +1,5 @@ -import { useParams, useNavigate } from "react-router-dom"; -import { useEffect, useState ,useRef } from "react"; +import { useParams, useNavigate, NavLink } from "react-router-dom"; +import { useEffect, useState, useRef } from "react"; import { observer } from "mobx-react"; import { toJS, runInAction } from "mobx"; import { Row, Col, Space, Button, Typography, Card, Form, Upload, Input, Divider, DatePicker, Select, App, Modal } from "antd"; @@ -13,341 +13,304 @@ const { Title } = Typography; const { TextArea } = Input; function Detail() { - const navigate = useNavigate(); - const { GMDSN, GSN } = useParams(); - const { invoiceStore, authStore } = useStore(); - const { invoicekImages, invoiceGroupInfo, invoiceProductList, invoiceCurrencyList, invoiceZDDetail } = invoiceStore; - const [form] = Form.useForm(); - const [dataLoading, setDataLoading] = useState(false); - const { formCurrency, onCurrencyChange } = useState(); - const { notification } = App.useApp(); - - const [invoicePicList,setInvoicePicList] = useState([]); - - - useEffect(() => { - console.info("Detail.useEffect: " + GMDSN + "/" + GSN); - defaultShow(); - - }, [GMDSN, GSN]); - - - function defaultShow(){ - setDataLoading(true); - invoiceStore.fetchInvoiceDetail(GMDSN, GSN) - .then((json) => { - let ZDDetail = json.ZDDetail; - let arrLen = ZDDetail.length; - const formData = ZDDetail.map((data,index)=>{ - if (data.GMD_Dealed == false && arrLen == (index+1)){ //只有最后一条账单未审核通过才显示 - runInAction(() => { - invoiceStore.invoiceFormData = {'info_money':data.GMD_Cost,'info_Currency':data.GMD_Currency,'info_date':isNotEmpty(data.GMD_PayDate)?dayjs(data.GMD_PayDate):'','info_gmdsn':data.GMD_SN}; - }); - return {'info_money':data.GMD_Cost,'info_Currency':data.GMD_Currency,'info_date':isNotEmpty(data.GMD_PayDate)?dayjs(data.GMD_PayDate):'','info_gmdsn':data.GMD_SN}; - } - }); - - if (form){ - form.setFieldsValue(formData[arrLen-1]); //{'info_money':'111','info_Currency':'THB','info_date':''} - } - - - //图片列表 - let arrPicList = ZDDetail.map((data,index)=>{ - const GMD_Pic = data.GMD_Pic; - let picList = []; - if (isNotEmpty(GMD_Pic)){ - let js_Pic = JSON.parse(GMD_Pic) - picList = js_Pic.map((picData,pic_Index)=>{ - return { - uid: -pic_Index, //用负数,防止添加删除的时候错误 - name: '', - status: "done", - url: picData.url, - } - }); - } - if (data.GMD_Dealed == false && arrLen == (index+1)){ - runInAction(() => { - invoiceStore.invoicekImages = picList; - }); - } - return picList; - - }) - setInvoicePicList(arrPicList); - }) - .catch(ex => { - notification.error({ - message: `Notification`, - description: ex.message, - placement: 'top', - duration: 4, - }); - }) - .finally(() => { - setDataLoading(false); - }); - } - - const fileList = toJS(invoicekImages); - //图片列表 - let arrimg = []; - if (isNotEmpty(fileList)) { - arrimg = fileList.map((data, index) => { - return { - url: data.url - } - }); - } - const onFinish = values => { - const fieldVaule = { - ...values, - 'info_date': isNotEmpty(values['info_date']) ? values['info_date'].format('YYYY-MM-DD') : null, - 'info_images': JSON.stringify(arrimg), - } - console.log("Success:", fieldVaule); - //入库 - if (fieldVaule) { - invoiceStore.postEditInvoiceDetail(fieldVaule.info_gmdsn, fieldVaule.info_Currency, fieldVaule.info_money, fieldVaule.info_date, fieldVaule.info_images, "").then((data) => { - console.log(data); - runInAction(() => { - let param = { 'info_money': fieldVaule.info_money, 'info_Currency': fieldVaule.info_Currency, 'info_date': fieldVaule.info_date }; - invoiceStore.invoiceFormData = param; - }) - if (data.errcode == 0 ){ - notification.success({ - message: `Notification`, - description: "Success Submit!", - placement: "top", - duration: 4, - }); - } - }); - } - - }; - - - - const handleChange = info => { - console.log(info); - let newFileList = [...info.fileList]; - newFileList = newFileList.map(file => { - if (file.response && file.response.result) { - file.url = file.response.result.file_url; - } - return file; - }); - runInAction(() => { - invoiceStore.invoicekImages = newFileList; - }); - }; - - const handRemove = info => { - console.log(info); - invoiceStore.removeFeedbackImages(info.url); - return true; - }; - - //币种 - function bindCurrency() { - let arr = []; - arr = invoiceCurrencyList.map((data, index) => { - return { - value: data.CRI_Code, - label: data.CRI_Name - }; - }); - - return arr; - } - - function addInvoice(){ - invoiceStore.postAddInvoice(GSN, "", 0, "", "[]", "").then((data) => { - }).finally(()=>{ - defaultShow(); - }) - } - - function addButton(check) { - if (check) { - return ( - - - - - - - - ) - } - } - - //循环生成多次报账信息 - function bindSubmitForm() { - let submitForm = invoiceZDDetail.map((data, index) => { - if (data.GMD_Dealed) { //已审核的直接显示信息即可,无需表单 - return ( - - - - Invoice {index + 1} - -
- -
Click to Upload
-
-
- Details - - - - - - Currency: - - - - - - {addButton(index + 1 == invoiceZDDetail.length)} - - - -
- - ) - } else { - // 一个团只能有一个未审核的账单记录 - return ( - - - -
- Invoice {index + 1} - - -
- -
Click to Upload
-
-
-
- Details - - - - - - - - - - - - - - - - - - -
- - -
- ) - } - - }) - return submitForm; - } - - - - return ( - <> - - - - - Reference Number: {invoiceGroupInfo.VGroupInfo} - - - - - - - {bindSubmitForm()} - - - ); - - - - + const navigate = useNavigate(); + const { GMDSN, GSN } = useParams(); + const { invoiceStore, authStore } = useStore(); + const { invoicekImages, invoiceGroupInfo, invoiceProductList, invoiceCurrencyList, invoiceZDDetail } = invoiceStore; + const [form] = Form.useForm(); + const [dataLoading, setDataLoading] = useState(false); + const { formCurrency, onCurrencyChange } = useState(); + const { notification } = App.useApp(); + + const [invoicePicList, setInvoicePicList] = useState([]); + + useEffect(() => { + console.info("Detail.useEffect: " + GMDSN + "/" + GSN); + defaultShow(); + }, [GMDSN, GSN]); + + function defaultShow() { + setDataLoading(true); + invoiceStore + .fetchInvoiceDetail(GMDSN, GSN) + .then(json => { + let ZDDetail = json.ZDDetail; + let arrLen = ZDDetail.length; + const formData = ZDDetail.map((data, index) => { + if (data.GMD_Dealed == false && arrLen == index + 1) { + //只有最后一条账单未审核通过才显示 + runInAction(() => { + invoiceStore.invoiceFormData = { info_money: data.GMD_Cost, info_Currency: data.GMD_Currency, info_date: isNotEmpty(data.GMD_PayDate) ? dayjs(data.GMD_PayDate) : "", info_gmdsn: data.GMD_SN }; + }); + return { info_money: data.GMD_Cost, info_Currency: data.GMD_Currency, info_date: isNotEmpty(data.GMD_PayDate) ? dayjs(data.GMD_PayDate) : "", info_gmdsn: data.GMD_SN }; + } + }); + + if (form) { + form.setFieldsValue(formData[arrLen - 1]); //{'info_money':'111','info_Currency':'THB','info_date':''} + } + + //图片列表 + let arrPicList = ZDDetail.map((data, index) => { + const GMD_Pic = data.GMD_Pic; + let picList = []; + if (isNotEmpty(GMD_Pic)) { + let js_Pic = JSON.parse(GMD_Pic); + picList = js_Pic.map((picData, pic_Index) => { + return { + uid: -pic_Index, //用负数,防止添加删除的时候错误 + name: "", + status: "done", + url: picData.url, + }; + }); + } + if (data.GMD_Dealed == false && arrLen == index + 1) { + runInAction(() => { + invoiceStore.invoicekImages = picList; + }); + } + return picList; + }); + setInvoicePicList(arrPicList); + }) + .catch(ex => { + notification.error({ + message: `Notification`, + description: ex.message, + placement: "top", + duration: 4, + }); + }) + .finally(() => { + setDataLoading(false); + }); + } + + const fileList = toJS(invoicekImages); + //图片列表 + let arrimg = []; + if (isNotEmpty(fileList)) { + arrimg = fileList.map((data, index) => { + return { + url: data.url, + }; + }); + } + const onFinish = values => { + const fieldVaule = { + ...values, + info_date: isNotEmpty(values["info_date"]) ? values["info_date"].format("YYYY-MM-DD") : null, + info_images: JSON.stringify(arrimg), + }; + console.log("Success:", fieldVaule); + //入库 + if (fieldVaule) { + invoiceStore.postEditInvoiceDetail(fieldVaule.info_gmdsn, fieldVaule.info_Currency, fieldVaule.info_money, fieldVaule.info_date, fieldVaule.info_images, "").then(data => { + console.log(data); + runInAction(() => { + let param = { info_money: fieldVaule.info_money, info_Currency: fieldVaule.info_Currency, info_date: fieldVaule.info_date }; + invoiceStore.invoiceFormData = param; + }); + if (data.errcode == 0) { + notification.success({ + message: `Notification`, + description: "Success Submit!", + placement: "top", + duration: 4, + }); + } + }); + } + }; + + const handleChange = info => { + console.log(info); + let newFileList = [...info.fileList]; + newFileList = newFileList.map(file => { + if (file.response && file.response.result) { + file.url = file.response.result.file_url; + } + return file; + }); + runInAction(() => { + invoiceStore.invoicekImages = newFileList; + }); + }; + + const handRemove = info => { + console.log(info); + invoiceStore.removeFeedbackImages(info.url); + return true; + }; + + //币种 + function bindCurrency() { + let arr = []; + arr = invoiceCurrencyList.map((data, index) => { + return { + value: data.CRI_Code, + label: data.CRI_Name, + }; + }); + + return arr; + } + + function addInvoice() { + invoiceStore + .postAddInvoice(GSN, "", 0, "", "[]", "") + .then(data => {}) + .finally(() => { + defaultShow(); + }); + } + + function addButton(check) { + if (check) { + return ( + + + + + ); + } + } + + //循环生成多次报账信息 + function bindSubmitForm() { + let submitForm = invoiceZDDetail.map((data, index) => { + if (data.GMD_Dealed) { + //已审核的直接显示信息即可,无需表单 + return ( + + + + Invoice {index + 1} + +
+ +
Click to Upload
+
+
+ Details + + + + + + Currency: + + + + + + {addButton(index + 1 == invoiceZDDetail.length)} + + +
+ ); + } else { + // 一个团只能有一个未审核的账单记录 + return ( + + + +
+ Invoice {index + 1} + + +
+ +
Click to Upload
+
+
+
+ Details + + + {" "} + + + + + + + + + + + + + + + + + + + +
+ + +
+ ); + } + }); + return submitForm; + } + + return ( + <> + + + + Reference Number: {invoiceGroupInfo.VGroupInfo} + + + Back + + + + {bindSubmitForm()} + + + ); } - export default observer(Detail); - diff --git a/src/views/invoice/Index.jsx b/src/views/invoice/Index.jsx index 4f6bccf..a5b4097 100644 --- a/src/views/invoice/Index.jsx +++ b/src/views/invoice/Index.jsx @@ -26,14 +26,15 @@ function Index() { }, { title: "Arrival Date", - key: "LeftGDate", - dataIndex: "LeftGDate", + key: "GetGDate", + dataIndex: "GetGDate", render: (text, record) => (isNotEmpty(text) ? formatDate(new Date(text)) : ""), }, { title: "Total Amount", key: "AllMoney", dataIndex: "AllMoney", + render: (text, record) => (isNotEmpty(record.GMD_Currency) ? record.GMD_Currency + " " + text : text), }, { title: "Status", @@ -43,15 +44,6 @@ function Index() { ]; function BillStatus(text, record) { - // if (record.GMD_Dealed){ - // return "已审核"; - // }else if (record.GMDFillworkers_SN<1){ - // return "未填写"; - // }else if (record.VRequestVerify){ - // return "未审核"; - // }else{ - // return "未提交"; - // } let FKState = record.FKState - 1; return ( , }, { title: "Travel Advisor", - // status: 'finish', icon: , }, { title: "Finance Dept", - //status: 'process', icon: , }, { title: "Paid", - //status: 'wait', icon: , }, ]} From b4ebb06c88d21be9d9e41d44b93c89b8c78157ce Mon Sep 17 00:00:00 2001 From: YCC Date: Thu, 25 May 2023 15:34:59 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/Invoice.js | 1 + src/views/invoice/Detail.jsx | 286 +++++++++++++++-------------------- src/views/invoice/Index.jsx | 2 +- 3 files changed, 128 insertions(+), 161 deletions(-) diff --git a/src/stores/Invoice.js b/src/stores/Invoice.js index 7ed600b..e599be0 100644 --- a/src/stores/Invoice.js +++ b/src/stores/Invoice.js @@ -177,6 +177,7 @@ class Invoice { removeFeedbackImages(fileurl) { let url = `/service-fileServer/FileDelete`; url += `?fileurl=${fileurl}`; + url += `&token=${this.root.authStore.login.token}`; return fetch(config.HT_HOST + url) .then(response => response.json()) .then(json => { diff --git a/src/views/invoice/Detail.jsx b/src/views/invoice/Detail.jsx index 7d9435f..be49724 100644 --- a/src/views/invoice/Detail.jsx +++ b/src/views/invoice/Detail.jsx @@ -2,7 +2,7 @@ import { useParams, useNavigate, NavLink } from "react-router-dom"; import { useEffect, useState, useRef } from "react"; import { observer } from "mobx-react"; import { toJS, runInAction } from "mobx"; -import { Row, Col, Space, Button, Typography, Card, Form, Upload, Input, Divider, DatePicker, Select, App, Modal } from "antd"; +import { Row, Col, Space, Button, Typography, Card, Form, Upload, Input, Divider, DatePicker, Select, App, Descriptions } from "antd"; import { useStore } from "@/stores/StoreContext.js"; import { PlusOutlined } from "@ant-design/icons"; import { isNotEmpty } from "@/utils/commons"; @@ -179,167 +179,133 @@ function Detail() { } } - //循环生成多次报账信息 - function bindSubmitForm() { - let submitForm = invoiceZDDetail.map((data, index) => { - if (data.GMD_Dealed) { //已审核的直接显示信息即可,无需表单 - return ( - - - - Invoice {index + 1} - -
- -
Click to Upload
-
-
- Details - - - - - - Currency: - - - - - - {addButton(index + 1 == invoiceZDDetail.length)} - - - -
- - ) - } else { - // 一个团只能有一个未审核的账单记录 - return ( - - - -
- Invoice {index + 1} - - -
- -
Click to Upload
-
-
-
- Details - - - - - - - - - - - - - - - - - - -

Our Finance Dept makes payment during the last week in each month. So due date can only the last day of each month. If there's urgent payment, please contact the travel advisor and send invoice separately.

-
- - -
- ) - } - - }) - return submitForm; - } - - - - return ( - <> - - - - - Reference Number: {invoiceGroupInfo.VGroupInfo} - - - - - - - {bindSubmitForm()} - - - ); - - + //循环生成多次报账信息 + function bindSubmitForm() { + let submitForm = invoiceZDDetail.map((data, index) => { + if (data.GMD_Dealed) { + //已审核的直接显示信息即可,无需表单 + return ( + + + + Invoice {index + 1} + + + {data.GMD_Cost} + {data.GMD_Currency} + {data.GMD_PayDate} + + {addButton(index + 1 == invoiceZDDetail.length)} + + + + ); + } else { + // 一个团只能有一个未审核的账单记录 + return ( + + + +
+ Invoice {index + 1} + + +
+ +
Click to Upload
+
+
+
+ Details + + + {" "} + + + + + + + + + + + + + + + + + + + +

+ Our Finance Dept makes payment during the last week in each month. So due date can only the last day of each month. If there's urgent payment, please contact the travel advisor and send invoice + separately. +

+
+ + +
+ ); + } + }); + return submitForm; + } + return ( + <> + + + + Reference Number: {invoiceGroupInfo.VGroupInfo} + + + + + + + {bindSubmitForm()} + + + ); } export default observer(Detail); diff --git a/src/views/invoice/Index.jsx b/src/views/invoice/Index.jsx index a5b4097..b4e14f6 100644 --- a/src/views/invoice/Index.jsx +++ b/src/views/invoice/Index.jsx @@ -100,7 +100,7 @@ function Index() { - + From 20daa50c5b883fd231ed465e97c8aaafa1836659 Mon Sep 17 00:00:00 2001 From: Jimmy Liow <18777396951@163.com> Date: Thu, 25 May 2023 15:59:53 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E6=80=BB=E6=95=B0=E9=94=99=E8=AF=AF=EF=BC=9B=E4=BE=9B=E5=BA=94?= =?UTF-8?q?=E5=95=86=E5=8F=98=E6=9B=B4=E4=B8=8D=E8=83=BD=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=8E=9F=E6=9D=A5=E5=86=85=E5=AE=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/Auth.js | 76 ++++++++++++++++++++++++-------- src/stores/Reservation.js | 2 +- src/views/App.jsx | 28 +++++++++--- src/views/reservation/Detail.jsx | 13 ++++-- src/views/reservation/Newest.jsx | 1 + 5 files changed, 92 insertions(+), 28 deletions(-) diff --git a/src/stores/Auth.js b/src/stores/Auth.js index a564fec..c1e5bd1 100644 --- a/src/stores/Auth.js +++ b/src/stores/Auth.js @@ -4,6 +4,8 @@ import { HT_HOST } from "@/config"; import { isNotEmpty, prepareUrl } from '@/utils/commons'; const KEY_LOGIN_TOKEN = 'KEY_LOGIN_TOKEN'; +const KEY_TRAVEL_AGENCY_ID = 'KEY_TRAVEL_AGENCY_ID'; +const KEY_USER_ID = 'KEY_USER_ID'; class Auth { @@ -11,12 +13,11 @@ class Auth { makeAutoObservable(this, { rootStore: false }); this.root = root; this.login.token = root.getSession(KEY_LOGIN_TOKEN); + this.login.userId = root.getSession(KEY_USER_ID); + this.login.travelAgencyId = root.getSession(KEY_TRAVEL_AGENCY_ID); if (isNotEmpty(this.login.token)) { this.fetchUserDetail(); } - setInterval(() => { - // console.info('Auth.check.token.'); - }, 10000); } valdateUserPassword(usr, pwd) { @@ -29,6 +30,7 @@ class Auth { .then(json => { if (json.errcode == 0) { this.login.token = json.Result.token; + this.login.timeout = false; this.root.putSession(KEY_LOGIN_TOKEN, json.Result.token); return json.Result.WU_LMI_SN; } else { @@ -46,14 +48,17 @@ class Auth { .then(json => { if (json.errcode == 0) { runInAction(() => { - this.login.userId = json.Result.LMI_SN, - this.login.username = json.Result.LoginName, - this.login.travelAgencyId = json.Result.LMI_VEI_SN, - this.login.travelAgencyName = json.Result.VName, - this.login.telephone = json.Result.LkPhone, - this.login.emailAddress = json.Result.LMI_listmail, - this.login.cityId = json.Result.citysn + this.login.userId = json.Result.LMI_SN; + this.login.username = json.Result.LoginName; + this.login.travelAgencyId = json.Result.LMI_VEI_SN; + this.login.travelAgencyName = json.Result.VName; + this.login.telephone = json.Result.LkPhone; + this.login.emailAddress = json.Result.LMI_listmail; + this.login.cityId = json.Result.citysn; + this.root.putSession(KEY_TRAVEL_AGENCY_ID, this.login.travelAgencyId); + this.root.putSession(KEY_USER_ID, this.login.userId); }); + this.startTokenInterval(this.login.token); return this.login; } else { throw new Error(json.errmsg + ': ' + json.errcode); @@ -61,6 +66,40 @@ class Auth { }); } + startTokenInterval(loginToken) { + const authStore = this; + async function fetchLastRequet() { + const fetchUrl = prepareUrl(HT_HOST + '/service-CooperateSOA/GetLastReqDate') + .append('token', loginToken) + .build(); + const json = await fetchJSON(fetchUrl) + if (json.errcode == 0 && isNotEmpty(json.result)) { + return json.result.LastReqDate; + } else { + return 0; + } + } + + setInterval(async () => { + const lastRequest = await fetchLastRequet(); + console.info(lastRequest); + const lastReqDate = new Date(lastRequest); + const now = new Date(); + const diffTime = now.getTime() - lastReqDate.getTime(); + const diffMinute = diffTime/1000/60; + console.info(now); + console.info(lastReqDate); + console.info('diffTime: ' + diffTime); + console.info('diffMinute: ' + diffMinute); + if (diffMinute > 3) { + console.info('timeout...'); + runInAction(() => { + authStore.login.timeout = true; + }); + } + }, 1000*60*1); + } + changeUserPassword(password, newPassword) { const formData = new FormData(); formData.append('UserID', this.login.userId); @@ -80,14 +119,15 @@ class Auth { } login = { - token: '',//'249FC25C949B4BB182431F89762AE5E8', - userId: 1, // LMI_SN - username: 'Vu Xuan Giang', - travelAgencyId: 32531, // VEI_SN - travelAgencyName: 'ANP', - telephone: '000', - emailAddress: 'abc@123.com', - cityId: 0 + token: '', + userId: 0, // LMI_SN + username: '0', + travelAgencyId: 0, // VEI_SN + travelAgencyName: '', + telephone: '', + emailAddress: '', + cityId: 0, + timeout: false } } diff --git a/src/stores/Reservation.js b/src/stores/Reservation.js index d276ec4..eaf0880 100644 --- a/src/stores/Reservation.js +++ b/src/stores/Reservation.js @@ -43,7 +43,7 @@ class Reservation { guide: data.Guide } }); - this.reservationPage.total = (json?.Result??[{RsTotal: 0}]).RsTotal; + this.reservationPage.total = (json?.Result??[{RsTotal: 0}])[0].RsTotal; }); } else { throw new Error(json.errmsg + ': ' + json.errcode); diff --git a/src/views/App.jsx b/src/views/App.jsx index 030dfa9..da0e7ce 100644 --- a/src/views/App.jsx +++ b/src/views/App.jsx @@ -2,7 +2,7 @@ import { Outlet, Link, useHref, useNavigate, NavLink } from "react-router-dom"; import { useEffect } from "react"; import { observer } from "mobx-react"; import { toJS } from "mobx"; -import { Layout, Menu, ConfigProvider, theme, Dropdown, Space, Row, Col, Badge, Typography, Divider, App as AntApp } from "antd"; +import { Layout, Menu, ConfigProvider, theme, Dropdown, Space, Row, Col, Badge, Typography, Modal, Input, Button, App as AntApp } from "antd"; import { DownOutlined } from "@ant-design/icons"; import "antd/dist/reset.css"; import AppLogo from "@/assets/logo-gh.png"; @@ -32,14 +32,14 @@ const items = [ function App() { const { authStore, noticeStore } = useStore(); - const { login } = authStore; + const login = toJS(authStore.login); const { noticeUnRead } = noticeStore; const href = useHref(); - const loginToken = toJS(login).token; + const loginToken = login.token; const navigate = useNavigate(); useEffect(() => { // Check location - console.info("href: " + href + '; login.token: ' + loginToken); + console.info("href: " + href + '; login.token: ' + loginToken + '; timeout: ' + login.timeout); if (href !== '/login' && isEmpty(loginToken)) { navigate('/login'); } @@ -65,6 +65,25 @@ function App() { algorithm: theme.defaultAlgorithm, }}> + + Login timeout + + + + + - { setConfirmLoading(true); - reservationStore.submitConfirmation(confirmText) + reservationStore.submitConfirmation(confirmText + ';' +newConfirmText) .finally(() => { + setNewConfirmText(''); setIsModalOpen(false); setConfirmLoading(false); }); @@ -102,9 +104,12 @@ function Detail() { open={isModalOpen} onOk={handleOk} onCancel={handleCancel} > Confirm + +
{confirmText}
+