可以了的一版

This commit is contained in:
ylj20011123 2025-10-31 20:29:59 +08:00
parent cc91234c59
commit 4be0bb5c3a
31 changed files with 3744 additions and 233 deletions

View File

@ -446,6 +446,30 @@ export default [
name: 'RegistrationStatistics', name: 'RegistrationStatistics',
component: './travelMember/RegistrationStatistics/index' 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', name: 'CardInformation',
icon: 'AccountBookOutlined', icon: 'AccountBookOutlined',
routes: [ routes: [
{
path: 'CardCouponApplicRules',
name: 'CardCouponApplicRules',
component: './CardInformation/CardCouponApplicRules/index'
},
{ {
path: 'CardVoucherCollection', path: 'CardVoucherCollection',
name: 'CardVoucherCollection', name: 'CardVoucherCollection',
@ -485,7 +514,8 @@ export default [
path: 'NewCouponReview', path: 'NewCouponReview',
name: 'NewCouponReview', name: 'NewCouponReview',
component: './CardInformation/NewCouponReview/index' component: './CardInformation/NewCouponReview/index'
} },
] ]
}, },
{ {

BIN
dist.zip

Binary file not shown.

View File

@ -1,6 +1,6 @@
{ {
"name": "ant-design-pro", "name": "ant-design-pro",
"version": "4.5.63", "version": "4.5.65",
"private": true, "private": true,
"description": "An out-of-box UI solution for enterprise applications", "description": "An out-of-box UI solution for enterprise applications",
"scripts": { "scripts": {

View File

@ -562,18 +562,6 @@ const BasicLayout: React.FC<BasicLayoutProps> = (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) => { getFieldEnum({ FieldExplainField: 'COUPONTYPE' }).then((COUPONTYPEList) => {
session.set('COUPONTYPEList', COUPONTYPEList); session.set('COUPONTYPEList', COUPONTYPEList);
@ -584,79 +572,6 @@ const BasicLayout: React.FC<BasicLayoutProps> = (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 // const shopregionList = await
getFieldEnum({ FieldExplainField: 'shopregion', notformate: true }).then(shopregionList => { getFieldEnum({ FieldExplainField: 'shopregion', notformate: true }).then(shopregionList => {
@ -805,53 +720,10 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
session.set('BusinessTradeIdsBigObj', BusinessTradeIdsBigObj); 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 // const serverpartList = await
handleGetServerpartTree({ handleGetServerpartTree({
ProvinceCode: currentUser?.ProvinceCode, ProvinceCode: currentUser?.ProvinceCode || "530000",
ServerpartType: 1000, ServerpartType: 1000,
StatisticsType: 1000, StatisticsType: 1000,
ShowWholePower: false, ShowWholePower: false,

View File

@ -1,10 +1,13 @@
import request from "@/utils/request" import requestEncryption from "@/utils/requestEncryption"
// 获取用户行为记录表列表 // 获取用户行为记录表列表
export async function handleGetBEHAVIORRECORDList(params?: any){ export async function handleGetBEHAVIORRECORDList(params?: any) {
const data = await request('/Platform/GetBEHAVIORRECORDList', { const data = await requestEncryption('/Log/GetBEHAVIORRECORDList', {
method: 'POST', method: 'POST',
data: params, data: {
...params,
requestEncryption: true
}
}) })
if (data.Result_Code !== 100) { if (data.Result_Code !== 100) {

View File

@ -442,8 +442,6 @@ const RoleList: React.FC<{ currentUser: CurrentUser | undefined }> = (props) =>
title: '', title: '',
breadcrumb: {}, breadcrumb: {},
}}> }}>
<ProTable<SystemRoleModel> <ProTable<SystemRoleModel>
headerTitle={<div> headerTitle={<div>
<div style={{ width: '100%', marginBottom: '16px' }}> <div style={{ width: '100%', marginBottom: '16px' }}>
@ -519,14 +517,16 @@ const RoleList: React.FC<{ currentUser: CurrentUser | undefined }> = (props) =>
req = { req = {
ShowStatus: params.ShowStatus === '1' ? true : params.ShowStatus === '0' ? false : '', ShowStatus: params.ShowStatus === '1' ? true : params.ShowStatus === '0' ? false : '',
SYSTEMROLE_TYPE: 2000, SYSTEMROLE_TYPE: 2000,
SystemRolePattern: params.SystemRolePattern SystemRolePattern: params.SystemRolePattern,
ProvinceCode: "530000"
} }
} else { } else {
req = { req = {
ShowStatus: params.ShowStatus === '1' ? true : params.ShowStatus === '0' ? false : '', ShowStatus: params.ShowStatus === '1' ? true : params.ShowStatus === '0' ? false : '',
// current: 1, // current: 1,
// pageSize: 20, // pageSize: 20,
SystemRolePattern: params.SystemRolePattern SystemRolePattern: params.SystemRolePattern,
ProvinceCode: "530000"
} }
} }
@ -658,7 +658,8 @@ const RoleList: React.FC<{ currentUser: CurrentUser | undefined }> = (props) =>
if (currentRow) { // 编辑数据 if (currentRow) { // 编辑数据
newValue = { ...currentRow, ...newValue, SYSTEMROLE_PID: value.SYSTEMROLE_PID || -1 } 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 // 当操作员是正常用户 则所属业主为他的账号归属的业主;若为内部账号,则所属业主为他所选择的业主 newValue.SYSTEMROLE_STATUS = newValue.SYSTEMROLE_STATUS ? 1 : 0 // 当操作员是正常用户 则所属业主为他的账号归属的业主;若为内部账号,则所属业主为他所选择的业主
if (roleCheckedMenu) { // 编辑角色时 是否配置了角色的权限 若配置 则取出配置的模块id if (roleCheckedMenu) { // 编辑角色时 是否配置了角色的权限 若配置 则取出配置的模块id
const moduleKey = roleCheckedMenu.filter(n => n.indexOf('2-') > -1) const moduleKey = roleCheckedMenu.filter(n => n.indexOf('2-') > -1)

View File

@ -9,37 +9,38 @@
* Copyright (c) 2022 by cclu/驿, All Rights Reserved. * Copyright (c) 2022 by cclu/驿, All Rights Reserved.
*/ */
import request from '@/utils/request'; import request from '@/utils/request';
import requestEncryption from '@/utils/requestEncryption'
import { wrapTreeNode, tableList } from '@/utils/format'; import { wrapTreeNode, tableList } from '@/utils/format';
import type { SystemRoleModel } from './data'; import type { SystemRoleModel } from './data';
// 获取列表数据 // 获取列表数据
export async function getRoleList(params?: any) { export async function getRoleList(params?: any) {
const data = await request('/FrameWork/GetSystemRoleList', { const data = await requestEncryption('/FrameWork/GetSystemRoleList', {
method: 'GET', method: 'GET',
params, params,
}) })
if (data.Result_Code !== 100) { if (data.Result_Code !== 100) {
return [] return []
} }
const treeTable = await wrapTreeNode(data.Result_Data.List); const treeTable = await wrapTreeNode(data.Result_Data.List);
return [...treeTable]; return [...treeTable];
} }
// 获取系统角色数量 // 获取系统角色数量
export async function getSystemRoleCount(params?: any) { export async function getSystemRoleCount(params?: any) {
const data = await request('/FrameWork/GetSystemRoleCount', { const data = await requestEncryption('/FrameWork/GetSystemRoleCount', {
method: 'GET', method: 'GET',
params, params,
}) })
if (data.Result_Code !== 100) { if (data.Result_Code !== 100) {
return {} 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) { export async function updataRole(data?: SystemRoleModel) {
return request('/Platform/SynchroSystemRole', { return requestEncryption('/Platform/SynchroSystemRole', {
method: 'POST', method: 'POST',
data, data,
// requestType: 'form', // requestType: 'form',
}); });
} }
// 新的同步 // 新的同步
export async function newUpdataRole(data?: SystemRoleModel) { export async function newUpdataRole(data?: SystemRoleModel) {
return request('/Platform/SynchroSYSTEMROLE', { return requestEncryption('/Platform/SynchroSYSTEMROLE', {
method: 'POST', method: 'POST',
data, data,
// requestType: 'form', // requestType: 'form',
}); });
} }
/* 删除角色 */ /* 删除角色 */
export async function deleteRole(systemRoleId: number) { export async function deleteRole(systemRoleId: number) {
return request(`/Platform/Deletesystemrole?systemRoleId=${systemRoleId}`, { return requestEncryption(`/Platform/Deletesystemrole?systemRoleId=${systemRoleId}`, {
method: 'POST', method: 'POST',
requestType: 'form', requestType: 'form',
}); });
} }
// 获取角色权限树 // 获取角色权限树
export async function getSystemMenuTree(SystemRoleId?: string) { export async function getSystemMenuTree(SystemRoleId?: string) {
const data = await request(`/FrameWork/GetSystemRoleModuleTree?SystemRoleId=${SystemRoleId || ''}`, { const data = await requestEncryption(`/FrameWork/GetSystemRoleModuleTree?SystemRoleId=${SystemRoleId || ''}`, {
method: 'GET', method: 'GET',
}); });
if (data.Result_Code !== 100) { if (data.Result_Code !== 100) {
return [] return []
} }
const treeTable = await wrapTreeNode(data.Result_Data.List); const treeTable = await wrapTreeNode(data.Result_Data.List);
return treeTable; return treeTable;
} }
// 获取角色数据详情 // 获取角色数据详情
export async function getSystemRoleDetail(SystemRoleId: number) { export async function getSystemRoleDetail(SystemRoleId: number) {
const data = await request(`/Platform/GetSystemRoleDetail?SystemRoleId=${SystemRoleId}`, { const data = await requestEncryption(`/Platform/GetSystemRoleDetail?SystemRoleId=${SystemRoleId}`, {
method: 'GET', method: 'GET',
}) })
if (data.Result_Code !== 100) { if (data.Result_Code !== 100) {
return {} return {}
} }
return data.Result_Data return data.Result_Data
} }
// 业主看板的权限 // 业主看板的权限
export async function handleAnalysisPermission(params?: any){ export async function handleAnalysisPermission(params?: any) {
const data = await request('/FrameWork/AuthorAnalysis', { const data = await requestEncryption('/FrameWork/AuthorAnalysis', {
method: 'GET', method: 'GET',
params, params,
}) })
@ -115,8 +116,8 @@ export async function handleAnalysisPermission(params?: any){
} }
// 获得供应商列表 // 获得供应商列表
export async function handleSupplierList(params?: any){ export async function handleSupplierList(params?: any) {
const data = await request('/Seller/GetSupplierDDL', { const data = await requestEncryption('/Seller/GetSupplierDDL', {
method: 'GET', method: 'GET',
params, params,
}) })
@ -129,8 +130,8 @@ export async function handleSupplierList(params?: any){
// 同步用户角色权限表 // 同步用户角色权限表
export async function handleSynchroUserSystemRoleDetailList(params?: any){ export async function handleSynchroUserSystemRoleDetailList(params?: any) {
const data = await request('/FrameWork/StorageUserSystemRoleList', { const data = await requestEncryption('/FrameWork/StorageUserSystemRoleList', {
method: 'POST', method: 'POST',
data: params, data: params,
}) })
@ -143,8 +144,8 @@ export async function handleSynchroUserSystemRoleDetailList(params?: any){
// 获得用户列表 // 获得用户列表
export async function handleGetUserList(params?: any){ export async function handleGetUserList(params?: any) {
const data = await request('/Platform/GetUserList', { const data = await requestEncryption('/Platform/GetUserList', {
method: 'POST', method: 'POST',
data: params, data: params,
}) })
@ -157,8 +158,8 @@ export async function handleGetUserList(params?: any){
// 获得角色详情 // 获得角色详情
export async function handleGetSYSTEMROLEDetail(params?: any){ export async function handleGetSYSTEMROLEDetail(params?: any) {
const data = await request('/Platform/GetSYSTEMROLEDetail', { const data = await requestEncryption('/Platform/GetSYSTEMROLEDetail', {
method: 'GET', method: 'GET',
params, params,
}) })

View File

@ -11,6 +11,7 @@
import request from '@/utils/request'; import request from '@/utils/request';
import { tableList, wrapTreeNode } from '@/utils/format'; import { tableList, wrapTreeNode } from '@/utils/format';
import type { UserModel } from './data'; import type { UserModel } from './data';
import requestEncryption from '@/utils/requestEncryption';
// import type { ModuleItem } from './data'; // import type { ModuleItem } from './data';
// 获取列表数据 // 获取列表数据
@ -172,9 +173,12 @@ export async function handleDeleteUSER(params: any) {
// 用户行为记录 // 用户行为记录
export async function handleSynchroBEHAVIORRECORD(params: any) { export async function handleSynchroBEHAVIORRECORD(params: any) {
const data = await request(`/Platform/SynchroBEHAVIORRECORD`, { const data = await requestEncryption(`/Log/SynchroBEHAVIORRECORD`, {
method: 'POST', method: 'POST',
data: params data: {
...params,
requestEncryption: true
}
}) })
if (data.Result_Code !== 100) { if (data.Result_Code !== 100) {

View File

@ -138,15 +138,15 @@ const Login: React.FC<LoginProps> = (props) => {
// } // }
// 可以一条龙拿到的 // 可以一条龙拿到的
fetch('https://qifu-api.baidubce.com/ip/local/geo/v1/district').then(response => response.text()).then(data => { // 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 obj: any = JSON.parse(data).data
const res = { // const res = {
...obj, // ...obj,
ip: JSON.parse(data).ip // ip: JSON.parse(data).ip
} // }
session.set('basicInfo', res); // session.set('basicInfo', res);
setBaseInfo(res) // setBaseInfo(res)
}); // });
const browserVersion = getBrowserVersion(); const browserVersion = getBrowserVersion();
session.set('browserVersion', browserVersion); session.set('browserVersion', browserVersion);

View File

@ -1,11 +1,15 @@
import request from '@/utils/request'; import request from '@/utils/request';
import requestEncryption from '@/utils/requestEncryption';
// 获取高速头条的列表接口 // 获取高速头条的列表接口
export async function handleGetNOTICEINFOList(params?: any) { export async function handleGetNOTICEINFOList(params?: any) {
const data = await request(`/Notice/GetNOTICEINFOList`, { const data = await requestEncryption(`/WisdomServerpart/GetNOTICEINFOList`, {
method: 'POST', method: 'POST',
data: params, data: {
...params,
requestEncryption: true
}
}); });
if (data.Result_Code !== 100) { if (data.Result_Code !== 100) {

View File

@ -9,6 +9,7 @@
import { wrapTreeNode } from "@/utils/format"; import { wrapTreeNode } from "@/utils/format";
import request from "@/utils/request"; import request from "@/utils/request";
import requestCode from "@/utils/requestCode"; import requestCode from "@/utils/requestCode";
import requestEncryption from "@/utils/requestEncryption";
// 服务区基础信息 // 服务区基础信息
export async function handleGetServerInfoTree(params?: any) { export async function handleGetServerInfoTree(params?: any) {

View File

@ -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<any>()
const EventRegistrationRef = useRef<ActionType>();
const { confirm } = Modal;
const modalFromRef = useRef<FormInstance>();
const selectServerpartFormRef = useRef<FormInstance>();
// 弹出框拖动效果
const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置
const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动
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<boolean>(false) // 弹出框的内容表单是否在提交
const [imagePreviewVisible, setImagePreviewVisible] = useState<boolean>(false) // 预览图片
const serverpartObj = session.get('serverpartObj')
const serverpartList = session.get('serverpartList')
// 选择服务区的悬浮框
const [selectServerpartModal, handleSelectServerpartModal] = useState<boolean>(false)
// 预览上传后的图片
const handlePreview = async () => {
setFileList(fileList)
setImagePreviewVisible(true)
};
const handleChangePreview = (val: any) => {
setImagePreviewVisible(val)
}
// 活动报名明细的列表
const columns: any = [
{
title: <div style={{ textAlign: 'center' }}></div>,
width: 180,
dataIndex: "MEMBERSHIP_NAME",
ellipsis: true,
hideInSearch: true,
},
{
title: <div style={{ textAlign: 'center' }}></div>,
width: 180,
dataIndex: "MEMBERSHIP_MOBILEPHONE",
ellipsis: true,
hideInSearch: true,
},
{
title: <div style={{ textAlign: 'center' }}></div>,
width: 180,
dataIndex: "ACTIVITYDETAIL_STATE",
ellipsis: true,
hideInSearch: true,
valueType: "select",
fieldProps: {
options: [{ label: "取消", value: 0 }, { label: "报名", value: 1 }, { label: "参与", value: 9 }]
}
},
]
return (
<div>
<Modal
className="EventRegistration"
title={
<div
style={{
width: '100%',
cursor: 'move',
}}
onMouseOver={() => {
if (disabled) {
setDraggleDisabled(false)
}
}}
onMouseOut={() => {
setDraggleDisabled(true)
}}
onFocus={() => { }}
onBlur={() => { }}
>
{parentRow ? '编辑活动内容' : '新增活动内容'}
</div>
}
destroyOnClose={true}
width={900}
bodyStyle={{
height: '700px', // 你可以根据需要调整高度
overflowY: 'auto',
}}
footer={readonly ? '' :
<div style={{ width: '100%', display: 'flex', justifyContent: 'flex-end' }}>
<Button onClick={() => {
handleConfirmLoading(false)
setOnShow(false)
setparentRow(undefined);
setFileList([])
modalFromRef.current?.resetFields();
}}></Button>
<Button type="primary" loading={confirmLoading} style={{ marginLeft: '16px' }} onClick={async () => {
modalFromRef.current?.validateFields().then((values) => {
modalFromRef.current?.submit();
})
}}>
</Button>
</div>
}
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 <Draggable
disabled={disabled}
bounds={bounds}
onStart={(event, uiData) => onDraggaleStart(event, uiData)}
handle=".EventRegistration"
>
<div ref={draggleRef}>{modal}</div>
</Draggable>
}}
>
<ProForm
layout={'horizontal'}
formRef={modalFromRef}
submitter={false}
// initialValues={parentRow ? {
// ...parentRow,
// } : {}}
request={async () => {
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)
}
}}
>
<Row gutter={8}>
<Col span={12}>
<ProFormText
label={"活动名称"}
name={"ACTIVITY_NAME"}
rules={[{ required: true, message: '请输入活动名称' }]}
readonly={readonly}
/>
</Col>
<Col span={12}>
<ProFormDigit
label={"人数上限"}
name={"MAXIMUM_CAPACITY"}
fieldProps={{
min: 0,
max: 999999
}}
readonly={readonly}
/>
</Col>
<Col span={12}>
<ProFormDatePicker
label={"活动开始时间"}
name={"ACTIVITY_STARTDATE"}
width="lg"
readonly={readonly}
/>
</Col>
<Col span={12}>
<ProFormDatePicker
label={"活动结束时间"}
name={"ACTIVITY_ENDDATE"}
width="lg"
readonly={readonly}
/>
</Col>
<Col span={12}>
<ProFormText
label={"活动地点"}
name={"ACTIVITY_LOCATION"}
readonly={readonly}
/>
</Col>
<Col span={24}>
<ProFormUploadButton
name="ACTIVITY_IMG"
label="活动图片"
listType="picture-card"
accept="image/*"
readonly={readonly}
fieldProps={{
className: readonly ? "noUoloadButton" : "",
beforeUpload: beforeUpload,
onPreview: handlePreview,
fileList: fileList, // 绑定 fileList
customRequest: ({ file, onSuccess, onError, onProgress }) => {
// 开始处理
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: <ExclamationCircleOutlined />,
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)
}
}
}}
/>
</Col>
<Col span={24}>
<ProFormTextArea
label={'活动描述'}
name={'ACTIVITY_INFO'}
readonly={readonly}
/>
</Col>
<Col span={24}>
<ProFormText
label={"活动范围"}
name={"SERVERPART_SHOWNAME"}
readonly
/>
{
readonly ? '' :
<Button type="primary" disabled={readonly} onClick={() => {
handleSelectServerpartModal(true)
}}></Button>
}
</Col>
<Col span={24} style={{ display: 'none' }}>
<ProFormText
label={"活动范围"}
name={"SERVERPART_ID"}
readonly
/>
</Col>
</Row>
</ProForm>
{
parentRow ?
<ProTable
headerTitle={'活动报名明细'}
actionRef={EventRegistrationRef}
columns={columns}
search={false}
bordered
request={async () => {
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 }
}}
/> : ""
}
</Modal>
<Modal
title={"选择服务区"}
open={selectServerpartModal}
destroyOnClose={true}
width={800}
bodyStyle={{
height: '700px', // 你可以根据需要调整高度
overflowY: 'auto',
}}
onCancel={() => {
handleSelectServerpartModal(false)
}}
onOk={async () => {
selectServerpartFormRef.current?.validateFields().then((values) => {
selectServerpartFormRef.current?.submit();
})
}}
>
<ProForm
formRef={selectServerpartFormRef}
submitter={false}
onFinish={async (values) => {
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 || []
}
}}
>
<Button type={"primary"} onClick={() => {
let allId: any = []
if (serverpartList && serverpartList.length > 0) {
serverpartList.forEach((item: any) => {
allId.push(item.value)
})
}
let currentIds = selectServerpartFormRef.current?.getFieldValue('SERVERPART_IDS') || []
if (currentIds.toString() === allId.toString()) {
selectServerpartFormRef.current?.setFieldsValue({
SERVERPART_IDS: []
})
} else {
selectServerpartFormRef.current?.setFieldsValue({
SERVERPART_IDS: allId
})
}
}}></Button>
<ProFormCheckbox.Group
label={"选择服务区"}
name={"SERVERPART_IDS"}
fieldProps={{
options: serverpartList
}}
/>
</ProForm>
</Modal>
{/* 图片预览组件 */}
{fileList && fileList.length > 0 && <div style={{ display: 'none' }}>
<Image.PreviewGroup
preview={{
visible: imagePreviewVisible,
onVisibleChange: vis => {
handleChangePreview(vis)
}
}}>
{
fileList.map((n) => <Image src={n.url} key={n.url} />)
}
</Image.PreviewGroup>
</div>}
</div>
)
}
export default connect(({ user, }: ConnectState) => ({
currentUser: user.currentUser,
}))(EventRegistrationDetail);

View File

@ -0,0 +1,7 @@
.noUoloadButton {
.ant-upload-list-picture-card {
.ant-upload-select {
display: none;
}
}
}

View File

@ -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<ActionType>();
const formRef = useRef<FormInstance>();
const [printOut, setPrintOut] = useState<any>(); // 打印数据的内容
const [collapsible, setCollapsible] = useState<boolean>(false)
const [modalVisible, handleModalVisible] = useState<boolean>();
const [confirmLoading, handleConfirmLoading] = useState<boolean>(false) // 弹出框的内容表单是否在提交
const serverpartObj = session.get('serverpartObj')
const serverpartList = session.get('serverpartList')
// 树相关的属性和方法
const [selectedId, setSelectedId] = useState<string>()
// 查询的条件
const [searchParams, setSearchParams] = useState<any>()
// 当前选择的行数据
const [currentRow, setCurrentRow] = useState<any>()
// 文件列表
const [fileList, setFileList] = useState<any>([])
const [imagePreviewVisible, setImagePreviewVisible] = useState<boolean>(false) // 预览图片
// 选择服务区的悬浮框
const [selectServerpartModal, handleSelectServerpartModal] = useState<boolean>(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: <div style={{ textAlign: 'center' }}></div>,
width: 180,
dataIndex: "ACTIVITY_NAME",
ellipsis: true,
hideInSearch: true,
},
{
title: <div style={{ textAlign: 'center' }}></div>,
width: 150,
dataIndex: "SERVERPART_NAME",
ellipsis: true,
hideInSearch: true
},
{
title: <div style={{ textAlign: 'center' }}></div>,
width: 150,
dataIndex: "ACTIVITY_LOCATION",
ellipsis: true,
hideInSearch: true,
},
{
title: <div style={{ textAlign: 'center' }}></div>,
width: 120,
dataIndex: "MAXIMUM_CAPACITY",
ellipsis: true,
hideInSearch: true,
valueType: "digit",
align: 'right'
},
{
title: <div style={{ textAlign: 'center' }}></div>,
width: 250,
dataIndex: "ACTIVITY_INFO",
ellipsis: true,
hideInSearch: true,
},
{
title: <div style={{ textAlign: 'center' }}></div>,
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: <div style={{ textAlign: 'center' }}></div>,
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 <Space>
<a onClick={() => {
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)
}}></a>
<Popconfirm
title="确认删除?"
onConfirm={async () => {
await handleGetDeleteActivity(record.ACTIVITY_ID)
}}
>
<a></a>
</Popconfirm>
</Space>
}
}
]
// 删除活动的方法
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 (
<div>
<div style={{ backgroundColor: '#fff', display: 'flex' }}>
<div style={{
width: '100%',
paddingTop: 0,
paddingBottom: 0,
paddingRight: 0
}}>
<ProTable
actionRef={actionRef}
formRef={formRef}
columns={columns}
bordered
expandable={{
expandRowByClick: true
}}
scroll={{ x: "100%", y: "calc(100vh - 410px)" }}
headerTitle={<PageTitleBox props={props} />} // 列表表头
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: [
<Button
key="new"
type="primary"
onClick={(e) => {
handleModalVisible(true)
}}
>
</Button>
]
}}
/>
</div>
<EventRegistrationDetail parentRow={currentRow} setparentRow={setCurrentRow} onShow={modalVisible} setOnShow={handleModalVisible} currentUser={currentUser} actionRef={actionRef} fileList={fileList} setFileList={setFileList} />
</div>
</div >
)
}
export default connect(({ user }: ConnectState) => ({
currentUser: user.currentUser
}))(EventRegistration);

View File

@ -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
}

View File

@ -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;
}

View File

@ -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<ActionType>();
const formRef = useRef<FormInstance>();
const [currentRow, setCurrentRow] = useState<any>()
const [showModal, setShowModal] = useState<boolean>()
// 图片列表
const [fileList, setFileList] = useState<any>()
const [imagePreviewVisible, setImagePreviewVisible] = useState<boolean>(false) // 预览图片
const MEMBERSHIPTYPEYNList = session.get('MEMBERSHIPTYPEYNList')
const [currentImgIndex, setCurrentImgIndex] = useState<number>(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: <div style={{ textAlign: 'center' }}></div>,
dataIndex: "BUSINESSMAN_NAME",
hideInSearch: true,
width: 250,
ellipsis: true,
render: (_, record) => {
return record?.BUSINESSMAN_NAME ? <a onClick={() => {
setCurrentRow(record)
setShowModal(true)
}}>
{record?.BUSINESSMAN_NAME}
</a> : ""
}
},
{
title: <div style={{ textAlign: 'center' }}></div>,
dataIndex: "TAXPAYER_IDENTIFYCODE",
hideInSearch: true,
width: 150,
ellipsis: true,
},
{
title: <div style={{ textAlign: 'center' }}></div>,
dataIndex: "LINK_PERSON",
hideInSearch: true,
width: 150,
ellipsis: true,
},
{
title: <div style={{ textAlign: 'center' }}></div>,
dataIndex: "LINK_MOBILEPHONE",
hideInSearch: true,
width: 150,
ellipsis: true,
},
{
title: <div style={{ textAlign: 'center' }}></div>,
dataIndex: "BUSINESS_PROFILE",
hideInSearch: true,
width: 150,
ellipsis: true,
},
{
title: <div style={{ textAlign: 'center' }}></div>,
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 (
<div>
<ProTable
headerTitle={"招商明细"}
actionRef={actionRef}
columns={detailColumns}
scroll={{ x: "100%", y: 500 }}
request={async (params: any) => {
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 && <div style={{ display: 'none' }}>
<Image.PreviewGroup
preview={{
visible: imagePreviewVisible,
current: currentImgIndex,
onVisibleChange: vis => {
handleChangePreview(vis)
},
}}>
{
fileList.map((n) => <Image src={n.url} key={n.url} />)
}
</Image.PreviewGroup>
</div>}
<Modal
title={"招商明细"}
destroyOnClose={true}
width={900}
bodyStyle={{
height: '700px', // 你可以根据需要调整高度
overflowY: 'auto',
}}
visible={showModal}
onCancel={() => {
setShowModal(false)
}}
footer={false}
onOk={async () => { // 提交框内的数据
}}
>
<ProForm
formRef={formRef}
submitter={false}
request={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 {}
}}
>
<Row gutter={8}>
<Col span={12}>
<ProFormText
label={"商家名称"}
name={"BUSINESSMAN_NAME"}
readonly
/>
</Col>
<Col span={12}>
<ProFormSelect
label={"经营业态"}
name={"MEMBERSHIP_TYPE"}
readonly
request={async () => {
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
// }}
/>
</Col>
<Col span={12}>
<ProFormText
label={"统一信用代码"}
name={"TAXPAYER_IDENTIFYCODE"}
readonly
/>
</Col>
<Col span={12}>
<ProFormText
label={"联系人员"}
name={"LINK_PERSON"}
readonly
/>
</Col>
<Col span={12}>
<ProFormText
label={"联系电话"}
name={"LINK_MOBILEPHONE"}
readonly
/>
</Col>
<Col span={12}>
<ProFormText
label={"申请时间"}
name={"OPERATE_DATE"}
readonly
/>
</Col>
<Col span={24}>
<ProFormTextArea
label={"商家简介"}
name={"BUSINESS_PROFILE"}
readonly
/>
</Col>
<Col span={24}>
<ProFormUploadButton
name="file"
label="资质材料"
listType="picture-card"
labelCol={{ span: 3 }}
wrapperCol={{ span: 20 }}
fileList={fileList}
fieldProps={{
className: "noUoloadButton",
onPreview: (e: any) => {
handlePreview(e.uid - 1)
},
}}
readonly
/>
</Col>
</Row>
</ProForm>
</Modal>
</div>
)
}
export default connect(({ user, }: ConnectState) => ({
currentUser: user.currentUser,
}))(InvestmentInformationDetail);

View File

@ -0,0 +1,7 @@
.noUoloadButton {
.ant-upload-list-picture-card {
.ant-upload-select {
display: none;
}
}
}

View File

@ -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<ActionType>();
const tableRef = useRef<ActionType>();
const formRef = useRef<FormInstance>();
const modalRef = useRef<FormInstance>();
const [reqDetailList, setReqDetailList] = useState<any>(); // 合计项数据源
const [printOut, setPrintOut] = useState<any>(); // 打印数据的内容
const [collapsible, setCollapsible] = useState<boolean>(false)
const [treeView, setTreeView] = useState<any>()
const [printIndex, setPrintIndex] = useState<number>(new Date().getTime())
// 树相关的属性和方法
const [selectedId, setSelectedId] = useState<string>()
// 是否显示打印的表格
const [showExportTable, setShowExportTable] = useState<boolean>(false)
// 查询的条件
const [searchParams, setSearchParams] = useState<any>()
// 头条类型 对象格式
const [NOTICEINFO_TYPES, setNOTICEINFO_TYPESOBJ] = useState<any>()
const [NOTICEINFO_TYPESList, setNOTICEINFO_TYPESList] = useState<any>()
// 显示新增窗口
const [showAddModal, setShowAddModal] = useState<boolean>(false)
// 弹出框的确认效果
const [confirmLoading, setConfirmLoading] = useState<boolean>(false)
// 当前选中行数据
const [currentRow, setCurrentRow] = useState<any>()
// 图片列表
const [fileList, setFileList] = useState<any>()
const [imagePreviewVisible, setImagePreviewVisible] = useState<boolean>(false) // 预览图片
// 预览上传后的图片
const handlePreview = async () => {
setFileList(fileList)
setImagePreviewVisible(true)
};
const handleChangePreview = (val: any) => {
setImagePreviewVisible(val)
}
// 显示详情的modal
const [showNoticeModal, setShowNoticeModal] = useState<boolean>(false)
// 显示招商详情的行数据
const [currentNoticeRow, setCurrentNoticeRow] = useState<any>()
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: <div style={{ textAlign: 'center' }}>头条类型</div>,
// 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: <div style={{ textAlign: 'center' }}></div>,
dataIndex: "NOTICEINFO_TITLE",
hideInSearch: true,
width: 250,
ellipsis: true,
},
{
title: <div style={{ textAlign: 'center' }}></div>,
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 <div>
<a onClick={() => {
setCurrentRow(record)
setShowAddModal(true)
}}>
</a>
<Popconfirm
title={'确认删除?'}
onConfirm={() => {
handleDeleteLine(record?.NOTICEINFO_ID)
}}
>
<a style={{ marginLeft: '8px' }}></a>
</Popconfirm>
</div>
}
}
]
// 新增头条
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 (
<div ref={(el) => {
// 打印报表
if (!reqDetailList || reqDetailList.length === 0) return;
setPrintOut(el);
}} >
<div className={`saleReportHideBox${printIndex}`} style={{ position: 'fixed', zIndex: -1, top: 0, left: 0 }}>
{
showExportTable && reqDetailList && reqDetailList.length > 0 ?
<ProTable
columns={columns}
dataSource={reqDetailList}
pagination={false}
expandable={{
defaultExpandAllRows: true
}}
/> : ''
}
</div>
<div id='hiddenBox' style={{ position: 'fixed', zIndex: -1, top: 0, left: 0 }} />
<div style={{ backgroundColor: '#fff', display: 'flex' }}>
{/* <LeftSelectTree setSelectedId={setSelectedId} setCollapsible={setCollapsible} collapsible={collapsible} /> */}
<div style={{
width: '100%',
paddingTop: 0,
paddingBottom: 0,
paddingRight: 0
}}>
<ProTable
actionRef={actionRef}
formRef={formRef}
columns={columns}
bordered
expandable={{
expandRowByClick: true
}}
scroll={{ x: "100%", y: "calc(100vh - 430px)" }}
headerTitle={<PageTitleBox props={props} />}
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: [
<Button type="primary" onClick={() => {
setShowAddModal(true)
}}></Button>
]
}}
/>
</div>
</div>
{/* 图片预览组件 */}
{fileList && fileList.length > 0 && <div style={{ display: 'none' }}>
<Image.PreviewGroup
preview={{
visible: imagePreviewVisible,
onVisibleChange: vis => {
handleChangePreview(vis)
}
}}>
{
fileList.map((n) => <Image src={n.url} key={n.url} />)
}
</Image.PreviewGroup>
</div>}
<Modal
title={currentRow ? "编辑头条" : "新增头条"}
destroyOnClose={true}
width={900}
bodyStyle={{
height: '700px', // 你可以根据需要调整高度
overflowY: 'auto',
}}
visible={showAddModal}
confirmLoading={confirmLoading}
onCancel={() => {
handleModalClose()
}}
onOk={async () => { // 提交框内的数据
modalRef.current?.validateFields().then(async (res: any) => {
setConfirmLoading(true)
await handleAddHeadlines(res)
setConfirmLoading(false)
})
}}
>
<ProForm
formRef={modalRef}
layout={'horizontal'}
submitter={false}
request={async () => {
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 {}
}}
>
<Row gutter={16}>
<Col span={12}>
<ProFormTreeSelect
label={'头条类型'}
name={'NOTICEINFO_TYPE'}
rules={[{
required: true,
message: '请选择头条类型'
}]}
fieldProps={{
options: NOTICEINFO_TYPESList,
treeDefaultExpandAll: true
}}
/>
</Col>
<Col span={12}>
<ProFormText
label={'头条标题'}
name={'NOTICEINFO_TITLE'}
rules={[{
required: true,
message: '请输入标题内容'
}]}
/>
</Col>
<Col span={12}>
<ProFormSelect
label={'服务区名称'}
name={'SERVERPART_ID'}
request={async () => {
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
}}
/>
</Col>
<Col span={12}>
<ProFormDatePicker
label={'生效时间'}
name={'START_DATE'}
width="lg"
rules={[{
required: true,
message: '请选择生效时间'
}]}
fieldProps={{
format: "YYYY-MM-DD", // 格式化日期和时间
}}
/>
</Col>
<Col span={12}>
<ProFormDatePicker
label={'截止时间'}
name={'END_DATE'}
width="lg"
rules={[{
required: true,
message: '请选择截止时间'
}]}
fieldProps={{
format: "YYYY-MM-DD", // 格式化日期和时间
}}
/>
</Col>
<Col span={24}>
<ProFormTextArea
label={'头条内容'}
name={'NOTICEINFO_CONTENT'}
/>
</Col>
<Col span={24}>
<ProFormTextArea
label={'备注说明'}
name={'NOTICEINFO_DESC'}
/>
</Col>
<Col span={24}>
<ProFormUploadButton
name="file"
label="上传头条图片"
labelCol={{ span: 3 }}
wrapperCol={{ span: 20 }}
fileList={fileList}
fieldProps={{
onPreview: handlePreview,
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: <ExclamationCircleOutlined />,
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)
}
}
}}
/>
</Col>
</Row>
</ProForm>
{
currentRow ?
<InvestmentInformationDetail parentRow={currentRow} />
: ""
}
</Modal>
</div>
)
}
export default connect(({ user }: ConnectState) => ({
currentUser: user.currentUser
}))(InvestmentInformation);

View File

@ -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<any>()
const tableRef = useRef<ActionType>();
const { confirm } = Modal;
const modalFromRef = useRef<FormInstance>();
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<boolean>() // 是否拖动
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<boolean>(false) // 弹出框的内容表单是否在提交
const [selectName, setSelectName] = useState<string[]>(); // 选择的服务区名称
// 当前选择的服务区方位
const [REGIONList, setREGIONList] = useState<any>([])
const [imagePreviewVisible, setImagePreviewVisible] = useState<boolean>(false) // 预览图片
// 显示订单详情的悬浮框
const [orderModalVisible, handleOrderModalVisible] = useState<boolean>(false);
// 订单的当前行数据
const [currentRow, setCurrentRow] = useState<any>();
// 预览上传后的图片
const handlePreview = async () => {
setFileList(fileList)
setImagePreviewVisible(true)
};
const handleChangePreview = (val: any) => {
setImagePreviewVisible(val)
}
const columns: any = [
{
title: <div style={{ textAlign: 'center' }}></div>,
width: 150,
align: 'center',
dataIndex: "RESTSTATIONBILL_CODE",
ellipsis: true,
hideInSearch: true,
render: (_, record) => {
return <a onClick={() => {
setCurrentRow(record)
handleOrderModalVisible(true)
}}>
{record.RESTSTATIONBILL_CODE}
</a>
}
},
{
title: <div style={{ textAlign: 'center' }}></div>,
width: 150,
align: 'center',
dataIndex: "MEMBERSHIP_NAME",
ellipsis: true,
hideInSearch: true,
},
{
title: <div style={{ textAlign: 'center' }}></div>,
width: 150,
align: 'center',
dataIndex: "MEMBERSHIP_MOBILEPHONE",
ellipsis: true,
hideInSearch: true,
},
{
title: <div style={{ textAlign: 'center' }}></div>,
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: <div style={{ textAlign: 'center' }}></div>,
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: <div style={{ textAlign: 'center' }}></div>,
width: 150,
align: 'center',
dataIndex: "REMAIN_SECONDS",
ellipsis: true,
hideInSearch: true
},
{
title: <div style={{ textAlign: 'center' }}></div>,
width: 150,
align: 'center',
dataIndex: "RENEWAL_STATUS",
ellipsis: true,
hideInSearch: true,
valueType: "select",
valueEnum: {
1: { text: '未续费', status: 'error' },
2: { text: '已续费', status: 'Success' },
}
},
{
title: <div style={{ textAlign: 'center' }}></div>,
width: 150,
align: 'center',
dataIndex: "CLEANING_STATUS",
ellipsis: true,
hideInSearch: true,
valueType: "select",
valueEnum: {
0: { text: '待清洁', status: 'error' },
1: { text: '已清洁', status: 'Success' },
}
},
{
title: <div style={{ textAlign: 'center' }}></div>,
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: <div style={{ textAlign: 'center' }}></div>,
width: 150,
align: 'center',
dataIndex: "EMERGENCY_PHONENUMBER",
ellipsis: true,
},
{
title: <div style={{ textAlign: 'center' }}></div>,
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 (
<div>
<Modal
className="SharedRestStationManagement"
title={
<div
style={{
width: '100%',
cursor: 'move',
}}
onMouseOver={() => {
if (disabled) {
setDraggleDisabled(false)
}
}}
onMouseOut={() => {
setDraggleDisabled(true)
}}
onFocus={() => { }}
onBlur={() => { }}
>
{parentRow ? '编辑共享休息站' : '新增共享休息站'}
</div>
}
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 ? '' :
<div style={{ width: '100%', display: 'flex', justifyContent: 'flex-end' }}>
<Button onClick={() => {
handleConfirmLoading(false)
setOnShow(false)
setParentRow(undefined);
setREGIONList([])
setFileList([])
}}></Button>
<Button type="primary" loading={confirmLoading} style={{ marginLeft: '16px' }} onClick={async () => {
modalFromRef.current?.validateFields().then(async (values) => {
await handleAddUpdateStation(values)
})
}}>
</Button>
</div>
}
modalRender={(modal) => {
return <Draggable
disabled={disabled}
bounds={bounds}
onStart={(event, uiData) => onDraggaleStart(event, uiData)}
handle=".SharedRestStationManagement"
>
<div ref={draggleRef}>{modal}</div>
</Draggable>
}}
>
<ProForm
layout={'horizontal'}
formRef={modalFromRef}
submitter={false}
labelCol={{ style: { width: 100 } }}
request={async () => {
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 {}
}
}}
>
<Row gutter={8}>
<Col span={12}>
<ProFormText
label={"休息站名称"}
name={"RESTSTATION_NAME"}
rules={[{ required: true, message: '请输入共享休息站名称' }]}
readonly={readonly}
/>
</Col>
<Col span={12}>
<ProFormSelect
label={"所属服务区"}
name={"SERVERPART_ID"}
fieldProps={{
options: serverpartList,
showSearch: true,
onChange: async (e, option) => {
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}
/>
</Col>
<Col span={12}>
<ProFormSelect
label={"服务区方位"}
name={"SERVERPART_REGION"}
fieldProps={{
options: REGIONList,
}}
/>
</Col>
<Col span={12}>
<ProFormText
label={"所在位置"}
name={"RESTSTATION_LOCATION"}
/>
</Col>
<Col span={12}>
<ProFormSelect
label={"门锁状态"}
name={"LOCK_STATUS"}
fieldProps={{
options: [{ label: "空闲中", value: 1 }, { label: "使用中", value: 2 }],
}}
/>
</Col>
<Col span={12}>
<ProFormSelect
label={"保洁状态"}
name={"CLEANING_STATUS"}
fieldProps={{
options: [{ label: "待清洁", value: 1 }, { label: "清洁中", value: 2 }, { label: "已清洁", value: 3 }],
}}
/>
</Col>
<Col span={12}>
<ProFormText
label={"紧急联系电话"}
name={"EMERGENCY_CONTACT"}
/>
</Col>
<Col span={12}>
<ProFormDigit
label={"评价打分"}
name={"RESTSTATIONBILL_SCORE"}
fieldProps={{
max: 5
}}
/>
</Col>
<Col span={12}>
<ProFormSelect
label={"有效状态"}
name={"RESTSTATION_STATE"}
fieldProps={{
options: [{ label: "有效", value: 1 }, { label: "无效", value: 0 }],
}}
initialValue={1}
/>
</Col>
<Col span={24}>
<ProFormTextArea
label={"备注说明"}
name={"RESTSTATION_DESC"}
/>
</Col>
<Col span={24}>
<ProFormUploadButton
name="RESTSTATION_IMG"
label="休息室图片"
listType="picture-card"
accept="image/*"
readonly={readonly}
fieldProps={{
beforeUpload: beforeUpload,
onPreview: handlePreview,
fileList: fileList, // 绑定 fileList
customRequest: ({ file, onSuccess, onError, onProgress }) => {
// 开始处理
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: <ExclamationCircleOutlined />,
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)
}
}
}}
/>
</Col>
</Row>
{/* 休息站订单信息 */}
{
parentRow && parentRow.RESTSTATION_ID ?
<div>
<ProTable
actionRef={tableRef}
bordered
columns={columns}
search={{ span: 12 }}
scroll={{ x: "100%", y: 400 }}
request={async (params: any) => {
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: [
<Button
key="new"
type="primary"
onClick={() => {
handleOrderModalVisible(true)
}}
>
</Button>
]
}}
/>
</div> : ""
}
</ProForm>
</Modal>
<SharedRestStationOrderDetail bigParams={parentRow} onShow={orderModalVisible} setOnShow={handleOrderModalVisible} parentRow={currentRow} setParentRow={setCurrentRow} actionRef={tableRef} currentUser={currentUser} readonly={currentRow?.RESTSTATIONBILL_ID} />
</div>
)
}
export default connect(({ user, }: ConnectState) => ({
currentUser: user.currentUser,
}))(SharedRestStationDetail);

View File

@ -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<FormInstance>();
const draggleRef = React.createRef<any>()
// 弹出框拖动效果
const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置
const [disabled, setDraggleDisabled] = useState<boolean>() // 是否拖动
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<boolean>(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 (
<div>
<Modal
className="SharedRestStationOrderDetail"
title={
<div
style={{
width: '100%',
cursor: 'move',
}}
onMouseOver={() => {
if (disabled) {
setDraggleDisabled(false)
}
}}
onMouseOut={() => {
setDraggleDisabled(true)
}}
onFocus={() => { }}
onBlur={() => { }}
>
{parentRow ? '编辑共享休息站' : '新增共享休息站'}
</div>
}
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 ? '' :
<div style={{ width: '100%', display: 'flex', justifyContent: 'flex-end' }}>
<Button onClick={() => {
handleConfirmLoading(false)
setOnShow(false)
setParentRow(undefined);
}}></Button>
<Button type="primary" loading={confirmLoading} style={{ marginLeft: '16px' }} onClick={async () => {
formRef.current?.validateFields().then(async (values) => {
handleAddUpdateOrder(values)
})
}}>
</Button>
</div>
}
modalRender={(modal) => {
return <Draggable
disabled={disabled}
bounds={bounds}
onStart={(event, uiData) => onDraggaleStart(event, uiData)}
handle=".SharedRestStationOrderDetail"
>
<div ref={draggleRef}>{modal}</div>
</Draggable>
}}
>
<ProForm
layout={'horizontal'}
formRef={formRef}
submitter={false}
labelCol={{ style: { width: 100 } }}
request={async () => {
if (parentRow) {
return { ...parentRow, };
} else {
return {}
}
}}
>
<Row gutter={8}>
<Col span={12}>
<ProFormText
label={"会员名称"}
name={"MEMBERSHIP_NAME"}
readonly={readonly}
/>
</Col>
<Col span={12}>
<ProFormText
label={"手机号码"}
name={"MEMBERSHIP_MOBILEPHONE"}
readonly={readonly}
/>
</Col>
<Col span={12}>
<ProFormDatePicker
label={"下单时间"}
width={'lg'}
name={"ORDER_STARTDATE"}
readonly={readonly}
/>
</Col>
<Col span={12}>
<ProFormDatePicker
label={"结束时间"}
width={'lg'}
name={"ORDER_ENDDATE"}
readonly={readonly}
/>
</Col>
<Col span={12}>
<ProFormDigit
label={"剩余时间/分"}
name={"REMAIN_SECONDS"}
readonly={readonly}
/>
</Col>
<Col span={12}>
<ProFormSelect
label={"续费状态"}
name={"RENEWAL_STATUS"}
readonly={readonly}
fieldProps={{
options: [{ label: '已续费', value: 2 }, { label: '未续费', value: 1 }]
}}
/>
</Col>
<Col span={12}>
<ProFormSelect
label={"保洁状态"}
name={"CLEANING_STATUS"}
readonly={readonly}
fieldProps={{
options: [{ label: '待清洁', value: 0 }, { label: '已清洁', value: 1 }]
}}
/>
</Col>
<Col span={12}>
<ProFormDigit
label={"评价打分"}
name={"RESTSTATIONBILL_SCORE"}
readonly={readonly}
/>
</Col>
<Col span={12}>
<ProFormSelect
label={"订单状态"}
name={"RESTSTATIONBILL_STATE"}
readonly={readonly}
fieldProps={{
options: [{ label: '待付款', value: 1 }, { label: '使用中', value: 2 }, { label: '已完成', value: 3 }]
}}
/>
</Col>
</Row>
</ProForm>
</Modal>
</div>
)
}
export default connect(({ user, }: ConnectState) => ({
currentUser: user.currentUser,
}))(SharedRestStationOrderDetail);

View File

@ -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<ActionType>();
const formRef = useRef<FormInstance>();
const [printOut, setPrintOut] = useState<any>(); // 打印数据的内容
const [collapsible, setCollapsible] = useState<boolean>(false)
const [modalVisible, handleModalVisible] = useState<boolean>();
// 树相关的属性和方法
const [selectedId, setSelectedId] = useState<string>()
// 查询的条件
const [searchParams, setSearchParams] = useState<any>()
// 当前选择的行数据
const [currentRow, setCurrentRow] = useState<any>()
// 文件列表
const [fileList, setFileList] = useState<any>([])
const columns: any = [
{
title: <div style={{ textAlign: 'center' }}></div>,
width: 150,
dataIndex: "RESTSTATION_NAME",
ellipsis: true,
hideInSearch: true,
},
{
title: <div style={{ textAlign: 'center' }}></div>,
width: 150,
dataIndex: "SERVERPART_NAME",
ellipsis: true,
hideInSearch: true,
},
{
title: <div style={{ textAlign: 'center' }}></div>,
width: 150,
dataIndex: "SERVERPART_REGION",
ellipsis: true,
hideInSearch: true,
},
{
title: <div style={{ textAlign: 'center' }}></div>,
width: 150,
dataIndex: "RESTSTATION_LOCATION",
ellipsis: true,
hideInSearch: true,
},
{
title: <div style={{ textAlign: 'center' }}></div>,
width: 120,
dataIndex: "LOCK_STATUS",
ellipsis: true,
align: 'center',
hideInSearch: true,
valueType: "select",
valueEnum: {
1: { text: '空闲中', status: 'success' },
2: { text: '使用中', status: 'error' },
}
},
{
title: <div style={{ textAlign: 'center' }}></div>,
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 <Space>
<a onClick={() => {
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)
}}></a>
<Popconfirm
title="确认删除?"
onConfirm={async () => {
await handleGetDeleteActivity(record.RESTSTATION_ID)
}}
>
<a></a>
</Popconfirm>
</Space>
}
}
]
// 删除共享休息站
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 (
<div>
<div style={{ backgroundColor: '#fff', display: 'flex' }}>
<LeftSelectTree setSelectedId={setSelectedId} setCollapsible={setCollapsible} collapsible={collapsible} />
<div style={{
width: !collapsible ? 'calc(100% - 300px)' : 'calc(100% - 60px)',
paddingTop: 0,
paddingBottom: 0,
paddingRight: 0
}}>
<ProTable
actionRef={actionRef}
formRef={formRef}
columns={columns}
bordered
expandable={{
expandRowByClick: true
}}
scroll={{ x: "100%", y: "calc(100vh - 410px)" }}
headerTitle={<PageTitleBox props={props} />} // 列表表头
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: [
<Button
key="new"
type="primary"
onClick={(e) => {
handleModalVisible(true)
}}
>
</Button>
]
}}
/>
</div>
<SharedRestStationDetail parentRow={currentRow} setParentRow={setCurrentRow} onShow={modalVisible} setOnShow={handleModalVisible} fileList={fileList} setFileList={setFileList} currentUser={currentUser} actionRef={actionRef} />
</div>
</div>
)
}
export default connect(({ user }: ConnectState) => ({
currentUser: user.currentUser
}))(SharedRestStationManagement);

View File

@ -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
}

View File

@ -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<ActionType>();
const formRef = useRef<FormInstance>();
const [modalVisible, handleModalVisible] = useState<boolean>();
const serverpartObj = session.get('serverpartObj')
// 查询的条件
const [searchParams, setSearchParams] = useState<any>()
// 当前选择的行数据
const [currentRow, setCurrentRow] = useState<any>()
// 文件列表
const [fileList, setFileList] = useState<any>([])
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: <div style={{ textAlign: 'center' }}></div>,
width: 180,
dataIndex: "ACTIVITY_NAME",
ellipsis: true,
hideInSearch: true,
render: (_, record) => {
return <a onClick={() => {
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}</a>
}
},
{
title: <div style={{ textAlign: 'center' }}></div>,
width: 150,
dataIndex: "SERVERPART_NAME",
ellipsis: true,
hideInSearch: true
},
{
title: <div style={{ textAlign: 'center' }}></div>,
width: 150,
dataIndex: "ACTIVITY_LOCATION",
ellipsis: true,
hideInSearch: true,
},
{
title: <div style={{ textAlign: 'center' }}></div>,
width: 120,
dataIndex: "MAXIMUM_CAPACITY",
ellipsis: true,
hideInSearch: true,
valueType: "digit",
align: 'right'
},
{
title: <div style={{ textAlign: 'center' }}></div>,
width: 250,
dataIndex: "ACTIVITY_INFO",
ellipsis: true,
hideInSearch: true,
},
{
title: <div style={{ textAlign: 'center' }}></div>,
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: <div style={{ textAlign: 'center' }}></div>,
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 <Space>
<Popconfirm
title="确认上架?"
onConfirm={async () => {
handleGetUpadteActivityState(record, 1)
}}
>
<a></a>
</Popconfirm>
<Popconfirm
title="确认下架?"
onConfirm={async () => {
handleGetUpadteActivityState(record, 2)
}}
>
<a></a>
</Popconfirm>
</Space>
}
}
]
// 只管上下架的接口
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 (
<div>
<div style={{ backgroundColor: '#fff', display: 'flex' }}>
<div style={{
width: '100%',
paddingTop: 0,
paddingBottom: 0,
paddingRight: 0
}}>
<ProTable
actionRef={actionRef}
formRef={formRef}
columns={columns}
bordered
expandable={{
expandRowByClick: true
}}
scroll={{ x: "100%", y: "calc(100vh - 410px)" }}
headerTitle={<PageTitleBox props={props} />} // 列表表头
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: []
}}
/>
</div>
<EventRegistrationDetail parentRow={currentRow} setparentRow={setCurrentRow} onShow={modalVisible} setOnShow={handleModalVisible} currentUser={currentUser} actionRef={actionRef} readonly={true} fileList={fileList} setFileList={setFileList} />
</div>
</div >
)
}
export default connect(({ user }: ConnectState) => ({
currentUser: user.currentUser
}))(EventRegistration);

View File

@ -1,6 +1,7 @@
import type { CurrentUser } from '@/models/user'; import type { CurrentUser } from '@/models/user';
import request from '@/utils/request'; import request from '@/utils/request';
import requestEncryption from '@/utils/requestEncryption';
export async function query(): Promise<any> { // 根据用户token获取用户信息 export async function query(): Promise<any> { // 根据用户token获取用户信息
const data = await request(`/Logging/GetPassportInfoByToken`, { const data = await request(`/Logging/GetPassportInfoByToken`, {
@ -25,10 +26,11 @@ export async function queryCurrent(UserIdEncrypted: string | number): Promise<Cu
} }
// 获取消息队列 // 获取消息队列
export async function queryNotices(params: any): Promise<any> { export async function queryNotices(params: any): Promise<any> {
const data = await request('/Platform/GetMessageList',{ // 只获取未读的通知 // const data = await request('/Platform/GetMessageList',{ // 只获取未读的通知
const data = await request('/Log/GetMessageList', { // 只获取未读的通知
method: 'POST', 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) { // 登录超时 if (data.Result_Code !== 100) { // 登录超时
return [] return []
@ -38,10 +40,10 @@ export async function queryNotices(params: any): Promise<any> {
// 消息状态更新 // 消息状态更新
export async function changeNoticesState(params: any): Promise<boolean> { export async function changeNoticesState(params: any): Promise<boolean> {
const data = await request('/Platform/SynchroMessage',{ const data = await request('/Platform/SynchroMessage', {
method: 'POST', method: 'POST',
data: {...params} data: { ...params }
}); });
if (data.Result_Code !== 100) { // 登录超时 if (data.Result_Code !== 100) { // 登录超时
return false return false
@ -54,10 +56,10 @@ export async function setMessageState(params: {
recStaffId: number, recStaffId: number,
messageState: number messageState: number
}): Promise<boolean> { }): Promise<boolean> {
const data = await request('/Platform/SetMessageState',{ const data = await request('/Platform/SetMessageState', {
method: 'POST', method: 'POST',
data: {...params} data: { ...params }
}); });
if (data.Result_Code !== 100) { // 更新失败 if (data.Result_Code !== 100) { // 更新失败
return false return false
@ -80,9 +82,12 @@ export async function getUserMenu(userid?: number): Promise<any[]> {
// 添加用户行为记录 // 添加用户行为记录
export function synchroBehaviorRecord(data: any): void { export function synchroBehaviorRecord(data: any): void {
request(`/Platform/SynchroBehaviorrecord`, { requestEncryption(`/Log/SynchroBehaviorrecord`, {
method: 'POST', method: 'POST',
data data: {
...data,
requestEncryption: true
}
}); });
} }
@ -90,9 +95,12 @@ export function synchroBehaviorRecord(data: any): void {
// 添加用户行为具体接口的 // 添加用户行为具体接口的
export function SynchroBEHAVIORRECORD(data: any): void { export function SynchroBEHAVIORRECORD(data: any): void {
request(`/Platform/SynchroBEHAVIORRECORD`, { requestEncryption(`/Log/SynchroBEHAVIORRECORD`, {
method: 'POST', method: 'POST',
data data: {
...data,
requestEncryption: true
}
}); });
} }

View File

@ -59,7 +59,7 @@ const errorHandler = (error: { response: Response }): Response => {
const request = extend({ const request = extend({
errorHandler, // default error handling errorHandler, // default error handling
// prefix: '/EShangApiMain',// 开发 // prefix: '/EShangApiMain',// 开发
prefix: 'https://pos.eshangtech.com/EShangApiMain', // 正式 prefix: 'https://pos.eshangtech.com/MemberApi', // 正式
headers: { headers: {
token: '', token: '',
ProvinceCode: '', ProvinceCode: '',

View File

@ -58,7 +58,8 @@ const errorHandler = (error: { response: Response }): Response => {
const request = extend({ const request = extend({
errorHandler, // default error handling errorHandler, // default error handling
// prefix: '/EShangApiMain',// 开发 // 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', // 正式 // prefix: 'http://10.104.1.175:8070/platform', // 正式
headers: { headers: {
token: '', token: '',

View File

@ -57,7 +57,8 @@ const errorHandler = (error: { response: Response }): Response => {
const requestTest = extend({ const requestTest = extend({
errorHandler, // default error handling errorHandler, // default error handling
// prefix: '/EShangApiMain',// 开发 // prefix: '/EShangApiMain',// 开发
prefix: 'http://dev.eshangtech.com:8900/EShangApiMain', // 正式 // prefix: 'http://dev.eshangtech.com:8900/EShangApiMain', // 正式
prefix: 'https://api.eshangtech.com/MemberApi', // 正式
headers: { headers: {
token: '', token: '',
ProvinceCode: '', ProvinceCode: '',

View File

@ -57,7 +57,7 @@ const errorHandler = (error: { response: Response }): Response => {
const request = extend({ const request = extend({
errorHandler, // default error handling errorHandler, // default error handling
// prefix: '/EShangApiMain',// 开发 // prefix: '/EShangApiMain',// 开发
prefix: 'http://220.180.35.180:8000/EShangApiMain', // 正式 prefix: 'https://api.eshangtech.com/EShangApiMain', // 正式
headers: { headers: {
token: '', token: '',
ProvinceCode: '', ProvinceCode: '',
@ -85,14 +85,14 @@ request.interceptors.request.use((url, opt) => {
} }
} }
if ((url.indexOf('Synchro') > -1 || url.indexOf('Save') > -1) && if ((url.indexOf('Synchro') > -1 || url.indexOf('Save') > -1) &&
url.indexOf('Picture/SaveImgFile') === -1 ) { url.indexOf('Picture/SaveImgFile') === -1) {
// 添加操作人和业主单位信息 // 添加操作人和业主单位信息
options.data = { options.data = {
...options.data, ...options.data,
STAFF_ID: currentUser.ID, STAFF_ID: currentUser.ID,
STAFF_NAME: currentUser.Name, STAFF_NAME: currentUser.Name,
OWNERUNIT_ID: options.data.OWNERUNIT_ID || currentUser.OwnerUnitId, OWNERUNIT_ID: options.data.OWNERUNIT_ID || currentUser.OwnerUnitId,
OWNERUNIT_NAME: options.data.OWNERUNIT_NAME || currentUser.ProvinceUnit, OWNERUNIT_NAME: options.data.OWNERUNIT_NAME || currentUser.ProvinceUnit,
PROVINCE_CODE: options.data.PROVINCE_CODE || currentUser.ProvinceCode, PROVINCE_CODE: options.data.PROVINCE_CODE || currentUser.ProvinceCode,
OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss') OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss')

View File

@ -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<number, string> = {
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;

View File

@ -1,4 +1,4 @@
// 由 scripts/writeVersion.js 自动生成 // 由 scripts/writeVersion.js 自动生成
export const VERSION = "4.5.63"; export const VERSION = "4.5.65";
export const GIT_HASH = "85905b6"; export const GIT_HASH = "cc91234";
export const BUILD_TIME = "2025-10-21T06:39:13.375Z"; export const BUILD_TIME = "2025-10-31T09:52:44.987Z";