From b689d68218ab131b62744f46b5d0cb9904aaa801 Mon Sep 17 00:00:00 2001 From: YCC Date: Wed, 20 Mar 2024 17:30:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AF=BC=E6=B8=B8=E3=80=81?= =?UTF-8?q?=E8=A1=A8=E6=89=AC=E7=AD=89=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config.js | 2 +- src/stores/Report.js | 332 +++++-------------------------------- src/views/report/Index.jsx | 117 +++++++++---- 3 files changed, 133 insertions(+), 318 deletions(-) diff --git a/src/config.js b/src/config.js index acc2de0..930f853 100644 --- a/src/config.js +++ b/src/config.js @@ -1,7 +1,7 @@ import React from "react"; import dayjs from "dayjs"; -export const HT_HOST = process.env.NODE_ENV == "production" ? "https://p9axztuwd7x8a7.mycht.cn" :"http://202.103.68.231:889"; //"http://202.103.68.144:890"; +export const HT_HOST = process.env.NODE_ENV == "production" ? "https://p9axztuwd7x8a7.mycht.cn" :"http://202.103.68.144:890"; //"http://202.103.68.231:889"; export const DATE_FORMAT = "YYYY-MM-DD"; export const DATE_FORMAT_MONTH = "YYYY-MM"; export const DATE_PRESETS = [ diff --git a/src/stores/Report.js b/src/stores/Report.js index 82199a3..f37787c 100644 --- a/src/stores/Report.js +++ b/src/stores/Report.js @@ -12,65 +12,39 @@ class Report { this.root = root; } - invoiceList = []; //账单列表 - invoicekImages = []; //图片列表 - invoiceGroupInfo = {}; //账单详细 - invoiceProductList = []; //账单细项 - invoiceZDDetail = []; //报账信息 - invoiceCurrencyList = []; //币种 - invoicePicList = []; //多账单图片列表数组 - invoiceFormData = { info_money: 0, info_Currency: "", info_date: "" }; //存储form数据 - - invoicePaid = [] ; //支付账单列表 - invoicePaidDetail = []; //每期账单详细 + vendorScoresData = []; //地接统计数据集,合计数据,每月数据,地接考核分数 + productScoresData = []; //产品体验分析 常用酒店分析, 导游接待情况 + commendScoresData = []; //表扬情况, 投诉情况, 评建议 loading = false; - search_date_start = dayjs().month(0); - search_date_end = dayjs().month(11); + search_date_start = dayjs().month(0).startOf("month"); + search_date_end = dayjs().month(11).endOf("month"); onDateRangeChange = dates => { - console.log(dates); - this.search_date_start = dates==null? null: dates[0]; - this.search_date_end = dates==null? null: dates[1]; + this.search_date_start = dates == null ? null : dates[0].startOf("month"); + this.search_date_end = dates == null ? null : dates[1].endOf("month"); }; getHWVendorScores(VEI_SN, StartDate, EndDate) { - this.loading = true; - const fetchUrl = prepareUrl(HT_HOST + "/service-cusservice/PTGetHWProductScores") - .append("VEI_SN", VEI_SN) + this.loading = true; //HT_HOST + + const fetchUrl = prepareUrl("http://202.103.68.231:889/service-cusservice/PTGetHWVendorScores") + .append("VEI_SN", 1) .append("StartDate", StartDate) .append("EndDate", EndDate) - .append("token",this.root.authStore.login.token) + .append("StrDEI_SN", "(,-1,)") + .append("OrderType", "-1") + .append("GroupType", "-1") + .append("token", this.root.authStore.login.token) .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, - GMD_Currency: data.GMD_Currency, - VName: data.VName, - FKState: data.FKState, - }; - }); + if (isNotEmpty(json)) { + this.vendorScoresData = json; } else { - this.invoiceList = []; + this.vendorScoresData = []; } } else { throw new Error(json.errmsg + ": " + json.errcode); @@ -79,249 +53,54 @@ class Report { }); } - 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) - .append("token",this.root.authStore.login.token) - .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`; - url += `&token=${this.root.authStore.login.token}`; - fetch(config.HT_HOST + url) - .then(response => response.json()) - .then(json => { - console.log(json); - runInAction(() => { - this.invoicekImages = json.result.map((data, index) => { - return { - uid: -index, //用负数,防止添加删除的时候错误 - name: data.file_name, - status: "done", - url: data.file_url, - }; - }); - }); - }) - .catch(error => { - console.log("fetch data failed", error); - }); - } - - //从数据库获取图片列表 - 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) { - 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 => { - console.log(json); - return json.Result; - }) - .catch(error => { - console.log("fetch data failed", error); - }); - } - - 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); - formData.append("token",this.root.authStore.login.token); - - 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); - formData.append("token",this.root.authStore.login.token); - return postForm(postUrl, formData).then(json => { - console.info(json); - return json; - }); - } - - //账单状态 - invoiceStatus(FKState) { - switch (FKState - 1) { - case 1: - return "Submitted"; - break; - case 2: - return "Travel Advisor"; - break; - case 3: - return "Finance Dept"; - break; - case 4: - return "Paid"; - break; - default: - return ""; - break; - } - } - - fetchInvoicePaid(VEI_SN, GroupNo, DateStart, DateEnd) { - this.loading = true; - const fetchUrl = prepareUrl(HT_HOST + "/service-Cooperate/Cooperate/GetInvoicePaid") - .append("VEI_SN", VEI_SN) - .append("GroupNo", GroupNo) - .append("DateStart", DateStart) - .append("DateEnd", DateEnd) - .append("token",this.root.authStore.login.token) + getHWProductScores(VEI_SN, StartDate, EndDate) { + this.loading = true; //HT_HOST + + const fetchUrl = prepareUrl("http://202.103.68.231:889/service-cusservice/PTGetHWProductScores") + .append("VEI_SN", 1511) + .append("StartDate", StartDate) + .append("EndDate", EndDate) + .append("StrDEI_SN", "(,-1,)") + .append("OrderType", "-1") + .append("GroupType", "-1") + .append("token", this.root.authStore.login.token) .build(); return fetchJSON(fetchUrl).then(json => { runInAction(() => { this.loading = false; if (json.errcode == 0) { - if (isNotEmpty(json.Result)) { - this.invoicePaid = json.Result.map((data, index) => { - return { - key: data.fl_id, - fl_finaceNo: data.fl_finaceNo, - fl_vei_sn: data.fl_vei_sn, - fl_year: data.fl_year, - fl_month: data.fl_month, - fl_memo: data.fl_memo, - fl_adddate: data.fl_adddate, - fl_addUserSn: data.fl_addUserSn, - fl_updateUserSn: data.fl_updateUserSn, - fl_updatetime: data.fl_updatetime, - fl_state: data.fl_state, - fl_paid: data.fl_paid, - fl_pic: data.fl_pic, - fcount: data.fcount, - pSum: data.pSum, - }; - }); + if (isNotEmpty(json)) { + this.productScoresData = json; } else { - this.invoicePaid = []; + this.productScoresData = []; } } else { throw new Error(json.errmsg + ": " + json.errcode); } }); }); - } - - fetchInvoicePaidDetail(VEI_SN,FLID){ - this.loading = true; - const fetchUrl = prepareUrl(HT_HOST + "/service-Cooperate/Cooperate/GetInvoicePaidDetail") - .append("VEI_SN", VEI_SN) - .append("fl_id", FLID) - .append("token",this.root.authStore.login.token) + getHWCommendScores(VEI_SN, StartDate, EndDate) { + this.loading = true; //HT_HOST + + const fetchUrl = prepareUrl("http://202.103.68.231:889/service-cusservice/PTGetHWCommendScores") + .append("VEI_SN", 1511) + .append("StartDate", StartDate) + .append("EndDate", EndDate) + .append("StrDEI_SN", "(,-1,)") + .append("OrderType", "-1") + .append("GroupType", "-1") + .append("token", this.root.authStore.login.token) .build(); return fetchJSON(fetchUrl).then(json => { runInAction(() => { this.loading = false; if (json.errcode == 0) { - if (isNotEmpty(json.Result)) { - this.invoicePaidDetail = json.Result.map((data, index) => { - return { - key: data.fl2_id, - fl2_fl_id: data.fl2_fl_id, - fl2_GroupName: data.fl2_GroupName, - fl2_gri_sn: data.fl2_gri_sn, - fl2_gmd_sn: data.fl2_gmd_sn, - fl2_wl: data.fl2_wl, - fl2_ArriveDate: data.fl2_ArriveDate, - fl2_price: data.fl2_price, - fl2_state: data.fl2_state, - fl2_updatetime: data.fl2_updatetime, - fl2_updateUserSn: data.fl2_updateUserSn, - fl2_memo: data.fl2_memo, - fl2_memo2: data.fl2_memo2, - fl2_paid: data.fl2_paid, - fl2_pic: data.fl2_pic, - }; - }); + if (isNotEmpty(json)) { + this.commendScoresData = json; } else { - this.invoicePaidDetail = []; + this.commendScoresData = []; } } else { throw new Error(json.errmsg + ": " + json.errcode); @@ -329,31 +108,6 @@ class Report { }); }); } - - /* 测试数据 */ - //账单列表范例数据 - 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, - FKState: 1, - GMD_Currency: "", - PersonNum: "1大1小", - VName: "", - }, - ]; } export default Report; diff --git a/src/views/report/Index.jsx b/src/views/report/Index.jsx index 6e3de82..4f56b49 100644 --- a/src/views/report/Index.jsx +++ b/src/views/report/Index.jsx @@ -12,25 +12,10 @@ const { Title, Paragraph, Text } = Typography; function Index() { const { reportStore, authStore } = useStore(); - const { search_date_start, search_date_end } = reportStore; + const { search_date_start, search_date_end, vendorScoresData, productScoresData, commendScoresData } = reportStore; useEffect(() => {}, []); - const dataSource = [ - { - key: "1", - name: "Groups", - age: 32, - address: "西湖区湖底公园1号", - }, - { - key: "2", - name: "胡彦祖", - age: 42, - address: "西湖区湖底公园1号", - }, - ]; - const columns_primary = [ { title: "Groups", @@ -172,6 +157,62 @@ function Index() { }, ]; + const columns_guide = [ + { + title: "导游", + dataIndex: "TGI2_Name", + key: "TGI2_Name", + }, + { + title: "平均分", + dataIndex: "VAverage", + key: "VAverage", + }, + { + title: "接团数", + dataIndex: "ReceptionGroups", + key: "ReceptionGroups", + }, + { + title: "表扬数", + dataIndex: "CommendNum", + key: "CommendNum", + }, + { + title: "表扬率", + dataIndex: "CommendRate", + key: "CommendRate", + }, + { + title: "投诉数", + dataIndex: "Complaints", + key: "Complaints", + }, + { + title: "投诉率", + dataIndex: "ComplaintRate", + key: "ComplaintRate", + }, + ]; + + const columns_commend = [ + { + title: "团号", + dataIndex: "GRI_NO", + key: "GRI_NO", + }, + { + title: "投诉对象", + dataIndex: "ObjectName", + key: "ObjectName", + }, + { + title: "客人评论", + dataIndex: "ECI_Content", + key: "ECI_Content", + }, + ]; + const dataSource_dmc = [ { key: "1", @@ -232,16 +273,23 @@ function Index() { @@ -251,18 +299,31 @@ function Index() { Primary Data - +
Monthly Data -
+
地接考核分数
+ + 导游接待情况 +
+ + 表扬情况 +
+ + 投诉情况 +
+ + 批评建议 +
+ );