From d6d1495c02b6ece4dcf425b26930545aa97123a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=B9=8F?= Date: Wed, 31 May 2023 14:51:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=99=9A=E6=8B=9F=E5=9B=A2=E6=8A=A5=E8=B4=A6?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/invoice/Detail.jsx | 282 ++++++++++++++++++----------------- 1 file changed, 148 insertions(+), 134 deletions(-) diff --git a/src/views/invoice/Detail.jsx b/src/views/invoice/Detail.jsx index b07ab0d..fe7b851 100644 --- a/src/views/invoice/Detail.jsx +++ b/src/views/invoice/Detail.jsx @@ -35,44 +35,47 @@ function Detail() { .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':''} - } + if (isNotEmpty(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 }; + } + }); - //图片列表 - 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 (form) { + form.setFieldsValue(formData[arrLen - 1]); //{'info_money':'111','info_Currency':'THB','info_date':''} } - if (data.GMD_Dealed == false && arrLen == index + 1) { - runInAction(() => { - invoiceStore.invoicekImages = picList; - }); - } - return picList; - }); - setInvoicePicList(arrPicList); + + //图片列表 + 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({ @@ -181,107 +184,118 @@ function Detail() { //循环生成多次报账信息 function bindSubmitForm() { - let submitForm = invoiceZDDetail.map((data, index) => { - if (data.GMD_Dealed) { - //已审核的直接显示信息即可,无需表单 - return ( - - - - - - - - {data.GMD_Cost} - {data.GMD_Currency} - {data.GMD_PayDate} - {invoiceStore.invoiceStatus(data.FKState)} - + let submitForm =null; + if (isNotEmpty(invoiceZDDetail)){ + submitForm = invoiceZDDetail.map((data, index) => { + if (data.GMD_Dealed) { + //已审核的直接显示信息即可,无需表单 + return ( + + + + + + + + {data.GMD_Cost} + {data.GMD_Currency} + {data.GMD_PayDate} + {invoiceStore.invoiceStatus(data.FKState)} + - {addButton(index + 1 == invoiceZDDetail.length)} - - - - ); - } else { - // 一个团只能有一个未审核的账单记录 - return ( - - - -
- Invoice {index + 1} - - -
- -
Click to Upload
-
-
-
- Details - - - {" "} - - - - - - - - - - - - - - - - - - - -
- - -
- ); + {addButton(index + 1 == invoiceZDDetail.length)} + + +
+ ); + } else { + // 一个团只能有一个未审核的账单记录 + return ( + + + +
+ Invoice {index + 1} + + +
+ +
Click to Upload
+
+
+
+ Details + + + {" "} + + + + + + + + + + + + + + + + + + + +
+ + +
+ ); + } + }); + }else{ + submitForm = ()=>{ + return( + <> + {addButton(1==1)} + + ); } - }); + } return submitForm; }