From 9ca62d437dcf2837cc17143bcc440aba2060fe40 Mon Sep 17 00:00:00 2001 From: ylj20011123 Date: Mon, 1 Dec 2025 09:02:13 +0800 Subject: [PATCH] update --- src/pages/User/login/index.tsx | 4 +- src/pages/User/login/service.ts | 16 ++ .../SalesFlow/components/FlowDetail.tsx | 1 + .../components/serverpart/Index.tsx | 6 + .../basicServiceInformation/index.tsx | 2 +- .../BusinessAnalysis/RevenueReport/index.tsx | 158 ++++++++++++- .../revenueYOYQOQReport/index.tsx | 12 +- .../BusinessAnalysis/saleFlow/index.tsx | 48 ++++ .../BusinessAnalysis/saleHisReport/index.tsx | 4 + .../BusinessAnalysis/saleReport/index.tsx | 2 +- src/pages/reports/audit/curVerify/index.tsx | 4 +- .../ProductApprovalProcess/index.tsx | 42 +++- .../productControl/commoditySearch/index.tsx | 71 ++++-- .../productControl/components/detail.tsx | 3 +- src/utils/requestNewJava.ts | 214 ++++++++++++++++++ 15 files changed, 548 insertions(+), 39 deletions(-) create mode 100644 src/pages/User/login/service.ts create mode 100644 src/utils/requestNewJava.ts diff --git a/src/pages/User/login/index.tsx b/src/pages/User/login/index.tsx index 58dccbb..b0b8f44 100644 --- a/src/pages/User/login/index.tsx +++ b/src/pages/User/login/index.tsx @@ -24,6 +24,7 @@ import styles from './index.less'; import { line } from '@antv/g2plot'; import session from '@/utils/session'; import { getLocationByIP, getUserIP } from '@/utils/format'; +import { handleGetIPDetail } from './service'; // 可接受的页面参数 export type LoginProps = { @@ -123,7 +124,8 @@ const Login: React.FC = (props) => { let IpInfo: any = await getUserIP() console.log('IpInfoIpInfoIpInfoIpInfo', IpInfo); // 用ip 去获取信息 - let ipDetail: any = await getLocationByIP(IpInfo, 'XrQQuNQRGxap9YH2xmvx3dzuJVkXhTzT') + let ipDetail: any = await handleGetIPDetail({ ip: IpInfo }) + console.log('ipDetailipDetailipDetail', ipDetail); const ipRes: any = { country: ipDetail.country, diff --git a/src/pages/User/login/service.ts b/src/pages/User/login/service.ts new file mode 100644 index 0000000..5effbd8 --- /dev/null +++ b/src/pages/User/login/service.ts @@ -0,0 +1,16 @@ + +import request from '@/utils/requestNewJava' + +export async function handleGetIPDetail(params: any) { + + const data = await request(`/location/ip`, { + method: 'GET', + params + }) + + if (data.Result_Code === 500) { + return [] + } + + return data.content.address_detail +} \ No newline at end of file diff --git a/src/pages/merchantManagement/reports/SalesFlow/components/FlowDetail.tsx b/src/pages/merchantManagement/reports/SalesFlow/components/FlowDetail.tsx index 5aab6bc..6256f3e 100644 --- a/src/pages/merchantManagement/reports/SalesFlow/components/FlowDetail.tsx +++ b/src/pages/merchantManagement/reports/SalesFlow/components/FlowDetail.tsx @@ -138,6 +138,7 @@ const CommoditysaleTable: React.FC<{ currentUser: CurrentUser | undefined, id: s contentStyle={{ fontWeight: "bolder" }} labelStyle={{ color: "#00000073" }} > + {id || ""} ¥{numeral(reduceData.SELLDETAILS_AMOUNT).format('0,0.00')} {numeral(reduceData.SELLDETAILS_COUNT).format('0,0')} ¥{numeral(reduceData.SELLDETAILS_OFFPRICE).format('0,0.00')} diff --git a/src/pages/newDataAnalysis/basicInfoService/components/serverpart/Index.tsx b/src/pages/newDataAnalysis/basicInfoService/components/serverpart/Index.tsx index f9cb0e6..8d324eb 100644 --- a/src/pages/newDataAnalysis/basicInfoService/components/serverpart/Index.tsx +++ b/src/pages/newDataAnalysis/basicInfoService/components/serverpart/Index.tsx @@ -177,6 +177,12 @@ const SERVERPARTTable = ({ currentRow, onShow, onRef }: DetailProps) => { disabled /> + + + = (props) let list: any = [] data.forEach((item: any) => { - if (item.value !== 424 ) { + if (item.value !== 424) { list.push(item) } }) diff --git a/src/pages/reports/BusinessAnalysis/RevenueReport/index.tsx b/src/pages/reports/BusinessAnalysis/RevenueReport/index.tsx index 90ecc0e..0526bd1 100644 --- a/src/pages/reports/BusinessAnalysis/RevenueReport/index.tsx +++ b/src/pages/reports/BusinessAnalysis/RevenueReport/index.tsx @@ -76,6 +76,15 @@ const RevenueSummaryTable: React.FC<{ currentUser?: CurrentUser }> = (props) => "RegionARevenue.Cash_Correct": { show: false }, "RegionBRevenue.Mobile_Correct": { show: false }, "RegionBRevenue.Cash_Correct": { show: false }, + "TotalRevenue.CostBill_Amount": { show: false }, + "TotalRevenue.InternalPay_Amount": { show: false }, + "TotalRevenue.YFHD_Amount": { show: false }, + "RegionARevenue.CostBill_Amount": { show: false }, + "RegionARevenue.InternalPay_Amount": { show: false }, + "RegionARevenue.YFHD_Amount": { show: false }, + "RegionBRevenue.CostBill_Amount": { show: false }, + "RegionBRevenue.InternalPay_Amount": { show: false }, + "RegionBRevenue.YFHD_Amount": { show: false } }) const [columnsDailyStateMap, setColumnsDailyStateMap] = useState({ Shop_Count: { show: false }, @@ -248,6 +257,8 @@ const RevenueSummaryTable: React.FC<{ currentUser?: CurrentUser }> = (props) => placeholder: "请输入商户/品牌/门店/服务区" } }, + + { // title: () => 服务区信息, title: '服务区信息', @@ -396,6 +407,21 @@ const RevenueSummaryTable: React.FC<{ currentUser?: CurrentUser }> = (props) => // return options; // }, }, + { + title: '传输方式', + width: 120, + ellipsis: true, + dataIndex: 'Transfer_Type', + hideInSearch: true, + valueType: 'select', + valueEnum: { + 0: "收银系统", + 1: "扫码传输", + 2: "接口传输" + } + }, + + ] }, @@ -466,6 +492,50 @@ const RevenueSummaryTable: React.FC<{ currentUser?: CurrentUser }> = (props) => return record?.TotalRevenue?.Cash_Correct ? numeral(record?.TotalRevenue?.Cash_Correct).format('0,0.00') : '-' } }, + { + title: "长款", + dataIndex: ["TotalRevenue", "Different_Price_More"], + width: 120, + align: 'right', + hideInSearch: true, + valueType: 'digit' + }, + { + title: "短款", + dataIndex: ["TotalRevenue", "Different_Price_Less"], + width: 120, + align: 'right', + hideInSearch: true, + valueType: 'digit' + }, + { + title: "大巴优惠", + dataIndex: ['TotalRevenue', 'CostBill_Amount'], + key: "TotalRevenue.CostBill_Amount", + width: 120, + align: 'right', + hideInSearch: true, + valueType: 'digit' + }, + { + title: "企业会员", + dataIndex: ["TotalRevenue", "InternalPay_Amount"], + key: "TotalRevenue.InternalPay_Amount", + width: 120, + align: 'right', + hideInSearch: true, + valueType: 'digit' + }, + { + title: "油非互动", + dataIndex: ["TotalRevenue", "YFHD_Amount"], + key: "TotalRevenue.YFHD_Amount", + width: 120, + align: 'right', + hideInSearch: true, + valueType: 'digit' + }, + // { // title: '长/短款', // dataIndex: 'TotalRevenue.Different_Price_Less', @@ -478,7 +548,6 @@ const RevenueSummaryTable: React.FC<{ currentUser?: CurrentUser }> = (props) => // return Different_Price_More === '-' && Different_Price_Less === '-' ? '-' : `${Different_Price_More} / ${Different_Price_Less}` // } // }, - ] }, { @@ -543,6 +612,49 @@ const RevenueSummaryTable: React.FC<{ currentUser?: CurrentUser }> = (props) => return record?.RegionARevenue?.Cash_Correct ? numeral(record?.RegionARevenue?.Cash_Correct).format('0,0.00') : '-' } }, + { + title: "长款", + dataIndex: ["RegionARevenue", "Different_Price_More"], + width: 120, + align: 'right', + hideInSearch: true, + valueType: 'digit' + }, + { + title: "短款", + dataIndex: ["RegionARevenue", "Different_Price_Less"], + width: 120, + align: 'right', + hideInSearch: true, + valueType: 'digit' + }, + { + title: "大巴优惠", + dataIndex: ["RegionARevenue", "CostBill_Amount"], + key: "RegionARevenue.CostBill_Amount", + width: 120, + align: 'right', + hideInSearch: true, + valueType: 'digit' + }, + { + title: "企业会员", + dataIndex: ["RegionARevenue", "InternalPay_Amount"], + key: "RegionARevenue.InternalPay_Amount", + width: 120, + align: 'right', + hideInSearch: true, + valueType: 'digit' + }, + { + title: "油非互动", + dataIndex: ["RegionARevenue", "YFHD_Amount"], + key: "RegionARevenue.YFHD_Amount", + width: 120, + align: 'right', + hideInSearch: true, + valueType: 'digit' + }, // { // title: '长/短款', // dataIndex: 'RegionARevenue.Different_Price_Less', @@ -621,6 +733,49 @@ const RevenueSummaryTable: React.FC<{ currentUser?: CurrentUser }> = (props) => return record?.RegionBRevenue?.Cash_Correct ? numeral(record?.RegionBRevenue?.Cash_Correct).format('0,0.00') : '-' } }, + { + title: "长款", + dataIndex: ["RegionBRevenue", "Different_Price_More"], + width: 120, + align: 'right', + hideInSearch: true, + valueType: 'digit' + }, + { + title: "短款", + dataIndex: ["RegionBRevenue", "Different_Price_Less"], + width: 120, + align: 'right', + hideInSearch: true, + valueType: 'digit' + }, + { + title: "大巴优惠", + dataIndex: ["RegionBRevenue", "CostBill_Amount"], + key: "RegionBRevenue.CostBill_Amount", + width: 120, + align: 'right', + hideInSearch: true, + valueType: 'digit' + }, + { + title: "企业会员", + dataIndex: ["RegionBRevenue", "InternalPay_Amount"], + key: "RegionBRevenue.InternalPay_Amount", + width: 120, + align: 'right', + hideInSearch: true, + valueType: 'digit' + }, + { + title: "油非互动", + dataIndex: ["RegionBRevenue", "YFHD_Amount"], + key: "RegionBRevenue.YFHD_Amount", + width: 120, + align: 'right', + hideInSearch: true, + valueType: 'digit' + }, // { // title: '长/短款', // dataIndex: 'RegionBRevenue.Different_Price_Less', @@ -1051,7 +1206,6 @@ const RevenueSummaryTable: React.FC<{ currentUser?: CurrentUser }> = (props) => return { data: [], success: true } }} - // params={{ ServerpartShopIds: shopId && shopId.length > 0 ? shopId.toString() : '' }} rowClassName={(record) => expandRow?.includes(record?.Serverpart_ID) && !record?.ServerpartShop_Name ? 'expanded' : ''} expandable={ diff --git a/src/pages/reports/BusinessAnalysis/revenueYOYQOQReport/index.tsx b/src/pages/reports/BusinessAnalysis/revenueYOYQOQReport/index.tsx index f105577..4032029 100644 --- a/src/pages/reports/BusinessAnalysis/revenueYOYQOQReport/index.tsx +++ b/src/pages/reports/BusinessAnalysis/revenueYOYQOQReport/index.tsx @@ -278,6 +278,16 @@ const revenueYOYQOQReport: React.FC<{ currentUser: CurrentUser }> = (props) => { return options; }, }, + { + title: '经营模式', + width: 120, + ellipsis: true, + align: 'center', + dataIndex: 'BUSINESS_TYPE', + hideInSearch: true, + valueType: 'select', + valueEnum: BUSINESSTYPEObj, + }, { title: '实收金额', dataIndex: '', @@ -685,7 +695,7 @@ const revenueYOYQOQReport: React.FC<{ currentUser: CurrentUser }> = (props) => { reqDetailList, `销售同环比分析_${searchParams?.StartDate}-${searchParams?.EndDate}`, { - footerMaker: currentUser?.Name, + footerMaker: currentUser?.Name, footerMakerTime: moment().format('YYYY-MM-DD HH:mm:ss'), footerStatsTime: `${searchParams?.StartDate}-${searchParams?.EndDate}` } diff --git a/src/pages/reports/BusinessAnalysis/saleFlow/index.tsx b/src/pages/reports/BusinessAnalysis/saleFlow/index.tsx index 915907d..f654e02 100644 --- a/src/pages/reports/BusinessAnalysis/saleFlow/index.tsx +++ b/src/pages/reports/BusinessAnalysis/saleFlow/index.tsx @@ -138,6 +138,7 @@ const saleFlow: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => placeholder: "请输入商品名称/商品条码" } }, + { dataIndex: 'TICKET_CODE', title: '小票编号', @@ -197,6 +198,53 @@ const saleFlow: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => align: 'right', sorter: (a, b) => a.SELLMASTER_OFFPRICE - b.SELLMASTER_OFFPRICE }, + // { + // dataIndex: '', + // title:
实付金额
, + // width: 120, + // hideInSearch: true, + // valueType: "money", + // ellipsis: true, + // align: 'right', + // }, + + { + dataIndex: 'INTERNAL_AMOUNT', + title:
抵扣金额
, + width: 120, + hideInSearch: true, + valueType: "money", + ellipsis: true, + align: 'right', + sorter: (a, b) => a.INTERNAL_AMOUNT - b.INTERNAL_AMOUNT + }, + { + dataIndex: 'COUPON_TYPE', + title:
抵扣类型
, + width: 120, + hideInSearch: true, + valueType: "select", + valueEnum: { + "1000": "满减券", + "2000": "折扣券", + "3000": "抵扣券", + "4000": "兑换券", + "5000": "代金券", + "9000": "实物券" + }, + ellipsis: true, + align: 'right', + }, + // { + // dataIndex: '', + // title:
其他支付
, + // width: 120, + // hideInSearch: true, + // valueType: "money", + // ellipsis: true, + // align: 'right', + // }, + { dataIndex: 'PAYMENT_TYPE_TEXT', width: 120, diff --git a/src/pages/reports/BusinessAnalysis/saleHisReport/index.tsx b/src/pages/reports/BusinessAnalysis/saleHisReport/index.tsx index 3ef4898..8bb4fbb 100644 --- a/src/pages/reports/BusinessAnalysis/saleHisReport/index.tsx +++ b/src/pages/reports/BusinessAnalysis/saleHisReport/index.tsx @@ -176,6 +176,7 @@ const saleHisReport: React.FC<{ currentUser: CurrentUser }> = (props) => { valueType: 'digit', dataIndex: 'Commodity_RetailPrice', hideInSearch: true, + sorter: (a, b) => a.Commodity_RetailPrice - b.Commodity_RetailPrice }, { title:
销售数量
, @@ -184,6 +185,7 @@ const saleHisReport: React.FC<{ currentUser: CurrentUser }> = (props) => { width: 150, align: 'right', valueType: 'digit', + sorter: (a, b) => a.Total_Count - b.Total_Count }, { title:
优惠金额
, @@ -192,6 +194,7 @@ const saleHisReport: React.FC<{ currentUser: CurrentUser }> = (props) => { hideInSearch: true, width: 150, align: 'right', + sorter: (a, b) => a.Total_OffAmount - b.Total_OffAmount }, { title:
对客营收
, @@ -200,6 +203,7 @@ const saleHisReport: React.FC<{ currentUser: CurrentUser }> = (props) => { hideInSearch: true, width: 150, align: 'right', + sorter: (a, b) => a.Total_SellAmount - b.Total_SellAmount }, { title:
diff --git a/src/pages/reports/BusinessAnalysis/saleReport/index.tsx b/src/pages/reports/BusinessAnalysis/saleReport/index.tsx index 25e709e..d167297 100644 --- a/src/pages/reports/BusinessAnalysis/saleReport/index.tsx +++ b/src/pages/reports/BusinessAnalysis/saleReport/index.tsx @@ -405,7 +405,7 @@ const saleReport: React.FC<{ currentUser: CurrentUser }> = (props) => { columns={columns} bordered headerTitle={} - search={{ span: 6 }} + search={{ span: 6, defaultCollapsed: false }} scroll={{ x: "100%", y: 'calc(100vh - 510px)' }} pagination={{ pageSize: 100 }} request={async (params, sorter) => { diff --git a/src/pages/reports/audit/curVerify/index.tsx b/src/pages/reports/audit/curVerify/index.tsx index a288f99..54d9023 100644 --- a/src/pages/reports/audit/curVerify/index.tsx +++ b/src/pages/reports/audit/curVerify/index.tsx @@ -112,7 +112,9 @@ const curVerify: React.FC<{ currentUser: CurrentUser }> = (props) => { dataIndex: 'PassCommCount/Current_GoodsCount', hideInSearch: true, render: (_, record) => { - return `${record?.PassCommCount || '0'}/${record?.Current_GoodsCount || '0'}` + return + {`${record?.PassCommCount || '0'}/${record?.Current_GoodsCount || '0'}`} + } }, { diff --git a/src/pages/reports/productControl/ProductApprovalProcess/index.tsx b/src/pages/reports/productControl/ProductApprovalProcess/index.tsx index 43e0c28..1ef930f 100644 --- a/src/pages/reports/productControl/ProductApprovalProcess/index.tsx +++ b/src/pages/reports/productControl/ProductApprovalProcess/index.tsx @@ -19,6 +19,7 @@ import { handleGetAPPROVALROUTEList } from "@/pages/Setting/serviceConfig/servic import ProForm, { ProFormSelect, ProFormTextArea } from "@ant-design/pro-form"; import { handleGetApprovalCommodityList, handleGetBUSINESSAPPROVALDetail, handleGetCOMMODITYRUNNINGList } from "./service"; import './style.less' +import session from "@/utils/session"; const { Step } = Steps const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) => { @@ -88,10 +89,36 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) = }, initialValue: "0" }, + { + dataIndex: 'Serverpart_IDS', + title: '服务区', + width: 150, + ellipsis: true, + align: 'center', + hideInTable: true, + valueType: 'select', + fieldProps: { + showSearch: true, + }, + request: async () => { + const list = session.get('ServerpartIdsTree') + return list || [] + }, + }, + { + dataIndex: 'searchText', + title: '查询内容', + ellipsis: true, + align: 'center', + hideInTable: true, + fieldProps: { + placeholder: '请输入查询商品名称/商品条码' + } + }, { dataIndex: 'BusinessProcess_Name', title: '业务名称', - width: 300, + width: 200, ellipsis: true, align: 'center', hideInSearch: true, @@ -105,7 +132,7 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) = { dataIndex: 'Serverpart_Name', title: '服务区名称', - width: 200, + width: 150, ellipsis: true, align: 'center', hideInSearch: true, @@ -113,7 +140,7 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) = { dataIndex: 'ServerpartShop_Name', title: '门店名称', - width: 200, + width: 150, ellipsis: true, align: 'center', hideInSearch: true, @@ -129,7 +156,7 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) = { dataIndex: 'BusinessProcess_StateText', title: '待审核环节', - width: 200, + width: 150, ellipsis: true, align: 'center', hideInSearch: true, @@ -149,7 +176,7 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) = { dataIndex: 'Accept_Code', title: '业务类别', - width: 200, + width: 150, ellipsis: true, align: 'center', hideInSearch: true, @@ -274,7 +301,7 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) = }} scroll={{ x: "100%", y: "calc(100vh - 410px)" }} headerTitle={} // 列表表头 - search={{ span: 6 }} + search={{ span: 6, defaultCollapsed: false }} request={async (params) => { const req: any = { @@ -282,7 +309,8 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) = SearchParameter: { Operation_Type: 6, Accept_Code: params?.searchType === "0" ? '' : params?.searchType, - BusinessProcess_StateSearch: statusList[params?.BusinessProcess_StateSearch] === "0" ? '' : statusList[params?.BusinessProcess_StateSearch] + BusinessProcess_StateSearch: statusList[params?.BusinessProcess_StateSearch] === "0" ? '' : statusList[params?.BusinessProcess_StateSearch], + Serverpart_IDS: params?.Serverpart_IDS || "" }, PageIndex: 1, PageSize: 999999 diff --git a/src/pages/reports/productControl/commoditySearch/index.tsx b/src/pages/reports/productControl/commoditySearch/index.tsx index f7e40fd..7d6d92d 100644 --- a/src/pages/reports/productControl/commoditySearch/index.tsx +++ b/src/pages/reports/productControl/commoditySearch/index.tsx @@ -33,6 +33,7 @@ import Detail from "@/pages/reports/productControl/components/detail"; import PageTitleBox from "@/components/PageTitleBox"; import { exportXlsxFromProColumnsExcelJS } from "@/utils/exportExcelFun"; import { formatTreeData } from "@/utils/format"; +import { getMyShopList } from "@/pages/account/center/sevice"; const commoditySearch: React.FC<{ currentUser: CurrentUser }> = (props) => { const { currentUser } = props @@ -81,7 +82,8 @@ const commoditySearch: React.FC<{ currentUser: CurrentUser }> = (props) => { const [showDetail, setShowDetail] = useState(false) const SHOPTRADEObj = session.get('SHOPTRADEObj') - + // 当前的门店列表 + const [currentShopList, setCurrentShopList] = useState() const ServerpartIdsList: any = session.get('ServerpartIdsList') const { loading: CommodityLoading, data: CommodityData } = useRequest(async () => { @@ -112,16 +114,30 @@ const commoditySearch: React.FC<{ currentUser: CurrentUser }> = (props) => { valueType: 'select', hideInTable: true, request: async () => { - // const data = await getServerpartOption(currentUser?.ProvinceCode) - // console.log('datadatadatadata', data); const ServerpartIdsTree: any = session.get('ServerpartIdsTree') return ServerpartIdsTree }, fieldProps: { showSearch: true, filterOption: (input, option) => (option?.label ?? '').toLowerCase().includes(input.toLowerCase()), + onChange: async (value: any, label: any) => { + formRef.current?.setFieldsValue({ serverpartShopId: undefined, InventoryTime: undefined }) + await handleGetShopList(value) + } } }, + { + title: "门店", + dataIndex: "serverpartShopId", + hideInTable: true, + valueType: 'select', + fieldProps: { + showSearch: true, + options: currentShopList + }, + }, + + { title: '状态', dataIndex: 'COMMODITY_STATE', @@ -296,26 +312,31 @@ const commoditySearch: React.FC<{ currentUser: CurrentUser }> = (props) => { } } - const exportTable = (e) => { - e.stopPropagation(); // 防止Collapse组件收起 - const main = document.getElementsByClassName('commoditySearchHideBox')[0] - const thead = main.querySelector('thead').cloneNode(true); // 深克隆DOM节点 - const tbody = main.querySelector('tbody').cloneNode(true); // 深克隆DOM节点 - const container = document.querySelector('#hiddenBox'); - - const tempTable = document.createElement('table'); - tempTable.appendChild(thead); - tempTable.appendChild(tbody); - - tempTable.setAttribute('id', 'table-to-xls-commoditySearch'); // 给table添加id,值与按钮上的table字段对应 - - container.appendChild(tempTable); // 把创建的节点添加到页面容器中 - - setShowLoading(false) - - downloadBtnRef.current.handleDownload(); - setShowExportTable(false) - tempTable.remove() // 防止重复打印一个内容 + // 拿到门店的列表数据 + const handleGetShopList = async (id: any) => { + if (!id) { + setCurrentShopList([]) + return + } + const req: any = { + // 调用的接口 里面 自己包了一层 + // SearchParameter: { + ISVALID: 1, + SERVERPART_ID: id, + INSALES_TYPE: 1, + // }, + PageIndex: 1, + PageSize: 999999, + SortStr: "SHOPTRADE,SHOPREGION,SHOPCODE" + } + const data = await getMyShopList(req) + let list: any = [] + if (data && data.length > 0) { + data.forEach((item: any) => { + list.push({ label: item.SHOPNAME, value: item.SERVERPARTSHOP_ID }) + }) + } + setCurrentShopList(list) } return ( @@ -430,12 +451,16 @@ const commoditySearch: React.FC<{ currentUser: CurrentUser }> = (props) => { sortstr += `,COMMODITY_ID ${dir}` } + console.log('paramsparamsparams', params); + + const req: any = { SearchType: 3, ProvinceCode: currentUser?.ProvinceCode, CommodityTypeId: currenMenu === '999999' ? '' : currenMenu, CommodityState: params?.COMMODITY_STATE, ServerpartID: params?.ServerpartID, + ServerpartShopID: params?.serverpartShopId || "", PageIndex: 1, PageSize: 999999, SearchKey: "COMMODITY_NAME,COMMODITY_BARCODE", diff --git a/src/pages/reports/productControl/components/detail.tsx b/src/pages/reports/productControl/components/detail.tsx index 8ea08c6..f750e8a 100644 --- a/src/pages/reports/productControl/components/detail.tsx +++ b/src/pages/reports/productControl/components/detail.tsx @@ -220,7 +220,6 @@ const detail = ({ currentUser, treeView, currentRow, showHotKeyEdit, setGetNewHo /> - diff --git a/src/utils/requestNewJava.ts b/src/utils/requestNewJava.ts new file mode 100644 index 0000000..f92663d --- /dev/null +++ b/src/utils/requestNewJava.ts @@ -0,0 +1,214 @@ +/** Request 网络请求工具 更详细的 api 文档: https://github.com/umijs/umi-request */ +import { extend } from 'umi-request'; + +import { notification } from 'antd'; + +import Cookies from 'js-cookie'; +import moment from 'moment'; +import session from './session'; +import type { CurrentUser } from '@/models/user'; +import { SynchroBEHAVIORRECORD } from '@/services/user'; + +const codeMessage: Record = { + 200: '服务器成功返回请求的数据。', + 201: '新建或修改数据成功。', + 202: '一个请求已经进入后台排队(异步任务)。', + 204: '删除数据成功。', + 400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。', + 401: '用户没有权限(令牌、用户名、密码错误)。', + 403: '用户得到授权,但是访问是被禁止的。', + 404: '发出的请求针对的是不存在的记录,服务器没有进行操作。', + 406: '请求的格式不可得。', + 410: '请求的资源被永久删除,且不会再得到的。', + 422: '当创建一个对象时,发生一个验证错误。', + 500: '服务器发生错误,请检查服务器。', + 502: '网关错误。', + 503: '服务不可用,服务器暂时过载或维护。', + 504: '网关超时。', +}; + +/** + * @zh-CN 异常处理程序 + * @en-US Exception handler + */ +const errorHandler = (error: { response: Response }): Response => { + const { response } = error; + + + if (response && response.status) { + const errorText = codeMessage[response.status] || response.statusText; + const { status, url } = response; + + notification.error({ + message: `请求错误 ${status}: ${url}`, + description: errorText, + }); + } else if (!response) { + notification.error({ + description: '您的网络异常,无法连接到服务器.', + message: '网络异常', + }); + } + return response; +}; +/** + * @en-US Configure the default parameters for request + * @zh-CN 配置request请求时的默认参数 + */ +const request = extend({ + errorHandler, // default error handling + // prefix: '/EShangApiMain',// 开发 + prefix: 'https://java.es.eshangtech.com:443', // 正式 + // prefix: 'http://111.229.213.193:18071', // 正式 + headers: { + token: '', + ProvinceCode: '', + ServerpartCodes: '', + // tmp: (new Date()).getTime() + } + + // credentials: 'include', // Does the default request bring cookies + +}); + +// 存一下进来调用的值 +// let userbeHaviObj: any = {} + +// request拦截器, 改变url 或 options. +request.interceptors.request.use((url, opt: any) => { + const options = { ...opt } + const currentUser: CurrentUser = session.get('currentUser'); + // let userbeHaviObj = { + // url: url, + // options: options, + // currentUser: currentUser, + // startTime: new Date().getTime() + // } + // options.userbeHaviObj = userbeHaviObj + + if (currentUser) { + if (options.headers) { + if (url.indexOf('SynchroSERVERPART') > -1) { + options.headers = { + ...options.headers, + PROVINCE_CODE: opt?.data?.PROVINCE_CODE, + ProvinceCode: opt?.data?.PROVINCE_CODE, + provincecode: opt?.data?.PROVINCE_CODE, + token: currentUser.UserToken || '', + ServerpartCodes: currentUser.CityAuthority || '', + ServerpartShopIds: currentUser.ServerpartShopIds || '', + UserPattern: currentUser?.UserPattern || '', + + } + } else { + options.headers = { + ...options.headers, + token: currentUser.UserToken || '', + ProvinceCode: opt?.data?.noProvinceCode ? '' : (currentUser.ProvinceCode || ''), + ServerpartCodes: currentUser.CityAuthority || '', + ServerpartShopIds: currentUser.ServerpartShopIds || '', + UserPattern: currentUser?.UserPattern || '', + } + } + } + + + if (url.indexOf('SynchroSERVERPART') > -1) { + options.data = { + ...options.data, + STAFF_ID: currentUser.ID, + STAFF_NAME: currentUser.Name, + OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + PROVINCE_CODE: opt?.data?.PROVINCE_CODE, + } + } else { + if ((url.indexOf('Synchro') > -1 || url.indexOf('Save') > -1) && + url.indexOf('Picture/SaveImgFile') === -1) { + + // 添加操作人和业主单位信息 + options.data = { + ...options.data, + STAFF_ID: currentUser.ID, + STAFF_NAME: currentUser.Name, + OWNERUNIT_ID: options.data.OWNERUNIT_ID || currentUser.OwnerUnitId, + OWNERUNIT_NAME: options.data.OWNERUNIT_NAME || currentUser.ProvinceUnit, + PROVINCE_CODE: (options.data.PROVINCE_CODE || currentUser.ProvinceCode), + + OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss') + } + if (currentUser?.UserPattern === 2000) { + options.data = { + ...options.data, + PROVINCE_CODE: (options.data.PROVINCE_CODE || currentUser.ProvinceCode), + BUSINESSMAN_ID: currentUser.BusinessManID, + } + } + } + } + + + } + + return { + // url: url.indexOf('handler_ajax.ashx')>-1 ?`https://user.eshangtech.com${url}`: `http://47.96.233.105/EShangApiMain${url}`, + url,// .indexOf('handler_ajax.ashx')>-1 ?`${url}`: `/EShangApiMain${url}`, + options, + } +}) +request.interceptors.response.use((response, option) => { + const nowTmp = moment() + Cookies.set('tmp', nowTmp.format()) + + // // 加个数组 如果请求地址是数组里面的 那就不调用 记录用户行为了 + // let specialList = ['/FrameWork/GetFieldEnumByField', "/FrameWork/GetUserModuleList", "/FrameWork/GetFieldEnumTree", '/Logging/GetPassportInfoByToken', '/Logging/UserLogin', 'Dictionary/GetFieEnumList', '/Platform/SynchroBehaviorrecord'] + // // 判断一下 现在的这次请求 是不是特殊 不需要进行记录的 + // let isOk: boolean = true + + // let userbeHaviObj = option?.userbeHaviObj || {} + + // specialList.forEach((item: any) => { + // if (userbeHaviObj.url.indexOf(item) !== -1) { + // isOk = false + // } + // }) + + // if (isOk) { + // let nowMenu = session.get("currentMenu") + // let endTime = new Date().getTime() + // let basicInfo = session.get("basicInfo") + // let systemBasin = session.get("systemBasin") + // let browserVersion = session.get("browserVersion") + + // const req: any = { + // USER_ID: userbeHaviObj.currentUser.ID, + // USER_NAME: userbeHaviObj.currentUser.Name, + // BEHAVIORRECORD_TYPE: "2000", // 1000 浏览页面 2000 行为记录 + // BEHAVIORRECORD_EXPLAIN: `在页面${nowMenu.name}调用接口${userbeHaviObj.url.split('https://api.eshangtech.com')[1]}`, + // BEHAVIORRECORD_TIME: moment(new Date(userbeHaviObj.startTime)).format('YYYY-MM-DD HH:mm:ss'), + // BEHAVIORRECORD_ROUT: nowMenu.pathname, + // BEHAVIORRECORD_ROUTNAME: nowMenu.name, + // BEHAVIORRECORD_LEAVETIME: moment(new Date(endTime)).format('YYYY-MM-DD HH:mm:ss'), + // BEHAVIORRECORD_DURATION: (endTime - userbeHaviObj.startTime) / 1000, + // OWNERUNIT_ID: userbeHaviObj.currentUser.OwnerUnitId, + // OWNERUNIT_NAME: userbeHaviObj.currentUser.OwnerUnitName, + // BUSINESSMAN_ID: userbeHaviObj.currentUser.BusinessManID, + // BUSINESSMAN_NAME: userbeHaviObj.currentUser.BusinessManName, + // SOURCE_PLATFORM: '驿商云平台', + // BEHAVIORRECORD_DESC: JSON.stringify(userbeHaviObj.options.params) === '{}' ? userbeHaviObj.url.split('?')[1] : JSON.stringify(userbeHaviObj.options.params), // 入参 + // USER_LOGINIP: basicInfo.ip, + // USER_LOGINPLACE: `${basicInfo.country}${basicInfo.prov}${basicInfo.city}${basicInfo.district}`, + // BROWSER_VERSION: browserVersion, + // OPERATING_SYSTEM: systemBasin + // } + // console.log('reqreqreqreqreq', req); + // // fetch('https://api.eshangtech.com/EShangApiMain/Platform/SynchroBEHAVIORRECORD', { + // // method: 'POST', + // // headers: { + // // 'Content-Type': 'application/json', + // // }, + // // body: JSON.stringify(req), + // // }) + // } + return response +}) +export default request;