diff --git a/config/routes.ts b/config/routes.ts index 0f3eacf..f421868 100644 --- a/config/routes.ts +++ b/config/routes.ts @@ -446,6 +446,30 @@ export default [ name: 'RegistrationStatistics', component: './travelMember/RegistrationStatistics/index' }, + // 活动内容库管理 + { + path: 'EventRegistration', + name: 'EventRegistration', + component: './travelMember/EventRegistration/index' + }, + // 活动列表管理 + { + path: 'activityList', + name: 'activityList', + component: './travelMember/activityList/index' + }, + // 共享休息站管理 + { + path: 'SharedRestStationManagement', + name: 'SharedRestStationManagement', + component: './travelMember/SharedRestStationManagement/index' + }, + // 招商信息列表 + { + path: 'InvestmentInformation', + name: 'InvestmentInformation', + component: './travelMember/InvestmentInformation/index' + }, ] }, { @@ -453,6 +477,11 @@ export default [ name: 'CardInformation', icon: 'AccountBookOutlined', routes: [ + { + path: 'CardCouponApplicRules', + name: 'CardCouponApplicRules', + component: './CardInformation/CardCouponApplicRules/index' + }, { path: 'CardVoucherCollection', name: 'CardVoucherCollection', @@ -485,7 +514,8 @@ export default [ path: 'NewCouponReview', name: 'NewCouponReview', component: './CardInformation/NewCouponReview/index' - } + }, + ] }, { diff --git a/dist.zip b/dist.zip index 5dad8a8..03f6267 100644 Binary files a/dist.zip and b/dist.zip differ diff --git a/package.json b/package.json index 6d24fbf..5a420b5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ant-design-pro", - "version": "4.5.63", + "version": "4.5.65", "private": true, "description": "An out-of-box UI solution for enterprise applications", "scripts": { diff --git a/src/layouts/BasicLayout.tsx b/src/layouts/BasicLayout.tsx index 3489719..719aca3 100644 --- a/src/layouts/BasicLayout.tsx +++ b/src/layouts/BasicLayout.tsx @@ -562,18 +562,6 @@ const BasicLayout: React.FC = (props) => { }) - - // 结算模式数组 - // const SETTLEMENT_MODESList = await - getFieldEnum({ FieldExplainField: 'SETTLEMENT_MODES' }).then((SETTLEMENT_MODESList) => { - session.set('SETTLEMENT_MODESList', SETTLEMENT_MODESList); - // 结算模式对象 - if (SETTLEMENT_MODESList && SETTLEMENT_MODESList.length > 0) { - const SETTLEMENT_MODESObj = handleGetLabel(SETTLEMENT_MODESList) - session.set('SETTLEMENT_MODESObj', SETTLEMENT_MODESObj); - } - }) - // 卡券类型 getFieldEnum({ FieldExplainField: 'COUPONTYPE' }).then((COUPONTYPEList) => { session.set('COUPONTYPEList', COUPONTYPEList); @@ -584,79 +572,6 @@ const BasicLayout: React.FC = (props) => { }) - - // 合同类型数组 - // const COMPACT_CHARACTERList = await - getFieldEnum({ FieldExplainField: 'COMPACT_CHARACTER' }).then((COMPACT_CHARACTERList) => { - session.set('COMPACT_CHARACTERList', COMPACT_CHARACTERList); - // 合同类型对象 - if (COMPACT_CHARACTERList && COMPACT_CHARACTERList.length > 0) { - const COMPACT_CHARACTERObj = handleGetLabel(COMPACT_CHARACTERList) - session.set('COMPACT_CHARACTERObj', COMPACT_CHARACTERObj); - } - }) - - - // 合同类型子项数组 - // const COMPACT_DETAILSList = await - getFieldEnum({ FieldExplainField: 'COMPACT_DETAILS' }).then(COMPACT_DETAILSList => { - session.set('COMPACT_DETAILSList', COMPACT_DETAILSList); - // 合同类型子项对象 - if (COMPACT_DETAILSList && COMPACT_DETAILSList.length > 0) { - const COMPACT_DETAILSObj = handleGetLabel(COMPACT_DETAILSList) - session.set('COMPACT_DETAILSObj', COMPACT_DETAILSObj); - } - }) - - - // 合同附属类型数组 - // const COMPACT_CHILDTYPEList = await - getFieldEnum({ FieldExplainField: "COMPACT_CHILDTYPE" }).then(COMPACT_CHILDTYPEList => { - session.set('COMPACT_CHILDTYPEList', COMPACT_CHILDTYPEList); - // 合同附属类型对象 - if (COMPACT_CHILDTYPEList && COMPACT_CHILDTYPEList.length > 0) { - const COMPACT_CHILDTYPEObj = handleGetLabel(COMPACT_CHILDTYPEList) - session.set('COMPACT_CHILDTYPEObj', COMPACT_CHILDTYPEObj); - } - }) - - - // 合同结算周期数组 - // const SETTLEMENT_CYCLEList = await - getFieldEnum({ FieldExplainField: 'SETTLEMENT_CYCLE' }).then(SETTLEMENT_CYCLEList => { - session.set('SETTLEMENT_CYCLEList', SETTLEMENT_CYCLEList); - // 合同结算周期对象 - if (SETTLEMENT_CYCLEList && SETTLEMENT_CYCLEList.length > 0) { - const SETTLEMENT_CYCLEObj = handleGetLabel(SETTLEMENT_CYCLEList) - session.set('SETTLEMENT_CYCLEObj', SETTLEMENT_CYCLEObj); - } - }) - - - // 合同类型数组 - // const COMPACT_TYPEList = await - getFieldEnum({ FieldExplainField: 'COMPACT_TYPE' }).then(COMPACT_TYPEList => { - session.set('COMPACT_TYPEList', COMPACT_TYPEList); - // 合同类型对象 - if (COMPACT_TYPEList && COMPACT_TYPEList.length > 0) { - const COMPACT_TYPEObj = handleGetLabel(COMPACT_TYPEList) - session.set('COMPACT_TYPEObj', COMPACT_TYPEObj); - } - }) - - - // 签订程序数组 - // const COMPACTREGPROINSTList = await - getFieldEnum({ FieldExplainField: 'COMPACTREGPROINST' }).then(COMPACTREGPROINSTList => { - session.set('COMPACTREGPROINSTList', COMPACTREGPROINSTList); - // 合同类型对象 - if (COMPACTREGPROINSTList && COMPACTREGPROINSTList.length > 0) { - const COMPACTREGPROINSTObj = handleGetLabel(COMPACTREGPROINSTList) - session.set('COMPACTREGPROINSTObj', COMPACTREGPROINSTObj); - } - }) - - // 所属区域数组 // const shopregionList = await getFieldEnum({ FieldExplainField: 'shopregion', notformate: true }).then(shopregionList => { @@ -805,53 +720,10 @@ const BasicLayout: React.FC = (props) => { session.set('BusinessTradeIdsBigObj', BusinessTradeIdsBigObj); }) - - - // 预警类型 - // const waringList = await - getFieldGetFieEnumList({ FieldexPlain_Field: 'WARNING_TYPE' }).then(waringList => { - if (waringList && waringList.length > 0) { - const list: any = [] - const obj: any = {} - const descList: any = [] - const descObj: any = {} - waringList.forEach((item: any) => { - list.push({ label: item.FieldEnum_Name, value: item.FieldEnum_Value }) - obj[item.FieldEnum_Value] = item.FieldEnum_Name - descList.push({ label: item.FieldEnum_Desc, value: item.FieldEnum_Value }) - descObj[item.FieldEnum_Value] = item.FieldEnum_Desc - }) - session.set('waringList', list); - session.set('waringObj', obj); - session.set('waringDescList', descList); - session.set('waringDescObj', descObj); - } - }) - - // 业务类型 - // const PROCESS_TYPEList = await - getFieldEnumTree({ FieldExplainField: 'PROCESS_TYPE', sessionName: 'PROCESS_TYPE' }).then(PROCESS_TYPEList => { - if (PROCESS_TYPEList && PROCESS_TYPEList.length > 0) { - const obj: any = {} - const list: any = [] - PROCESS_TYPEList.forEach((item: any) => { - if (item.children && item.children.length > 0) { - item.children.forEach((subItem: any) => { - list.push({ label: subItem.label, value: subItem.value }) - obj[subItem.value] = subItem.label - }) - } - }) - session.set('PROCESS_TYPEList', list); - session.set('PROCESS_TYPEObj', obj); - session.set('PROCESS_TYPETree', PROCESS_TYPEList); - } - }) - // 服务区枚举 // const serverpartList = await handleGetServerpartTree({ - ProvinceCode: currentUser?.ProvinceCode, + ProvinceCode: currentUser?.ProvinceCode || "530000", ServerpartType: 1000, StatisticsType: 1000, ShowWholePower: false, diff --git a/src/pages/Setting/OperationLog/service.ts b/src/pages/Setting/OperationLog/service.ts index a391827..448cae0 100644 --- a/src/pages/Setting/OperationLog/service.ts +++ b/src/pages/Setting/OperationLog/service.ts @@ -1,10 +1,13 @@ -import request from "@/utils/request" +import requestEncryption from "@/utils/requestEncryption" // 获取用户行为记录表列表 -export async function handleGetBEHAVIORRECORDList(params?: any){ - const data = await request('/Platform/GetBEHAVIORRECORDList', { +export async function handleGetBEHAVIORRECORDList(params?: any) { + const data = await requestEncryption('/Log/GetBEHAVIORRECORDList', { method: 'POST', - data: params, + data: { + ...params, + requestEncryption: true + } }) if (data.Result_Code !== 100) { diff --git a/src/pages/Setting/Roles/index.tsx b/src/pages/Setting/Roles/index.tsx index 9aae76b..a1283e2 100644 --- a/src/pages/Setting/Roles/index.tsx +++ b/src/pages/Setting/Roles/index.tsx @@ -442,8 +442,6 @@ const RoleList: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => title: '', breadcrumb: {}, }}> - - headerTitle={
@@ -519,14 +517,16 @@ const RoleList: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => req = { ShowStatus: params.ShowStatus === '1' ? true : params.ShowStatus === '0' ? false : '', SYSTEMROLE_TYPE: 2000, - SystemRolePattern: params.SystemRolePattern + SystemRolePattern: params.SystemRolePattern, + ProvinceCode: "530000" } } else { req = { ShowStatus: params.ShowStatus === '1' ? true : params.ShowStatus === '0' ? false : '', // current: 1, // pageSize: 20, - SystemRolePattern: params.SystemRolePattern + SystemRolePattern: params.SystemRolePattern, + ProvinceCode: "530000" } } @@ -658,7 +658,8 @@ const RoleList: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => if (currentRow) { // 编辑数据 newValue = { ...currentRow, ...newValue, SYSTEMROLE_PID: value.SYSTEMROLE_PID || -1 } } - newValue.SYSTEMROLE_PROVINCE = !currentUser?.SuperAdmin ? currentUser?.ProvinceCode : newValue.SYSTEMROLE_PROVINCE // 当操作员是正常用户 则所属业主为他的账号归属的业主;若为内部账号,则所属业主为他所选择的业主 + newValue.SYSTEMROLE_PROVINCE = "530000" + // newValue.SYSTEMROLE_PROVINCE = !currentUser?.SuperAdmin ? currentUser?.ProvinceCode : newValue.SYSTEMROLE_PROVINCE // 当操作员是正常用户 则所属业主为他的账号归属的业主;若为内部账号,则所属业主为他所选择的业主 newValue.SYSTEMROLE_STATUS = newValue.SYSTEMROLE_STATUS ? 1 : 0 // 当操作员是正常用户 则所属业主为他的账号归属的业主;若为内部账号,则所属业主为他所选择的业主 if (roleCheckedMenu) { // 编辑角色时 是否配置了角色的权限 若配置 则取出配置的模块id const moduleKey = roleCheckedMenu.filter(n => n.indexOf('2-') > -1) diff --git a/src/pages/Setting/Roles/service.ts b/src/pages/Setting/Roles/service.ts index abb4d87..b349e79 100644 --- a/src/pages/Setting/Roles/service.ts +++ b/src/pages/Setting/Roles/service.ts @@ -9,37 +9,38 @@ * Copyright (c) 2022 by cclu/杭州驿商科技, All Rights Reserved. */ import request from '@/utils/request'; +import requestEncryption from '@/utils/requestEncryption' import { wrapTreeNode, tableList } from '@/utils/format'; import type { SystemRoleModel } from './data'; // 获取列表数据 export async function getRoleList(params?: any) { - const data = await request('/FrameWork/GetSystemRoleList', { - method: 'GET', - params, - }) + const data = await requestEncryption('/FrameWork/GetSystemRoleList', { + method: 'GET', + params, + }) - if (data.Result_Code !== 100) { - return [] - } + if (data.Result_Code !== 100) { + return [] + } - const treeTable = await wrapTreeNode(data.Result_Data.List); - return [...treeTable]; + const treeTable = await wrapTreeNode(data.Result_Data.List); + return [...treeTable]; } // 获取系统角色数量 export async function getSystemRoleCount(params?: any) { - const data = await request('/FrameWork/GetSystemRoleCount', { - method: 'GET', - params, - }) + const data = await requestEncryption('/FrameWork/GetSystemRoleCount', { + method: 'GET', + params, + }) - if (data.Result_Code !== 100) { - return {} - } + if (data.Result_Code !== 100) { + return {} + } - return data.Result_Data; + return data.Result_Data; } /** @@ -49,60 +50,60 @@ export async function getSystemRoleCount(params?: any) { */ export async function updataRole(data?: SystemRoleModel) { - return request('/Platform/SynchroSystemRole', { - method: 'POST', - data, - // requestType: 'form', - }); + return requestEncryption('/Platform/SynchroSystemRole', { + method: 'POST', + data, + // requestType: 'form', + }); } // 新的同步 export async function newUpdataRole(data?: SystemRoleModel) { - return request('/Platform/SynchroSYSTEMROLE', { - method: 'POST', - data, - // requestType: 'form', - }); + return requestEncryption('/Platform/SynchroSYSTEMROLE', { + method: 'POST', + data, + // requestType: 'form', + }); } /* 删除角色 */ export async function deleteRole(systemRoleId: number) { - return request(`/Platform/Deletesystemrole?systemRoleId=${systemRoleId}`, { - method: 'POST', - requestType: 'form', - }); + return requestEncryption(`/Platform/Deletesystemrole?systemRoleId=${systemRoleId}`, { + method: 'POST', + requestType: 'form', + }); } // 获取角色权限树 export async function getSystemMenuTree(SystemRoleId?: string) { - const data = await request(`/FrameWork/GetSystemRoleModuleTree?SystemRoleId=${SystemRoleId || ''}`, { - method: 'GET', - }); - if (data.Result_Code !== 100) { - return [] - } + const data = await requestEncryption(`/FrameWork/GetSystemRoleModuleTree?SystemRoleId=${SystemRoleId || ''}`, { + method: 'GET', + }); + if (data.Result_Code !== 100) { + return [] + } - const treeTable = await wrapTreeNode(data.Result_Data.List); - return treeTable; + const treeTable = await wrapTreeNode(data.Result_Data.List); + return treeTable; } // 获取角色数据详情 export async function getSystemRoleDetail(SystemRoleId: number) { - const data = await request(`/Platform/GetSystemRoleDetail?SystemRoleId=${SystemRoleId}`, { - method: 'GET', - }) + const data = await requestEncryption(`/Platform/GetSystemRoleDetail?SystemRoleId=${SystemRoleId}`, { + method: 'GET', + }) - if (data.Result_Code !== 100) { - return {} - } + if (data.Result_Code !== 100) { + return {} + } - return data.Result_Data + return data.Result_Data } // 业主看板的权限 -export async function handleAnalysisPermission(params?: any){ - const data = await request('/FrameWork/AuthorAnalysis', { +export async function handleAnalysisPermission(params?: any) { + const data = await requestEncryption('/FrameWork/AuthorAnalysis', { method: 'GET', params, }) @@ -115,8 +116,8 @@ export async function handleAnalysisPermission(params?: any){ } // 获得供应商列表 -export async function handleSupplierList(params?: any){ - const data = await request('/Seller/GetSupplierDDL', { +export async function handleSupplierList(params?: any) { + const data = await requestEncryption('/Seller/GetSupplierDDL', { method: 'GET', params, }) @@ -129,8 +130,8 @@ export async function handleSupplierList(params?: any){ // 同步用户角色权限表 -export async function handleSynchroUserSystemRoleDetailList(params?: any){ - const data = await request('/FrameWork/StorageUserSystemRoleList', { +export async function handleSynchroUserSystemRoleDetailList(params?: any) { + const data = await requestEncryption('/FrameWork/StorageUserSystemRoleList', { method: 'POST', data: params, }) @@ -143,8 +144,8 @@ export async function handleSynchroUserSystemRoleDetailList(params?: any){ // 获得用户列表 -export async function handleGetUserList(params?: any){ - const data = await request('/Platform/GetUserList', { +export async function handleGetUserList(params?: any) { + const data = await requestEncryption('/Platform/GetUserList', { method: 'POST', data: params, }) @@ -157,8 +158,8 @@ export async function handleGetUserList(params?: any){ // 获得角色详情 -export async function handleGetSYSTEMROLEDetail(params?: any){ - const data = await request('/Platform/GetSYSTEMROLEDetail', { +export async function handleGetSYSTEMROLEDetail(params?: any) { + const data = await requestEncryption('/Platform/GetSYSTEMROLEDetail', { method: 'GET', params, }) diff --git a/src/pages/Setting/Users/service.ts b/src/pages/Setting/Users/service.ts index fb3e210..9feb078 100644 --- a/src/pages/Setting/Users/service.ts +++ b/src/pages/Setting/Users/service.ts @@ -11,6 +11,7 @@ import request from '@/utils/request'; import { tableList, wrapTreeNode } from '@/utils/format'; import type { UserModel } from './data'; +import requestEncryption from '@/utils/requestEncryption'; // import type { ModuleItem } from './data'; // 获取列表数据 @@ -172,9 +173,12 @@ export async function handleDeleteUSER(params: any) { // 用户行为记录 export async function handleSynchroBEHAVIORRECORD(params: any) { - const data = await request(`/Platform/SynchroBEHAVIORRECORD`, { + const data = await requestEncryption(`/Log/SynchroBEHAVIORRECORD`, { method: 'POST', - data: params + data: { + ...params, + requestEncryption: true + } }) if (data.Result_Code !== 100) { diff --git a/src/pages/User/login/index.tsx b/src/pages/User/login/index.tsx index a51910c..c6d6233 100644 --- a/src/pages/User/login/index.tsx +++ b/src/pages/User/login/index.tsx @@ -138,15 +138,15 @@ const Login: React.FC = (props) => { // } // 可以一条龙拿到的 - fetch('https://qifu-api.baidubce.com/ip/local/geo/v1/district').then(response => response.text()).then(data => { - const obj: any = JSON.parse(data).data - const res = { - ...obj, - ip: JSON.parse(data).ip - } - session.set('basicInfo', res); - setBaseInfo(res) - }); + // fetch('https://qifu-api.baidubce.com/ip/local/geo/v1/district').then(response => response.text()).then(data => { + // const obj: any = JSON.parse(data).data + // const res = { + // ...obj, + // ip: JSON.parse(data).ip + // } + // session.set('basicInfo', res); + // setBaseInfo(res) + // }); const browserVersion = getBrowserVersion(); session.set('browserVersion', browserVersion); diff --git a/src/pages/basicManage/highwayHeadlines/service.ts b/src/pages/basicManage/highwayHeadlines/service.ts index fe3c5f8..59b9014 100644 --- a/src/pages/basicManage/highwayHeadlines/service.ts +++ b/src/pages/basicManage/highwayHeadlines/service.ts @@ -1,11 +1,15 @@ import request from '@/utils/request'; +import requestEncryption from '@/utils/requestEncryption'; // 获取高速头条的列表接口 export async function handleGetNOTICEINFOList(params?: any) { - const data = await request(`/Notice/GetNOTICEINFOList`, { + const data = await requestEncryption(`/WisdomServerpart/GetNOTICEINFOList`, { method: 'POST', - data: params, + data: { + ...params, + requestEncryption: true + } }); if (data.Result_Code !== 100) { diff --git a/src/pages/newDataAnalysis/service.ts b/src/pages/newDataAnalysis/service.ts index b5bbbf8..77440e0 100644 --- a/src/pages/newDataAnalysis/service.ts +++ b/src/pages/newDataAnalysis/service.ts @@ -9,6 +9,7 @@ import { wrapTreeNode } from "@/utils/format"; import request from "@/utils/request"; import requestCode from "@/utils/requestCode"; +import requestEncryption from "@/utils/requestEncryption"; // 服务区基础信息 export async function handleGetServerInfoTree(params?: any) { diff --git a/src/pages/travelMember/EventRegistration/components/EventRegistrationDetail.tsx b/src/pages/travelMember/EventRegistration/components/EventRegistrationDetail.tsx new file mode 100644 index 0000000..6c32307 --- /dev/null +++ b/src/pages/travelMember/EventRegistration/components/EventRegistrationDetail.tsx @@ -0,0 +1,593 @@ +import { connect } from "umi"; +import type { ConnectState } from "@/models/connect"; +import { Button, Col, FormInstance, message, Modal, Row, Image } from "antd"; +import { useRef, useState } from "react"; +import React from "react"; +import { ExclamationCircleOutlined, setTwoToneColor } from "@ant-design/icons"; +import Draggable from "react-draggable"; +import ProForm, { ProFormCheckbox, ProFormDatePicker, ProFormDigit, ProFormText, ProFormTextArea, ProFormUploadButton } from "@ant-design/pro-form"; +import session from "@/utils/session"; +import moment from 'moment' +import { handleGetACTIVITYDETAILList, handleGetSynchroACTIVITY } from "../../SharedRestStationManagement/service"; +import { deleteAHYDPicture, uploadAHYDPicture } from "../service"; +import { compressImage } from "@/utils/imageCompress"; +import ProTable, { ActionType } from "@ant-design/pro-table"; +import './style.less' + +type DetailProps = { + parentRow: any;// 传入的当前行数据 + setparentRow: any;// 改变当前行数据的方法 + onShow: any;// 显示悬浮框 + setOnShow: any;// 改变显示悬浮框的方法 + currentUser: any; // 页面公参 + actionRef: any; // 外面表格的实例 + readonly: any; // 判断是不是只读 + fileList: any;// 图片附件 + setFileList: any;// 改变图片附件的方法 +} + +const beforeUpload = (file: any) => { + const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'; + if (!isJpgOrPng) { + message.error('请上传JPEG、jpg、png格式的图片文件!'); + return false; + } + const isLt5M = file.size / 1024 / 1024 < 5; + if (!isLt5M) { + message.error('图片大小不超过 5MB!'); + return false; + } + return true; +} + +const EventRegistrationDetail = ({ parentRow, setparentRow, onShow, setOnShow, currentUser, actionRef, readonly, fileList, setFileList }: DetailProps) => { + const draggleRef = React.createRef() + const EventRegistrationRef = useRef(); + const { confirm } = Modal; + const modalFromRef = useRef(); + const selectServerpartFormRef = useRef(); + + // 弹出框拖动效果 + const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置 + const [disabled, setDraggleDisabled] = useState() // 是否拖动 + const onDraggaleStart = (event, uiData) => { + const { clientWidth, clientHeight } = window.document.documentElement; + const targetRect = draggleRef.current?.getBoundingClientRect(); + if (!targetRect) { + return; + } + setBounds({ + left: -targetRect.left + uiData.x, + right: clientWidth - (targetRect.right - uiData.x), + top: -targetRect.top + uiData.y, + bottom: clientHeight - (targetRect.bottom - uiData.y), + }); + }; + const [confirmLoading, handleConfirmLoading] = useState(false) // 弹出框的内容表单是否在提交 + const [imagePreviewVisible, setImagePreviewVisible] = useState(false) // 预览图片 + const serverpartObj = session.get('serverpartObj') + const serverpartList = session.get('serverpartList') + // 选择服务区的悬浮框 + const [selectServerpartModal, handleSelectServerpartModal] = useState(false) + // 预览上传后的图片 + const handlePreview = async () => { + setFileList(fileList) + setImagePreviewVisible(true) + }; + const handleChangePreview = (val: any) => { + setImagePreviewVisible(val) + } + + // 活动报名明细的列表 + const columns: any = [ + { + title:
人员姓名
, + width: 180, + dataIndex: "MEMBERSHIP_NAME", + ellipsis: true, + hideInSearch: true, + }, + { + title:
联系方式
, + width: 180, + dataIndex: "MEMBERSHIP_MOBILEPHONE", + ellipsis: true, + hideInSearch: true, + }, + { + title:
报名状态
, + width: 180, + dataIndex: "ACTIVITYDETAIL_STATE", + ellipsis: true, + hideInSearch: true, + valueType: "select", + fieldProps: { + options: [{ label: "取消", value: 0 }, { label: "报名", value: 1 }, { label: "参与", value: 9 }] + } + }, + ] + + return ( +
+ { + if (disabled) { + setDraggleDisabled(false) + } + }} + onMouseOut={() => { + setDraggleDisabled(true) + }} + + onFocus={() => { }} + onBlur={() => { }} + > + {parentRow ? '编辑活动内容' : '新增活动内容'} +
+ } + destroyOnClose={true} + width={900} + bodyStyle={{ + height: '700px', // 你可以根据需要调整高度 + overflowY: 'auto', + }} + footer={readonly ? '' : +
+ + +
+ } + open={onShow} + confirmLoading={confirmLoading} + afterClose={() => { + modalFromRef.current?.resetFields(); + setparentRow(undefined); + }} + onCancel={() => { + handleConfirmLoading(false) + setOnShow(false) + setparentRow(undefined); + setFileList([]) + }} + onOk={async () => { + modalFromRef.current?.validateFields().then((values) => { + modalFromRef.current?.submit(); + }) + }} + modalRender={(modal) => { + return onDraggaleStart(event, uiData)} + handle=".EventRegistration" + > +
{modal}
+
+ }} + > + { + console.log('fileListfileListfileList', fileList); + + if (parentRow) { + let idList: any = [] + let nameStr: string = '' + if (parentRow.RelateList && parentRow.RelateList.length > 0) { + parentRow.RelateList.forEach((item: any) => { + idList.push(item.SERVERPART_ID) + if (nameStr) { + nameStr += `,${item.SERVERPART_NAME}` + } else { + nameStr = item.SERVERPART_NAME + } + }) + } + return { + ...parentRow, + SERVERPART_ID: idList, + SERVERPART_SHOWNAME: nameStr, + } + } + return {} + }} + labelCol={{ style: { width: 120 } }} + onFinish={async (values) => { + console.log('valuesvaluesvalues', values); + + let req: any = {} + let RelateList: any = [] + if (values.SERVERPART_ID && values.SERVERPART_ID.length > 0) { + values.SERVERPART_ID.forEach((item: any) => { + RelateList.push({ + RTACTIVITY_ID: "", + ACTIVITY_ID: "", + SERVERPART_ID: item, + SERVERPART_CODE: "", + SERVERPART_NAME: serverpartObj[item], + SERVERPART_REGION: "", + SERVERPARTSHOP_ID: "", + SHOPCODE: "", + SHOPNAME: "", + MAXIMUM_CAPACITY: "", + RTACTIVITY_STATE: 1, + STAFF_ID: currentUser.ID, + STAFF_NAME: currentUser.Name, + OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + RTACTIVITY_DESC: "", + }) + + }) + } + + if (parentRow) { + req = { + ...parentRow, + ...values, + SERVERPART_ID: '', + SERVERPART_NAME: values.SERVERPART_SHOWNAME, + STAFF_ID: currentUser.ID, + STAFF_NAME: currentUser.Name, + OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + RelateList: RelateList + } + } else { + req = { + ...values, + SERVERPART_ID: '', + SERVERPART_NAME: values.SERVERPART_SHOWNAME, + PROVINCE_CODE: "530000", + STAFF_ID: currentUser.ID, + STAFF_NAME: currentUser.Name, + OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + RelateList: RelateList, + ACTIVITY_STATE: 2 + } + } + console.log('reqreqreqreq', req); + + handleConfirmLoading(true) + const data = await handleGetSynchroACTIVITY(req) + console.log('datadatadatadata', data); + if (data.Result_Code === 100) { + + if (values.ACTIVITY_IMG && values.ACTIVITY_IMG.length > 0) { + const formData = new FormData(); + values.ACTIVITY_IMG.forEach((file: any) => { + if (!file.ImageUrl) { + // 使用压缩后的文件,如果没有则使用原文件 + const fileToUpload = file.originFileObj?.compressedFile || file.originFileObj; + formData.append('files[]', fileToUpload); + formData.append('ImageName', typeof file !== 'string' ? file?.name : ''); + } + }); + formData.append('TableId', data.Result_Data.ACTIVITY_ID); + formData.append('TableType', '1308'); + + console.log('formData', formData); + await uploadAHYDPicture(formData) + } + + handleConfirmLoading(false) + message.success(data.Result_Desc) + handleConfirmLoading(false) + setOnShow(false) + setparentRow(undefined); + setFileList([]) + if (actionRef) { + actionRef.current?.reload() + } + } else { + handleConfirmLoading(false) + message.error(data.Result_Desc) + } + + }} + > + + + + + + + + + + + + + + + + + + { + // 开始处理 + onProgress?.({ percent: 10 }); + compressImage(file as File, { + width: 300, + height: 300, + maxSize: 200 // KB + }) + .then(compressedFile => { + console.log(`压缩成功: ${file.name} 从 ${(file.size / 1024).toFixed(1)}KB 压缩到 ${(compressedFile.size / 1024).toFixed(1)}KB`); + + // 保存压缩后的文件到原文件对象上 + (file as any).compressedFile = compressedFile; + + onProgress?.({ percent: 100 }); + onSuccess?.(compressedFile); + }) + .catch(err => { + console.error('图片压缩失败:', err); + message.error('图片处理失败,请重试'); + onError?.(err); + }); + }, + onChange: async (info: any) => { + console.log('info', info); + console.log('fileList', fileList); + if (info.file.status === 'removed') { + const index = fileList.findIndex(n => n.uid === info.file.uid); + confirm({ + title: '确认删除该文件吗?', + icon: , + async onOk() { + if (info.file.ImageId) { + const deleteLoading = message.loading('正在删除...') + // const success = await deletePicture(info.file?.ImagePath, info.file?.uid, '', '5000') + const success = await deleteAHYDPicture(info.file?.ImagePath, info.file?.uid, '', '5000') + deleteLoading() + + if (success) { + const files = [...fileList] + files.splice(index, 1) + setFileList(files) + message.success("删除成功") + if (actionRef) { + actionRef.current?.reload() + } + } + else { + message.error("删除失败") + } + } else { + const files = [...fileList]; + files.splice(index, 1); + setFileList(files); + } + }, + onCancel() { + }, + }); + } else { + setFileList(info.fileList) + } + } + }} + /> + + + + + + + { + readonly ? '' : + + } + + + + + + + + { + parentRow ? + { + const req: any = { + SearchParameter: { + ACTIVITY_IDS: parentRow?.ACTIVITY_ID + }, + PageIndex: 1, + PageSize: 999999, + } + const data = await handleGetACTIVITYDETAILList(req) + console.log('datadatadata', data); + if (data && data.length > 0) { + return { data, success: true } + } + return { data: [], success: true } + }} + /> : "" + } + + + + + + { + handleSelectServerpartModal(false) + }} + onOk={async () => { + selectServerpartFormRef.current?.validateFields().then((values) => { + selectServerpartFormRef.current?.submit(); + }) + }} + > + { + console.log('valuesvaluesvalues', values); + let str: string = '' + if (values.SERVERPART_IDS && values.SERVERPART_IDS.length > 0) { + values.SERVERPART_IDS.forEach((item: any) => { + if (str) { + str += `,${serverpartObj[item]}` + } else { + str = serverpartObj[item] + } + }) + } + + modalFromRef.current?.setFieldsValue({ + SERVERPART_ID: values.SERVERPART_IDS, + SERVERPART_SHOWNAME: str + }) + handleSelectServerpartModal(false) + }} + request={async () => { + let formData: any = modalFromRef.current?.getFieldsValue() + console.log('formDataformDataformData', formData); + + return { + SERVERPART_IDS: formData.SERVERPART_ID || [] + } + }} + > + + + + + + {/* 图片预览组件 */} + {fileList && fileList.length > 0 &&
+ { + handleChangePreview(vis) + } + }}> + { + fileList.map((n) => ) + } + +
} + +
+ ) +} + +export default connect(({ user, }: ConnectState) => ({ + currentUser: user.currentUser, +}))(EventRegistrationDetail); diff --git a/src/pages/travelMember/EventRegistration/components/style.less b/src/pages/travelMember/EventRegistration/components/style.less new file mode 100644 index 0000000..aa3ff42 --- /dev/null +++ b/src/pages/travelMember/EventRegistration/components/style.less @@ -0,0 +1,7 @@ +.noUoloadButton { + .ant-upload-list-picture-card { + .ant-upload-select { + display: none; + } + } +} \ No newline at end of file diff --git a/src/pages/travelMember/EventRegistration/index.tsx b/src/pages/travelMember/EventRegistration/index.tsx new file mode 100644 index 0000000..fed7d2e --- /dev/null +++ b/src/pages/travelMember/EventRegistration/index.tsx @@ -0,0 +1,264 @@ +import { connect } from "umi"; +import type { CurrentUser } from "umi"; +import type { ConnectState } from "@/models/connect"; +import React, { useRef, useState } from "react"; +import ProCard from "@ant-design/pro-card"; +import { MenuFoldOutlined } from "@ant-design/icons"; +import type { FormInstance } from "antd"; +import { Button, Col, message, Modal, Popconfirm, Row, Space, Spin, Tree } from "antd"; +import useRequest from "@ahooksjs/use-request"; +import { getServerpartTree } from "@/services/options"; +import type { ActionType } from "@ant-design/pro-table"; +import ProTable from "@ant-design/pro-table"; +import ReactHTMLTableToExcel from "react-html-table-to-excel"; +import LeftSelectTree from "@/pages/reports/settlementAccount/component/leftSelectTree"; +import PageTitleBox from "@/components/PageTitleBox"; +import Draggable from "react-draggable"; +import ProForm, { ProFormCheckbox, ProFormDatePicker, ProFormDigit, ProFormSelect, ProFormText, ProFormTextArea, ProFormUploadButton } from "@ant-design/pro-form"; +import moment from "moment"; +import { handleDeleteACTIVITY, handleGetACTIVITYList, handleGetSynchroACTIVITY } from "../SharedRestStationManagement/service"; +import session from "@/utils/session"; +import './style.less' +import { set } from "lodash"; +import { compressImage } from "@/utils/imageCompress"; +import { deleteAHYDPicture, uploadAHYDPicture } from "./service"; +import EventRegistrationDetail from "./components/EventRegistrationDetail"; + + + +const EventRegistration: React.FC<{ currentUser: CurrentUser }> = (props) => { + const { currentUser } = props + const { confirm } = Modal; + const actionRef = useRef(); + const formRef = useRef(); + const [printOut, setPrintOut] = useState(); // 打印数据的内容 + const [collapsible, setCollapsible] = useState(false) + + const [modalVisible, handleModalVisible] = useState(); + const [confirmLoading, handleConfirmLoading] = useState(false) // 弹出框的内容表单是否在提交 + const serverpartObj = session.get('serverpartObj') + const serverpartList = session.get('serverpartList') + // 树相关的属性和方法 + const [selectedId, setSelectedId] = useState() + // 查询的条件 + const [searchParams, setSearchParams] = useState() + // 当前选择的行数据 + const [currentRow, setCurrentRow] = useState() + // 文件列表 + const [fileList, setFileList] = useState([]) + const [imagePreviewVisible, setImagePreviewVisible] = useState(false) // 预览图片 + // 选择服务区的悬浮框 + const [selectServerpartModal, handleSelectServerpartModal] = useState(false) + + const columns: any = [ + { + title: '统计时间', + dataIndex: 'search_date', + valueType: 'dateRange', + hideInTable: true, + hideInDescriptions: true, + hideInSearch: false, + initialValue: [moment(), moment().subtract(-1, 'M')], + search: { + transform: (value) => { + return { + ACTIVITY_ENDDATE_Start: value[0], + ACTIVITY_STARTDATE_End: value[1], + }; + }, + }, + }, + { + title: '服务区', + dataIndex: "SERVERPART_IDS", + hideInTable: true, + valueType: 'select', + valueEnum: serverpartObj, + fieldProps: { + showSearch: true, // 支持输入文字搜索 + filterOption: (input, option) => (option?.label ?? '').toLowerCase().includes(input.toLowerCase()), + } + }, + { + title:
活动名称
, + width: 180, + dataIndex: "ACTIVITY_NAME", + ellipsis: true, + hideInSearch: true, + }, + { + title:
活动范围
, + width: 150, + dataIndex: "SERVERPART_NAME", + ellipsis: true, + hideInSearch: true + }, + { + title:
活动地点
, + width: 150, + dataIndex: "ACTIVITY_LOCATION", + ellipsis: true, + hideInSearch: true, + }, + { + title:
人数上限
, + width: 120, + dataIndex: "MAXIMUM_CAPACITY", + ellipsis: true, + hideInSearch: true, + valueType: "digit", + align: 'right' + }, + { + title:
活动描述
, + width: 250, + dataIndex: "ACTIVITY_INFO", + ellipsis: true, + hideInSearch: true, + }, + { + title:
活动时间
, + width: 170, + dataIndex: "ACTIVITY_STARTDATE", + ellipsis: true, + hideInSearch: true, + align: 'center', + render: (_, record) => { + return record?.ACTIVITY_STARTDATE && record?.ACTIVITY_ENDDATE ? `${moment(record?.ACTIVITY_STARTDATE).format('YYYY/MM/DD')}-${moment(record?.ACTIVITY_ENDDATE).format('YYYY/MM/DD')}` : '不限时间' + } + }, + { + title:
活动状态
, + width: 120, + dataIndex: "ACTIVITY_STATE", + ellipsis: true, + hideInSearch: true, + align: 'center', + valueType: "select", + valueEnum: { + 1: { text: '已上架', status: 'success' }, + 2: { text: '未上架', status: 'error' }, + 9: { text: '已下架', status: 'error' }, + } + }, + { + title: "操作", + dataIndex: "option", + width: 120, + align: 'center', + hideInSearch: true, + render: (_, record) => { + return + { + let imgList: any = [] + if (record?.ImageList && record?.ImageList.length > 0) { + record?.ImageList.forEach((item: any) => { + let obj = JSON.parse(JSON.stringify(item)) + obj.url = obj.ImageUrl + obj.name = obj.ImageName + obj.uid = item.ImageId + obj.status = 'done' + imgList.push(obj) + }) + } + setCurrentRow({ + ...record, + ACTIVITY_IMG: imgList + }) + setFileList(imgList); + handleModalVisible(true) + }}>编辑 + { + await handleGetDeleteActivity(record.ACTIVITY_ID) + }} + > + 删除 + + + } + } + ] + + // 删除活动的方法 + const handleGetDeleteActivity = async (activityId: string) => { + const req: any = { + ACTIVITYId: activityId + } + const data = await handleDeleteACTIVITY(req) + if (data.Result_Code === 100) { + message.success(data.Result_Desc) + + actionRef.current?.reload() + } else { + message.error(data.Result_Desc) + } + } + + return ( +
+
+
+ } // 列表表头 + search={{ span: 6 }} + request={async (params) => { + const req: any = { + SearchParameter: { + ACTIVITY_ENDDATE_Start: params.ACTIVITY_ENDDATE_Start, + ACTIVITY_STARTDATE_End: params.ACTIVITY_STARTDATE_End, + SERVERPART_IDS: params?.SERVERPART_IDS, + PROVINCE_CODE: "530000", + ACTIVITY_STATES: "1,2" + }, + PageIndex: 1, + PageSize: 999999, + } + setSearchParams(params) + const data = await handleGetACTIVITYList(req) + console.log('datadatadatadata', data); + if (data.List && data.List.length > 0) { + return { data: data.List, success: true } + } + return { data: [], success: true } + }} + toolbar={{ + actions: [ + + + ] + }} + /> +
+ + +
+
+ ) +} + +export default connect(({ user }: ConnectState) => ({ + currentUser: user.currentUser +}))(EventRegistration); diff --git a/src/pages/travelMember/EventRegistration/service.ts b/src/pages/travelMember/EventRegistration/service.ts new file mode 100644 index 0000000..d49d9d2 --- /dev/null +++ b/src/pages/travelMember/EventRegistration/service.ts @@ -0,0 +1,90 @@ +// 云南专用的上传图片 +// import request from '@/utils/requestYNUpload'; +import request from '@/utils/request'; +import { tableList } from '@/utils/format'; + +// 上传图片的公共方法 +// 上传图片信息(文件格式传输) 入参数据: TableId【数据表内码】 TableName【数据表名称】 ImageName【图片名称】 +export async function uploadPicture(uploadFilds?: any) { + return await request(`/Picture/UploadPicture`, { + method: 'POST', + data: uploadFilds + }) +} + + +export async function uploadAHYDPicture(uploadFilds?: any) { + return await request(`/Picture/UploadPicture`, { + method: 'POST', + data: uploadFilds + }) +} + +export async function SavePicture(uploadFilds?: any) { + + return await request(`/Picture/SaveImgFile`, { + method: 'POST', + data: uploadFilds + }) + +} + +// 获取附件图片 +export async function getPictureList(id: number, TableType?: string) { + const data = await request(`/Picture/GetPictureList?TableId=${id}&TableType=${TableType || ''}`, { + method: 'GET' + }) + + if (data.Result_Code !== 100) { + return { + data: [], + current: 1, + pageSize: 10, + total: 0, + success: false + } + } + return tableList(data.Result_Data); +} + +// 删除图片 +export async function deleteAHYDPicture(imagepath: string, id: number, TableName?: string, TableType?: string) { + + const data = await request(`/Picture/DeletePicture?imagepath=${imagepath}&imageid=${id}&TableName=${TableName || ''}&TableType=${TableType || ''}`, { + method: 'POST' + }) + + if (data.Result_Code !== 100) { + return false + } + + return true +} + +// 删除图片 +export async function deletePicture(imagepath: string, id: number, TableName?: string, TableType?: string) { + + const data = await request(`/Picture/DeletePicture?imagepath=${imagepath}&imageid=${id}&TableName=${TableName || ''}&TableType=${TableType || ''}`, { + method: 'POST' + }) + + if (data.Result_Code !== 100) { + return false + } + + return true +} +// 删除多张图片 +export async function deleteMultiPicture(params: { imagepath: string, id: number, TableName?: string, TableType?: string }[]) { + + const data = await request(`/Picture/DeleteMultiPicture`, { + method: 'POST', + data: params + }) + + if (data.Result_Code !== 100) { + return false + } + + return true +} diff --git a/src/pages/travelMember/EventRegistration/style.less b/src/pages/travelMember/EventRegistration/style.less new file mode 100644 index 0000000..50f7920 --- /dev/null +++ b/src/pages/travelMember/EventRegistration/style.less @@ -0,0 +1,19 @@ +// 全局或组件级样式(css / less / styled) +/* 推荐放在全局 less/css,确保权重足够 */ +.wrap-select .ant-select-selector { + white-space: normal !important; + align-items: flex-start !important; + padding: 4px !important; + min-height: 38px; +} +.wrap-select .ant-select-selection-overflow { + display: flex !important; + flex-wrap: wrap !important; /* 关键:允许换行 */ + align-items: flex-start !important; +} +.wrap-select .ant-select-selection-item { + display: inline-block !important; /* 每个 tag 用 inline-block */ + margin: 4px 6px 4px 0 !important; + padding: 2px 6px !important; + border-radius: 4px !important; +} diff --git a/src/pages/travelMember/InvestmentInformation/components/InvestmentInformationDetail.tsx b/src/pages/travelMember/InvestmentInformation/components/InvestmentInformationDetail.tsx new file mode 100644 index 0000000..b7a9b13 --- /dev/null +++ b/src/pages/travelMember/InvestmentInformation/components/InvestmentInformationDetail.tsx @@ -0,0 +1,318 @@ +import { connect } from "umi"; +import type { ConnectState } from "@/models/connect"; +import ProTable, { ActionType } from "@ant-design/pro-table"; +import moment from 'moment' +import { useRef, useState } from "react"; +import { handleGetPictureList, handleGetRTNOTICEINFOList } from "../../SharedRestStationManagement/service"; +import { Col, FormInstance, Modal, Row, Image, message } from "antd"; +import ProForm, { ProFormSelect, ProFormText, ProFormTextArea, ProFormUploadButton } from "@ant-design/pro-form"; +import session from "@/utils/session"; +import { ExclamationCircleOutlined } from "@ant-design/icons"; +import './style.less' + +type DetailProps = { + parentRow: any +} +const InvestmentInformationDetail = ({ parentRow }: DetailProps) => { + const { confirm } = Modal; + const actionRef = useRef(); + const formRef = useRef(); + const [currentRow, setCurrentRow] = useState() + const [showModal, setShowModal] = useState() + // 图片列表 + const [fileList, setFileList] = useState() + const [imagePreviewVisible, setImagePreviewVisible] = useState(false) // 预览图片 + const MEMBERSHIPTYPEYNList = session.get('MEMBERSHIPTYPEYNList') + const [currentImgIndex, setCurrentImgIndex] = useState(0) + // 预览上传后的图片 + const handlePreview = async (index: number) => { + setCurrentImgIndex(index) + setFileList(fileList) + setImagePreviewVisible(true) + }; + const handleChangePreview = (val: any) => { + setImagePreviewVisible(val) + if (!val) { + setCurrentImgIndex(0) + } + } + // 明细的表格项 + const detailColumns: any = [ + { + title:
商家名称
, + dataIndex: "BUSINESSMAN_NAME", + hideInSearch: true, + width: 250, + ellipsis: true, + render: (_, record) => { + return record?.BUSINESSMAN_NAME ? { + setCurrentRow(record) + setShowModal(true) + }}> + {record?.BUSINESSMAN_NAME} + : "" + } + }, + { + title:
统一信用代码
, + dataIndex: "TAXPAYER_IDENTIFYCODE", + hideInSearch: true, + width: 150, + ellipsis: true, + }, + { + title:
联系人员
, + dataIndex: "LINK_PERSON", + hideInSearch: true, + width: 150, + ellipsis: true, + }, + { + title:
联系电话
, + dataIndex: "LINK_MOBILEPHONE", + hideInSearch: true, + width: 150, + ellipsis: true, + }, + { + title:
商家简介
, + dataIndex: "BUSINESS_PROFILE", + hideInSearch: true, + width: 150, + ellipsis: true, + }, + { + title:
申请时间
, + dataIndex: "OPERATE_DATE", + hideInSearch: true, + width: 150, + ellipsis: true, + render: (_, record) => { + return record?.OPERATE_DATE ? moment(record?.OPERATE_DATE).format('YYYY-MM-DD HH:mm:ss') : "" + } + }, + ] + + return ( +
+ { + const req: any = { + SearchParameter: { + NOTICEINFO_IDS: parentRow?.NOTICEINFO_ID, + }, + PageIndex: 1, + PageSize: 999999, + } + + const data = await handleGetRTNOTICEINFOList(req) + if (data && data.length > 0) { + return { data, success: true } + } + return { data: [], success: true } + }} + search={false} + bordered + /> + {/* 图片预览组件 */} + {fileList && fileList.length > 0 &&
+ { + handleChangePreview(vis) + }, + }}> + { + fileList.map((n) => ) + } + +
} + + { + setShowModal(false) + }} + footer={false} + onOk={async () => { // 提交框内的数据 + + }} + > + { + if (currentRow?.RTNOTICEINFO_ID) { + // const imgReq: any = { + // TableId: currentRow?.RTNOTICEINFO_ID, + // TableType: 1310, + // } + // const imgData = await handleGetPictureList(imgReq) + // console.log('imgData', imgData); + // const imgList: any = imgData.Result_Data.List + // const realImgList: any = [] + // if (imgList && imgList.length > 0) { + // imgList.forEach((item: any) => { + // realImgList.push({ + // uid: item.ImageId, + // name: item.ImageName, + // status: 'done', + // url: item.ImageUrl, + // imgUrl: item.ImagePath, + // }) + // }) + // } + // setFileList(realImgList) + // console.log('dasdasd', currentRow); + + const realImgList: any = [] + if (currentRow?.RTNOTICEINFO_URL) { + let imgList: any = currentRow?.RTNOTICEINFO_URL.split(',') + imgList.forEach((item: any, index: number) => { + realImgList.push({ + uid: index + 1, + name: "", + status: 'done', + url: item, + imgUrl: "", + }) + }) + } + setFileList(realImgList) + console.log('currentRowcurrentRowcurrentRow', currentRow); + + return { + ...currentRow, + OPERATE_DATE: moment(currentRow?.OPERATE_DATE).format('YYYY-MM-DD HH:mm:ss') + } + } + return {} + }} + > + + + + + + { + const params = new URLSearchParams({ + action_type: 'GetEnumLable', + fieldexplainField: 'BUSINESS_TARGET', + fieldenumIndex: '4000' + }); + const response: any = await fetch( + `https://eshangtech.com:18998/Coop.Merchant/Handler/handler_ajax.ashx?${params.toString()}`, + { + method: "GET", + headers: { + "Content-Type": "application/json", + }, + + } + ); + const res = await response.json(); + console.log('resresresresres', res); + let result: any = [] + if (res && res.Data && res.Data.List) { + // 找到FIELDENUM_VALUE为'4600'的项 + const targetItem = res.Data.List.find((item: any) => item.FIELDENUM_VALUE === '4600'); + + if (targetItem && targetItem.fieldenumList) { + // 将fieldenumList转换为需要的格式 + result = targetItem.fieldenumList.map((item: any) => ({ + label: item.FIELDENUM_NAME, + value: item.FIELDENUM_VALUE + })); + } + } + return result + }} + // fieldProps={{ + // options: MEMBERSHIPTYPEYNList + // }} + /> + + + + + + + + + + + + + + + + + + + { + handlePreview(e.uid - 1) + }, + }} + readonly + /> + + + + +
+ ) +} + +export default connect(({ user, }: ConnectState) => ({ + currentUser: user.currentUser, +}))(InvestmentInformationDetail); diff --git a/src/pages/travelMember/InvestmentInformation/components/style.less b/src/pages/travelMember/InvestmentInformation/components/style.less new file mode 100644 index 0000000..aa3ff42 --- /dev/null +++ b/src/pages/travelMember/InvestmentInformation/components/style.less @@ -0,0 +1,7 @@ +.noUoloadButton { + .ant-upload-list-picture-card { + .ant-upload-select { + display: none; + } + } +} \ No newline at end of file diff --git a/src/pages/travelMember/InvestmentInformation/index.tsx b/src/pages/travelMember/InvestmentInformation/index.tsx new file mode 100644 index 0000000..e103047 --- /dev/null +++ b/src/pages/travelMember/InvestmentInformation/index.tsx @@ -0,0 +1,577 @@ +import { connect } from "umi"; +import type { CurrentUser } from "umi"; +import type { ConnectState } from "@/models/connect"; +import React, { useRef, useState } from "react"; +import { ExclamationCircleOutlined, MenuFoldOutlined } from "@ant-design/icons"; +import type { FormInstance } from "antd"; +import { Col, Modal, Row, Image } from "antd"; +import { Button, message, Space, Spin, Tree } from "antd"; +import { getFieldEnumTree, getServerpartTree } from "@/services/options"; +import type { ActionType } from "@ant-design/pro-table"; +import ProTable from "@ant-design/pro-table"; +import PageTitleBox from "@/components/PageTitleBox"; +import moment from 'moment' +import ProForm, { ProFormDatePicker, ProFormSelect, ProFormText, ProFormTextArea, ProFormTreeSelect, ProFormUploadButton } from "@ant-design/pro-form"; +import { deleteAHYDPicture, deletePicture, uploadAHYDPicture, uploadPicture } from "@/services/picture"; +import Popconfirm from "antd/es/popconfirm"; +import { handleDeleteNOTICEINFO, handleGetNOTICEINFOList, handleSynchroNOTICEINFO } from "@/pages/basicManage/highwayHeadlines/service"; +import { handleGetPictureList, handleGetRTNOTICEINFOList } from "../SharedRestStationManagement/service"; +import { handleGetServerpartTree } from "@/pages/basicManage/serverpartAssets/service"; +import { bool } from "aws-sdk/clients/signer"; +import InvestmentInformationDetail from "./components/InvestmentInformationDetail"; + + +const InvestmentInformation: React.FC<{ currentUser: CurrentUser }> = (props) => { + const { currentUser } = props + const { confirm } = Modal; + const actionRef = useRef(); + const tableRef = useRef(); + const formRef = useRef(); + const modalRef = useRef(); + const [reqDetailList, setReqDetailList] = useState(); // 合计项数据源 + const [printOut, setPrintOut] = useState(); // 打印数据的内容 + const [collapsible, setCollapsible] = useState(false) + const [treeView, setTreeView] = useState() + const [printIndex, setPrintIndex] = useState(new Date().getTime()) + + + // 树相关的属性和方法 + const [selectedId, setSelectedId] = useState() + // 是否显示打印的表格 + const [showExportTable, setShowExportTable] = useState(false) + // 查询的条件 + const [searchParams, setSearchParams] = useState() + // 头条类型 对象格式 + const [NOTICEINFO_TYPES, setNOTICEINFO_TYPESOBJ] = useState() + const [NOTICEINFO_TYPESList, setNOTICEINFO_TYPESList] = useState() + // 显示新增窗口 + const [showAddModal, setShowAddModal] = useState(false) + // 弹出框的确认效果 + const [confirmLoading, setConfirmLoading] = useState(false) + // 当前选中行数据 + const [currentRow, setCurrentRow] = useState() + // 图片列表 + const [fileList, setFileList] = useState() + const [imagePreviewVisible, setImagePreviewVisible] = useState(false) // 预览图片 + // 预览上传后的图片 + const handlePreview = async () => { + setFileList(fileList) + setImagePreviewVisible(true) + }; + const handleChangePreview = (val: any) => { + setImagePreviewVisible(val) + } + // 显示详情的modal + const [showNoticeModal, setShowNoticeModal] = useState(false) + // 显示招商详情的行数据 + const [currentNoticeRow, setCurrentNoticeRow] = useState() + + const columns: any = [ + { + title: '统计时间', + dataIndex: 'search_date', + valueType: 'dateRange', + hideInTable: true, + hideInDescriptions: true, + initialValue: [moment().subtract(1, 'month'), moment()], + search: { + transform: (value: any) => { + return { + StartDate: value[0], + EndDate: value[1], + }; + }, + }, + }, + // { + // title:
头条类型
, + // dataIndex: 'NOTICEINFO_TYPES', + // valueType: 'treeSelect', + // align: 'center', + // width: 150, + // ellipsis: true, + // request: async () => { + // const list = await getFieldEnumTree({ FieldExplainField: 'NOTICEINFO_TYPE' }) + // console.log('list2222', list); + // setNOTICEINFO_TYPESList(list) + // const obj: any = [] + // if (list && list.length > 0) { + // list.forEach((item: any) => { + // item.disabled = true + // if (item.children && item.children.length > 0) { + // item.children.forEach((subItem: any) => { + // obj[subItem.value] = subItem.label + // }) + // } + // }) + // } + // console.log('obj', obj); + + // setNOTICEINFO_TYPESOBJ(obj) + // return list + // }, + // fieldProps: { + // treeDefaultExpandAll: true, + // allowClear: true, + // }, + // render: (_, record) => { + // return record?.NOTICEINFO_TYPE && NOTICEINFO_TYPES ? NOTICEINFO_TYPES[record?.NOTICEINFO_TYPE] : '-' + // } + // }, + { + title:
标题
, + dataIndex: "NOTICEINFO_TITLE", + hideInSearch: true, + width: 250, + ellipsis: true, + }, + { + title:
内容
, + dataIndex: "NOTICEINFO_CONTENT", + hideInSearch: true, + width: 350, + ellipsis: true, + }, + // { + // title: '下发时间', + // dataIndex: "ISSUED_DATE", + // hideInSearch: true, + // width: 150, + // align: 'center', + // ellipsis: true, + // render: (_, record) => { + // return record?.ISSUED_DATE ? moment(record?.ISSUED_DATE).format('YYYY-MM-DD HH:mm:ss') : "-" + // } + // }, + // { + // title: '图片列表', + // dataIndex: "ImageList", + // hideInSearch: true, + // width: 120, + // align: 'center', + // ellipsis: true + // }, + { + title: '操作人员', + dataIndex: "STAFF_NAME", + hideInSearch: true, + width: 150, + align: 'center', + ellipsis: true + }, + { + title: '备注说明', + dataIndex: "NOTICEINFO_DESC", + hideInSearch: true, + width: 200, + align: 'center', + ellipsis: true + }, + { + title: '操作', + dataIndex: "options", + hideInSearch: true, + width: 120, + align: 'center', + ellipsis: true, + render: (_, record) => { + return
+ { + setCurrentRow(record) + setShowAddModal(true) + }}> + 编辑 + + { + handleDeleteLine(record?.NOTICEINFO_ID) + }} + > + 删除 + + +
+ } + } + ] + + + + // 新增头条 + const handleAddHeadlines = async (obj: any) => { + console.log('obj', obj); + + let req: any = {} + if (currentRow?.NOTICEINFO_ID) { + req = { + ...currentRow, + NOTICEINFO_TYPE: obj.NOTICEINFO_TYPE, + PROVINCE_CODE: currentUser?.ProvinceCode, + NOTICEINFO_TITLE: obj.NOTICEINFO_TITLE, + NOTICEINFO_CONTENT: obj.NOTICEINFO_CONTENT, + START_DATE: obj.START_DATE ? moment(obj.START_DATE._d).format('YYYY-MM-DD HH:mm:ss') : '', + END_DATE: obj.END_DATE ? moment(obj.END_DATE._d).format('YYYY-MM-DD HH:mm:ss') : '', + NOTICEINFO_DESC: obj.NOTICEINFO_DESC, + NOTICEINFO_STATE: 1, + SERVERPART_ID: obj.SERVERPART_ID + } + } else { + req = { + NOTICEINFO_TYPE: obj.NOTICEINFO_TYPE, + PROVINCE_CODE: currentUser?.ProvinceCode, + NOTICEINFO_TITLE: obj.NOTICEINFO_TITLE, + NOTICEINFO_CONTENT: obj.NOTICEINFO_CONTENT, + START_DATE: obj.START_DATE ? moment(obj.START_DATE._d).format('YYYY-MM-DD HH:mm:ss') : '', + END_DATE: obj.END_DATE ? moment(obj.END_DATE._d).format('YYYY-MM-DD HH:mm:ss') : '', + NOTICEINFO_DESC: obj.NOTICEINFO_DESC, + NOTICEINFO_STATE: 1, + SERVERPART_ID: obj.SERVERPART_ID + } + } + + console.log('req', req); + const data = await handleSynchroNOTICEINFO(req) + console.log('fileList', fileList); + if (fileList && fileList.length > 0) { + const formData = new FormData(); + fileList.forEach((item: any) => { + formData.append('files[]', item.originFileObj); + formData.append('ImageName', item.name); + }) + formData.append('TableType', '1401'); + formData.append('TableId', data.Result_Data.NOTICEINFO_ID.toString()); + // const success = await uploadAHYDPicture(formData) + const success = await uploadAHYDPicture(formData) + console.log('success', success); + } + if (data.Result_Code === 100) { + message.success(data.Result_Desc) + handleModalClose() + actionRef.current?.reload() + } else { + message.error(data.Result_Desc) + setConfirmLoading(false) + } + } + + // 悬浮框的关闭事件 + const handleModalClose = () => { + setConfirmLoading(false) + setCurrentRow(undefined) + setFileList([]) + setShowAddModal(false) + + } + + // 删除头条 + const handleDeleteLine = async (id: any) => { + const data = await handleDeleteNOTICEINFO({ NOTICEINFOId: id }) + if (data.Result_Code === 100) { + message.success(data.Result_Desc) + actionRef.current?.reload() + } else { + message.error(data.Result_Desc) + } + } + + + return ( +
{ + // 打印报表 + if (!reqDetailList || reqDetailList.length === 0) return; + setPrintOut(el); + }} > + +
+ { + showExportTable && reqDetailList && reqDetailList.length > 0 ? + : '' + } +
+
+ +
+ {/* */} +
+ } + search={{ span: 6 }} + request={async (params) => { + const req: any = { + SearchParameter: { + NOTICEINFO_TYPES: 1050, + // START_DATE_Start: params?.StartDate, + // END_DATE_Start: params?.EndDate, + PROVINCE_CODE: currentUser?.ProvinceCode, + NOTICEINFO_STATE: 1 + }, + PageIndex: 1, + PageSize: 999999, + } + setSearchParams(params) + const data = await handleGetNOTICEINFOList(req) + console.log('data', data); + + if (data && data.length > 0) { + return { data, success: true } + } + return { data: [], success: true } + }} + toolbar={{ + actions: [ + + ] + }} + /> +
+
+ + {/* 图片预览组件 */} + {fileList && fileList.length > 0 &&
+ { + handleChangePreview(vis) + } + }}> + { + fileList.map((n) => ) + } + +
} + + + { + handleModalClose() + }} + onOk={async () => { // 提交框内的数据 + modalRef.current?.validateFields().then(async (res: any) => { + setConfirmLoading(true) + + await handleAddHeadlines(res) + setConfirmLoading(false) + }) + }} + > + { + if (currentRow?.NOTICEINFO_ID) { + const imgReq: any = { + TableId: currentRow?.NOTICEINFO_ID, + TableType: 1401, + } + const imgData = await handleGetPictureList(imgReq) + console.log('imgData', imgData); + const imgList: any = imgData.Result_Data.List + const realImgList: any = [] + if (imgList && imgList.length > 0) { + imgList.forEach((item: any) => { + realImgList.push({ + uid: item.ImageId, + name: item.ImageName, + status: 'done', + url: item.ImageUrl, + imgUrl: item.ImagePath, + }) + }) + } + setFileList(realImgList) + console.log('currentRowcurrentRowcurrentRow', currentRow); + + return currentRow + } + return {} + }} + > + + + + + + + + + + { + const req: any = { + ProvinceCode: currentUser?.ProvinceCode, + ServerpartType: 1000, + StatisticsType: 1000, + ShowWholePower: false, + ShowSPRegion: false, + ShowRoyalty: false, + ShowCompactCount: false, + } + const data = await handleGetServerpartTree(req) + // 去除安徽驿达 + const list: any = [] + if (data && data.length > 0) { + data.forEach((item: any) => { + if (item.value !== 424) { + list.push(item) + } + }) + } + return list + }} + /> + + + + + + + + + + + + + + + + { + console.log('info', info); + console.log('fileList', fileList); + if (info.file.status === 'removed') { + const index = fileList.findIndex(n => n.uid === info.file.uid); + confirm({ + title: '确认删除该文件吗?', + icon: , + async onOk() { + const deleteLoading = message.loading('正在删除...') + // const success = await deletePicture(info.file?.deletepath, info.file?.uid, '', '5000') + const success = await deleteAHYDPicture(info.file?.deletepath, info.file?.uid, '', '5000') + deleteLoading() + + if (success) { + const files = [...fileList] + files.splice(index, 1) + setFileList(files) + } + else { + message.error("删除失败") + } + }, + onCancel() { + }, + }); + } else { + setFileList(info.fileList) + } + } + }} + /> + + + + + + + { + currentRow ? + + : "" + } + +
+ ) +} + +export default connect(({ user }: ConnectState) => ({ + currentUser: user.currentUser +}))(InvestmentInformation); diff --git a/src/pages/travelMember/SharedRestStationManagement/components/SharedRestStationDetail.tsx b/src/pages/travelMember/SharedRestStationManagement/components/SharedRestStationDetail.tsx new file mode 100644 index 0000000..0873aee --- /dev/null +++ b/src/pages/travelMember/SharedRestStationManagement/components/SharedRestStationDetail.tsx @@ -0,0 +1,615 @@ +import { connect } from "umi"; +import type { ConnectState } from "@/models/connect"; +import { Button, Col, FormInstance, message, Modal, Row } from "antd"; +import { useRef, useState } from "react"; +import React from "react"; +import Draggable from "react-draggable"; +import ProForm, { ProFormDigit, ProFormSelect, ProFormText, ProFormTextArea, ProFormUploadButton } from "@ant-design/pro-form"; +import session from "@/utils/session"; +import { handleGetServerpartInfo } from "@/pages/newDataAnalysis/service"; +import { compressImage } from "@/utils/imageCompress"; +import { ExclamationCircleOutlined } from "@ant-design/icons"; +import { deleteAHYDPicture, uploadAHYDPicture } from "@/services/picture"; +import { handleGetRESTSTATIONBILLList, handleGetSynchroRESTSTATION } from "../service"; +import moment from 'moment' +import ProTable, { ActionType } from "@ant-design/pro-table"; +import SharedRestStationOrderDetail from "./SharedRestStationOrderDetail"; + +type DetailProps = { + parentRow: any; // 当前行数据 + setParentRow: any; // 改变当前行数据的方法 + onShow: any;// 显示悬浮框 + setOnShow: any;// 改变显示悬浮框的方法 + readonly?: any;// 判断是不是只读 + fileList: any;// 图片附件 + setFileList: any;// 改变图片附件的方法 + currentUser: any;// 页面公参 + actionRef: any;// 父级表格实例 +} + +const beforeUpload = (file: any) => { + const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'; + if (!isJpgOrPng) { + message.error('请上传JPEG、jpg、png格式的图片文件!'); + return false; + } + const isLt5M = file.size / 1024 / 1024 < 5; + if (!isLt5M) { + message.error('图片大小不超过 5MB!'); + return false; + } + return true; +} + +const SharedRestStationDetail = ({ parentRow, setParentRow, onShow, setOnShow, readonly, fileList, setFileList, currentUser, actionRef }: DetailProps) => { + const draggleRef = React.createRef() + const tableRef = useRef(); + + const { confirm } = Modal; + const modalFromRef = useRef(); + const serverpartList = session.get('serverpartList') + const serverpartObj = session.get('serverpartObj') + + // 弹出框拖动效果 + const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置 + const [disabled, setDraggleDisabled] = useState() // 是否拖动 + const onDraggaleStart = (event, uiData) => { + const { clientWidth, clientHeight } = window.document.documentElement; + const targetRect = draggleRef.current?.getBoundingClientRect(); + if (!targetRect) { + return; + } + setBounds({ + left: -targetRect.left + uiData.x, + right: clientWidth - (targetRect.right - uiData.x), + top: -targetRect.top + uiData.y, + bottom: clientHeight - (targetRect.bottom - uiData.y), + }); + }; + const [confirmLoading, handleConfirmLoading] = useState(false) // 弹出框的内容表单是否在提交 + const [selectName, setSelectName] = useState(); // 选择的服务区名称 + // 当前选择的服务区方位 + const [REGIONList, setREGIONList] = useState([]) + const [imagePreviewVisible, setImagePreviewVisible] = useState(false) // 预览图片 + // 显示订单详情的悬浮框 + const [orderModalVisible, handleOrderModalVisible] = useState(false); + // 订单的当前行数据 + const [currentRow, setCurrentRow] = useState(); + + // 预览上传后的图片 + const handlePreview = async () => { + setFileList(fileList) + setImagePreviewVisible(true) + }; + const handleChangePreview = (val: any) => { + setImagePreviewVisible(val) + } + + const columns: any = [ + { + title:
订单编码
, + width: 150, + align: 'center', + dataIndex: "RESTSTATIONBILL_CODE", + ellipsis: true, + hideInSearch: true, + render: (_, record) => { + return { + setCurrentRow(record) + handleOrderModalVisible(true) + }}> + {record.RESTSTATIONBILL_CODE} + + } + }, + { + title:
会员名称
, + width: 150, + align: 'center', + dataIndex: "MEMBERSHIP_NAME", + ellipsis: true, + hideInSearch: true, + }, + { + title:
手机号码
, + width: 150, + align: 'center', + dataIndex: "MEMBERSHIP_MOBILEPHONE", + ellipsis: true, + hideInSearch: true, + }, + { + title:
下单时间
, + width: 150, + align: 'center', + dataIndex: "ORDER_STARTDATE", + ellipsis: true, + hideInSearch: true, + render: (_, record) => { + return record?.ORDER_STARTDATE ? moment(record?.ORDER_STARTDATE).format('YYYY/MM/DD HH:mm:ss') : '' + } + }, + { + title:
结束时间
, + width: 150, + align: 'center', + dataIndex: "ORDER_ENDDATE", + ellipsis: true, + hideInSearch: true, + render: (_, record) => { + return record?.ORDER_ENDDATE ? moment(record?.ORDER_ENDDATE).format('YYYY/MM/DD HH:mm:ss') : '' + } + }, + { + title:
剩余时间
, + width: 150, + align: 'center', + dataIndex: "REMAIN_SECONDS", + ellipsis: true, + hideInSearch: true + }, + { + title:
续费状态
, + width: 150, + align: 'center', + dataIndex: "RENEWAL_STATUS", + ellipsis: true, + hideInSearch: true, + valueType: "select", + valueEnum: { + 1: { text: '未续费', status: 'error' }, + 2: { text: '已续费', status: 'Success' }, + } + }, + { + title:
保洁状态
, + width: 150, + align: 'center', + dataIndex: "CLEANING_STATUS", + ellipsis: true, + hideInSearch: true, + valueType: "select", + valueEnum: { + 0: { text: '待清洁', status: 'error' }, + 1: { text: '已清洁', status: 'Success' }, + } + }, + { + title:
订单状态
, + width: 150, + align: 'center', + dataIndex: "RESTSTATIONBILL_STATE", + ellipsis: true, + hideInSearch: true, + valueType: "select", + fieldProps: { + options: [{ label: '待付款', value: 1 }, { label: '使用中', value: 2 }, { label: '已完成', value: 3 }] + } + }, + { + title:
联系电话
, + width: 150, + align: 'center', + dataIndex: "EMERGENCY_PHONENUMBER", + ellipsis: true, + }, + { + title:
评价打分
, + width: 150, + align: 'center', + dataIndex: "RESTSTATIONBILL_SCORE", + ellipsis: true, + hideInSearch: true + }, + ] + + // 新增同步休息站 + const handleAddUpdateStation = async (obj: any) => { + let req: any = {} + + if (parentRow.RESTSTATION_ID) { + req = { + ...parentRow, + ...obj, + STAFF_ID: currentUser.ID, + STAFF_NAME: currentUser.Name, + OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + } + } else { + req = { + ...obj, + PROVINCE_CODE: "530000", + SERVERPART_NAME: serverpartObj[obj.SERVERPART_ID], + STAFF_ID: currentUser.ID, + STAFF_NAME: currentUser.Name, + OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + } + } + console.log('reqreqreqreq', req); + handleConfirmLoading(true) + const data = await handleGetSynchroRESTSTATION(req) + if (data.Result_Code === 100) { + + if (obj.RESTSTATION_IMG && obj.RESTSTATION_IMG.length > 0) { + const formData = new FormData(); + obj.RESTSTATION_IMG.forEach((file: any) => { + if (!file.ImageUrl) { + // 使用压缩后的文件,如果没有则使用原文件 + const fileToUpload = file.originFileObj?.compressedFile || file.originFileObj; + formData.append('files[]', fileToUpload); + formData.append('ImageName', typeof file !== 'string' ? file?.name : ''); + } + }); + formData.append('TableId', data.Result_Data.RESTSTATION_ID); + formData.append('TableType', '1309'); + + console.log('formData', formData); + await uploadAHYDPicture(formData) + } + + handleConfirmLoading(false) + message.success(data.Result_Desc) + setOnShow(false) + setParentRow(undefined); + setFileList([]) + if (actionRef) { + actionRef.current?.reload() + } + } else { + handleConfirmLoading(false) + message.error(data.Result_Desc) + } + } + + return ( +
+ { + if (disabled) { + setDraggleDisabled(false) + } + }} + onMouseOut={() => { + setDraggleDisabled(true) + }} + + onFocus={() => { }} + onBlur={() => { }} + > + {parentRow ? '编辑共享休息站' : '新增共享休息站'} +
+ } + destroyOnClose={true} + width={900} + bodyStyle={{ + height: '700px', // 你可以根据需要调整高度 + overflowY: 'auto', + }} + open={onShow} + confirmLoading={confirmLoading} + afterClose={() => { + modalFromRef.current?.resetFields(); + setParentRow(undefined); + }} + onCancel={() => { + handleConfirmLoading(false) + setOnShow(false) + setParentRow(undefined); + setREGIONList([]) + setFileList([]) + }} + footer={readonly ? '' : +
+ + +
+ } + modalRender={(modal) => { + return onDraggaleStart(event, uiData)} + handle=".SharedRestStationManagement" + > +
{modal}
+
+ }} + > + { + if (parentRow) { + if (parentRow?.SERVERPART_ID) { + const regReq: any = { + ServerpartId: parentRow?.SERVERPART_ID + } + const regData = await handleGetServerpartInfo(regReq) + console.log('regDataregDataregData', regData); + + let list: any = regData.RegionInfo + let res: any = [] + if (list && list.length > 0) { + list.forEach((item: any) => { + res.push({ label: item.SERVERPART_REGIONNAME, value: item.SERVERPART_REGION }) + }) + } + setREGIONList(res) + } + return { ...parentRow, SERVERPART_REGION: Number(parentRow.SERVERPART_REGION) }; + } else { + return {} + } + + }} + > + + + + + + { + modalFromRef.current?.setFieldsValue({ SERVERPART_REGION: '' }) + if (e) { + const regReq: any = { + ServerpartId: e + } + const regData = await handleGetServerpartInfo(regReq) + console.log('regDataregDataregData', regData); + + let list: any = regData.RegionInfo + let res: any = [] + if (list && list.length > 0) { + list.forEach((item: any) => { + res.push({ label: item.SERVERPART_REGIONNAME, value: item.SERVERPART_REGION }) + }) + } + setREGIONList(res) + } else { + setREGIONList([]) + } + } + }} + readonly={readonly} + /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { + // 开始处理 + onProgress?.({ percent: 10 }); + compressImage(file as File, { + width: 300, + height: 300, + maxSize: 200 // KB + }) + .then(compressedFile => { + console.log(`压缩成功: ${file.name} 从 ${(file.size / 1024).toFixed(1)}KB 压缩到 ${(compressedFile.size / 1024).toFixed(1)}KB`); + + // 保存压缩后的文件到原文件对象上 + (file as any).compressedFile = compressedFile; + + onProgress?.({ percent: 100 }); + onSuccess?.(compressedFile); + }) + .catch(err => { + console.error('图片压缩失败:', err); + message.error('图片处理失败,请重试'); + onError?.(err); + }); + }, + onChange: async (info: any) => { + console.log('info', info); + console.log('fileList', fileList); + if (info.file.status === 'removed') { + const index = fileList.findIndex(n => n.uid === info.file.uid); + confirm({ + title: '确认删除该文件吗?', + icon: , + async onOk() { + if (info.file.ImageId) { + const deleteLoading = message.loading('正在删除...') + // const success = await deletePicture(info.file?.ImagePath, info.file?.uid, '', '5000') + const success = await deleteAHYDPicture(info.file?.ImagePath, info.file?.uid, '', '5000') + deleteLoading() + + if (success) { + const files = [...fileList] + files.splice(index, 1) + setFileList(files) + message.success("删除成功") + if (actionRef) { + actionRef.current?.reload() + } + } + else { + message.error("删除失败") + } + } else { + const files = [...fileList]; + files.splice(index, 1); + setFileList(files); + } + }, + onCancel() { + }, + }); + } else { + setFileList(info.fileList) + } + } + }} + /> + + + + + + {/* 休息站订单信息 */} + { + parentRow && parentRow.RESTSTATION_ID ? +
+ { + const req: any = { + SearchParameter: { + RESTSTATION_IDS: parentRow?.RESTSTATION_ID, + RESTSTATIONBILL_STATES: "1,2,3" + }, + KeyWord: { + Key: 'EMERGENCY_PHONENUMBER', + Value: params?.EMERGENCY_PHONENUMBER || '' + }, + PageIndex: 1, + PageSize: 999999, + } + const data = await handleGetRESTSTATIONBILLList(req) + console.log('datadatadata', data); + if (data && data.length > 0) { + return { data, success: true } + } + return { data: [], success: true } + }} + options={false} + toolbar={{ + actions: [ + + ] + }} + /> +
: "" + } +
+ + + +
+ ) +} + +export default connect(({ user, }: ConnectState) => ({ + currentUser: user.currentUser, +}))(SharedRestStationDetail); diff --git a/src/pages/travelMember/SharedRestStationManagement/components/SharedRestStationOrderDetail.tsx b/src/pages/travelMember/SharedRestStationManagement/components/SharedRestStationOrderDetail.tsx new file mode 100644 index 0000000..1793a39 --- /dev/null +++ b/src/pages/travelMember/SharedRestStationManagement/components/SharedRestStationOrderDetail.tsx @@ -0,0 +1,244 @@ +import { connect } from "umi"; +import type { ConnectState } from "@/models/connect"; +import { Button, Col, FormInstance, message, Modal, Row } from "antd"; +import { useRef, useState } from "react"; +import React from "react"; +import Draggable from "react-draggable"; +import ProForm, { ProFormDatePicker, ProFormDigit, ProFormSelect, ProFormText } from "@ant-design/pro-form"; +import moment from "moment"; +import { handleSynchroRESTSTATIONBILL } from "../service"; + +type DetailProps = { + onShow: any;// 显示悬浮框的判断 + setOnShow: any;// 设置显示悬浮框的状态 + parentRow: any; // 当前行数据 + setParentRow: any;// 设置当前行数据 + readonly?: any + currentUser: any + actionRef?: any + bigParams?: any // 更外层的数据 +} +const SharedRestStationOrderDetail = ({ onShow, setOnShow, parentRow, setParentRow, readonly, currentUser, actionRef, bigParams }: DetailProps) => { + const formRef = useRef(); + + const draggleRef = React.createRef() + // 弹出框拖动效果 + const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置 + const [disabled, setDraggleDisabled] = useState() // 是否拖动 + const onDraggaleStart = (event, uiData) => { + const { clientWidth, clientHeight } = window.document.documentElement; + const targetRect = draggleRef.current?.getBoundingClientRect(); + if (!targetRect) { + return; + } + setBounds({ + left: -targetRect.left + uiData.x, + right: clientWidth - (targetRect.right - uiData.x), + top: -targetRect.top + uiData.y, + bottom: clientHeight - (targetRect.bottom - uiData.y), + }); + }; + const [confirmLoading, handleConfirmLoading] = useState(false) // 弹出框的内容表单是否在提交 + + const handleAddUpdateOrder = async (values: any) => { + if (!bigParams?.RESTSTATION_ID) { + return + } + let req: any = { + ...values, + RESTSTATIONBILL_CODE: `YN-${moment().format('YYYYMMDDHHmmss')}-${moment().format('HHmmss')}`, + RESTSTATION_ID: bigParams?.RESTSTATION_ID, + STAFF_ID: currentUser.ID, + STAFF_NAME: currentUser.Name, + OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + } + + + console.log('reqreqreqreq', req); + handleConfirmLoading(true) + const data = await handleSynchroRESTSTATIONBILL(req) + if (data.Result_Code === 100) { + handleConfirmLoading(false) + message.success(data.Result_Desc) + handleConfirmLoading(false) + setOnShow(false) + setParentRow(undefined); + if (actionRef) { + actionRef.current?.reload() + } + } else { + handleConfirmLoading(false) + message.error(data.Result_Desc) + } + } + + return ( +
+ { + if (disabled) { + setDraggleDisabled(false) + } + }} + onMouseOut={() => { + setDraggleDisabled(true) + }} + + onFocus={() => { }} + onBlur={() => { }} + > + {parentRow ? '编辑共享休息站' : '新增共享休息站'} +
+ } + destroyOnClose={true} + width={800} + bodyStyle={{ + height: '700px', // 你可以根据需要调整高度 + overflowY: 'auto', + }} + open={onShow} + confirmLoading={confirmLoading} + afterClose={() => { + formRef.current?.resetFields(); + setParentRow(undefined); + }} + onCancel={() => { + handleConfirmLoading(false) + setOnShow(false) + setParentRow(undefined); + }} + footer={readonly ? '' : +
+ + +
+ } + modalRender={(modal) => { + return onDraggaleStart(event, uiData)} + handle=".SharedRestStationOrderDetail" + > +
{modal}
+
+ }} + > + + { + if (parentRow) { + return { ...parentRow, }; + } else { + return {} + } + }} + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ ) +} + +export default connect(({ user, }: ConnectState) => ({ + currentUser: user.currentUser, +}))(SharedRestStationOrderDetail); diff --git a/src/pages/travelMember/SharedRestStationManagement/index.tsx b/src/pages/travelMember/SharedRestStationManagement/index.tsx new file mode 100644 index 0000000..38e6002 --- /dev/null +++ b/src/pages/travelMember/SharedRestStationManagement/index.tsx @@ -0,0 +1,216 @@ +import { connect } from "umi"; +import type { CurrentUser } from "umi"; +import type { ConnectState } from "@/models/connect"; +import React, { useRef, useState } from "react"; +import ProCard from "@ant-design/pro-card"; +import { MenuFoldOutlined } from "@ant-design/icons"; +import type { FormInstance } from "antd"; +import { Button, message, Modal, Popconfirm, Space, Spin, Tree } from "antd"; +import useRequest from "@ahooksjs/use-request"; +import { getServerpartTree } from "@/services/options"; +import type { ActionType } from "@ant-design/pro-table"; +import ProTable from "@ant-design/pro-table"; +import ReactHTMLTableToExcel from "react-html-table-to-excel"; +import LeftSelectTree from "@/pages/reports/settlementAccount/component/leftSelectTree"; +import PageTitleBox from "@/components/PageTitleBox"; +import Draggable from "react-draggable"; +import ProForm from "@ant-design/pro-form"; +import moment from "moment"; +import { handleDeleteRESTSTATION, handleGetRESTSTATIONList } from "./service"; +import SharedRestStationDetail from "./components/SharedRestStationDetail"; + + +const SharedRestStationManagement: React.FC<{ currentUser: CurrentUser }> = (props) => { + const { currentUser } = props + const actionRef = useRef(); + const formRef = useRef(); + const [printOut, setPrintOut] = useState(); // 打印数据的内容 + const [collapsible, setCollapsible] = useState(false) + + const [modalVisible, handleModalVisible] = useState(); + // 树相关的属性和方法 + const [selectedId, setSelectedId] = useState() + // 查询的条件 + const [searchParams, setSearchParams] = useState() + // 当前选择的行数据 + const [currentRow, setCurrentRow] = useState() + // 文件列表 + const [fileList, setFileList] = useState([]) + const columns: any = [ + { + title:
休息站名称
, + width: 150, + dataIndex: "RESTSTATION_NAME", + ellipsis: true, + hideInSearch: true, + }, + { + title:
服务区名称
, + width: 150, + dataIndex: "SERVERPART_NAME", + ellipsis: true, + hideInSearch: true, + }, + { + title:
服务区方位
, + width: 150, + dataIndex: "SERVERPART_REGION", + ellipsis: true, + hideInSearch: true, + }, + { + title:
所在位置
, + width: 150, + dataIndex: "RESTSTATION_LOCATION", + ellipsis: true, + hideInSearch: true, + }, + { + title:
门锁状态
, + width: 120, + dataIndex: "LOCK_STATUS", + ellipsis: true, + align: 'center', + hideInSearch: true, + valueType: "select", + valueEnum: { + 1: { text: '空闲中', status: 'success' }, + 2: { text: '使用中', status: 'error' }, + } + }, + { + title:
有效状态
, + width: 120, + dataIndex: "LOCK_STATUS", + ellipsis: true, + hideInSearch: true, + align: 'center', + valueType: "select", + fieldProps: { + options: [{ label: "有效", value: 1 }, { label: "无效", value: 0 }] + } + }, + { + title: "操作", + dataIndex: "option", + width: 120, + align: 'center', + hideInSearch: true, + render: (_, record) => { + return + { + let imgList: any = [] + if (record?.ImageList && record?.ImageList.length > 0) { + record?.ImageList.forEach((item: any) => { + let obj = JSON.parse(JSON.stringify(item)) + obj.url = obj.ImageUrl + obj.name = obj.ImageName + obj.uid = item.ImageId + obj.status = 'done' + imgList.push(obj) + }) + } + setCurrentRow({ + ...record, + ACTIVITY_IMG: imgList + }) + setFileList(imgList); + handleModalVisible(true) + }}>编辑 + { + await handleGetDeleteActivity(record.RESTSTATION_ID) + }} + > + 删除 + + + } + } + ] + + // 删除共享休息站 + const handleGetDeleteActivity = async (id: any) => { + const req: any = { + RESTSTATIONId: id + } + const data = await handleDeleteRESTSTATION(req) + if (data.Result_Code === 100) { + message.success(data.Result_Desc) + + actionRef.current?.reload() + } else { + message.error(data.Result_Desc) + } + } + + + return ( +
+
+ +
+ } // 列表表头 + search={{ span: 6 }} + request={async (params) => { + if (!selectedId) { + return + } + const req: any = { + SearchParameter: { + SERVERPART_IDS: selectedId, + RESTSTATION_STATE: 1 + }, + PageIndex: 1, + PageSize: 999999, + } + setSearchParams(params) + const data = await handleGetRESTSTATIONList(req) + console.log('datadatadata', data); + if (data && data.length > 0) { + return { data: data, success: true } + } + return { data: [], success: true } + }} + toolbar={{ + actions: [ + + + ] + }} + /> +
+ + + +
+
+ ) +} + +export default connect(({ user }: ConnectState) => ({ + currentUser: user.currentUser +}))(SharedRestStationManagement); diff --git a/src/pages/travelMember/SharedRestStationManagement/service.ts b/src/pages/travelMember/SharedRestStationManagement/service.ts new file mode 100644 index 0000000..dc7194f --- /dev/null +++ b/src/pages/travelMember/SharedRestStationManagement/service.ts @@ -0,0 +1,171 @@ +import requestEncryption from '@/utils/requestEncryption'; +import request from '@/utils/request'; + +// 获取活动表列表 +export async function handleGetACTIVITYList(params?: any) { + const data = await requestEncryption(`/Member/GetACTIVITYList`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }); + + if (data.Result_Code !== 100) { + return { + List: [] + } + } + return data.Result_Data; +} + + +// 同步活动 +export async function handleGetSynchroACTIVITY(params?: any) { + const data = await requestEncryption(`/Member/SynchroACTIVITY`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }); + + if (data.Result_Code !== 100) { + return { + List: [] + } + } + return data; +} + +// 删除活动 +export async function handleDeleteACTIVITY(params?: any) { + const data = await requestEncryption(`/Member/DeleteACTIVITY`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }); + + if (data.Result_Code !== 100) { + return { + List: [] + } + } + return data; +} + + +// 获得共享休息站列表数据 +export async function handleGetRESTSTATIONList(params?: any) { + const data = await requestEncryption(`/Member/GetRESTSTATIONList`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }); + + if (data.Result_Code !== 100) { + return { + List: [] + } + } + return data.Result_Data.List; +} + + +// 同步共享休息站表 +export async function handleGetSynchroRESTSTATION(params?: any) { + const data = await requestEncryption(`/Member/SynchroRESTSTATION`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }); + + if (data.Result_Code !== 100) { + return { + List: [] + } + } + return data; +} + +// 删除共享休息站表 +export async function handleDeleteRESTSTATION(params?: any) { + const data = await requestEncryption(`/Member/DeleteRESTSTATION`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }); + + if (data.Result_Code !== 100) { + return { + List: [] + } + } + return data; +} + +// 获取共享休息站订单表列表 +export async function handleGetRESTSTATIONBILLList(params?: any) { + const data = await requestEncryption(`/Member/GetRESTSTATIONBILLList`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }); + + if (data.Result_Code !== 100) { + return { + List: [] + } + } + return data.Result_Data.List; +} + +// 同步共享休息站订单表列表 +export async function handleSynchroRESTSTATIONBILL(params?: any) { + const data = await requestEncryption(`/Member/SynchroRESTSTATIONBILL`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }); + + if (data.Result_Code !== 100) { + return { + List: [] + } + } + return data; +} + + +// 获取活动报名信息表列表 +export async function handleGetACTIVITYDETAILList(params?: any) { + const data = await requestEncryption(`/Member/GetACTIVITYDETAILList`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }); + + if (data.Result_Code !== 100) { + return { + List: [] + } + } + return data.Result_Data.List; +} + +// 获取消息通知关联表列表 招商的报名信息 +export async function handleGetRTNOTICEINFOList(params?: any) { + const data = await requestEncryption(`/MemberMessage/GetRTNOTICEINFOList`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }); + + if (data.Result_Code !== 100) { + return { + List: [] + } + } + return data.Result_Data.List; +} + + +export async function handleGetPictureList(params: any) { + const data = await request('/Picture/GetPictureList', { + method: 'GET', + params + }) + + if (data.Result_Code !== 100) { + return [] + } + + return data +} + diff --git a/src/pages/travelMember/activityList/index.tsx b/src/pages/travelMember/activityList/index.tsx new file mode 100644 index 0000000..d3ff784 --- /dev/null +++ b/src/pages/travelMember/activityList/index.tsx @@ -0,0 +1,244 @@ +import { connect } from "umi"; +import type { CurrentUser } from "umi"; +import type { ConnectState } from "@/models/connect"; +import React, { useRef, useState } from "react"; +import type { FormInstance } from "antd"; +import { Button, Col, message, Modal, Popconfirm, Row, Space, Spin, Tree } from "antd"; +import type { ActionType } from "@ant-design/pro-table"; +import ProTable from "@ant-design/pro-table"; +import PageTitleBox from "@/components/PageTitleBox"; +import moment from "moment"; +import { handleDeleteACTIVITY, handleGetACTIVITYList, handleGetSynchroACTIVITY } from "../SharedRestStationManagement/service"; +import session from "@/utils/session"; +import EventRegistrationDetail from "../EventRegistration/components/EventRegistrationDetail"; + + + +const EventRegistration: React.FC<{ currentUser: CurrentUser }> = (props) => { + const { currentUser } = props + const actionRef = useRef(); + const formRef = useRef(); + + const [modalVisible, handleModalVisible] = useState(); + const serverpartObj = session.get('serverpartObj') + + // 查询的条件 + const [searchParams, setSearchParams] = useState() + // 当前选择的行数据 + const [currentRow, setCurrentRow] = useState() + // 文件列表 + const [fileList, setFileList] = useState([]) + + const columns: any = [ + { + title: '统计时间', + dataIndex: 'search_date', + valueType: 'dateRange', + hideInTable: true, + hideInDescriptions: true, + hideInSearch: false, + initialValue: [moment(), moment().subtract(-1, 'M')], + search: { + transform: (value) => { + return { + ACTIVITY_ENDDATE_Start: value[0], + ACTIVITY_STARTDATE_End: value[1], + }; + }, + }, + }, + { + title: '服务区', + dataIndex: "SERVERPART_IDS", + hideInTable: true, + valueType: 'select', + valueEnum: serverpartObj, + fieldProps: { + showSearch: true, // 支持输入文字搜索 + filterOption: (input, option) => (option?.label ?? '').toLowerCase().includes(input.toLowerCase()), + } + }, + { + title:
活动名称
, + width: 180, + dataIndex: "ACTIVITY_NAME", + ellipsis: true, + hideInSearch: true, + render: (_, record) => { + return { + let imgList: any = [] + if (record?.ImageList && record?.ImageList.length > 0) { + record?.ImageList.forEach((item: any) => { + let obj = JSON.parse(JSON.stringify(item)) + obj.url = obj.ImageUrl + obj.name = obj.ImageName + obj.uid = item.ImageId + obj.status = 'done' + imgList.push(obj) + }) + } + setCurrentRow({ + ...record, + ACTIVITY_IMG: imgList + }) + setFileList(imgList); + handleModalVisible(true) + }}>{record?.ACTIVITY_NAME} + } + }, + { + title:
活动范围
, + width: 150, + dataIndex: "SERVERPART_NAME", + ellipsis: true, + hideInSearch: true + }, + { + title:
活动地点
, + width: 150, + dataIndex: "ACTIVITY_LOCATION", + ellipsis: true, + hideInSearch: true, + }, + { + title:
人数上限
, + width: 120, + dataIndex: "MAXIMUM_CAPACITY", + ellipsis: true, + hideInSearch: true, + valueType: "digit", + align: 'right' + }, + { + title:
活动描述
, + width: 250, + dataIndex: "ACTIVITY_INFO", + ellipsis: true, + hideInSearch: true, + }, + { + title:
活动时间
, + width: 170, + dataIndex: "ACTIVITY_STARTDATE", + ellipsis: true, + hideInSearch: true, + align: 'center', + render: (_, record) => { + return record?.ACTIVITY_STARTDATE && record?.ACTIVITY_ENDDATE ? `${moment(record?.ACTIVITY_STARTDATE).format('YYYY/MM/DD')}-${moment(record?.ACTIVITY_ENDDATE).format('YYYY/MM/DD')}` : '不限时间' + } + }, + { + title:
活动状态
, + width: 120, + dataIndex: "ACTIVITY_STATE", + ellipsis: true, + hideInSearch: true, + align: 'center', + valueType: "select", + valueEnum: { + 1: { text: '已上架', status: 'success' }, + 2: { text: '未上架', status: 'error' }, + 9: { text: '已下架', status: 'error' }, + } + }, + { + title: "操作", + dataIndex: "option", + width: 120, + align: 'center', + hideInSearch: true, + render: (_, record) => { + return + { + handleGetUpadteActivityState(record, 1) + }} + > + 上架 + + { + handleGetUpadteActivityState(record, 2) + }} + > + 下架 + + + } + } + ] + + // 只管上下架的接口 + const handleGetUpadteActivityState = async (obj: any, type: number) => { + // type 1 上架 2 下架 + const req: any = { + ...obj, + ACTIVITY_STATE: type + } + const data = await handleGetSynchroACTIVITY(req) + if (data.Result_Code === 100) { + message.success(data.Result_Desc) + actionRef.current?.reload() + } else { + message.success(data.Result_Desc) + } + } + + + return ( +
+
+
+ } // 列表表头 + search={{ span: 6 }} + request={async (params) => { + const req: any = { + SearchParameter: { + ACTIVITY_ENDDATE_Start: params.ACTIVITY_ENDDATE_Start, + ACTIVITY_STARTDATE_End: params.ACTIVITY_STARTDATE_End, + SERVERPART_IDS: params?.SERVERPART_IDS, + PROVINCE_CODE: "530000", + ACTIVITY_STATES: "1,2" + }, + PageIndex: 1, + PageSize: 999999, + } + setSearchParams(params) + const data = await handleGetACTIVITYList(req) + console.log('datadatadatadata', data); + if (data.List && data.List.length > 0) { + return { data: data.List, success: true } + } + return { data: [], success: true } + }} + toolbar={{ + actions: [] + }} + /> +
+ + +
+
+ ) +} + +export default connect(({ user }: ConnectState) => ({ + currentUser: user.currentUser +}))(EventRegistration); diff --git a/src/services/user.ts b/src/services/user.ts index e6dbcfc..4e581eb 100644 --- a/src/services/user.ts +++ b/src/services/user.ts @@ -1,6 +1,7 @@ import type { CurrentUser } from '@/models/user'; import request from '@/utils/request'; +import requestEncryption from '@/utils/requestEncryption'; export async function query(): Promise { // 根据用户token获取用户信息 const data = await request(`/Logging/GetPassportInfoByToken`, { @@ -25,10 +26,11 @@ export async function queryCurrent(UserIdEncrypted: string | number): Promise { - - const data = await request('/Platform/GetMessageList',{ // 只获取未读的通知 + + // const data = await request('/Platform/GetMessageList',{ // 只获取未读的通知 + const data = await request('/Log/GetMessageList', { // 只获取未读的通知 method: 'POST', - data: {SearchParameter:{...params,MESSAGE_STATE:1},pageIndex:1,pageSize: 99,SortStr: 'MESSAGE_STATE asc,OPERATE_DATE desc'} + data: { SearchParameter: { ...params, MESSAGE_STATE: 1 }, pageIndex: 1, pageSize: 99, SortStr: 'MESSAGE_STATE asc,OPERATE_DATE desc' } }); if (data.Result_Code !== 100) { // 登录超时 return [] @@ -38,10 +40,10 @@ export async function queryNotices(params: any): Promise { // 消息状态更新 export async function changeNoticesState(params: any): Promise { - - const data = await request('/Platform/SynchroMessage',{ + + const data = await request('/Platform/SynchroMessage', { method: 'POST', - data: {...params} + data: { ...params } }); if (data.Result_Code !== 100) { // 登录超时 return false @@ -54,10 +56,10 @@ export async function setMessageState(params: { recStaffId: number, messageState: number }): Promise { - - const data = await request('/Platform/SetMessageState',{ + + const data = await request('/Platform/SetMessageState', { method: 'POST', - data: {...params} + data: { ...params } }); if (data.Result_Code !== 100) { // 更新失败 return false @@ -80,9 +82,12 @@ export async function getUserMenu(userid?: number): Promise { // 添加用户行为记录 export function synchroBehaviorRecord(data: any): void { - request(`/Platform/SynchroBehaviorrecord`, { + requestEncryption(`/Log/SynchroBehaviorrecord`, { method: 'POST', - data + data: { + ...data, + requestEncryption: true + } }); } @@ -90,9 +95,12 @@ export function synchroBehaviorRecord(data: any): void { // 添加用户行为具体接口的 export function SynchroBEHAVIORRECORD(data: any): void { - request(`/Platform/SynchroBEHAVIORRECORD`, { + requestEncryption(`/Log/SynchroBEHAVIORRECORD`, { method: 'POST', - data + data: { + ...data, + requestEncryption: true + } }); } \ No newline at end of file diff --git a/src/utils/request.ts b/src/utils/request.ts index 2c3432c..d7c34e8 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -59,7 +59,7 @@ const errorHandler = (error: { response: Response }): Response => { const request = extend({ errorHandler, // default error handling // prefix: '/EShangApiMain',// 开发 - prefix: 'https://pos.eshangtech.com/EShangApiMain', // 正式 + prefix: 'https://pos.eshangtech.com/MemberApi', // 正式 headers: { token: '', ProvinceCode: '', diff --git a/src/utils/requestJava.ts b/src/utils/requestJava.ts index b75b7fc..3a695dd 100644 --- a/src/utils/requestJava.ts +++ b/src/utils/requestJava.ts @@ -58,7 +58,8 @@ const errorHandler = (error: { response: Response }): Response => { const request = extend({ errorHandler, // default error handling // prefix: '/EShangApiMain',// 开发 - prefix: 'https://admin.es.eshangtech.com/platform', // 正式 + // prefix: 'https://admin.es.eshangtech.com/platform', // 正式 + prefix: 'https://java.es.eshangtech.com:443', // 正式 // prefix: 'http://10.104.1.175:8070/platform', // 正式 headers: { token: '', diff --git a/src/utils/requestTest.ts b/src/utils/requestTest.ts index bb57d2f..a57e2fe 100644 --- a/src/utils/requestTest.ts +++ b/src/utils/requestTest.ts @@ -57,7 +57,8 @@ const errorHandler = (error: { response: Response }): Response => { const requestTest = extend({ errorHandler, // default error handling // prefix: '/EShangApiMain',// 开发 - prefix: 'http://dev.eshangtech.com:8900/EShangApiMain', // 正式 + // prefix: 'http://dev.eshangtech.com:8900/EShangApiMain', // 正式 + prefix: 'https://api.eshangtech.com/MemberApi', // 正式 headers: { token: '', ProvinceCode: '', diff --git a/src/utils/requestUpLoad.ts b/src/utils/requestUpLoad.ts index aa5493d..d999063 100644 --- a/src/utils/requestUpLoad.ts +++ b/src/utils/requestUpLoad.ts @@ -57,7 +57,7 @@ const errorHandler = (error: { response: Response }): Response => { const request = extend({ errorHandler, // default error handling // prefix: '/EShangApiMain',// 开发 - prefix: 'http://220.180.35.180:8000/EShangApiMain', // 正式 + prefix: 'https://api.eshangtech.com/EShangApiMain', // 正式 headers: { token: '', ProvinceCode: '', @@ -85,14 +85,14 @@ request.interceptors.request.use((url, opt) => { } } if ((url.indexOf('Synchro') > -1 || url.indexOf('Save') > -1) && - url.indexOf('Picture/SaveImgFile') === -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, + 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') diff --git a/src/utils/requestYNUpload.ts b/src/utils/requestYNUpload.ts new file mode 100644 index 0000000..38f6ce3 --- /dev/null +++ b/src/utils/requestYNUpload.ts @@ -0,0 +1,220 @@ +/** 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'; +import { encryptAES } from './handleAes'; + +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://samember.yciccloud.com:8999/EShangApiMain', // 正式 + 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, + OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss') + } + } + } + } + + if (options && options.data && options.data.requestEncryption) { + options.data = { + name: "", + value: encryptAES(JSON.stringify(options.data)) + } + } + } + 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://pos.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://pos.eshangtech.com/EShangApiMain/Platform/SynchroBEHAVIORRECORD', { + // // method: 'POST', + // // headers: { + // // 'Content-Type': 'application/json', + // // }, + // // body: JSON.stringify(req), + // // }) + // } + return response +}) +export default request; diff --git a/src/versionEnv.ts b/src/versionEnv.ts index 1dc6b2d..98d6a79 100644 --- a/src/versionEnv.ts +++ b/src/versionEnv.ts @@ -1,4 +1,4 @@ // 由 scripts/writeVersion.js 自动生成 -export const VERSION = "4.5.63"; -export const GIT_HASH = "85905b6"; -export const BUILD_TIME = "2025-10-21T06:39:13.375Z"; +export const VERSION = "4.5.65"; +export const GIT_HASH = "cc91234"; +export const BUILD_TIME = "2025-10-31T09:52:44.987Z";