diff --git a/src/stores/Feedback.js b/src/stores/Feedback.js index cf014e0..739c5d0 100644 --- a/src/stores/Feedback.js +++ b/src/stores/Feedback.js @@ -11,7 +11,7 @@ class Feedback { } loading = false; - search_date_start = dayjs().startOf("M"); + search_date_start = dayjs().subtract(2, "M").startOf("M"); search_date_end = dayjs().endOf("M"); feedbackList = []; //反馈列表 feedbackImages = []; //图片列表 diff --git a/src/stores/Invoice.js b/src/stores/Invoice.js index 53e06b0..f06405e 100644 --- a/src/stores/Invoice.js +++ b/src/stores/Invoice.js @@ -1,122 +1,118 @@ -import { makeAutoObservable,runInAction } from "mobx"; -import { fetchJSON,postForm} from "@/utils/request"; -import { prepareUrl,isNotEmpty } from '@/utils/commons'; +import { makeAutoObservable, runInAction } from "mobx"; +import { fetchJSON, postForm } from "@/utils/request"; +import { prepareUrl, isNotEmpty } from "@/utils/commons"; import { HT_HOST } from "@/config"; import { json } from "react-router-dom"; import * as config from "@/config"; import dayjs from "dayjs"; class Invoice { - constructor(root) { - makeAutoObservable(this, { rootStore: false }); - this.root = root; - } - - invoiceList = []; //账单列表 - invoicekImages = []; //图片列表 - invoiceGroupInfo= {}; //账单详细 - invoiceProductList=[];//账单细项 - invoiceZDDetail = []; //报账信息 - invoiceCurrencyList=[];//币种 - invoicePicList = [] //多账单图片列表数组 - invoiceFormData = {'info_money':0,'info_Currency':'','info_date':''}; //存储form数据 - - - - fetchInvoiceList(current,OrderType,GroupNo,DateStart,DateEnd,Orderbytype){ - this.invoicePage.current=current; - const totalNum = current == 1 ? 0 : this.invoicePage.total; - //组合param - const fetchUrl = prepareUrl(HT_HOST + '/service-cusservice/PTSearchGMBPageList') - .append('VEI_SN', this.root.authStore.login.travelAgencyId) // - .append('OrderType',OrderType) - .append('GroupNo',GroupNo) - .append('DateStart',DateStart) - .append('DateEnd',DateEnd) - .append('Orderbytype',Orderbytype) - .append('TimeType',0) - .append('limitmarket',"") - .append('mddgroup',"") - .append('SecuryGroup',"") - .append('TotalNum', totalNum) - .append('PageSize', this.invoicePage.size) - .append('PageIndex', this.invoicePage.current) - .build(); - - return fetchJSON(fetchUrl) - .then(json => { - runInAction(()=>{ - if (json.errcode==0){ - if (isNotEmpty(json.Result)){ - this.invoiceList = json.Result.map((data,index)=>{ - return{ - key:data.GMDSN, - gmd_gri_sn : data.gmd_gri_sn, - gmd_vei_sn : data.gmd_vei_sn, - GetGDate : data.GetGDate, - GMD_FillWorkers_SN : data.GMD_FillWorkers_SN, - GMD_FWks_LastEditTime : data.GMD_FWks_LastEditTime, - GMD_VerifyUser_SN : data.GMD_VerifyUser_SN, - GMD_Dealed : data.GMD_Dealed, - GMD_VRequestVerify : data.GMD_VRequestVerify, - LeftGDate : data.LeftGDate, - GMD_FillWorkers_Name : data.GMD_FillWorkers_Name, - GroupName : data.GroupName, - AllMoney : data.AllMoney, - PersonNum : data.PersonNum, - VName : data.VName, - FKState:data.FKState - } - - }); - this.invoicePage.total = json.Result[0].TotalCount; - } - - // else{ - // this.invoiceList=[]; - // this.invoicePage.total=0; - // } - - }else{ - throw new Error(json.errmsg + ': ' + json.errcode); - } - - }); - - }); - - - } - - - fetchInvoiceDetail(GMDSN,GSN){ - const fetchUrl = prepareUrl(HT_HOST + '/service-cusservice/PTGetZDDetail') - .append('VEI_SN', this.root.authStore.login.travelAgencyId) // - .append('GRI_SN',GSN) - .append('GMD_SN',GMDSN) - .append('LGC',1) - .append('Bill',1) - .build(); - - return fetchJSON(fetchUrl) - .then(json=>{ - runInAction(()=>{ - if(json.errcode==0){ - this.invoiceGroupInfo = json.GroupInfo[0]; - this.invoiceProductList = json.ProductList; - this.invoiceCurrencyList = json.CurrencyList; - this.invoiceZDDetail = json.ZDDetail; - }else{ - throw new Error(json.errmsg + ': ' + json.errcode); - } - }) - return json; - }); + constructor(root) { + makeAutoObservable(this, { rootStore: false }); + this.root = root; + } - } + invoiceList = []; //账单列表 + invoicekImages = []; //图片列表 + invoiceGroupInfo = {}; //账单详细 + invoiceProductList = []; //账单细项 + invoiceZDDetail = []; //报账信息 + invoiceCurrencyList = []; //币种 + invoicePicList = []; //多账单图片列表数组 + invoiceFormData = { info_money: 0, info_Currency: "", info_date: "" }; //存储form数据 + + loading = false; + search_date_start = dayjs().subtract(2, "M").startOf("M"); + search_date_end = dayjs().endOf("M"); + + onDateRangeChange = dates => { + console.log(dates); + this.search_date_start = dates[0]; + this.search_date_end = dates[1]; + }; + + fetchInvoiceList(VEI_SN, GroupNo, DateStart, DateEnd) { + this.loading = true; + const fetchUrl = prepareUrl(HT_HOST + "/service-cusservice/PTSearchGMBPageList") + .append("VEI_SN", VEI_SN) + .append("OrderType", 0) + .append("GroupNo", GroupNo) + .append("DateStart", DateStart) + .append("DateEnd", DateEnd) + .append("Orderbytype", 1) + .append("TimeType", 0) + .append("limitmarket", "") + .append("mddgroup", "") + .append("SecuryGroup", "") + .append("TotalNum", 0) + .append("PageSize", 2000) + .append("PageIndex", 1) + .build(); + + return fetchJSON(fetchUrl).then(json => { + runInAction(() => { + this.loading = false; + if (json.errcode == 0) { + if (isNotEmpty(json.Result)) { + this.invoiceList = json.Result.map((data, index) => { + return { + key: data.GMDSN, + gmd_gri_sn: data.gmd_gri_sn, + gmd_vei_sn: data.gmd_vei_sn, + GetGDate: data.GetGDate, + GMD_FillWorkers_SN: data.GMD_FillWorkers_SN, + GMD_FWks_LastEditTime: data.GMD_FWks_LastEditTime, + GMD_VerifyUser_SN: data.GMD_VerifyUser_SN, + GMD_Dealed: data.GMD_Dealed, + GMD_VRequestVerify: data.GMD_VRequestVerify, + LeftGDate: data.LeftGDate, + GMD_FillWorkers_Name: data.GMD_FillWorkers_Name, + GroupName: data.GroupName, + AllMoney: data.AllMoney, + PersonNum: data.PersonNum, + VName: data.VName, + FKState: data.FKState, + }; + }); + this.invoicePage.total = json.Result[0].TotalCount; + } + + // else{ + // this.invoiceList=[]; + // this.invoicePage.total=0; + // } + } else { + throw new Error(json.errmsg + ": " + json.errcode); + } + }); + }); + } + fetchInvoiceDetail(GMDSN, GSN) { + const fetchUrl = prepareUrl(HT_HOST + "/service-cusservice/PTGetZDDetail") + .append("VEI_SN", this.root.authStore.login.travelAgencyId) + .append("GRI_SN", GSN) + .append("GMD_SN", GMDSN) + .append("LGC", 1) + .append("Bill", 1) + .build(); + + return fetchJSON(fetchUrl).then(json => { + runInAction(() => { + if (json.errcode == 0) { + this.invoiceGroupInfo = json.GroupInfo[0]; + this.invoiceProductList = json.ProductList; + this.invoiceCurrencyList = json.CurrencyList; + this.invoiceZDDetail = json.ZDDetail; + } else { + throw new Error(json.errmsg + ": " + json.errcode); + } + }); + return json; + }); + } - //获取供应商提交的图片 + //获取供应商提交的图片 getInvoicekImages(VEI_SN, GRI_SN) { let url = `/service-fileServer/ListFile`; url += `?GRI_SN=${GRI_SN}&VEI_SN=${VEI_SN}&FilePathName=invoice`; @@ -140,51 +136,48 @@ class Invoice { }); } - //从数据库获取图片列表 - getInvoicekImages_fromData(jsonData){ - let arrLen = jsonData.length; - let arrPicList = jsonData.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)){ - - this.invoicekImages = picList; - } - return picList; - - }) - - runInAction(()=>{ - this.invoicePicList = arrPicList; - }); - - } - - //获取数据库的表单默认数据回填。 - getFormData(jsonData){ - let arrLen = jsonData.length; - return jsonData.map((data,index)=>{ - if (data.GMD_Dealed == false && arrLen == (index+1)){ //只有最后一条账单未审核通过才显示 - runInAction(() => { - this.invoiceFormData = {'info_money':data.GMD_Cost,'info_Currency':data.GMD_Currency,'info_date':isNotEmpty(data.GMD_PayDate)?dayjs(data.GMD_PayDate):''}; - }); - } - }); - } + //从数据库获取图片列表 + getInvoicekImages_fromData(jsonData) { + let arrLen = jsonData.length; + let arrPicList = jsonData.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) { + this.invoicekImages = picList; + } + return picList; + }); + + runInAction(() => { + this.invoicePicList = arrPicList; + }); + } + //获取数据库的表单默认数据回填。 + getFormData(jsonData) { + let arrLen = jsonData.length; + return jsonData.map((data, index) => { + if (data.GMD_Dealed == false && arrLen == index + 1) { + //只有最后一条账单未审核通过才显示 + runInAction(() => { + this.invoiceFormData = { info_money: data.GMD_Cost, info_Currency: data.GMD_Currency, info_date: isNotEmpty(data.GMD_PayDate) ? dayjs(data.GMD_PayDate) : "" }; + }); + } + }); + } - removeFeedbackImages(fileurl) { + removeFeedbackImages(fileurl) { let url = `/service-fileServer/FileDelete`; url += `?fileurl=${fileurl}`; return fetch(config.HT_HOST + url) @@ -198,78 +191,68 @@ class Invoice { }); } + postEditInvoiceDetail(GMD_SN, Currency, Cost, PayDate, Pic, Memo) { + let postUrl = HT_HOST + "/service-cusservice/EditSupplierFK"; + let formData = new FormData(); + formData.append("LMI_SN", this.root.authStore.login.userId); + formData.append("GMD_SN", GMD_SN); + formData.append("Currency", Currency); + formData.append("Cost", Cost); + formData.append("PayDate", isNotEmpty(PayDate) ? PayDate : ""); + formData.append("Pic", Pic); + formData.append("Memo", Memo); + + return postForm(postUrl, formData).then(json => { + console.info(json); + return json; + }); + } - postEditInvoiceDetail(GMD_SN,Currency,Cost,PayDate,Pic,Memo){ - let postUrl = HT_HOST + '/service-cusservice/EditSupplierFK'; - let formData = new FormData(); - formData.append('LMI_SN', this.root.authStore.login.userId); - formData.append('GMD_SN', GMD_SN); - formData.append('Currency', Currency); - formData.append('Cost', Cost); - formData.append('PayDate', isNotEmpty(PayDate)?PayDate:'' ); - formData.append('Pic', Pic); - formData.append('Memo', Memo); - - return postForm(postUrl,formData) - .then(json=>{ - console.info(json); - return json; - }); - } - - postAddInvoice(GRI_SN,Currency,Cost,PayDate,Pic,Memo){ - let postUrl = HT_HOST + '/service-cusservice/AddSupplierFK'; - let formData = new FormData(); - formData.append('LMI_SN', this.root.authStore.login.userId); - formData.append('VEI_SN', this.root.authStore.login.travelAgencyId); - formData.append('GRI_SN', GRI_SN); - formData.append('Currency', Currency); - formData.append('Cost', Cost); - formData.append('PayDate', isNotEmpty(PayDate)?PayDate:'' ); - formData.append('Pic', Pic); - formData.append('Memo', Memo); - return postForm(postUrl,formData) - .then(json=>{ - console.info(json); - return json; - }); - } - - - invoicePage = { - current:1, - size:10, - total:0 - } - - /* 测试数据 */ - //账单列表范例数据 - testData= - [ - { - "GSMSN":449865, - "gmd_gri_sn":334233, - "gmd_vei_sn":628, - "GetDate":"2023-04-2 00:33:33", - "GMD_FillWorkers_SN":8617, - "GMD_FWks_LastEditTime":"2023-04-26 12:33:33", - "GMD_VerifyUser_SN":8928, - "GMD_Dealed":1, - "GMD_VRequestVerify":1, - "TotalCount":22, - "LeftGDate":"2023-03-30 00:00:00", - "GMD_FillWorkers_Name":"", - "GroupName":" 中华游230501-CA230402033", - "AllMoney":3539, - "PersonNum":"1大1小", - "VName":"" - } - ] + postAddInvoice(GRI_SN, Currency, Cost, PayDate, Pic, Memo) { + let postUrl = HT_HOST + "/service-cusservice/AddSupplierFK"; + let formData = new FormData(); + formData.append("LMI_SN", this.root.authStore.login.userId); + formData.append("VEI_SN", this.root.authStore.login.travelAgencyId); + formData.append("GRI_SN", GRI_SN); + formData.append("Currency", Currency); + formData.append("Cost", Cost); + formData.append("PayDate", isNotEmpty(PayDate) ? PayDate : ""); + formData.append("Pic", Pic); + formData.append("Memo", Memo); + return postForm(postUrl, formData).then(json => { + console.info(json); + return json; + }); + } + invoicePage = { + current: 1, + size: 10, + total: 0, + }; + + /* 测试数据 */ + //账单列表范例数据 + testData = [ + { + GSMSN: 449865, + gmd_gri_sn: 334233, + gmd_vei_sn: 628, + GetDate: "2023-04-2 00:33:33", + GMD_FillWorkers_SN: 8617, + GMD_FWks_LastEditTime: "2023-04-26 12:33:33", + GMD_VerifyUser_SN: 8928, + GMD_Dealed: 1, + GMD_VRequestVerify: 1, + TotalCount: 22, + LeftGDate: "2023-03-30 00:00:00", + GMD_FillWorkers_Name: "", + GroupName: " 中华游230501-CA230402033", + AllMoney: 3539, + PersonNum: "1大1小", + VName: "", + }, + ]; } export default Invoice; - - - - diff --git a/src/views/feedback/Index.jsx b/src/views/feedback/Index.jsx index f2db471..2bba0b2 100644 --- a/src/views/feedback/Index.jsx +++ b/src/views/feedback/Index.jsx @@ -35,7 +35,7 @@ const feedbackListColumns = [ }, { title: "External Reviews", - dataIndex: "GriName", + dataIndex: "TAGood", }, ]; @@ -49,12 +49,13 @@ function Index() { useEffect(() => { feedbackStore.searchFeedbackList(authStore.login.travelAgencyId, referenceNo, search_date_start.format(config.DATE_FORMAT), search_date_end.format(config.DATE_FORMAT) + " 23:59") .catch(ex => { - notification.error({ - message: `Error`, - description: ex.message, - placement: 'top', - duration: 4, - }); + // notification.error({ + // message: `Error`, + // description: ex.message, + // placement: 'top', + // duration: 4, + // }); + console.log(ex.message); }); }, []); @@ -93,6 +94,7 @@ function Index() { +