From 59c2d7d5bd0962d67bd1dc80ab3901fdcad28791 Mon Sep 17 00:00:00 2001 From: ylj20011123 Date: Fri, 11 Jul 2025 21:09:14 +0800 Subject: [PATCH] update --- src/layouts/BasicLayout.tsx | 83 ++- .../MerchantInformation/index.tsx | 387 +++++++++---- .../component/leftSelectTree.tsx | 8 +- .../travelMember/AfterSalesManage/index.tsx | 524 ++++++++++++++++- .../AfterSalesTypeManage/index.tsx | 523 ++++++++++++++++- .../components/orderDetailModal.tsx | 385 +++++++++++++ .../BookingMealOrder/components/style.less | 110 ++++ .../travelMember/BookingMealOrder/index.tsx | 11 +- .../ConsumptionRecordSearch/index.tsx | 56 +- .../GrowthValueRecordSearch/index.tsx | 19 +- .../components/growthConfig.tsx | 522 +++++++++++++++++ .../GrowthValueRuleConfig/index.tsx | 153 +++-- .../MallClassificationManage/index.tsx | 173 +++--- .../components/addressDetail.tsx | 542 ++++++++++++++++++ .../travelMember/MemberAddress/index.tsx | 7 +- .../MembershipLevelManage/index.tsx | 522 ++++++++++++++++- .../OrderCategoryManage/index.tsx | 128 +++-- .../components/OrderCategoryTree.tsx | 2 +- .../components/OrderCategoryTreeMultiple.tsx | 232 ++++++++ .../travelMember/OrderProductManage/index.tsx | 190 +++--- .../travelMember/PointsRecordSearch/index.tsx | 14 +- .../PointsRuleConfig/PointConfig.tsx | 522 +++++++++++++++++ .../travelMember/PointsRuleConfig/index.tsx | 270 ++++++--- .../ProductSpecificationManage/index.tsx | 50 +- .../RegistrationRetentionAnalysis/index.tsx | 438 +++++++++++++- .../SupplierMerchantManage/index.tsx | 133 +++-- src/pages/travelMember/memberInfor/index.tsx | 166 ++++-- .../component/modalFooter.tsx | 51 ++ .../travelMember/scenicSpotConfig/index.tsx | 140 +++-- .../components/serverpartInfo.tsx | 133 ++--- .../travelMember/serverpartInfo/index.tsx | 210 ++++++- .../travelMember/serverpartInfo/style.less | 29 + src/pages/travelMember/service.ts | 50 ++ src/services/options/index.ts | 41 ++ src/services/options/typings.d.ts | 2 +- 35 files changed, 6102 insertions(+), 724 deletions(-) create mode 100644 src/pages/travelMember/BookingMealOrder/components/orderDetailModal.tsx create mode 100644 src/pages/travelMember/BookingMealOrder/components/style.less create mode 100644 src/pages/travelMember/GrowthValueRuleConfig/components/growthConfig.tsx create mode 100644 src/pages/travelMember/MemberAddress/components/addressDetail.tsx create mode 100644 src/pages/travelMember/OrderProductManage/components/OrderCategoryTreeMultiple.tsx create mode 100644 src/pages/travelMember/PointsRuleConfig/PointConfig.tsx create mode 100644 src/pages/travelMember/scenicSpotConfig/component/modalFooter.tsx create mode 100644 src/pages/travelMember/serverpartInfo/style.less diff --git a/src/layouts/BasicLayout.tsx b/src/layouts/BasicLayout.tsx index 789752d..d2b2328 100644 --- a/src/layouts/BasicLayout.tsx +++ b/src/layouts/BasicLayout.tsx @@ -29,8 +29,9 @@ import IconFont from '@/components/IconFont'; import type { CurrentUser } from '@/models/user' import session from '@/utils/session'; import upMenu from '@/assets/tab/upMenu.svg' -import { getFieldEnum, getFieldEnumTree, getFieldGetFieEnumList, getTravelFieldEnumTree, handleGetFieldEnumTreeTravel } from "@/services/options"; +import { getFieldEnum, getFieldEnumTravel, getFieldEnumTree, getFieldGetFieEnumList, getTravelFieldEnumTree, handleGetFieldEnumTreeTravel, handleGetNestingFIELDENUMList } from "@/services/options"; import { handleGetServerpartTree } from '@/pages/basicManage/serverpartAssets/service'; +import { handeGetNestingFIELDENUMList } from '@/pages/travelMember/service'; const { TabPane } = Tabs; @@ -205,6 +206,84 @@ const BasicLayout: React.FC = (props) => { // 拿到所有枚举的方法 const handleGetAllFieldEnum = async () => { + // 云南会员类型枚举 + getFieldEnumTravel({ FieldExplainField: 'MEMBERSHIP_TYPE', FieldEnumStatus: 1 }).then((MEMBERSHIPTYPEYN: any) => { + if (MEMBERSHIPTYPEYN && MEMBERSHIPTYPEYN.length > 0) { + const obj: any = {} + const list: any = [] + MEMBERSHIPTYPEYN.forEach((item: any) => { + list.push({ label: item.label, value: item.value }) + obj[item.value] = item.label + }) + session.set('MEMBERSHIPTYPEYNList', list); + session.set('MEMBERSHIPTYPEYNObj', obj); + session.set('MEMBERSHIPTYPEYNTree', MEMBERSHIPTYPEYN); + } + }) + + // 云南的会员等级枚举 + handeGetNestingFIELDENUMList({ + FIELDEXPLAIN_FIELD: 'MEMBERSHIP_LEVEL_YN', + FIELDEXPLAIN_ID: "", + FIELDENUM_PID: "", + FIELDENUM_STATUS: 1, + SearchKey: "" + }).then((MEMBERSHIPLEVELYN: any) => { + if (MEMBERSHIPLEVELYN && MEMBERSHIPLEVELYN.length > 0) { + const obj: any = {} + const list: any = [] + MEMBERSHIPLEVELYN.forEach((item: any) => { + list.push({ label: item.FIELDENUM_NAME, value: item.FIELDENUM_VALUE }) + obj[item.FIELDENUM_VALUE] = item.FIELDENUM_NAME + }) + session.set('MEMBERSHIPLEVELYNList', list); + session.set('MEMBERSHIPLEVELYNObj', obj); + session.set('MEMBERSHIPLEVELYNTree', MEMBERSHIPLEVELYN); + } + }) + // 云南的会员积分枚举 + handeGetNestingFIELDENUMList({ + FIELDEXPLAIN_FIELD: 'POINT_TYPE', + FIELDEXPLAIN_ID: "", + FIELDENUM_PID: "", + FIELDENUM_STATUS: 1, + SearchKey: "" + }).then((POINTTYPE: any) => { + if (POINTTYPE && POINTTYPE.length > 0) { + const obj: any = {} + const list: any = [] + POINTTYPE.forEach((item: any) => { + list.push({ label: item.FIELDENUM_NAME, value: item.FIELDENUM_VALUE }) + obj[item.FIELDENUM_VALUE] = item.FIELDENUM_NAME + }) + session.set('POINTTYPEList', list); + session.set('POINTTYPEObj', obj); + session.set('POINTTYPETree', POINTTYPE); + } + }) + + // 云南的会员成长值枚举 + handeGetNestingFIELDENUMList({ + FIELDEXPLAIN_FIELD: 'GROWTH_TYPE', + FIELDEXPLAIN_ID: "", + FIELDENUM_PID: "", + FIELDENUM_STATUS: 1, + SearchKey: "" + }).then((GROWTHTYPE: any) => { + if (GROWTHTYPE && GROWTHTYPE.length > 0) { + const obj: any = {} + const list: any = [] + GROWTHTYPE.forEach((item: any) => { + list.push({ label: item.FIELDENUM_NAME, value: item.FIELDENUM_VALUE }) + obj[item.FIELDENUM_VALUE] = item.FIELDENUM_NAME + }) + session.set('GROWTHTYPEList', list); + session.set('GROWTHTYPEObj', obj); + session.set('GROWTHTYPETree', GROWTHTYPE); + } + }) + + // 云南门店业态 handleGetFieldEnumTreeTravel({ FieldExplainField: 'BUSINESS_TRADE', FieldEnumStatus: false }).then((BUSINESSTRADEYN: any) => { if (BUSINESSTRADEYN && BUSINESSTRADEYN.length > 0) { @@ -388,6 +467,8 @@ const BasicLayout: React.FC = (props) => { } }) + + // 会员类型的枚举 // const MEMBERSHIPTYPE = getFieldEnumTree({ FieldExplainField: 'MEMBERSHIP_TYPE' }).then((MEMBERSHIPTYPE: any) => { diff --git a/src/pages/operatingMerchants/MerchantInformation/index.tsx b/src/pages/operatingMerchants/MerchantInformation/index.tsx index fce6658..1b4ad65 100644 --- a/src/pages/operatingMerchants/MerchantInformation/index.tsx +++ b/src/pages/operatingMerchants/MerchantInformation/index.tsx @@ -25,6 +25,9 @@ import session from '@/utils/session'; import PageTitleBox from '@/components/PageTitleBox'; import { handeGetCOMMENTList, handeGetPictureList, handeGetRevenueReport } from '@/pages/travelMember/service'; import { deletePicture, uploadPicture } from '@/services/picture'; +import { handleGetServerPartShopNewList } from '@/pages/basicManage/serviceArea/service'; +import { handleGetServerpartShopList } from '@/pages/DataVerification/service'; +import ModalFooter from '@/pages/travelMember/scenicSpotConfig/component/modalFooter'; const beforeUpload = (file: any) => { const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'; @@ -133,7 +136,10 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> = hideInSearch: true, ellipsis: true, render: (_, record) => { - return record?.SELLER_NAME ? `${record?.SERVERPART_NAME || ""}${record?.SELLER_NAME}` : "-" + return record?.SELLER_NAME ? { + setCurrentRow({ ...record }); + handleModalVisible(true); + }}>{`${record?.SERVERPART_NAME || ""}${record?.SELLER_NAME}`} : "-" } }, { @@ -279,38 +285,38 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> = align: 'center', hideInSearch: true, }, - { - dataIndex: 'option', - title: '操作', - valueType: 'option', - width: 120, - align: 'center', - fixed: 'right', - hideInSearch: true, - render: (_, record) => { - return ( - - { - console.log('recordrecordrecordrecord', record); - setCurrentRow({ ...record }); - handleModalVisible(true); - }} - > - 编辑 - - { - await handelDelete(record.SELLER_ID); - }} - > - 删除 - - - ); - }, - }, + // { + // dataIndex: 'option', + // title: '操作', + // valueType: 'option', + // width: 120, + // align: 'center', + // fixed: 'right', + // hideInSearch: true, + // render: (_, record) => { + // return ( + // + // { + // console.log('recordrecordrecordrecord', record); + // setCurrentRow({ ...record }); + // handleModalVisible(true); + // }} + // > + // 编辑 + // + // { + // await handelDelete(record.SELLER_ID); + // }} + // > + // 删除 + // + // + // ); + // }, + // }, ]; // 关联商家的表格 @@ -340,45 +346,46 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> = valueType: "select", valueEnum: shopregionObj }, - { - dataIndex: 'SCANCODE_ORDER', - title: '扫码点餐', - align: 'center', - width: 120, - hideInSearch: true, - valueType: "select", - valueEnum: { - "0": "禁用", - "1": "启用" - } - }, + // { + // dataIndex: 'SCANCODE_ORDER', + // title: '扫码点餐', + // align: 'center', + // width: 120, + // hideInSearch: true, + // valueType: "select", + // valueEnum: { + // "0": "禁用", + // "1": "启用" + // } + // }, { dataIndex: 'BUSINESS_STATE', title: '经营状态', align: 'center', width: 120, valueType: "select", + hideInSearch: true, valueEnum: businessStateObj }, - { - dataIndex: 'SHOPDIRECTION', - title: '门店方向', - align: 'center', - width: 120, - ellipsis: true, - hideInSearch: true, - }, - { - dataIndex: 'ISVALID', - title: '门店状态', - align: 'center', - width: 120, - valueEnum: { - "0": "无效", - "1": "有效" - }, - initialValue: "1" - }, + // { + // dataIndex: 'SHOPDIRECTION', + // title: '门店方向', + // align: 'center', + // width: 120, + // ellipsis: true, + // hideInSearch: true, + // }, + // { + // dataIndex: 'ISVALID', + // title: '门店状态', + // align: 'center', + // width: 120, + // valueEnum: { + // "0": "无效", + // "1": "有效" + // }, + // initialValue: "1" + // }, { dataIndex: 'SERVERPARTSHOP_DESC', title: '介绍说明', @@ -466,25 +473,25 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> = width: 150, align: 'center' }, - { - title: "操作", - dataIndex: "option", - width: 120, - align: 'center', - render: (_, record) => { - return - { - await handleRemoveSeller(record) - }} - > - 解除关联 - + // { + // title: "操作", + // dataIndex: "option", + // width: 120, + // align: 'center', + // render: (_, record) => { + // return + // { + // await handleRemoveSeller(record) + // }} + // > + // 解除关联 + // - - } - } + // + // } + // } ] // 评论信息表格 @@ -581,6 +588,11 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> = } else { message.success('删除成功!'); actionRef.current?.reload() + + setShowAddModal(false) + setSelectRowKeys(null) + setSelectRowDetail(null) + setSelectAssociationServerpart(null) } }; @@ -740,8 +752,8 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> = setRevenueLoading(false) console.log('datadata', data); if (data && data.length > 0) { + message.success('获取成功!') let obj: any = data[0] - formRef.current?.setFieldsValue({ MONTHLYSALES: obj.TotalRevenue.Ticket_Count || "0", CASHPAY: obj.TotalRevenue.Revenue_Amount || "0", @@ -766,6 +778,106 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> = }; + // 新增的确认按钮的方法 + const handleModalOk = async () => { + // 判断是新增 还是关联 看看有没有 SELLER_ID 有就是关联 没有就是新增 + if (currentRow?.SELLER_ID) { + if (!(selectedRowKeys && selectedRowKeys.length > 0)) { + message.error('请选择要关联的门店!') + return + } + // 关联 接口 + const req: any = { + SellerId: currentRow?.SELLER_ID, + ShopIds: selectedRowKeys.toString() + } + const data = await handleGetRelateShopToSeller(req) + if (data.Result_Code === 100) { + message.success(data.Result_Desc) + setShowAddModal(false) + setSelectRowKeys(null) + setSelectRowDetail(null) + // formRef.current?.resetFields() + handleGetMemberDetail() + setSelectAssociationServerpart(null) + } else { + message.error(data.Result_Desc) + } + } else { + if (!(selectedRowKeys && selectedRowKeys.length > 0)) { + setShowAddModal(false) + setSelectRowKeys(null) + setSelectRowDetail(null) + setSelectAssociationServerpart(null) + } else { + console.log('selectedRowDetailselectedRowDetailselectedRowDetailselectedRowDetail', selectedRowDetail); + // 必须要是同一商户的 才能进去 + let sellIdList: any = [] + let SHOPTRADEList: any = [] + let serverpartList: any = [] + let SERVERPARTSHOP_IDS: string = '' + selectedRowDetail.forEach((item: any) => { + if (sellIdList.indexOf(item.SELLER_ID) === -1) { + sellIdList.push(item.SELLER_ID) + } + if (SHOPTRADEList.indexOf(item.SHOPTRADE) === -1) { + SHOPTRADEList.push(item.SHOPTRADE) + } + if (serverpartList.indexOf(item.SERVERPART_ID) === -1) { + serverpartList.push(item.SERVERPART_ID) + } + if (item.SERVERPARTSHOP_ID) { + if (SERVERPARTSHOP_IDS) { + SERVERPARTSHOP_IDS += `,${item.SERVERPARTSHOP_ID}` + } else { + SERVERPARTSHOP_IDS = `${item.SERVERPARTSHOP_ID}` + } + } + }) + + console.log('sellIdListsellIdListsellIdList', sellIdList); + console.log('SHOPTRADEListSHOPTRADEListSHOPTRADEList', SHOPTRADEList); + if (sellIdList && sellIdList.length > 1) { + message.error("仅支持选择一个商家!") + return + } + + if (SHOPTRADEList && SHOPTRADEList.length > 1) { + message.error("仅支持选择一种业态!") + return + } + + if (serverpartList && serverpartList.length > 1) { + message.error("仅支持选择一个服务区!") + return + } + let obj: any = selectedRowDetail[0] + + // 调用商家详情 + const req: any = { + SERVERPARTSELLERId: sellIdList[0] + } + const detail: any = await handleGetSERVERPARTSELLERDetail(req) + setShowAddModal(false) + setSelectRowKeys(null) + setSelectRowDetail(null) + setSelectAssociationServerpart(null) + setCurrentShopData(selectedRowDetail) + + setCurrentRow({ + ...detail, + SHOPTRADE: obj.SHOPTRADE, + SERVERPART_ID: Number(obj.SERVERPART_ID), + SERVERPARTSHOP_IDS: SERVERPARTSHOP_IDS, + SERVERPART_NAME: obj.SERVERPART_NAME + }) + handleModalVisible(true) + + } + } + } + + return (
@@ -819,8 +931,8 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> = icon={} type="primary" onClick={() => { - // setShowAddModal(true) - handleModalVisible(true); + setShowAddModal(true) + // handleModalVisible(true); }} > 服务区商家信息 @@ -867,39 +979,38 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> = { }} + bodyStyle={{ + height: '700px', // 你可以根据需要调整高度 + overflowY: 'auto', + }} onCancel={() => { setShowAddModal(false) setSelectRowKeys(null) setSelectRowDetail(null) + setSelectAssociationServerpart(null) }} - okText={"关联"} + okText={currentRow?.SELLER_ID ? "关联" : "确认"} onOk={async () => { // 提交框内的数据 - if (!(selectedRowKeys && selectedRowKeys.length > 0)) { - message.error('请选择要关联的门店!') - return - } - - // 关联 接口 - const req: any = { - SellerId: currentRow?.SELLER_ID, - ShopIds: selectedRowKeys.toString() - } - const data = await handleGetRelateShopToSeller(req) - if (data.Result_Code === 100) { - message.success(data.Result_Desc) - setShowAddModal(false) - setSelectRowKeys(null) - setSelectRowDetail(null) - // formRef.current?.resetFields() - handleGetMemberDetail() - } else { - message.error(data.Result_Desc) - } + handleModalOk() }} + // footer={ { + // await handelDelete(currentRow?.SELLER_ID) + // }} + // handleCancel={() => { + // setShowAddModal(false) + // setSelectRowKeys(null) + // setSelectRowDetail(null) + // setSelectAssociationServerpart(null) + // }} + // handleOK={() => { + // handleModalOk() + // }} />} >
@@ -915,26 +1026,51 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> = return } const req: any = { - searchParameter: { + SearchParameter: { SERVERPART_IDS: selectAssociationServerpart, - ISVALID: params?.ISVALID, - BUSINESS_STATE: params?.BUSINESS_STATE + ISVALID: 1 }, PageIndex: 1, PageSize: 999999, - SortStr: "SHOPTRADE,SHOPREGION,SHOPSHORTNAME,SHOPCODE" + SortStr: "SHOPTRADE,SHOPSHORTNAME,SHOPREGION,SERVERPART_CODE", } - const data = await handleGetSERVERPARTSHOPList(req) - if (data.List && data.List.length > 0) { + const data = await handleGetServerpartShopList(req) + console.log('datadatadatadatadata', data); + if (data && data.length > 0) { let list: any = [] - data.List.forEach((item: any) => { - if (!item.SELLER_ID) { + data.forEach((item: any) => { + if (item.SELLER_ID && item.SHOPTRADE) { list.push(item) } }) return { data: list, success: true } } return { data: [], success: true } + + // if (!selectAssociationServerpart) { + // return + // } + // const req: any = { + // searchParameter: { + // SERVERPART_IDS: selectAssociationServerpart, + // ISVALID: params?.ISVALID, + // BUSINESS_STATE: params?.BUSINESS_STATE + // }, + // PageIndex: 1, + // PageSize: 999999, + // SortStr: "SHOPTRADE,SHOPREGION,SHOPSHORTNAME,SHOPCODE" + // } + // const data = await handleGetSERVERPARTSHOPList(req) + // if (data.List && data.List.length > 0) { + // let list: any = [] + // data.List.forEach((item: any) => { + // if (!item.SELLER_ID) { + // list.push(item) + // } + // }) + // return { data: list, success: true } + // } + // return { data: [], success: true } }} pagination={false} rowSelection={{ @@ -976,10 +1112,10 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> = } destroyOnClose={true} bodyStyle={{ - maxHeight: '700px', // 你可以根据需要调整高度 + height: '700px', // 你可以根据需要调整高度 overflowY: 'auto', }} - width={'65%'} + width={1200} visible={modalVisible} confirmLoading={confirmLoading} afterClose={() => { @@ -1013,13 +1149,13 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> = }} footer={
- { - currentRow?.SELLER_ID ? + // currentRow?.SELLER_ID ? + currentRow?.SERVERPART_ID ?
- + }}>关联门店 */} @@ -1050,11 +1186,14 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> = autoFocusFirstInput submitter={false} preserve={false} + labelCol={{ style: { width: 100 } }} request={async () => { const data = await handleGetMemberDetail() let list1: any = [] let list2: any = [] let list3: any = [] + console.log('currentRowcurrentRowcurrentRowcurrentRow', currentRow); + if (currentRow?.IconList && currentRow?.IconList.length > 0) { currentRow?.IconList.forEach((item: any) => { @@ -1164,6 +1303,7 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> = return { ...data, SHOPTRADE: currentRow?.SHOPTRADE ? Number(currentRow?.SHOPTRADE) : "", + SERVERPART_ID: currentRow?.SERVERPART_ID ? Number(currentRow?.SERVERPART_ID) : "", // MerchantLogo: list1, // DoorImage: list2, // InteriorImage: list3, @@ -1211,6 +1351,7 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> = message: '请输入商家名称!' } ]} + disabled={currentRow?.SELLER_NAME} /> @@ -1231,6 +1372,7 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> = message: '请选择门店业态!' } ]} + disabled={currentRow?.SHOPTRADE} /> @@ -1261,6 +1403,7 @@ const MerchantInformation: React.FC<{ currentUser: CurrentUser | undefined }> = filterOption: (input, option) => (option?.label ?? '').toLowerCase().includes(input.toLowerCase()) }} + disabled={currentRow?.SERVERPART_ID} /> diff --git a/src/pages/reports/settlementAccount/component/leftSelectTree.tsx b/src/pages/reports/settlementAccount/component/leftSelectTree.tsx index 5708976..b2d858e 100644 --- a/src/pages/reports/settlementAccount/component/leftSelectTree.tsx +++ b/src/pages/reports/settlementAccount/component/leftSelectTree.tsx @@ -11,6 +11,7 @@ import { getServerpartTree } from "@/services/options"; import useRequest from "@ahooksjs/use-request"; import './style.less' import { getMerchantShopTree } from "@/pages/Setting/Users/service"; +import session from "@/utils/session"; type DetailProps = { @@ -39,7 +40,12 @@ const LeftSelectTree = ({ setSelectedId, reload, actionRef, currentUser, width, if (currentUser?.UserPattern === 2000) { data = await getMerchantShopTree({ BusinessManId: currentUser?.BusinessManID, ShowShop: false }); } else { - data = await getServerpartTree(currentUser?.ProvinceCode, currentUser?.CityAuthority, true, true, true) + let SERVERPARTTree = session.get('SERVERPARTTree') + if (SERVERPARTTree) { + data = SERVERPARTTree + } else { + data = await getServerpartTree(currentUser?.ProvinceCode, currentUser?.CityAuthority, true, true, true) + } } console.log('datatree', data); diff --git a/src/pages/travelMember/AfterSalesManage/index.tsx b/src/pages/travelMember/AfterSalesManage/index.tsx index 4b84307..62ee042 100644 --- a/src/pages/travelMember/AfterSalesManage/index.tsx +++ b/src/pages/travelMember/AfterSalesManage/index.tsx @@ -1,15 +1,523 @@ -// 点餐售后管理 -import { ConnectState } from "@/models/connect"; -import { connect, CurrentUser } from "umi"; +// 点餐售后管理 售后服务管理 +// 点餐类别管理 点餐分类管理 +import React, { useRef, useState, Suspense } from 'react'; +import moment from 'moment'; // 时间相关引用,没有使用可以删除 +import numeral from "numeral"; // 数字相关引用,没有使用可以删除 +import { connect } from 'umi'; -const AfterSalesManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { - return ( -
+import useRequest from '@ahooksjs/use-request'; // 请求数据的引用 +import Draggable from 'react-draggable'; +import SubMenu from "antd/lib/menu/SubMenu"; +import ProTable from '@ant-design/pro-table'; +import ProDescriptions from '@ant-design/pro-descriptions'; +import ProForm, { ProFormDatePicker, ProFormDateTimePicker, ProFormDateTimeRangePicker, ProFormDigit, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormTreeSelect, ProFormUploadButton } from '@ant-design/pro-form'; +import { MenuFoldOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons'; +import { PageContainer } from '@ant-design/pro-layout'; +import { Button, Col, Drawer, message, Row, Popconfirm, Space, Image, Modal, Form, Switch, Upload, Tooltip, Descriptions, TreeSelect } from 'antd'; -
- ) +import type { CurrentUser } from "umi"; +import type { ConnectState } from '@/models/connect'; +import type { ActionType, ProColumns } from '@ant-design/pro-table'; +import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions'; +import type { FormInstance } from 'antd'; + +import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除 +import { handeDeleteFIELDENUM, handeGetFIELDENUMList, handeGetFIELDEXPLAINList, handeGetNestingFIELDENUMList, handeSynchroFIELDENUM, handlDeleteUSERDEFINEDTYPE, handlGetUSERDEFINEDTYPEList, handlSynchroUSERDEFINEDTYPE } from '../service'; +import PageTitleBox from '@/components/PageTitleBox'; +import { uploadPicture } from '@/services/picture'; +import defaultIcon from '../../../assets/brand/defaultIcon.png' +import classNames from 'classnames'; +import session from '@/utils/session'; +import ModalFooter from '../scenicSpotConfig/component/modalFooter'; + + +const beforeUpload = (file: any) => { + const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'; + if (!isJpgOrPng) { + message.error('请上传JPEG、jpg、png格式的图片文件!'); + } + const isLt2M = file.size / 1024 / 1024 < 2; + if (!isLt2M) { + message.error('图片大小不超过 2MB!'); + } + return isJpgOrPng && isLt2M; } + +const AfterSalesManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { + const { currentUser } = props + const { confirm } = Modal; + const actionRef = useRef(); + const formRef = useRef(); + const [currentRow, setCurrentRow] = useState(); + const [showDetail, setShowDetail] = useState(); + const [modalVisible, handleModalVisible] = useState(); + const [confirmLoading, handleConfirmLoading] = useState(false) // 弹出框的内容表单是否在提交 + const [searchParams, setSearchParams] = useState(); + // 分类的树形结构数据 + const [typeTreeData, setTypeTreeData] = useState() + // 表单里面的是否预售 + const [formPRESALE_TYPE, setFormPRESALE_TYPE] = useState(false) + + // 弹出框拖动效果 + const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置 + const [disabled, setDraggleDisabled] = useState() // 是否拖动 + const draggleRef = React.createRef() + + let AFTERSALETYPEObj = session.get('AFTERSALETYPEObj') + const { data: FIELDEXPLAIN_ID } = useRequest(async () => { + const req: any = { + SearchParameter: { + FIELDEXPLAIN_FIELD: "AFTERSALE_TYPE" + } + } + const data = await handeGetFIELDEXPLAINList(req) + if (data && data.length > 0) { + let obj: any = data[0] + return obj.FIELDEXPLAIN_ID + } + + }) + // 文件列表 + const [fileList, setFileList] = useState([]) + const [imagePreviewVisible, setImagePreviewVisible] = useState(false) // 预览图片 + + 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 columns: any = [ + { + dataIndex: 'FIELDENUM_NAME', + title: '类别名称', + align: 'center', + width: 300, + ellipsis: true, + hideInSearch: true, + hideInDescriptions: true, + render: (_, record) => { + return { + setCurrentRow({ ...record }); + handleModalVisible(true); + }} + >{record?.FIELDENUM_NAME || ""} + } + }, + { + dataIndex: 'FIELDENUM_VALUE', + title: '售后枚举', + align: 'center', + width: 120, + ellipsis: true, + // valueType: 'treeSelect', + // valueEnum: typeTreeData, + hideInSearch: true, + }, + { + dataIndex: 'FIELDENUM_INDEX', + title: '类别索引', + align: 'center', + width: 120, + ellipsis: true, + hideInSearch: true, + }, + { + dataIndex: 'FIELDENUM_STATUS', + title: '有效状态', + align: 'center', + width: 120, + ellipsis: true, + valueType: "select", + valueEnum: { + "1": "有效", + "0": "无效" + }, + initialValue: "1" + }, + { + dataIndex: 'FIELDENUM_DESC', + title: '备注说明', + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + // { + // dataIndex: 'option', + // title: '操作', + // width: 100, + // ellipsis: true, + // valueType: 'option', + // align: 'center', + // hideInSearch: true, + // render: (_, record) => { + // return ( + // + // { + // setCurrentRow({ ...record }); + // handleModalVisible(true); + // }} + // > + // 编辑 + // + // { + // handelDelete(record.FIELDENUM_ID); + // }} + // > + // 删除 + // + // + // ); + // }, + // }, + ]; + + // 预览上传后的图片 + const handlePreview = async () => { + setFileList(fileList) + setImagePreviewVisible(true) + }; + const handleChangePreview = (val: any) => { + setImagePreviewVisible(val) + } + + // 删除点餐类别 + const handelDelete = async (id: any) => { + const req: any = { + FIELDENUMId: id + } + const result = await handeDeleteFIELDENUM(req) + if (result.Result_Code !== 100) { + message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`); + } else { + message.success('删除成功!'); + actionRef.current?.reload() + handleConfirmLoading(false) + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) + } + } + + // 同步点餐列表 + const handleAddUpdate = async (res: any) => { + let req: any = {} + if (currentRow?.FIELDENUM_ID) { + req = { + ...currentRow, + ...res, + } + } else { + req = { + ...res, + FIELDEXPLAIN_ID: FIELDEXPLAIN_ID, + FIELDENUM_PID: -1, + } + } + const data = await handeSynchroFIELDENUM(req) + handleConfirmLoading(false) + if (data.Result_Code === 100) { + message.success("新增成功!") + setCurrentRow(undefined) + formRef?.current?.resetFields() + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) + actionRef.current?.reload() + } else { + message.error(data.Result_Desc) + } + } + + return ( + + { + return `${record?.FIELDENUM_PID}-${record?.FIELDENUM_ID}` + }} + formRef={formRef} + headerTitle={} // 列表表头 + actionRef={actionRef} + search={{ span: 6, labelWidth: 'auto' }} + bordered + // 请求数据 + request={async (params, sorter) => { + const req = { + FIELDEXPLAIN_FIELD: 'AFTERSALE_TYPE', + FIELDEXPLAIN_ID: "", + FIELDENUM_PID: "", + FIELDENUM_STATUS: params?.FIELDENUM_STATUS, + SearchKey: "" + } + const data = await handeGetNestingFIELDENUMList(req); + if (data && data.length > 0) { + setTypeTreeData(data) + return { data: data, success: true, total: data.length } + } + return { data: [], success: true } + }} + columns={columns} + toolbar={{ + actions: [ + // 新增按钮 + , + ], + }} + /> + + {/* 图片预览组件 */} + {fileList && fileList.length > 0 &&
+ { + handleChangePreview(vis) + } + }}> + { + fileList.map((n) => ) + } + +
} + + + { + if (disabled) { + setDraggleDisabled(false) + } + }} + onMouseOut={() => { + setDraggleDisabled(true) + }} + + onFocus={() => { }} + onBlur={() => { }} + > + {currentRow ? '更新售后类别' : '新建售后类别'} +
+ } + destroyOnClose={true} + width={900} + bodyStyle={{ + height: '700px', // 你可以根据需要调整高度 + overflowY: 'auto', + }} + visible={modalVisible} + confirmLoading={confirmLoading} + afterClose={() => { + formRef.current?.resetFields(); + setCurrentRow(undefined); + }} + footer={ { + await handelDelete(currentRow?.FIELDENUM_ID) + }} + handleCancel={() => { + handleConfirmLoading(false) + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) + }} + handleOK={() => { + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} + + />} + onCancel={() => { + handleConfirmLoading(false) + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) + }} + + onOk={async () => { // 提交框内的数据 + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} + modalRender={(modal) => { + return onDraggaleStart(event, uiData)} + handle='.orderCategoryModal' + > +
{modal}
+
+ }} + > + { + let newValue = { ...values }; + if (currentRow) { + // 编辑数据 + newValue = { ...values, FIELDENUM_ID: currentRow.FIELDENUM_ID }; + } + // 如果有开关,要把开关的代码写进去 + await handleAddUpdate(newValue); + + handleConfirmLoading(false) + setFormPRESALE_TYPE(false) + }} + > + + {/* + { + if (typeTreeData && typeTreeData.length > 0) { + let list: any = [{ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 }, ...typeTreeData] + return list + } else { + const req = { + FIELDEXPLAIN_FIELD: 'AFTERSALE_TYPE', + FIELDEXPLAIN_ID: "", + FIELDENUM_PID: "", + FIELDENUM_STATUS: 1, + SearchKey: "" + } + const data = await handeGetNestingFIELDENUMList(req); + if (data && data.length > 0) { + data.unshirft({ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 }) + setTypeTreeData(data) + return data + } else { + return [{ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 }] + } + } + }} + fieldProps={{ + fieldNames: { + label: 'FIELDENUM_NAME', + value: 'FIELDENUM_ID', + children: 'children' + }, + showSearch: true, + filterTreeNode: (input, node) => + (node.FIELDENUM_NAME || '').toLowerCase().includes(input.toLowerCase()) + }} + rules={[ + { + required: true, + message: "请选择上级类别" + } + ]} + /> + */} + + + + + + + + + + + + + + + + + + + + + ); +}; export default connect(({ user }: ConnectState) => ({ currentUser: user.currentUser }))(AfterSalesManage); \ No newline at end of file diff --git a/src/pages/travelMember/AfterSalesTypeManage/index.tsx b/src/pages/travelMember/AfterSalesTypeManage/index.tsx index de22935..e00ca4d 100644 --- a/src/pages/travelMember/AfterSalesTypeManage/index.tsx +++ b/src/pages/travelMember/AfterSalesTypeManage/index.tsx @@ -1,15 +1,522 @@ // 售后类型管理 -import { ConnectState } from "@/models/connect"; -import { connect, CurrentUser } from "umi"; +import React, { useRef, useState, Suspense } from 'react'; +import moment from 'moment'; // 时间相关引用,没有使用可以删除 +import numeral from "numeral"; // 数字相关引用,没有使用可以删除 +import { connect } from 'umi'; -const AfterSalesTypeManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { - return ( -
+import useRequest from '@ahooksjs/use-request'; // 请求数据的引用 +import Draggable from 'react-draggable'; +import SubMenu from "antd/lib/menu/SubMenu"; +import ProTable from '@ant-design/pro-table'; +import ProDescriptions from '@ant-design/pro-descriptions'; +import ProForm, { ProFormDatePicker, ProFormDateTimePicker, ProFormDateTimeRangePicker, ProFormDigit, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormTreeSelect, ProFormUploadButton } from '@ant-design/pro-form'; +import { MenuFoldOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons'; +import { PageContainer } from '@ant-design/pro-layout'; +import { Button, Col, Drawer, message, Row, Popconfirm, Space, Image, Modal, Form, Switch, Upload, Tooltip, Descriptions, TreeSelect } from 'antd'; -
- ) +import type { CurrentUser } from "umi"; +import type { ConnectState } from '@/models/connect'; +import type { ActionType, ProColumns } from '@ant-design/pro-table'; +import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions'; +import type { FormInstance } from 'antd'; + +import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除 +import { handeDeleteFIELDENUM, handeGetFIELDENUMList, handeGetFIELDEXPLAINList, handeGetNestingFIELDENUMList, handeSynchroFIELDENUM, handlDeleteUSERDEFINEDTYPE, handlGetUSERDEFINEDTYPEList, handlSynchroUSERDEFINEDTYPE } from '../service'; +import PageTitleBox from '@/components/PageTitleBox'; +import { uploadPicture } from '@/services/picture'; +import defaultIcon from '../../../assets/brand/defaultIcon.png' +import classNames from 'classnames'; +import session from '@/utils/session'; +import ModalFooter from '../scenicSpotConfig/component/modalFooter'; + + +const beforeUpload = (file: any) => { + const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'; + if (!isJpgOrPng) { + message.error('请上传JPEG、jpg、png格式的图片文件!'); + } + const isLt2M = file.size / 1024 / 1024 < 2; + if (!isLt2M) { + message.error('图片大小不超过 2MB!'); + } + return isJpgOrPng && isLt2M; } + +const AfterSalesManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { + const { currentUser } = props + const { confirm } = Modal; + const actionRef = useRef(); + const formRef = useRef(); + const [currentRow, setCurrentRow] = useState(); + const [showDetail, setShowDetail] = useState(); + const [modalVisible, handleModalVisible] = useState(); + const [confirmLoading, handleConfirmLoading] = useState(false) // 弹出框的内容表单是否在提交 + const [searchParams, setSearchParams] = useState(); + // 分类的树形结构数据 + const [typeTreeData, setTypeTreeData] = useState() + // 表单里面的是否预售 + const [formPRESALE_TYPE, setFormPRESALE_TYPE] = useState(false) + + // 弹出框拖动效果 + const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置 + const [disabled, setDraggleDisabled] = useState() // 是否拖动 + const draggleRef = React.createRef() + + let AFTERSALETYPEObj = session.get('AFTERSALETYPEObj') + const { data: FIELDEXPLAIN_ID } = useRequest(async () => { + const req: any = { + SearchParameter: { + FIELDEXPLAIN_FIELD: "AFTERSALE_TYPE" + } + } + const data = await handeGetFIELDEXPLAINList(req) + if (data && data.length > 0) { + let obj: any = data[0] + return obj.FIELDEXPLAIN_ID + } + + }) + // 文件列表 + const [fileList, setFileList] = useState([]) + const [imagePreviewVisible, setImagePreviewVisible] = useState(false) // 预览图片 + + 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 columns: any = [ + { + dataIndex: 'FIELDENUM_NAME', + title: '类别名称', + align: 'center', + width: 300, + ellipsis: true, + hideInSearch: true, + hideInDescriptions: true, + render: (_, record) => { + return { + setCurrentRow({ ...record }); + handleModalVisible(true); + }} + >{record?.FIELDENUM_NAME || ""} + } + }, + { + dataIndex: 'FIELDENUM_VALUE', + title: '售后枚举', + align: 'center', + width: 120, + ellipsis: true, + // valueType: 'treeSelect', + // valueEnum: typeTreeData, + hideInSearch: true, + }, + { + dataIndex: 'FIELDENUM_INDEX', + title: '类别索引', + align: 'center', + width: 120, + ellipsis: true, + hideInSearch: true, + }, + { + dataIndex: 'FIELDENUM_STATUS', + title: '有效状态', + align: 'center', + width: 120, + ellipsis: true, + valueType: "select", + valueEnum: { + "1": "有效", + "0": "无效" + }, + initialValue: "1" + }, + { + dataIndex: 'FIELDENUM_DESC', + title: '备注说明', + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + // { + // dataIndex: 'option', + // title: '操作', + // width: 100, + // ellipsis: true, + // valueType: 'option', + // align: 'center', + // hideInSearch: true, + // render: (_, record) => { + // return ( + // + // { + // setCurrentRow({ ...record }); + // handleModalVisible(true); + // }} + // > + // 编辑 + // + // { + // handelDelete(record.FIELDENUM_ID); + // }} + // > + // 删除 + // + // + // ); + // }, + // }, + ]; + + // 预览上传后的图片 + const handlePreview = async () => { + setFileList(fileList) + setImagePreviewVisible(true) + }; + const handleChangePreview = (val: any) => { + setImagePreviewVisible(val) + } + + // 删除点餐类别 + const handelDelete = async (id: any) => { + const req: any = { + FIELDENUMId: id + } + const result = await handeDeleteFIELDENUM(req) + if (result.Result_Code !== 100) { + message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`); + } else { + message.success('删除成功!'); + actionRef.current?.reload() + handleConfirmLoading(false) + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) + } + } + + // 同步点餐列表 + const handleAddUpdate = async (res: any) => { + let req: any = {} + if (currentRow?.FIELDENUM_ID) { + req = { + ...currentRow, + ...res, + } + } else { + req = { + ...res, + FIELDEXPLAIN_ID: FIELDEXPLAIN_ID, + FIELDENUM_PID: -1, + } + } + const data = await handeSynchroFIELDENUM(req) + handleConfirmLoading(false) + if (data.Result_Code === 100) { + message.success("新增成功!") + setCurrentRow(undefined) + formRef?.current?.resetFields() + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) + actionRef.current?.reload() + } else { + message.error(data.Result_Desc) + } + } + + return ( + + { + return `${record?.FIELDENUM_PID}-${record?.FIELDENUM_ID}` + }} + formRef={formRef} + headerTitle={} // 列表表头 + actionRef={actionRef} + search={{ span: 6, labelWidth: 'auto' }} + bordered + // 请求数据 + request={async (params, sorter) => { + const req = { + FIELDEXPLAIN_FIELD: 'AFTERSALE_TYPE', + FIELDEXPLAIN_ID: "", + FIELDENUM_PID: "", + FIELDENUM_STATUS: params?.FIELDENUM_STATUS, + SearchKey: "" + } + const data = await handeGetNestingFIELDENUMList(req); + if (data && data.length > 0) { + setTypeTreeData(data) + return { data: data, success: true, total: data.length } + } + return { data: [], success: true } + }} + columns={columns} + toolbar={{ + actions: [ + // 新增按钮 + , + ], + }} + /> + + {/* 图片预览组件 */} + {fileList && fileList.length > 0 &&
+ { + handleChangePreview(vis) + } + }}> + { + fileList.map((n) => ) + } + +
} + + + { + if (disabled) { + setDraggleDisabled(false) + } + }} + onMouseOut={() => { + setDraggleDisabled(true) + }} + + onFocus={() => { }} + onBlur={() => { }} + > + {currentRow ? '更新售后类别' : '新建售后类别'} +
+ } + destroyOnClose={true} + width={900} + bodyStyle={{ + height: '700px', // 你可以根据需要调整高度 + overflowY: 'auto', + }} + visible={modalVisible} + confirmLoading={confirmLoading} + afterClose={() => { + formRef.current?.resetFields(); + setCurrentRow(undefined); + }} + footer={ { + await handelDelete(currentRow?.FIELDENUM_ID) + }} + handleCancel={() => { + handleConfirmLoading(false) + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) + }} + handleOK={() => { + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} + + />} + onCancel={() => { + handleConfirmLoading(false) + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) + }} + + onOk={async () => { // 提交框内的数据 + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} + modalRender={(modal) => { + return onDraggaleStart(event, uiData)} + handle='.orderCategoryModal' + > +
{modal}
+
+ }} + > + { + let newValue = { ...values }; + if (currentRow) { + // 编辑数据 + newValue = { ...values, FIELDENUM_ID: currentRow.FIELDENUM_ID }; + } + // 如果有开关,要把开关的代码写进去 + await handleAddUpdate(newValue); + + handleConfirmLoading(false) + setFormPRESALE_TYPE(false) + }} + > + + {/* + { + if (typeTreeData && typeTreeData.length > 0) { + let list: any = [{ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 }, ...typeTreeData] + return list + } else { + const req = { + FIELDEXPLAIN_FIELD: 'AFTERSALE_TYPE', + FIELDEXPLAIN_ID: "", + FIELDENUM_PID: "", + FIELDENUM_STATUS: 1, + SearchKey: "" + } + const data = await handeGetNestingFIELDENUMList(req); + if (data && data.length > 0) { + data.unshirft({ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 }) + setTypeTreeData(data) + return data + } else { + return [{ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 }] + } + } + }} + fieldProps={{ + fieldNames: { + label: 'FIELDENUM_NAME', + value: 'FIELDENUM_ID', + children: 'children' + }, + showSearch: true, + filterTreeNode: (input, node) => + (node.FIELDENUM_NAME || '').toLowerCase().includes(input.toLowerCase()) + }} + rules={[ + { + required: true, + message: "请选择上级类别" + } + ]} + /> + */} + + + + + + + + + + + + + + + + + + + + + ); +}; export default connect(({ user }: ConnectState) => ({ currentUser: user.currentUser -}))(AfterSalesTypeManage); \ No newline at end of file +}))(AfterSalesManage); \ No newline at end of file diff --git a/src/pages/travelMember/BookingMealOrder/components/orderDetailModal.tsx b/src/pages/travelMember/BookingMealOrder/components/orderDetailModal.tsx new file mode 100644 index 0000000..9d5300a --- /dev/null +++ b/src/pages/travelMember/BookingMealOrder/components/orderDetailModal.tsx @@ -0,0 +1,385 @@ +import { connect } from "umi"; +import type { ConnectState } from "@/models/connect"; +import { Col, FormInstance, Modal, Row } from "antd"; +import { useRef, useState } from "react"; +import Draggable from "react-draggable"; +import React from "react"; +import ProForm, { ProFormSelect, ProFormText } from "@ant-design/pro-form"; +import moment from 'moment' +import orderIcon from '@/assets/detail/orderIcon.png' +import closeIcon from '@/assets/detail/closeIcon.png' +import ProTable from "@ant-design/pro-table"; +import { handeGetSALEBILLList, handeGetSALEDETAILList } from "../../service"; +import './style.less' + +type DetailProps = { + modalVisible: boolean //显示属性 + handleCloseModal: any // 关闭调用的方法 + currentRow: any +} +const OrderDetailModal = ({ modalVisible, handleCloseModal, currentRow }: DetailProps) => { + const formRef = useRef(); + const draggleRef = React.createRef() + const modalRef = useRef(); + + const [confirmLoading, handleConfirmLoading] = useState(false) // 弹出框的内容表单是否在提交 + // const [currentRow, setCurrentRow] = useState(); + const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置 + const [disabled, setDraggleDisabled] = useState() // 是否拖动 + + const onDraggaleStart = (event, uiData) => { + const { clientWidth, clientHeight } = window.document.documentElement; + const targetRect = draggleRef.current?.getBoundingClientRect(); + if (!targetRect) { + return; + } + setBounds({ + left: -targetRect.left + uiData.x, + right: clientWidth - (targetRect.right - uiData.x), + top: -targetRect.top + uiData.y, + bottom: clientHeight - (targetRect.bottom - uiData.y), + }); + }; + + // 订单详情的表格 + const orderDetailColumns: any = [ + { + dataIndex: "index", + title: "序号", + align: 'center', + hideInSearch: true, + valueType: "index", + width: 70, + ellipsis: true, + }, + { + dataIndex: 'COMMODITY_NAME', + title: '商品名称', + align: 'center', + hideInSearch: true, + width: 150, + ellipsis: true, + }, + { + dataIndex: 'COMMODITY_BARCODE', + title: '商品条码', + align: 'center', + hideInSearch: true, + width: 150, + ellipsis: true, + }, + { + dataIndex: 'ORDER_COUNT', + title: '数量', + align: 'center', + hideInSearch: true, + width: 150, + ellipsis: true, + }, + { + dataIndex: 'AVERAGE_PRICE', + title: '单价', + align: 'center', + hideInSearch: true, + width: 150, + ellipsis: true, + }, + { + dataIndex: 'ORDER_AMOUNT', + title: '金额', + align: 'center', + hideInSearch: true, + width: 150, + ellipsis: true, + }, + ] + + return ( +
+
} + destroyOnClose={true} + width={1200} + visible={modalVisible} + confirmLoading={confirmLoading} + afterClose={() => { + formRef.current?.resetFields(); + // setCurrentRow(undefined); + }} + onCancel={() => { + handleConfirmLoading(false) + // handleModalVisible(false) + // setCurrentRow(undefined); + }} + footer={false} + modalRender={(modal) => { + return onDraggaleStart(event, uiData)} + handle=".bookingOrderModalTop" + > +
{modal}
+
+ }} + > + +
+
+ + 订单详情 +
+
+ { + if (handleCloseModal) { + handleCloseModal() + } + }} /> +
+
+ +
+
订单信息
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + { + let SALEBILL_ID: string = '' + if (!currentRow?.SALEBILL_ID) { + const req: any = { + searchParameter: { + SALEBILL_CODE: currentRow?.TICKET_CODE + }, + PageIndex: 1, + PageSize: 1, + } + const data = await handeGetSALEBILLList(req) + console.log('dasdas', data); + let obj: any = data.List && data.List.length > 0 ? data.List[0] : null + SALEBILL_ID = obj.SALEBILL_ID + + modalRef.current?.setFieldsValue({ + SALEBILL_CODE: obj.SALEBILL_CODE || "", + CHANNEL_TYPE: obj.CHANNEL_TYPE || "", + ORDER_DATE: obj.ORDER_DATE ? moment(obj.ORDER_DATE).format('YYYY-MM-DD HH:mm:ss') : "", + RECORD_COUNT: obj.RECORD_COUNT || "", + TOTAL_COUNT: obj.TOTAL_COUNT || "", + ORDER_AMOUNT: obj.ORDER_AMOUNT || "", + COUPON_AMOUNT: obj.COUPON_AMOUNT || "", + PACK_AMOUNT: obj.PACK_AMOUNT || "", + CONSUME_SCORE: obj.CONSUME_SCORE || "", + PAY_AMOUNT: obj.PAY_AMOUNT || "", + COST_AMOUNT: obj.COST_AMOUNT || "", + SALEBILL_STATE: obj.SALEBILL_STATE || "", + COMMENT_STATE: obj.COMMENT_STATE || "", + TAKE_TYPE: obj.TAKE_TYPE || "", + PACK_TYPE: obj.PACK_TYPE || "", + TAKE_NUMBER: obj.TAKE_NUMBER || "", + }) + + } + + const req: any = { + searchParameter: { + SALEBILL_ID: currentRow?.SALEBILL_ID || SALEBILL_ID + }, + PageIndex: 1, + PageSize: 999999, + } + const data = await handeGetSALEDETAILList(req) + console.log('datadatadata', data); + if (data.List && data.List.length > 0) { + return { data: data.List, success: true, total: data.TotalCount } + } + return { data: [], success: true } + }} + summary={() => { + // extra 是 request 返回的 extra 字段 + return ( + + 合计 + + {currentRow?.TOTAL_COUNT || 0} + + {currentRow?.ORDER_AMOUNT?.toFixed(2) || '0.00'} + + ) + }} + /> + + +
+ ) +} + +export default connect(({ user, }: ConnectState) => ({ + currentUser: user.currentUser, +}))(OrderDetailModal); diff --git a/src/pages/travelMember/BookingMealOrder/components/style.less b/src/pages/travelMember/BookingMealOrder/components/style.less new file mode 100644 index 0000000..e2ae373 --- /dev/null +++ b/src/pages/travelMember/BookingMealOrder/components/style.less @@ -0,0 +1,110 @@ +.BookingMealOrderDetailModal { + .react-draggable { + .ant-modal-content { + border-radius: 16px; + + .ant-modal-close { + display: none; + } + + .ant-modal-body { + padding: 0; + height: 800px; + overflow-y: auto; + overflow: hidden; + + .ant-form { + .bookingOrderModalTop { + width: 100%; + display: flex; + align-items: center; + justify-content: space-between; + border-bottom: 1px solid #D5D8DE; + box-sizing: border-box; + padding-bottom: 10px; + box-sizing: border-box; + padding: 30px 20px; + + .modalTopLeft { + display: flex; + align-items: center; + + .memberIcon { + width: 18px; + height: 18px; + margin-right: 5px; + } + + .modalTitle { + font-family: PingFangSC, PingFang SC; + font-weight: 600; + font-size: 18px; + color: rgba(0, 0, 0, 0.85); + line-height: 18px; + text-align: left; + font-style: normal; + } + } + + .modalTopRight { + width: 18px; + height: 18px; + + .memberIcon { + width: 18px; + height: 18px; + cursor: pointer; + } + } + } + + .bookingOrderModalCenter { + width: 100%; + height: 100%; + margin-top: 14px; + box-sizing: border-box; + padding: 0 34px; + + .smallTitle { + font-family: PingFangSC, PingFang SC; + font-weight: 600; + font-size: 16px; + color: #333333; + line-height: 10px; + text-align: left; + font-style: normal; + margin-bottom: 10px; + } + + .smallTitle::after { + content: ""; + width: 2px; + height: 14px; + background-color: #155DFE; + position: relative; + left: -5px; + top: 2px; + } + + + .ant-row { + .memberInfoDetailItem { + .ant-form-item { + margin-bottom: 12px; + } + } + } + + } + + + } + } + + .ant-modal-body::-webkit-scrollbar { + width: 0; + display: none; + } + } + } +} \ No newline at end of file diff --git a/src/pages/travelMember/BookingMealOrder/index.tsx b/src/pages/travelMember/BookingMealOrder/index.tsx index b1b4d55..58afea2 100644 --- a/src/pages/travelMember/BookingMealOrder/index.tsx +++ b/src/pages/travelMember/BookingMealOrder/index.tsx @@ -16,6 +16,7 @@ import LeftSelectTree from "@/pages/reports/settlementAccount/component/leftSele import './style.less' import orderIcon from '@/assets/detail/orderIcon.png' import closeIcon from '@/assets/detail/closeIcon.png' +import OrderDetailModal from "./components/orderDetailModal"; const BookingMealOrder: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { @@ -300,9 +301,9 @@ const BookingMealOrder: React.FC<{ currentUser: CurrentUser | undefined }> = (pr />
+ - - = (pr
- - - - = (pr }} /> - + */} ) diff --git a/src/pages/travelMember/ConsumptionRecordSearch/index.tsx b/src/pages/travelMember/ConsumptionRecordSearch/index.tsx index d786b51..a04ad45 100644 --- a/src/pages/travelMember/ConsumptionRecordSearch/index.tsx +++ b/src/pages/travelMember/ConsumptionRecordSearch/index.tsx @@ -17,6 +17,7 @@ import PageTitleBox from "@/components/PageTitleBox"; import { handleGetCONSUMPTIONRECORDList } from "../service"; import moment from 'moment' import session from "@/utils/session"; +import OrderDetailModal from "../BookingMealOrder/components/orderDetailModal"; const ConsumptionRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props) => { @@ -29,8 +30,12 @@ const ConsumptionRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props) const [collapsible, setCollapsible] = useState(false) const [treeView, setTreeView] = useState() const [printIndex, setPrintIndex] = useState(new Date().getTime()) + // 显示订单详情的悬浮框 + const [showOrderModal, setShowOrderModal] = useState(false) + const [currentRow, setCurrentRow] = useState() let CONSUMPTIONRECORDTYPEObj = session.get('CONSUMPTIONRECORDTYPEObj') + let MEMBERSHIPLEVELYNObj = session.get('MEMBERSHIPLEVELYNObj') // 树相关的属性和方法 const [selectedId, setSelectedId] = useState() @@ -58,14 +63,54 @@ const ConsumptionRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props) }, initialValue: [moment().format('YYYY-MM-DD'), moment().subtract(1, 'M').format('YYYY-MM-DD')], }, + // { + // title: "服务区名称", + // width: 150, + // dataIndex: "SERVERPART_NAME", + // hideInSearch: true, + // align: 'center', + // ellipsis: true, + // }, { - title: "服务区名称", + title: "用户昵称", width: 150, - dataIndex: "SERVERPART_NAME", + dataIndex: "MEMBERSHIP_NAME", hideInSearch: true, align: 'center', ellipsis: true, }, + { + title: "手机号码", + width: 150, + dataIndex: "MEMBERSHIP_MOBILEPHONE", + hideInSearch: true, + align: 'center', + ellipsis: true, + }, + { + title: "会员等级", + width: 150, + dataIndex: "MEMBERSHIP_LEVEL", + hideInSearch: true, + align: 'center', + ellipsis: true, + valueType: 'select', + valueEnum: MEMBERSHIPLEVELYNObj + }, + { + title: "订单编号", + width: 200, + dataIndex: "TICKET_CODE", + hideInSearch: true, + align: 'center', + ellipsis: true, + render: (_, record) => { + return record?.TICKET_CODE ? { + setCurrentRow(record) + setShowOrderModal(true) + }}>{record?.TICKET_CODE} : "-" + } + }, { title: "门店名称", width: 150, @@ -142,7 +187,9 @@ const ConsumptionRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props) } }, ] - + const handleCloseModal = () => { + setShowOrderModal(false) + } return (
{ @@ -193,6 +240,9 @@ const ConsumptionRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props) />
+ + + ) } diff --git a/src/pages/travelMember/GrowthValueRecordSearch/index.tsx b/src/pages/travelMember/GrowthValueRecordSearch/index.tsx index c72d698..fea4953 100644 --- a/src/pages/travelMember/GrowthValueRecordSearch/index.tsx +++ b/src/pages/travelMember/GrowthValueRecordSearch/index.tsx @@ -16,6 +16,7 @@ import LeftSelectTree from "@/pages/reports/settlementAccount/component/leftSele import PageTitleBox from "@/components/PageTitleBox"; import { handleGetMEMBERGROWTHList } from "../service"; import moment from 'moment' +import session from "@/utils/session"; const GrowthValueRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props) => { @@ -29,6 +30,8 @@ const GrowthValueRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props) const [treeView, setTreeView] = useState() const [printIndex, setPrintIndex] = useState(new Date().getTime()) + let POINTTYPEObj = session.get('POINTTYPEObj') + // 树相关的属性和方法 const [selectedId, setSelectedId] = useState() @@ -93,16 +96,20 @@ const GrowthValueRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props) { title: "成长来源", width: 120, - dataIndex: "GROWTH_VALUE", + dataIndex: "GROWTH_SOURCE", align: 'center', ellipsis: true, valueType: 'select', valueEnum: { "0": "全部", - "1000": "消费赠送", - "2000": "消费抵扣", - "3000": "注册赠送", + ...POINTTYPEObj }, + // valueEnum: { + // "0": "全部", + // "1000": "消费赠送", + // "2000": "消费抵扣", + // "3000": "注册赠送", + // }, initialValue: "0" }, { @@ -162,10 +169,10 @@ const GrowthValueRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props) request={async (params) => { const req: any = { searchParameter: { - PROVINCE_CODE: currentUser?.ProvinceCode || "", + // PROVINCE_CODE: currentUser?.ProvinceCode || "", OWNERUNIT_ID: 911, SCORESETTING_STATE: 1, - GROWTH_VALUES: params?.GROWTH_VALUE === "0" ? "" : params?.GROWTH_VALUE, + GROWTH_SOURCES: params?.GROWTH_SOURCE === "0" ? "" : params?.GROWTH_SOURCE, GROWTH_TYPE: params?.GROWTH_TYPE === "-2" ? '' : params?.GROWTH_TYPE }, PageIndex: params?.current, diff --git a/src/pages/travelMember/GrowthValueRuleConfig/components/growthConfig.tsx b/src/pages/travelMember/GrowthValueRuleConfig/components/growthConfig.tsx new file mode 100644 index 0000000..19f1316 --- /dev/null +++ b/src/pages/travelMember/GrowthValueRuleConfig/components/growthConfig.tsx @@ -0,0 +1,522 @@ +// 成长值枚举规则配置页面 +import React, { useRef, useState, Suspense } from 'react'; +import moment from 'moment'; // 时间相关引用,没有使用可以删除 +import numeral from "numeral"; // 数字相关引用,没有使用可以删除 +import { connect } from 'umi'; + +import useRequest from '@ahooksjs/use-request'; // 请求数据的引用 +import Draggable from 'react-draggable'; +import SubMenu from "antd/lib/menu/SubMenu"; +import ProTable from '@ant-design/pro-table'; +import ProDescriptions from '@ant-design/pro-descriptions'; +import ProForm, { ProFormDatePicker, ProFormDateTimePicker, ProFormDateTimeRangePicker, ProFormDigit, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormTreeSelect, ProFormUploadButton } from '@ant-design/pro-form'; +import { MenuFoldOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons'; +import { PageContainer } from '@ant-design/pro-layout'; +import { Button, Col, Drawer, message, Row, Popconfirm, Space, Image, Modal, Form, Switch, Upload, Tooltip, Descriptions, TreeSelect } from 'antd'; + +import type { CurrentUser } from "umi"; +import type { ConnectState } from '@/models/connect'; +import type { ActionType, ProColumns } from '@ant-design/pro-table'; +import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions'; +import type { FormInstance } from 'antd'; + +import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除 +import PageTitleBox from '@/components/PageTitleBox'; +import { uploadPicture } from '@/services/picture'; +import defaultIcon from '../../../assets/brand/defaultIcon.png' +import classNames from 'classnames'; +import session from '@/utils/session'; +import ModalFooter from '../../scenicSpotConfig/component/modalFooter'; +import { handeDeleteFIELDENUM, handeGetFIELDEXPLAINList, handeGetNestingFIELDENUMList, handeSynchroFIELDENUM } from '../../service'; + + +const beforeUpload = (file: any) => { + const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'; + if (!isJpgOrPng) { + message.error('请上传JPEG、jpg、png格式的图片文件!'); + } + const isLt2M = file.size / 1024 / 1024 < 2; + if (!isLt2M) { + message.error('图片大小不超过 2MB!'); + } + return isJpgOrPng && isLt2M; +} + + +const GrowthConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { + const { currentUser } = props + const { confirm } = Modal; + const actionRef = useRef(); + const formRef = useRef(); + const [currentRow, setCurrentRow] = useState(); + const [showDetail, setShowDetail] = useState(); + const [modalVisible, handleModalVisible] = useState(); + const [confirmLoading, handleConfirmLoading] = useState(false) // 弹出框的内容表单是否在提交 + const [searchParams, setSearchParams] = useState(); + // 分类的树形结构数据 + const [typeTreeData, setTypeTreeData] = useState() + // 表单里面的是否预售 + const [formPRESALE_TYPE, setFormPRESALE_TYPE] = useState(false) + + // 弹出框拖动效果 + const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置 + const [disabled, setDraggleDisabled] = useState() // 是否拖动 + const draggleRef = React.createRef() + + let AFTERSALETYPEObj = session.get('AFTERSALETYPEObj') + const { data: FIELDEXPLAIN_ID } = useRequest(async () => { + const req: any = { + SearchParameter: { + FIELDEXPLAIN_FIELD: "GROWTH_TYPE" + } + } + const data = await handeGetFIELDEXPLAINList(req) + if (data && data.length > 0) { + let obj: any = data[0] + return obj.FIELDEXPLAIN_ID + } + + }) + // 文件列表 + const [fileList, setFileList] = useState([]) + const [imagePreviewVisible, setImagePreviewVisible] = useState(false) // 预览图片 + + 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 columns: any = [ + { + dataIndex: 'FIELDENUM_NAME', + title: '类别名称', + align: 'center', + width: 300, + ellipsis: true, + hideInSearch: true, + hideInDescriptions: true, + render: (_, record) => { + return { + setCurrentRow({ ...record }); + handleModalVisible(true); + }} + >{record?.FIELDENUM_NAME || ""} + } + }, + { + dataIndex: 'FIELDENUM_VALUE', + title: '售后枚举', + align: 'center', + width: 120, + ellipsis: true, + // valueType: 'treeSelect', + // valueEnum: typeTreeData, + hideInSearch: true, + }, + { + dataIndex: 'FIELDENUM_INDEX', + title: '类别索引', + align: 'center', + width: 120, + ellipsis: true, + hideInSearch: true, + }, + { + dataIndex: 'FIELDENUM_STATUS', + title: '有效状态', + align: 'center', + width: 120, + ellipsis: true, + valueType: "select", + valueEnum: { + "1": "有效", + "0": "无效" + }, + initialValue: "1" + }, + { + dataIndex: 'FIELDENUM_DESC', + title: '备注说明', + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + // { + // dataIndex: 'option', + // title: '操作', + // width: 100, + // ellipsis: true, + // valueType: 'option', + // align: 'center', + // hideInSearch: true, + // render: (_, record) => { + // return ( + // + // { + // setCurrentRow({ ...record }); + // handleModalVisible(true); + // }} + // > + // 编辑 + // + // { + // handelDelete(record.FIELDENUM_ID); + // }} + // > + // 删除 + // + // + // ); + // }, + // }, + ]; + + // 预览上传后的图片 + const handlePreview = async () => { + setFileList(fileList) + setImagePreviewVisible(true) + }; + const handleChangePreview = (val: any) => { + setImagePreviewVisible(val) + } + + // 删除点餐类别 + const handelDelete = async (id: any) => { + const req: any = { + FIELDENUMId: id + } + const result = await handeDeleteFIELDENUM(req) + if (result.Result_Code !== 100) { + message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`); + } else { + message.success('删除成功!'); + actionRef.current?.reload() + handleConfirmLoading(false) + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) + } + } + + // 同步点餐列表 + const handleAddUpdate = async (res: any) => { + let req: any = {} + if (currentRow?.FIELDENUM_ID) { + req = { + ...currentRow, + ...res, + } + } else { + req = { + ...res, + FIELDEXPLAIN_ID: FIELDEXPLAIN_ID, + FIELDENUM_PID: -1, + } + } + const data = await handeSynchroFIELDENUM(req) + handleConfirmLoading(false) + if (data.Result_Code === 100) { + message.success("新增成功!") + setCurrentRow(undefined) + formRef?.current?.resetFields() + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) + actionRef.current?.reload() + } else { + message.error(data.Result_Desc) + } + } + + return ( + + { + return `${record?.FIELDENUM_PID}-${record?.FIELDENUM_ID}` + }} + formRef={formRef} + headerTitle={} // 列表表头 + actionRef={actionRef} + search={{ span: 6, labelWidth: 'auto' }} + bordered + // 请求数据 + request={async (params, sorter) => { + const req = { + FIELDEXPLAIN_FIELD: 'GROWTH_TYPE', + FIELDEXPLAIN_ID: "", + FIELDENUM_PID: "", + FIELDENUM_STATUS: params?.FIELDENUM_STATUS, + SearchKey: "" + } + const data = await handeGetNestingFIELDENUMList(req); + if (data && data.length > 0) { + setTypeTreeData(data) + return { data: data, success: true, total: data.length } + } + return { data: [], success: true } + }} + columns={columns} + toolbar={{ + actions: [ + // 新增按钮 + , + ], + }} + /> + + {/* 图片预览组件 */} + {fileList && fileList.length > 0 &&
+ { + handleChangePreview(vis) + } + }}> + { + fileList.map((n) => ) + } + +
} + + + { + if (disabled) { + setDraggleDisabled(false) + } + }} + onMouseOut={() => { + setDraggleDisabled(true) + }} + + onFocus={() => { }} + onBlur={() => { }} + > + {currentRow ? '更新售后类别' : '新建售后类别'} + + } + destroyOnClose={true} + width={900} + bodyStyle={{ + height: '700px', // 你可以根据需要调整高度 + overflowY: 'auto', + }} + visible={modalVisible} + confirmLoading={confirmLoading} + afterClose={() => { + formRef.current?.resetFields(); + setCurrentRow(undefined); + }} + footer={ { + await handelDelete(currentRow?.FIELDENUM_ID) + }} + handleCancel={() => { + handleConfirmLoading(false) + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) + }} + handleOK={() => { + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} + + />} + onCancel={() => { + handleConfirmLoading(false) + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) + }} + + onOk={async () => { // 提交框内的数据 + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} + modalRender={(modal) => { + return onDraggaleStart(event, uiData)} + handle='.orderCategoryModal' + > +
{modal}
+
+ }} + > + { + let newValue = { ...values }; + if (currentRow) { + // 编辑数据 + newValue = { ...values, FIELDENUM_ID: currentRow.FIELDENUM_ID }; + } + // 如果有开关,要把开关的代码写进去 + await handleAddUpdate(newValue); + + handleConfirmLoading(false) + setFormPRESALE_TYPE(false) + }} + > + + {/* + { + if (typeTreeData && typeTreeData.length > 0) { + let list: any = [{ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 }, ...typeTreeData] + return list + } else { + const req = { + FIELDEXPLAIN_FIELD: 'GROWTH_TYPE', + FIELDEXPLAIN_ID: "", + FIELDENUM_PID: "", + FIELDENUM_STATUS: 1, + SearchKey: "" + } + const data = await handeGetNestingFIELDENUMList(req); + if (data && data.length > 0) { + data.unshirft({ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 }) + setTypeTreeData(data) + return data + } else { + return [{ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 }] + } + } + }} + fieldProps={{ + fieldNames: { + label: 'FIELDENUM_NAME', + value: 'FIELDENUM_ID', + children: 'children' + }, + showSearch: true, + filterTreeNode: (input, node) => + (node.FIELDENUM_NAME || '').toLowerCase().includes(input.toLowerCase()) + }} + rules={[ + { + required: true, + message: "请选择上级类别" + } + ]} + /> + */} + + + + + + + + + + + + + + + + + + +
+
+ ); +}; +export default connect(({ user }: ConnectState) => ({ + currentUser: user.currentUser +}))(GrowthConfig); \ No newline at end of file diff --git a/src/pages/travelMember/GrowthValueRuleConfig/index.tsx b/src/pages/travelMember/GrowthValueRuleConfig/index.tsx index 084f7de..ab83949 100644 --- a/src/pages/travelMember/GrowthValueRuleConfig/index.tsx +++ b/src/pages/travelMember/GrowthValueRuleConfig/index.tsx @@ -24,6 +24,8 @@ import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚 import { handleDeleteGROWTHSETTING, handleGetGROWTHSETTINGList, handleSynchroGROWTHSETTING } from '../service'; import session from '@/utils/session'; import PageTitleBox from '@/components/PageTitleBox'; +import ModalFooter from '../scenicSpotConfig/component/modalFooter'; +import GrowthConfig from './components/growthConfig'; @@ -34,16 +36,17 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> const [currentRow, setCurrentRow] = useState(); const [showDetail, setShowDetail] = useState(); const [modalVisible, handleModalVisible] = useState(); + const [showConfig, setShowConfig] = useState(); const [confirmLoading, handleConfirmLoading] = useState(false) // 弹出框的内容表单是否在提交 const [searchParams, setSearchParams] = useState(); // 会员成长值枚举 - let GROWTHSETTINGTYPEList = session.get('GROWTHSETTINGTYPEList') - let GROWTHSETTINGTYPEObj = session.get('GROWTHSETTINGTYPEObj') + let GROWTHTYPEList = session.get('GROWTHTYPEList') + let GROWTHTYPEObj = session.get('GROWTHTYPEObj') let MEMBERSHIP_TYPEList = session.get('MEMBERSHIP_TYPEList') let MEMBERSHIP_TYPEObj = session.get('MEMBERSHIP_TYPEObj') - let MEMBERSHIP_LEVELList = session.get('MEMBERSHIP_LEVELList') - let MEMBERSHIP_LEVELObj = session.get('MEMBERSHIP_LEVELObj') + let MEMBERSHIPLEVELYNList = session.get('MEMBERSHIPLEVELYNList') + let MEMBERSHIPLEVELYNObj = session.get('MEMBERSHIPLEVELYNObj') // 弹出框拖动效果 @@ -75,7 +78,7 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> align: 'center', hideInSearch: true, valueType: 'select', - valueEnum: GROWTHSETTINGTYPEObj + valueEnum: GROWTHTYPEObj }, { dataIndex: 'GROWTHSETTING_NAME', @@ -84,6 +87,12 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> width: 120, hideInSearch: true, hideInDescriptions: true, + render: (_, record) => { + return record?.GROWTHSETTING_NAME ? { + setCurrentRow({ ...record }); + handleModalVisible(true); + }}>{record?.GROWTHSETTING_NAME} : '-' + } }, { dataIndex: 'MEMBERSHIP_TYPE', @@ -101,7 +110,7 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> width: 120, hideInSearch: true, valueType: 'select', - valueEnum: MEMBERSHIP_LEVELObj + valueEnum: MEMBERSHIPLEVELYNObj }, { dataIndex: 'PROMOTION_LEVEL', @@ -109,7 +118,7 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> width: 120, align: 'center', hideInSearch: true, - valueEnum: MEMBERSHIP_LEVELObj + valueEnum: MEMBERSHIPLEVELYNObj }, { dataIndex: 'GROWTH_VALUE', @@ -149,12 +158,12 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> title: '有效状态', width: 120, align: 'center', - hideInSearch: true, valueType: 'select', valueEnum: { "1": "有效", "0": "无效" - } + }, + initialValue: "1" }, // { // dataIndex: 'STAFF_NAME', @@ -175,36 +184,36 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> // align: 'center', // hideInSearch: true, // }, - { - dataIndex: 'option', - title: '操作', - width: 120, - align: 'center', - valueType: 'option', - hideInSearch: true, - render: (_, record) => { - return ( - - { - setCurrentRow({ ...record }); - handleModalVisible(true); - }} - > - 编辑 - - { - await handelDelete(record.GROWTHSETTING_ID); - }} - > - 删除 - - - ); - }, - }, + // { + // dataIndex: 'option', + // title: '操作', + // width: 120, + // align: 'center', + // valueType: 'option', + // hideInSearch: true, + // render: (_, record) => { + // return ( + // + // { + // setCurrentRow({ ...record }); + // handleModalVisible(true); + // }} + // > + // 编辑 + // + // { + // await handelDelete(record.GROWTHSETTING_ID); + // }} + // > + // 删除 + // + // + // ); + // }, + // }, ]; @@ -217,6 +226,8 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> } else { message.success('删除成功!'); actionRef.current?.reload() + handleConfirmLoading(false) + handleModalVisible(false) } }; @@ -274,7 +285,7 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> searchParameter: { PROVINCE_CODE: currentUser?.ProvinceCode || "", OWNERUNIT_ID: 911, - GROWTHSETTING_STATE: 1 + GROWTHSETTING_STATE: params?.GROWTHSETTING_STATE }, PageIndex: 1, PageSize: 20 @@ -299,6 +310,16 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> > 会员成长值配置 , + // 配置成长值规则枚举 + ], }} pagination={{ defaultPageSize: 10 }} @@ -326,9 +347,11 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> /> )} + } destroyOnClose={true} width={900} + bodyStyle={{ + height: '700px', // 你可以根据需要调整高度 + overflowY: 'auto', + }} + footer={ { + await handelDelete(currentRow?.GROWTHSETTING_ID) + }} + handleCancel={() => { + handleConfirmLoading(false) + handleModalVisible(false) + }} + handleOK={() => { + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} + + />} + visible={modalVisible} confirmLoading={confirmLoading} afterClose={() => { @@ -372,6 +417,7 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> disabled={disabled} bounds={bounds} onStart={(event, uiData) => onDraggaleStart(event, uiData)} + handle='.GrowthValueModal' >
{modal}
@@ -383,6 +429,7 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> autoFocusFirstInput submitter={false} preserve={false} + labelCol={{ style: { width: 80 } }} initialValues={{ ...currentRow, SCORESETTING_STATE: (currentRow?.GROWTHSETTING_STATE || currentRow?.GROWTHSETTING_STATE === 0) ? currentRow?.GROWTHSETTING_STATE : 1 @@ -391,9 +438,8 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> let newValue: any = { ...values }; if (currentRow) { // 编辑数据 - newValue = { ...values, SCORESETTING_ID: currentRow.SCORESETTING_ID }; + newValue = { ...values, GROWTHSETTING_ID: currentRow.GROWTHSETTING_ID }; } - console.log('newValue', newValue); await handleAddUpdate(newValue); @@ -411,7 +457,7 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> message: '请选择规则类型' } ]} - options={GROWTHSETTINGTYPEList} + options={GROWTHTYPEList} /> @@ -437,14 +483,14 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> @@ -486,6 +532,23 @@ const GrowthValueRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }>
+ + { + setShowConfig(false) + }} + > + + ); }; diff --git a/src/pages/travelMember/MallClassificationManage/index.tsx b/src/pages/travelMember/MallClassificationManage/index.tsx index f537fd6..3ee1274 100644 --- a/src/pages/travelMember/MallClassificationManage/index.tsx +++ b/src/pages/travelMember/MallClassificationManage/index.tsx @@ -25,6 +25,7 @@ import { handlDeleteUSERDEFINEDTYPE, handlGetUSERDEFINEDTYPEList, handlSynchroUS import PageTitleBox from '@/components/PageTitleBox'; import { uploadPicture } from '@/services/picture'; import defaultIcon from '../../../assets/brand/defaultIcon.png' +import ModalFooter from '../scenicSpotConfig/component/modalFooter'; const beforeUpload = (file: any) => { @@ -101,7 +102,19 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined render: (_, record) => { return } }, @@ -111,21 +124,23 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined align: 'center', width: 120, ellipsis: true, + sorter: (a, b) => a.USERDEFINEDTYPE_INDEX - b.USERDEFINEDTYPE_INDEX, + defaultSortOrder: 'ascend', hideInSearch: true, }, - { - dataIndex: 'USERDEFINEDTYPE_STATE', - title: '有效状态', - align: 'center', - width: 120, - ellipsis: true, - valueType: "select", - valueEnum: { - "1": "有效", - "0": "无效" - }, - initialValue: "1" - }, + // { + // dataIndex: 'USERDEFINEDTYPE_STATE', + // title: '有效状态', + // align: 'center', + // width: 120, + // ellipsis: true, + // valueType: "select", + // valueEnum: { + // "1": "有效", + // "0": "无效" + // }, + // initialValue: "1" + // }, { dataIndex: 'SCANCODE_ORDER', title: '上架状态', @@ -152,58 +167,58 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined "1": "是" } }, - { - dataIndex: 'OWNERUNIT_NAME', - title: '业主单位', - align: 'center', - width: 180, - ellipsis: true, - hideInSearch: true, - }, - { - dataIndex: 'option', - title: '操作', - width: 100, - ellipsis: true, - valueType: 'option', - align: 'center', - hideInSearch: true, - render: (_, record) => { - return ( - - { - console.log('recordrecordrecord', record); - if (record?.USERDEFINEDTYPE_ICO) { - setFileList([{ - name: "", - url: record?.USERDEFINEDTYPE_ICO - }]) - } + // { + // dataIndex: 'OWNERUNIT_NAME', + // title: '业主单位', + // align: 'center', + // width: 180, + // ellipsis: true, + // hideInSearch: true, + // }, + // { + // dataIndex: 'option', + // title: '操作', + // width: 100, + // ellipsis: true, + // valueType: 'option', + // align: 'center', + // hideInSearch: true, + // render: (_, record) => { + // return ( + // + // { + // console.log('recordrecordrecord', record); + // if (record?.USERDEFINEDTYPE_ICO) { + // setFileList([{ + // name: "", + // url: record?.USERDEFINEDTYPE_ICO + // }]) + // } - if (record?.PRESALE_TYPE) { - setFormPRESALE_TYPE(true) - } + // if (record?.PRESALE_TYPE) { + // setFormPRESALE_TYPE(true) + // } - setCurrentRow({ ...record }); - handleModalVisible(true); - }} - > - 编辑 - - { - handelDelete(record.USERDEFINEDTYPE_ID); - }} - > - 删除 - - - ); - }, - }, + // setCurrentRow({ ...record }); + // handleModalVisible(true); + // }} + // > + // 编辑 + // + // { + // handelDelete(record.USERDEFINEDTYPE_ID); + // }} + // > + // 删除 + // + // + // ); + // }, + // }, ]; // 预览上传后的图片 @@ -226,6 +241,10 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined } else { message.success('删除成功!'); actionRef.current?.reload() + handleConfirmLoading(false) + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) } } @@ -296,7 +315,7 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined OWNERUNIT_ID: currentUser?.OwnerUnitId, PROVINCE_CODE: "", GOODSTYPE: 4000, - USERDEFINEDTYPE_STATE: params?.USERDEFINEDTYPE_STATE + USERDEFINEDTYPE_STATE: 1 // SearchKey: "" } const data = await handlGetUSERDEFINEDTYPEList(req); @@ -344,6 +363,7 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined { @@ -377,6 +401,25 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined setFormPRESALE_TYPE(false) setFileList([]) }} + footer={ { + handelDelete(currentRow.USERDEFINEDTYPE_ID) + }} + handleCancel={() => { + handleConfirmLoading(false) + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) + }} + handleOK={() => { + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} + + />} onOk={async () => { // 提交框内的数据 formRef?.current?.validateFields().then(() => { @@ -389,6 +432,7 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined disabled={disabled} bounds={bounds} onStart={(event, uiData) => onDraggaleStart(event, uiData)} + handle={".MallClassModal"} >
{modal}
@@ -397,6 +441,7 @@ const MallClassificationManage: React.FC<{ currentUser: CurrentUser | undefined { + const modalActionRef = useRef(); + const formRef = useRef(); + const [province, setProvince] = useState(''); + const [city, setCity] = useState(''); + const [county, setCounty] = useState(''); + const [currentRow, setCurrentRow] = useState(); + const [modalVisible, handleModalVisible] = useState(); + const [confirmLoading, handleConfirmLoading] = useState(false) // 弹出框的内容表单是否在提交 + + const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置 + const [disabled, setDraggleDisabled] = useState() // 是否拖动 + const draggleRef = React.createRef() + + // 抽屉里面的table的columns + const drawerColumns: any = [ + { + dataIndex: 'searchText', + title: '', + width: 150, + align: 'center', + hideInTable: true, + fieldProps: { + placeholder: "输入收货人名称" + } + }, + { + dataIndex: 'USER_NAME', + title: '收货人名称', + width: 150, + align: 'center', + ellipsis: true, + hideInSearch: true, + render: (_, record) => { + return record?.USER_NAME ? { + console.log('record', record); + + setProvince(record?.RECEIVE_PROVINCE) + setCity(record?.RECEIVE_CITY) + setCounty(record?.RECEIVE_COUNTY) + setCurrentRow({ ...record }); + handleModalVisible(true); + }} + > + {record?.USER_NAME || "-"} + : "-" + } + }, + { + dataIndex: 'USER_SEX', + title: '收货人性别', + width: 120, + align: 'center', + hideInSearch: true, + valueType: 'select', + valueEnum: { + "1": "男", + "2": "女", + "0": "-", + } + }, + { + dataIndex: 'MOBILEPHONE', + title: '手机号码', + width: 150, + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + { + dataIndex: 'RECEIVE_PROVINCE', + title: '省/直辖市', + width: 120, + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + { + dataIndex: 'RECEIVE_CITY', + title: '城市/直辖市', + width: 150, + align: 'center', + hideInSearch: true, + }, + { + dataIndex: 'RECEIVE_COUNTY', + title: '区/县', + width: 150, + align: 'center', + hideInSearch: true, + }, + { + dataIndex: 'ADDRESS', + title: '收货地址', + width: 300, + align: 'center', + hideInSearch: true, + }, + { + dataIndex: 'DOORPLATE', + title: '门牌号码', + width: 300, + align: 'center', + hideInSearch: true, + }, + { + dataIndex: 'ISDEFAULT', + title: '默认地址', + width: 120, + align: 'center', + hideInSearch: true, + ellipsis: true, + valueType: 'select', + valueEnum: { + "1": "是", + "0": "否", + } + }, + { + dataIndex: 'TAGTYPE', + title: '地址类型', + width: 120, + align: 'center', + hideInSearch: true, + ellipsis: true, + valueType: 'select', + valueEnum: { + "1000": "家", + "2000": "公司", + "3000": "其他", + } + }, + + // { + // dataIndex: 'CREATE_STAFF_NAME', + // title: '创建人名称', + // align: 'center', + // hideInSearch: true, + // }, + // { + // dataIndex: 'CREATE_DATE', + // title: '创建时间', + // valueType: 'date', + // align: 'center', + // hideInSearch: true, + // }, + // { + // dataIndex: 'UPDATE_STAFF_NAME', + // title: '更新人名称', + // align: 'center', + // hideInSearch: true, + // }, + // { + // dataIndex: 'UPDATE_DATE', + // title: '更新时间', + // valueType: 'date', + // align: 'center', + // hideInSearch: true, + // }, + // { + // dataIndex: 'MEMBERADDRESS_DESC', + // title: '备注说明', + // align: 'center', + // hideInSearch: true, + // }, + // { + // dataIndex: 'option', + // title: '操作', + // width: 120, + // align: 'center', + // valueType: 'option', + // hideInSearch: true, + // fixed: 'right', + // render: (_, record) => { + // return ( + // + // { + // console.log('record', record); + + // setProvince(record?.RECEIVE_PROVINCE) + // setCity(record?.RECEIVE_CITY) + // setCounty(record?.RECEIVE_COUNTY) + // setCurrentRow({ ...record }); + // handleModalVisible(true); + // }} + // > + // 编辑 + // + // { + // console.log('res', record); + + // await handelDelete(record.MEMBERADDRESS_ID); + // }} + // > + // 删除 + // + // + // ); + // }, + // }, + ]; + + const handelDelete = async (id: number) => { + const result = await handleDeleteMEMBERADDRESS({ + MEMBERADDRESSId: id + }); + console.log('resultresultresult', result); + if (result.Result_Code !== 100) { + message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`); + } else { + message.success('删除成功!'); + modalActionRef.current?.reload() + + handleConfirmLoading(false) + handleModalVisible(false) + setProvince("") + setCity("") + setCounty("") + } + }; + + 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 handleAddUpdate = async (res: any) => { + let req: any = {} + + if (currentRow?.MEMBERADDRESS_ID) { + req = { + ...currentRow, + ...res + } + } else { + req = { + ...res, + ADDTIME: moment().format('YYYY-MM-DD HH:mm:ss'), + STAFF_ID: currentUser?.ID, + STAFF_NAME: currentUser?.Name, + OWNERUNIT_ID: currentUser?.OwnerUnitId, + OWNERUNIT_NAME: currentUser?.OwnerUnitName, + PROVINCE_CODE: currentUser?.ProvinceCode + } + } + const data = await handleSynchroMEMBERADDRESS(req); + if (data.Result_Code === 100) { + message.success(data.Result_Desc) + formRef?.current?.resetFields() + setCurrentRow(undefined) + handleModalVisible(false) + modalActionRef.current?.reload() + } else { + message.error(data.Result_Desc) + } + }; + + + + return ( +
+ { + const req = { + SearchParameter: { + MEMBERSHIP_ID: currentBigRow?.MEMBERSHIP_ID, + PROVINCE_CODE: currentUser?.ProvinceCode || "", + OWNERUNIT_ID: 911, + ISVALID: 1 + }, + PageIndex: params.current, + PageSize: params.pageSize, + SortStr: "CREATE_DATE desc", + keyWord: { + Key: "USER_NAME", + Value: params?.searchText + } + } + const data = await handleGetMEMBERADDRESSList(req); + console.log('datadatadatadatadata', data); + if (data.List && data.List.length > 0) { + return { data: data.List, success: true, total: data.TotalCount } + } + return { data: [], success: true } + }} + /> + + + { + if (disabled) { + setDraggleDisabled(false) + } + }} + onMouseOut={() => { + setDraggleDisabled(true) + }} + + onFocus={() => { }} + onBlur={() => { }} + > + {currentRow ? '更新会员收货地址' : '新建会员收货地址'} +
+ } + destroyOnClose={true} + width={900} + bodyStyle={{ + height: '700px', // 你可以根据需要调整高度 + overflowY: 'auto', + }} + visible={modalVisible} + confirmLoading={confirmLoading} + afterClose={() => { + formRef.current?.resetFields(); + setCurrentRow(undefined); + }} + onCancel={() => { + handleConfirmLoading(false) + handleModalVisible(false) + setProvince("") + setCity("") + setCounty("") + }} + footer={ { + await handelDelete(currentRow?.MEMBERADDRESS_ID) + }} + handleCancel={() => { + handleConfirmLoading(false) + handleModalVisible(false) + setProvince("") + setCity("") + setCounty("") + }} + handleOK={() => { + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} + + />} + + onOk={async () => { // 提交框内的数据 + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} + modalRender={(modal) => { + return onDraggaleStart(event, uiData)} + handle=".modal-drag-title" + > +
{modal}
+
+ }} + > + { + let newValue: any = { ...values }; + if (currentRow) { + // 编辑数据 + newValue = { ...values, MEMBERADDRESS_ID: currentRow.MEMBERADDRESS_ID }; + } + await handleAddUpdate(newValue); + + handleConfirmLoading(false) + }} + > + + + + + + + + + + + + { + console.log('eee', e); + + setProvince(e.target.value) + } + }} + /> + + + { + setCity(e.target.value) + } + }} + /> + + + { + setCounty(e.target.value) + } + }} + /> + + + + + + + + + + + + + + + + + + + + + +
+ + ) +} + +export default connect(({ user, }: ConnectState) => ({ + currentUser: user.currentUser, +}))(AddressDetail); diff --git a/src/pages/travelMember/MemberAddress/index.tsx b/src/pages/travelMember/MemberAddress/index.tsx index 30fa2e5..99fe50f 100644 --- a/src/pages/travelMember/MemberAddress/index.tsx +++ b/src/pages/travelMember/MemberAddress/index.tsx @@ -21,6 +21,7 @@ import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions'; import type { FormInstance } from 'antd'; import { handeGetMemberAddressCombineList, handleDeleteMEMBERADDRESS, handleGetMEMBERADDRESSList, handleSynchroMEMBERADDRESS } from '../service'; import PageTitleBox from '@/components/PageTitleBox'; +import AddressDetail from './components/addressDetail'; @@ -531,6 +532,7 @@ const MemberAddress: React.FC<{ currentUser: CurrentUser | undefined }> = (props }} /> + {/* 这里和 会员详情里面的同步 如果有什么修改 记得一起改 */} = (props closable={false} destroyOnClose > - + {/* = (props } return { data: [], success: true } }} - /> + /> */} = (props) => { - return ( -
+import useRequest from '@ahooksjs/use-request'; // 请求数据的引用 +import Draggable from 'react-draggable'; +import SubMenu from "antd/lib/menu/SubMenu"; +import ProTable from '@ant-design/pro-table'; +import ProDescriptions from '@ant-design/pro-descriptions'; +import ProForm, { ProFormDatePicker, ProFormDateTimePicker, ProFormDateTimeRangePicker, ProFormDigit, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormTreeSelect, ProFormUploadButton } from '@ant-design/pro-form'; +import { MenuFoldOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons'; +import { PageContainer } from '@ant-design/pro-layout'; +import { Button, Col, Drawer, message, Row, Popconfirm, Space, Image, Modal, Form, Switch, Upload, Tooltip, Descriptions, TreeSelect } from 'antd'; -
- ) +import type { CurrentUser } from "umi"; +import type { ConnectState } from '@/models/connect'; +import type { ActionType, ProColumns } from '@ant-design/pro-table'; +import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions'; +import type { FormInstance } from 'antd'; + +import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除 +import { handeDeleteFIELDENUM, handeGetFIELDENUMList, handeGetFIELDEXPLAINList, handeGetNestingFIELDENUMList, handeSynchroFIELDENUM, handlDeleteUSERDEFINEDTYPE, handlGetUSERDEFINEDTYPEList, handlSynchroUSERDEFINEDTYPE } from '../service'; +import PageTitleBox from '@/components/PageTitleBox'; +import { uploadPicture } from '@/services/picture'; +import defaultIcon from '../../../assets/brand/defaultIcon.png' +import classNames from 'classnames'; +import session from '@/utils/session'; +import ModalFooter from '../scenicSpotConfig/component/modalFooter'; + + +const beforeUpload = (file: any) => { + const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'; + if (!isJpgOrPng) { + message.error('请上传JPEG、jpg、png格式的图片文件!'); + } + const isLt2M = file.size / 1024 / 1024 < 2; + if (!isLt2M) { + message.error('图片大小不超过 2MB!'); + } + return isJpgOrPng && isLt2M; } + +const MembershipLevelManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { + const { currentUser } = props + const { confirm } = Modal; + const actionRef = useRef(); + const formRef = useRef(); + const [currentRow, setCurrentRow] = useState(); + const [showDetail, setShowDetail] = useState(); + const [modalVisible, handleModalVisible] = useState(); + const [confirmLoading, handleConfirmLoading] = useState(false) // 弹出框的内容表单是否在提交 + const [searchParams, setSearchParams] = useState(); + // 分类的树形结构数据 + const [typeTreeData, setTypeTreeData] = useState() + // 表单里面的是否预售 + const [formPRESALE_TYPE, setFormPRESALE_TYPE] = useState(false) + + // 弹出框拖动效果 + const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置 + const [disabled, setDraggleDisabled] = useState() // 是否拖动 + const draggleRef = React.createRef() + + let AFTERSALETYPEObj = session.get('AFTERSALETYPEObj') + const { data: FIELDEXPLAIN_ID } = useRequest(async () => { + const req: any = { + SearchParameter: { + FIELDEXPLAIN_FIELD: "MEMBERSHIP_LEVEL_YN" + } + } + const data = await handeGetFIELDEXPLAINList(req) + if (data && data.length > 0) { + let obj: any = data[0] + return obj.FIELDEXPLAIN_ID + } + }) + // 文件列表 + const [fileList, setFileList] = useState([]) + const [imagePreviewVisible, setImagePreviewVisible] = useState(false) // 预览图片 + + 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 columns: any = [ + { + dataIndex: 'FIELDENUM_NAME', + title: '类别名称', + align: 'center', + width: 300, + ellipsis: true, + hideInSearch: true, + hideInDescriptions: true, + render: (_, record) => { + return { + setCurrentRow({ ...record }); + handleModalVisible(true); + }} + >{record?.FIELDENUM_NAME || ""} + } + }, + { + dataIndex: 'FIELDENUM_VALUE', + title: '等级枚举', + align: 'center', + width: 120, + ellipsis: true, + // valueType: 'treeSelect', + // valueEnum: typeTreeData, + hideInSearch: true, + }, + { + dataIndex: 'FIELDENUM_INDEX', + title: '类别索引', + align: 'center', + width: 120, + ellipsis: true, + hideInSearch: true, + }, + { + dataIndex: 'FIELDENUM_STATUS', + title: '有效状态', + align: 'center', + width: 120, + ellipsis: true, + valueType: "select", + valueEnum: { + "1": "有效", + "0": "无效" + }, + initialValue: "1" + }, + { + dataIndex: 'FIELDENUM_DESC', + title: '备注说明', + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + // { + // dataIndex: 'option', + // title: '操作', + // width: 100, + // ellipsis: true, + // valueType: 'option', + // align: 'center', + // hideInSearch: true, + // render: (_, record) => { + // return ( + // + // { + // setCurrentRow({ ...record }); + // handleModalVisible(true); + // }} + // > + // 编辑 + // + // { + // handelDelete(record.FIELDENUM_ID); + // }} + // > + // 删除 + // + // + // ); + // }, + // }, + ]; + + // 预览上传后的图片 + const handlePreview = async () => { + setFileList(fileList) + setImagePreviewVisible(true) + }; + const handleChangePreview = (val: any) => { + setImagePreviewVisible(val) + } + + // 删除点餐类别 + const handelDelete = async (id: any) => { + const req: any = { + FIELDENUMId: id + } + const result = await handeDeleteFIELDENUM(req) + if (result.Result_Code !== 100) { + message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`); + } else { + message.success('删除成功!'); + actionRef.current?.reload() + handleConfirmLoading(false) + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) + } + } + + // 同步点餐列表 + const handleAddUpdate = async (res: any) => { + let req: any = {} + if (currentRow?.FIELDENUM_ID) { + req = { + ...currentRow, + ...res, + } + } else { + req = { + ...res, + FIELDEXPLAIN_ID: FIELDEXPLAIN_ID, + FIELDENUM_PID: -1, + } + } + const data = await handeSynchroFIELDENUM(req) + handleConfirmLoading(false) + if (data.Result_Code === 100) { + message.success("新增成功!") + setCurrentRow(undefined) + formRef?.current?.resetFields() + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) + actionRef.current?.reload() + } else { + message.error(data.Result_Desc) + } + } + + return ( + + { + return `${record?.FIELDENUM_PID}-${record?.FIELDENUM_ID}` + }} + formRef={formRef} + headerTitle={} // 列表表头 + actionRef={actionRef} + search={{ span: 6, labelWidth: 'auto' }} + bordered + // 请求数据 + request={async (params, sorter) => { + const req = { + FIELDEXPLAIN_FIELD: 'MEMBERSHIP_LEVEL_YN', + FIELDEXPLAIN_ID: "", + FIELDENUM_PID: "", + FIELDENUM_STATUS: params?.FIELDENUM_STATUS, + SearchKey: "" + } + const data = await handeGetNestingFIELDENUMList(req); + console.log('datadatadatadatadata', data); + if (data && data.length > 0) { + setTypeTreeData(data) + return { data: data, success: true, total: data.length } + } + return { data: [], success: true } + }} + columns={columns} + toolbar={{ + actions: [ + // 新增按钮 + , + ], + }} + /> + + {/* 图片预览组件 */} + {fileList && fileList.length > 0 &&
+ { + handleChangePreview(vis) + } + }}> + { + fileList.map((n) => ) + } + +
} + + + { + if (disabled) { + setDraggleDisabled(false) + } + }} + onMouseOut={() => { + setDraggleDisabled(true) + }} + + onFocus={() => { }} + onBlur={() => { }} + > + {currentRow ? '更新会员等级类别' : '新建会员等级类别'} + + } + destroyOnClose={true} + width={900} + bodyStyle={{ + height: '700px', // 你可以根据需要调整高度 + overflowY: 'auto', + }} + visible={modalVisible} + confirmLoading={confirmLoading} + afterClose={() => { + formRef.current?.resetFields(); + setCurrentRow(undefined); + }} + footer={ { + await handelDelete(currentRow?.FIELDENUM_ID) + }} + handleCancel={() => { + handleConfirmLoading(false) + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) + }} + handleOK={() => { + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} + + />} + onCancel={() => { + handleConfirmLoading(false) + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) + }} + + onOk={async () => { // 提交框内的数据 + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} + modalRender={(modal) => { + return onDraggaleStart(event, uiData)} + handle='.membershipLevel' + > +
{modal}
+
+ }} + > + { + let newValue = { ...values }; + if (currentRow) { + // 编辑数据 + newValue = { ...values, FIELDENUM_ID: currentRow.FIELDENUM_ID }; + } + + // 如果有开关,要把开关的代码写进去 + await handleAddUpdate(newValue); + + handleConfirmLoading(false) + setFormPRESALE_TYPE(false) + }} + > + + {/* + { + if (typeTreeData && typeTreeData.length > 0) { + let list: any = [{ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 }, ...typeTreeData] + return list + } else { + const req = { + FIELDEXPLAIN_FIELD: 'MEMBERSHIP_LEVEL_YN', + FIELDEXPLAIN_ID: "", + FIELDENUM_PID: "", + FIELDENUM_STATUS: 1, + SearchKey: "" + } + const data = await handeGetNestingFIELDENUMList(req); + if (data && data.length > 0) { + data.unshirft({ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 }) + setTypeTreeData(data) + return data + } else { + return [{ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 }] + } + } + }} + fieldProps={{ + fieldNames: { + label: 'FIELDENUM_NAME', + value: 'FIELDENUM_ID', + children: 'children' + }, + showSearch: true, + filterTreeNode: (input, node) => + (node.FIELDENUM_NAME || '').toLowerCase().includes(input.toLowerCase()) + }} + rules={[ + { + required: true, + message: "请选择上级类别" + } + ]} + /> + */} + + + + + + + + + + + + + + + + + + +
+
+ ); +}; export default connect(({ user }: ConnectState) => ({ currentUser: user.currentUser }))(MembershipLevelManage); \ No newline at end of file diff --git a/src/pages/travelMember/OrderCategoryManage/index.tsx b/src/pages/travelMember/OrderCategoryManage/index.tsx index 42c5d0b..176d6ab 100644 --- a/src/pages/travelMember/OrderCategoryManage/index.tsx +++ b/src/pages/travelMember/OrderCategoryManage/index.tsx @@ -26,6 +26,7 @@ import PageTitleBox from '@/components/PageTitleBox'; import { uploadPicture } from '@/services/picture'; import defaultIcon from '../../../assets/brand/defaultIcon.png' import classNames from 'classnames'; +import ModalFooter from '../scenicSpotConfig/component/modalFooter'; const beforeUpload = (file: any) => { @@ -100,7 +101,24 @@ const OrderCategoryManage: React.FC<{ currentUser: CurrentUser | undefined }> = render: (_, record) => { return } }, @@ -159,50 +177,50 @@ const OrderCategoryManage: React.FC<{ currentUser: CurrentUser | undefined }> = ellipsis: true, hideInSearch: true, }, - { - dataIndex: 'option', - title: '操作', - width: 100, - ellipsis: true, - valueType: 'option', - align: 'center', - hideInSearch: true, - render: (_, record) => { - return ( - - { - console.log('recordrecordrecord', record); - if (record?.USERDEFINEDTYPE_ICO) { - setFileList([{ - name: "", - url: record?.USERDEFINEDTYPE_ICO - }]) - } + // { + // dataIndex: 'option', + // title: '操作', + // width: 100, + // ellipsis: true, + // valueType: 'option', + // align: 'center', + // hideInSearch: true, + // render: (_, record) => { + // return ( + // + // { + // console.log('recordrecordrecord', record); + // if (record?.USERDEFINEDTYPE_ICO) { + // setFileList([{ + // name: "", + // url: record?.USERDEFINEDTYPE_ICO + // }]) + // } - if (record?.PRESALE_TYPE) { - setFormPRESALE_TYPE(true) - } + // if (record?.PRESALE_TYPE) { + // setFormPRESALE_TYPE(true) + // } - setCurrentRow({ ...record }); - handleModalVisible(true); - }} - > - 编辑 - - { - handelDelete(record.USERDEFINEDTYPE_ID); - }} - > - 删除 - - - ); - }, - }, + // setCurrentRow({ ...record }); + // handleModalVisible(true); + // }} + // > + // 编辑 + // + // { + // handelDelete(record.USERDEFINEDTYPE_ID); + // }} + // > + // 删除 + // + // + // ); + // }, + // }, ]; // 预览上传后的图片 @@ -225,6 +243,11 @@ const OrderCategoryManage: React.FC<{ currentUser: CurrentUser | undefined }> = } else { message.success('删除成功!'); actionRef.current?.reload() + + handleConfirmLoading(false) + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) } } @@ -381,7 +404,27 @@ const OrderCategoryManage: React.FC<{ currentUser: CurrentUser | undefined }> = setFormPRESALE_TYPE(false) setFileList([]) }} + footer={ + { + await handelDelete(currentRow?.USERDEFINEDTYPE_ID) + }} + handleCancel={() => { + handleConfirmLoading(false) + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) + }} + handleOK={() => { + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} + /> + } onOk={async () => { // 提交框内的数据 formRef?.current?.validateFields().then(() => { handleConfirmLoading(true) @@ -404,6 +447,7 @@ const OrderCategoryManage: React.FC<{ currentUser: CurrentUser | undefined }> = formRef={formRef} autoFocusFirstInput submitter={false} + labelCol={{ style: { width: 80 } }} preserve={false} initialValues={currentRow ? { ...currentRow, diff --git a/src/pages/travelMember/OrderProductManage/components/OrderCategoryTree.tsx b/src/pages/travelMember/OrderProductManage/components/OrderCategoryTree.tsx index 67c5bba..7173b21 100644 --- a/src/pages/travelMember/OrderProductManage/components/OrderCategoryTree.tsx +++ b/src/pages/travelMember/OrderProductManage/components/OrderCategoryTree.tsx @@ -225,7 +225,7 @@ const OrderCategoryTree = ({ setSelectedId, reload, actionRef, currentUser, widt } colSpan={!collapsible ? "300px" : "60px"} - title={!collapsible ? "请选择商城分类" : ""} + title={!collapsible ? "请选择经营商家" : ""} headerBordered collapsed={collapsible} > diff --git a/src/pages/travelMember/OrderProductManage/components/OrderCategoryTreeMultiple.tsx b/src/pages/travelMember/OrderProductManage/components/OrderCategoryTreeMultiple.tsx new file mode 100644 index 0000000..bdba75c --- /dev/null +++ b/src/pages/travelMember/OrderProductManage/components/OrderCategoryTreeMultiple.tsx @@ -0,0 +1,232 @@ +import { connect } from "umi"; +import type { ConnectState } from "@/models/connect"; +import ProCard from "@ant-design/pro-card"; +import searchIcon from '@/assets/ai/searchIcon.png' +import { useRef, useState } from "react"; +import { MenuFoldOutlined } from "@ant-design/icons"; +import ProForm, { ProFormText } from "@ant-design/pro-form"; +import { Button, Col, FormInstance, Row, Tree } from "antd"; +import close from '@/assets/ai/close.png' +import { getServerpartTree } from "@/services/options"; +import useRequest from "@ahooksjs/use-request"; +import './style.less' +import { getMerchantShopTree } from "@/pages/Setting/Users/service"; +import { handeGetSPRegionShopTree } from "../../service"; + + +type DetailProps = { + setSelectedId: any; // 把选择的服务区 可以带给外层 + reload?: boolean; // 选择服务区 是否可以刷新组件之外的内容 + actionRef?: any; // 和reload配合使用 确认要刷新的内容 + currentUser: any; // 当前用户的信息 + width?: number; // 组件的宽度 + otherFun?: any; // 点击之后要进行的其他操作 多个操作可以写在一个方法里面传进来 + setCollapsible: any; // 是否收缩组件 + collapsible: boolean; // 收缩组件的判断依据 + haveTest?: boolean;// 是否有测试服务区 + handleGetLeftTreeData?: any // 拿到树数据的方法 必须要有输出值的 + noWj?: any // 把万佳商贸隐藏 + selectOnly?: boolean// 传入的时候 仅支持单选 +} +const LeftSelectTree = ({ setSelectedId, reload, actionRef, currentUser, width, otherFun, setCollapsible, collapsible, haveTest, handleGetLeftTreeData, noWj, selectOnly }: DetailProps) => { + const searchTreeRef = useRef(); + // 默认的服务区树 + const [allTreeViews, setAllTreeViews] = useState() + // 是否要显示全部 + const [isShowAllInTree, setIsShowAllInTree] = useState(false) + // 加载服务区树 + const { loading: treeLoading, data: treeViews } = useRequest(async () => { + const req: any = { + ProvinceCode: currentUser?.ProvinceCode, + // BusinessState: 1, + ShowOrder: true + + } + const data = await handeGetSPRegionShopTree(req) + console.log('获取服务区经营商家树', data); + setTreeView(data) + }) + // 显示服务区树搜索框 + const [showServiceSearchBox, setShowServiceSearchBox] = useState(false) + // 实际显示在左侧的服务区树 + const [treeView, setTreeView] = useState() + // 树要展开的行 + const [treeShowRow, setTreeShowRow] = useState() + // 筛选左侧的服务区树 + const handleFilterServiceTree = async (value?: string) => { + const resList: any = JSON.parse(JSON.stringify(allTreeViews)) + setSelectedId('') + if (resList && resList.length > 0 && value) { + setTreeView([]) + const list: any = [] + resList.forEach((item: any) => { + if (item.label.indexOf(value) !== -1) { + list.push(item) + } else { + if (item.children && item.children.length > 0) { + const childrenList: any = [] + item.children.forEach((subItem: any) => { + if (subItem.label.indexOf(value) !== -1) { + childrenList.push(subItem) + } + }) + item.children = childrenList + if (childrenList && childrenList.length > 0) { + list.push(item) + } + } + } + }) + if (list && list.length > 0) { + const keyList: any = ['0-0'] + list.forEach((item: any) => { + keyList.push(item.key) + }) + setTreeShowRow(keyList) + } + setTimeout(() => { + setTreeView(list) + }, 100) + } else { + setTreeView([]) + setTreeShowRow([]) + setTreeView(allTreeViews) + } + } + // 根据传入的服务区id筛选剔除掉这个服务区 + const handleFilterList = (list: any, id: any) => { + let res: any = [] + list.forEach((item: any) => { + if (item.value === id) { + + } else { + res.push(item) + } + }) + console.log('res', res); + return res + } + + // 仅支持单选一个服务区的时候 调用的方法 + const convertTreeForSelectOnly = (treeData: any[]): any[] => { + return treeData.map(item => { + const newItem = { + ...item, + disabled: item.type !== 1, + }; + if (item.children) { + newItem.children = convertTreeForSelectOnly(item.children); + } + return newItem; + }); + }; + + return ( +
+ + { + setShowServiceSearchBox(true) + }} /> + { + setCollapsible(!collapsible); + }} /> +
+ { + return [] + } + }} + isKeyPressSubmit + onFinish={(values: any) => { + return handleFilterServiceTree(values?.searchValue || '') + }} + > + + + + + + + + + + + + { + setShowServiceSearchBox(false) + }} /> +
+
} + colSpan={!collapsible ? "300px" : "60px"} + title={!collapsible ? "请选择服务区" : ""} + headerBordered + collapsed={collapsible} + > + {treeView && treeView.length > 0 ? { + if (selectOnly) { + // 只允许单选且只允许type为1 + const checked = Array.isArray(checkedKeys.checked) ? checkedKeys.checked : checkedKeys; + const node = info.node; + if (node.type === 2) { + setSelectedId(node.value); + if (reload) { + actionRef?.current?.reload(); + } + if (otherFun) { + otherFun(info); + } + } else { + // 取消非type=1的勾选 + setSelectedId(''); + } + } else { + // 多选逻辑 + const selectedIds = info.checkedNodes.filter((n: any) => n?.type === 2) + setSelectedId(selectedIds.map((n: any) => n?.value)?.toString() || '') + if (reload) { + actionRef?.current?.reload() + } + if (otherFun) { + otherFun(info) + } + } + }} + fieldNames={{ + title: "label", + key: "key" + }} + /> : ''} + + + ) +} + +export default connect(({ user }: ConnectState) => ({ + currentUser: user.currentUser, +}))(LeftSelectTree); diff --git a/src/pages/travelMember/OrderProductManage/index.tsx b/src/pages/travelMember/OrderProductManage/index.tsx index 1f38abf..79b4c05 100644 --- a/src/pages/travelMember/OrderProductManage/index.tsx +++ b/src/pages/travelMember/OrderProductManage/index.tsx @@ -28,6 +28,8 @@ import defaultIcon from '../../../assets/brand/defaultIcon.png' import OrderCategoryTree from './components/OrderCategoryTree'; import OrderCategoryManage from '../OrderCategoryManage'; import session from '@/utils/session'; +import OrderCategoryTreeMultiple from './components/OrderCategoryTreeMultiple'; +import Item from 'antd/lib/list/Item'; const beforeUpload = (file: any) => { @@ -47,6 +49,7 @@ const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = ( const { currentUser } = props const { confirm } = Modal; const actionRef = useRef(); + const selectMerchantActionRef = useRef(); const formRef = useRef(); const [currentRow, setCurrentRow] = useState(); const [showDetail, setShowDetail] = useState(); @@ -80,6 +83,8 @@ const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = ( const [selectListShop, setSelectListShop] = useState() // 点击选择了的商品上架的加载效果 const [selectListShopLoading, setSelectListShopLoading] = useState(false) + // 选择的当前商家 + const [selectMerchant, setSelectMerchant] = useState() const onDraggaleStart = (event, uiData) => { const { clientWidth, clientHeight } = window.document.documentElement; @@ -96,6 +101,7 @@ const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = ( }; // 定义列表字段内容 const columns: any = [ + { title: '查询时间', dataIndex: 'search_date', @@ -222,6 +228,11 @@ const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = ( ]; // 新增商品的columns const getProductsColumns: any = [ + { + title: '查询内容', + dataIndex: 'SearchKeyValue', + hideInTable: true, + }, { title: "序号", width: 70, @@ -301,7 +312,7 @@ const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = ( req = { ...currentRow, ...res, - MERCHANTS_ID: selectedId, + // MERCHANTS_ID: selectedId, OWNERUNIT_ID: currentUser?.OwnerUnitId, OWNERUNIT_NAME: currentUser?.OwnerUnitName, PROVINCE_CODE: currentUser?.ProvinceCode, @@ -312,7 +323,7 @@ const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = ( } else { req = { ...res, - MERCHANTS_ID: selectedId, + // MERCHANTS_ID: selectedId, OWNERUNIT_ID: currentUser?.OwnerUnitId, OWNERUNIT_NAME: currentUser?.OwnerUnitName, PROVINCE_CODE: currentUser?.ProvinceCode, @@ -407,7 +418,10 @@ const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = ( return (
- + {/* 单选的 */} + {/* */} + {/* 多选的 */} +
= ( return [] } - console.log('selectedIdselectedIdselectedIdselectedIdselectedId', selectedId); + console.log('selectedId', selectedId); + const req = { searchParameter: { @@ -442,7 +457,6 @@ const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = ( SELLER_IDS: selectedId || "", UPPER_STATE: params?.UPPER_STATE === "-1" ? "" : params?.UPPER_STATE, - // USERDEFINEDTYPE_IDS: selectedId, OPERATE_DATE_Start: params?.OPERATE_DATE_Start || "", OPERATE_DATE_End: params?.OPERATE_DATE_End || "", }, @@ -463,17 +477,14 @@ const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = ( columns={columns} toolbar={{ actions: [ - selectedId ? - <> - - < Button type={"primary"} onClick={() => { + <> + + {/* < Button type={"primary"} onClick={() => { setShowDetail(true) - }}>新增商品 - - : "", - + }}>新增商品 */} + ], }} /> @@ -603,6 +614,7 @@ const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = ( // 编辑数据 newValue = { ...values }; } + console.log('currentRowcurrentRowcurrentRow', currentRow); // 如果有开关,要把开关的代码写进去 await handleAddUpdate(newValue); @@ -870,7 +882,11 @@ const OrderProductManage: React.FC<{ currentUser: CurrentUser | undefined }> = (
); diff --git a/src/pages/travelMember/PointsRecordSearch/index.tsx b/src/pages/travelMember/PointsRecordSearch/index.tsx index a79aac2..5bcf8df 100644 --- a/src/pages/travelMember/PointsRecordSearch/index.tsx +++ b/src/pages/travelMember/PointsRecordSearch/index.tsx @@ -16,6 +16,7 @@ import LeftSelectTree from "@/pages/reports/settlementAccount/component/leftSele import { handleGetCONSUMPTIONRECORDList, handleGetPOINTRECORDList } from "../service"; import PageTitleBox from "@/components/PageTitleBox"; import moment from 'moment' +import session from "@/utils/session"; const PointsRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props) => { @@ -29,6 +30,7 @@ const PointsRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props) => { const [treeView, setTreeView] = useState() const [printIndex, setPrintIndex] = useState(new Date().getTime()) + let POINTTYPEObj = session.get('POINTTYPEObj') // 树相关的属性和方法 const [selectedId, setSelectedId] = useState() @@ -95,10 +97,14 @@ const PointsRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props) => { align: 'center', valueEnum: { "0": "全部", - "1000": "消费赠送", - "2000": "消费抵扣", - "3000": "注册赠送" + ...POINTTYPEObj }, + // valueEnum: { + // "0": "全部", + // "1000": "消费赠送", + // "2000": "消费抵扣", + // "3000": "注册赠送" + // }, initialValue: "0" }, { @@ -161,7 +167,7 @@ const PointsRecordSearch: React.FC<{ currentUser: CurrentUser }> = (props) => { request={async (params) => { const req: any = { SearchParameter: { - PROVINCE_CODE: currentUser?.ProvinceCode || "", + // PROVINCE_CODE: currentUser?.ProvinceCode || "", OWNERUNIT_ID: 911, POINT_TYPE: params?.POINT_TYPE === '-2' ? '' : params?.POINT_TYPE, POINT_SOURCE: params?.POINT_SOURCE === '0' ? '' : params?.POINT_SOURCE diff --git a/src/pages/travelMember/PointsRuleConfig/PointConfig.tsx b/src/pages/travelMember/PointsRuleConfig/PointConfig.tsx new file mode 100644 index 0000000..4bae423 --- /dev/null +++ b/src/pages/travelMember/PointsRuleConfig/PointConfig.tsx @@ -0,0 +1,522 @@ +// 积分枚举规则配置页面 +import React, { useRef, useState, Suspense } from 'react'; +import moment from 'moment'; // 时间相关引用,没有使用可以删除 +import numeral from "numeral"; // 数字相关引用,没有使用可以删除 +import { connect } from 'umi'; + +import useRequest from '@ahooksjs/use-request'; // 请求数据的引用 +import Draggable from 'react-draggable'; +import SubMenu from "antd/lib/menu/SubMenu"; +import ProTable from '@ant-design/pro-table'; +import ProDescriptions from '@ant-design/pro-descriptions'; +import ProForm, { ProFormDatePicker, ProFormDateTimePicker, ProFormDateTimeRangePicker, ProFormDigit, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormTreeSelect, ProFormUploadButton } from '@ant-design/pro-form'; +import { MenuFoldOutlined, PlusOutlined, ExclamationCircleOutlined } from '@ant-design/icons'; +import { PageContainer } from '@ant-design/pro-layout'; +import { Button, Col, Drawer, message, Row, Popconfirm, Space, Image, Modal, Form, Switch, Upload, Tooltip, Descriptions, TreeSelect } from 'antd'; + +import type { CurrentUser } from "umi"; +import type { ConnectState } from '@/models/connect'; +import type { ActionType, ProColumns } from '@ant-design/pro-table'; +import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions'; +import type { FormInstance } from 'antd'; + +import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除 +import PageTitleBox from '@/components/PageTitleBox'; +import { uploadPicture } from '@/services/picture'; +import defaultIcon from '../../../assets/brand/defaultIcon.png' +import classNames from 'classnames'; +import session from '@/utils/session'; +import { handeDeleteFIELDENUM, handeGetFIELDEXPLAINList, handeGetNestingFIELDENUMList, handeSynchroFIELDENUM } from '../service'; +import ModalFooter from '../scenicSpotConfig/component/modalFooter'; + + +const beforeUpload = (file: any) => { + const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'; + if (!isJpgOrPng) { + message.error('请上传JPEG、jpg、png格式的图片文件!'); + } + const isLt2M = file.size / 1024 / 1024 < 2; + if (!isLt2M) { + message.error('图片大小不超过 2MB!'); + } + return isJpgOrPng && isLt2M; +} + + +const PointConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { + const { currentUser } = props + const { confirm } = Modal; + const actionRef = useRef(); + const formRef = useRef(); + const [currentRow, setCurrentRow] = useState(); + const [showDetail, setShowDetail] = useState(); + const [modalVisible, handleModalVisible] = useState(); + const [confirmLoading, handleConfirmLoading] = useState(false) // 弹出框的内容表单是否在提交 + const [searchParams, setSearchParams] = useState(); + // 分类的树形结构数据 + const [typeTreeData, setTypeTreeData] = useState() + // 表单里面的是否预售 + const [formPRESALE_TYPE, setFormPRESALE_TYPE] = useState(false) + + // 弹出框拖动效果 + const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置 + const [disabled, setDraggleDisabled] = useState() // 是否拖动 + const draggleRef = React.createRef() + + let AFTERSALETYPEObj = session.get('AFTERSALETYPEObj') + const { data: FIELDEXPLAIN_ID } = useRequest(async () => { + const req: any = { + SearchParameter: { + FIELDEXPLAIN_FIELD: "POINT_TYPE" + } + } + const data = await handeGetFIELDEXPLAINList(req) + if (data && data.length > 0) { + let obj: any = data[0] + return obj.FIELDEXPLAIN_ID + } + + }) + // 文件列表 + const [fileList, setFileList] = useState([]) + const [imagePreviewVisible, setImagePreviewVisible] = useState(false) // 预览图片 + + 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 columns: any = [ + { + dataIndex: 'FIELDENUM_NAME', + title: '类别名称', + align: 'center', + width: 300, + ellipsis: true, + hideInSearch: true, + hideInDescriptions: true, + render: (_, record) => { + return { + setCurrentRow({ ...record }); + handleModalVisible(true); + }} + >{record?.FIELDENUM_NAME || ""} + } + }, + { + dataIndex: 'FIELDENUM_VALUE', + title: '售后枚举', + align: 'center', + width: 120, + ellipsis: true, + // valueType: 'treeSelect', + // valueEnum: typeTreeData, + hideInSearch: true, + }, + { + dataIndex: 'FIELDENUM_INDEX', + title: '类别索引', + align: 'center', + width: 120, + ellipsis: true, + hideInSearch: true, + }, + { + dataIndex: 'FIELDENUM_STATUS', + title: '有效状态', + align: 'center', + width: 120, + ellipsis: true, + valueType: "select", + valueEnum: { + "1": "有效", + "0": "无效" + }, + initialValue: "1" + }, + { + dataIndex: 'FIELDENUM_DESC', + title: '备注说明', + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + // { + // dataIndex: 'option', + // title: '操作', + // width: 100, + // ellipsis: true, + // valueType: 'option', + // align: 'center', + // hideInSearch: true, + // render: (_, record) => { + // return ( + // + // { + // setCurrentRow({ ...record }); + // handleModalVisible(true); + // }} + // > + // 编辑 + // + // { + // handelDelete(record.FIELDENUM_ID); + // }} + // > + // 删除 + // + // + // ); + // }, + // }, + ]; + + // 预览上传后的图片 + const handlePreview = async () => { + setFileList(fileList) + setImagePreviewVisible(true) + }; + const handleChangePreview = (val: any) => { + setImagePreviewVisible(val) + } + + // 删除点餐类别 + const handelDelete = async (id: any) => { + const req: any = { + FIELDENUMId: id + } + const result = await handeDeleteFIELDENUM(req) + if (result.Result_Code !== 100) { + message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`); + } else { + message.success('删除成功!'); + actionRef.current?.reload() + handleConfirmLoading(false) + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) + } + } + + // 同步点餐列表 + const handleAddUpdate = async (res: any) => { + let req: any = {} + if (currentRow?.FIELDENUM_ID) { + req = { + ...currentRow, + ...res, + } + } else { + req = { + ...res, + FIELDEXPLAIN_ID: FIELDEXPLAIN_ID, + FIELDENUM_PID: -1, + } + } + const data = await handeSynchroFIELDENUM(req) + handleConfirmLoading(false) + if (data.Result_Code === 100) { + message.success("新增成功!") + setCurrentRow(undefined) + formRef?.current?.resetFields() + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) + actionRef.current?.reload() + } else { + message.error(data.Result_Desc) + } + } + + return ( + + { + return `${record?.FIELDENUM_PID}-${record?.FIELDENUM_ID}` + }} + formRef={formRef} + headerTitle={} // 列表表头 + actionRef={actionRef} + search={{ span: 6, labelWidth: 'auto' }} + bordered + // 请求数据 + request={async (params, sorter) => { + const req = { + FIELDEXPLAIN_FIELD: 'POINT_TYPE', + FIELDEXPLAIN_ID: "", + FIELDENUM_PID: "", + FIELDENUM_STATUS: params?.FIELDENUM_STATUS, + SearchKey: "" + } + const data = await handeGetNestingFIELDENUMList(req); + if (data && data.length > 0) { + setTypeTreeData(data) + return { data: data, success: true, total: data.length } + } + return { data: [], success: true } + }} + columns={columns} + toolbar={{ + actions: [ + // 新增按钮 + , + ], + }} + /> + + {/* 图片预览组件 */} + {fileList && fileList.length > 0 &&
+ { + handleChangePreview(vis) + } + }}> + { + fileList.map((n) => ) + } + +
} + + + { + if (disabled) { + setDraggleDisabled(false) + } + }} + onMouseOut={() => { + setDraggleDisabled(true) + }} + + onFocus={() => { }} + onBlur={() => { }} + > + {currentRow ? '更新售后类别' : '新建售后类别'} +
+ } + destroyOnClose={true} + width={900} + bodyStyle={{ + height: '700px', // 你可以根据需要调整高度 + overflowY: 'auto', + }} + visible={modalVisible} + confirmLoading={confirmLoading} + afterClose={() => { + formRef.current?.resetFields(); + setCurrentRow(undefined); + }} + footer={ { + await handelDelete(currentRow?.FIELDENUM_ID) + }} + handleCancel={() => { + handleConfirmLoading(false) + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) + }} + handleOK={() => { + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} + + />} + onCancel={() => { + handleConfirmLoading(false) + handleModalVisible(false) + setFormPRESALE_TYPE(false) + setFileList([]) + }} + + onOk={async () => { // 提交框内的数据 + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} + modalRender={(modal) => { + return onDraggaleStart(event, uiData)} + handle='.orderCategoryModal' + > +
{modal}
+
+ }} + > + { + let newValue = { ...values }; + if (currentRow) { + // 编辑数据 + newValue = { ...values, FIELDENUM_ID: currentRow.FIELDENUM_ID }; + } + // 如果有开关,要把开关的代码写进去 + await handleAddUpdate(newValue); + + handleConfirmLoading(false) + setFormPRESALE_TYPE(false) + }} + > + + {/* + { + if (typeTreeData && typeTreeData.length > 0) { + let list: any = [{ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 }, ...typeTreeData] + return list + } else { + const req = { + FIELDEXPLAIN_FIELD: 'POINT_TYPE', + FIELDEXPLAIN_ID: "", + FIELDENUM_PID: "", + FIELDENUM_STATUS: 1, + SearchKey: "" + } + const data = await handeGetNestingFIELDENUMList(req); + if (data && data.length > 0) { + data.unshirft({ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 }) + setTypeTreeData(data) + return data + } else { + return [{ FIELDENUM_NAME: "默认类别", FIELDENUM_ID: -1 }] + } + } + }} + fieldProps={{ + fieldNames: { + label: 'FIELDENUM_NAME', + value: 'FIELDENUM_ID', + children: 'children' + }, + showSearch: true, + filterTreeNode: (input, node) => + (node.FIELDENUM_NAME || '').toLowerCase().includes(input.toLowerCase()) + }} + rules={[ + { + required: true, + message: "请选择上级类别" + } + ]} + /> + */} + + + + + + + + + + + + + + + + + + + + + ); +}; +export default connect(({ user }: ConnectState) => ({ + currentUser: user.currentUser +}))(PointConfig); \ No newline at end of file diff --git a/src/pages/travelMember/PointsRuleConfig/index.tsx b/src/pages/travelMember/PointsRuleConfig/index.tsx index 372dbd9..d80131a 100644 --- a/src/pages/travelMember/PointsRuleConfig/index.tsx +++ b/src/pages/travelMember/PointsRuleConfig/index.tsx @@ -24,6 +24,8 @@ import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚 import { handleDeleteSCORESETTING, handleGetSCORESETTINGList, handleSynchroSCORESETTING } from '../service'; import session from '@/utils/session'; import PageTitleBox from '@/components/PageTitleBox'; +import ModalFooter from '../scenicSpotConfig/component/modalFooter'; +import PointConfig from './PointConfig'; @@ -34,12 +36,19 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr const [currentRow, setCurrentRow] = useState(); const [showDetail, setShowDetail] = useState(); const [modalVisible, handleModalVisible] = useState(); + const [showConfigModal, setShowConfigModal] = useState(); + + const [confirmLoading, handleConfirmLoading] = useState(false) // 弹出框的内容表单是否在提交 const [searchParams, setSearchParams] = useState(); // 积分类型的枚举 let SCORETYPEList = session.get('SCORETYPEList') let SCORETYPEObj = session.get('SCORETYPEObj') let SCORETYPETree = session.get('SCORETYPETree') + let MEMBERSHIPLEVELYNObj = session.get('MEMBERSHIPLEVELYNObj') + let MEMBERSHIPLEVELYNList = session.get('MEMBERSHIPLEVELYNList') + let MEMBERSHIPTYPEYNList = session.get('MEMBERSHIPTYPEYNList') + let MEMBERSHIPTYPEYNObj = session.get('MEMBERSHIPTYPEYNObj') // 弹出框拖动效果 const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置 @@ -77,9 +86,35 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr { dataIndex: 'SCORE_NAME', title: '规则名称', + width: 200, + align: 'center', + hideInSearch: true, + render: (_, record) => { + return record?.SCORE_NAME ? { + setCurrentRow({ ...record }); + handleModalVisible(true); + }}> + {record?.SCORE_NAME} + : '-' + } + }, + { + dataIndex: 'MEMBERSHIP_LEVEL', + title: '会员等级', width: 120, align: 'center', hideInSearch: true, + valueType: 'select', + valueEnum: MEMBERSHIPLEVELYNObj + }, + { + dataIndex: 'MEMBERSHIP_TYPE', + title: '会员类型', + width: 120, + align: 'center', + hideInSearch: true, + valueType: 'select', + valueEnum: MEMBERSHIPTYPEYNObj }, { dataIndex: 'EXCHANGE_BASE', @@ -95,14 +130,14 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr align: 'center', hideInSearch: true, }, - { - dataIndex: 'MEET_AMOUNT', - title: '满足金额', - valueType: 'money', - width: 120, - align: 'center', - hideInSearch: true, - }, + // { + // dataIndex: 'MEET_AMOUNT', + // title: '满足金额', + // valueType: 'money', + // width: 120, + // align: 'center', + // hideInSearch: true, + // }, { dataIndex: 'EARN_POINTS', title: '赚取积分', @@ -117,28 +152,28 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr align: 'center', hideInSearch: true, }, - { - dataIndex: 'START_DATE', - title: '开始时间', - width: 150, - valueType: 'date', - align: 'center', - hideInSearch: true, - render: (_, record) => { - return record?.START_DATE ? moment(record?.START_DATE).format('YYYY-MM-DD HH:mm:ss') : "" - } - }, - { - dataIndex: 'END_DATE', - title: '结束时间', - width: 150, - valueType: 'date', - align: 'center', - hideInSearch: true, - render: (_, record) => { - return record?.END_DATE ? moment(record?.END_DATE).format('YYYY-MM-DD HH:mm:ss') : "" - } - }, + // { + // dataIndex: 'START_DATE', + // title: '开始时间', + // width: 150, + // valueType: 'date', + // align: 'center', + // hideInSearch: true, + // render: (_, record) => { + // return record?.START_DATE ? moment(record?.START_DATE).format('YYYY-MM-DD HH:mm:ss') : "" + // } + // }, + // { + // dataIndex: 'END_DATE', + // title: '结束时间', + // width: 150, + // valueType: 'date', + // align: 'center', + // hideInSearch: true, + // render: (_, record) => { + // return record?.END_DATE ? moment(record?.END_DATE).format('YYYY-MM-DD HH:mm:ss') : "" + // } + // }, // { // dataIndex: 'EXPIRY_DATE', // title: '有效期', @@ -163,12 +198,12 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr title: '有效状态', width: 120, align: 'center', - hideInSearch: true, valueType: 'select', valueEnum: { "1": "有效", "0": "无效" - } + }, + initialValue: "1" }, { dataIndex: 'ADDTIME', @@ -199,36 +234,36 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr // align: 'center', // hideInSearch: true, // }, - { - dataIndex: 'option', - title: '操作', - width: 150, - valueType: 'option', - align: 'center', - hideInSearch: true, - render: (_, record) => { - return ( - - { - setCurrentRow({ ...record }); - handleModalVisible(true); - }} - > - 编辑 - - { - await handelDelete(record.SCORESETTING_ID); - }} - > - 删除 - - - ); - }, - }, + // { + // dataIndex: 'option', + // title: '操作', + // width: 150, + // valueType: 'option', + // align: 'center', + // hideInSearch: true, + // render: (_, record) => { + // return ( + // + // { + // setCurrentRow({ ...record }); + // handleModalVisible(true); + // }} + // > + // 编辑 + // + // { + // await handelDelete(record.SCORESETTING_ID); + // }} + // > + // 删除 + // + // + // ); + // }, + // }, ]; const handelDelete = async (id: number) => { @@ -241,6 +276,8 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr } else { message.success('删除成功!'); actionRef.current?.reload() + handleConfirmLoading(false) + handleModalVisible(false) } }; @@ -251,11 +288,15 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr if (currentRow?.SCORESETTING_ID) { req = { ...currentRow, - ...res + ...res, + MEMBERSHIP_TYPE: res.MEMBERSHIP_TYPE === 0 ? '' : res.MEMBERSHIP_TYPE, + MEMBERSHIP_LEVEL: res.MEMBERSHIP_LEVEL === 0 ? '' : res.MEMBERSHIP_LEVEL, } } else { req = { ...res, + MEMBERSHIP_TYPE: res.MEMBERSHIP_TYPE === 0 ? '' : res.MEMBERSHIP_TYPE, + MEMBERSHIP_LEVEL: res.MEMBERSHIP_LEVEL === 0 ? '' : res.MEMBERSHIP_LEVEL, ADDTIME: moment().format('YYYY-MM-DD HH:mm:ss'), STAFF_ID: currentUser?.ID, STAFF_NAME: currentUser?.Name, @@ -304,7 +345,7 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr searchParameter: { PROVINCE_CODE: currentUser?.ProvinceCode || "", OWNERUNIT_ID: 911, - SCORESETTING_STATE: 1 + SCORESETTING_STATE: params?.SCORESETTING_STATE }, PageIndex: 1, PageSize: 20 @@ -330,6 +371,15 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr > 积分规则 , + ], }} pagination={{ defaultPageSize: 10 }} @@ -360,6 +410,10 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr } destroyOnClose={true} width={900} + bodyStyle={{ + height: '700px', // 你可以根据需要调整高度 + overflowY: 'auto', + }} visible={modalVisible} confirmLoading={confirmLoading} afterClose={() => { @@ -370,6 +424,23 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr handleConfirmLoading(false) handleModalVisible(false) }} + footer={ { + await handelDelete(currentRow?.SCORESETTING_ID) + }} + handleCancel={() => { + handleConfirmLoading(false) + handleModalVisible(false) + }} + handleOK={() => { + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} + + />} onOk={async () => { // 提交框内的数据 formRef?.current?.validateFields().then(() => { @@ -394,9 +465,11 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr autoFocusFirstInput submitter={false} preserve={false} + labelCol={{ style: { width: 80 } }} initialValues={{ ...currentRow, - SCORESETTING_STATE: (currentRow?.SCORESETTING_STATE || currentRow?.SCORESETTING_STATE === 0) ? currentRow?.SCORESETTING_STATE : 1 + SCORESETTING_STATE: (currentRow?.SCORESETTING_STATE || currentRow?.SCORESETTING_STATE === 0) ? currentRow?.SCORESETTING_STATE : 1, + MEMBERSHIP_LEVEL: currentRow?.MEMBERSHIP_LEVEL ? currentRow?.MEMBERSHIP_LEVEL.toString() : "" }} onFinish={async (values) => { let newValue: any = { ...values }; @@ -448,30 +521,49 @@ const PointsRuleConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr ]} /> + + + + + + + - - - - - - + + + + + + + {/* + + */} + = (pr ]} /> - + {/* = (pr name="END_DATE" label="结束时间" /> - - - - + */} = (pr + + { + setShowConfigModal(false) + }} + > + + ); }; diff --git a/src/pages/travelMember/ProductSpecificationManage/index.tsx b/src/pages/travelMember/ProductSpecificationManage/index.tsx index b970cc3..7e33a46 100644 --- a/src/pages/travelMember/ProductSpecificationManage/index.tsx +++ b/src/pages/travelMember/ProductSpecificationManage/index.tsx @@ -95,28 +95,7 @@ const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefine return record?.COMMODITY_STATE === 1 || record?.USERDEFINEDTYPE_STATE === 1 ? '有效' : '无效' } }, - { - dataIndex: 'USERDEFINEDTYPE_DATE', - title: '添加时间', - width: 200, - ellipsis: true, - align: 'center', - hideInSearch: true, - render: (_, record) => { - return record?.USERDEFINEDTYPE_DATE ? moment(record?.USERDEFINEDTYPE_DATE).format('YYYY-MM-DD HH:mm:ss') : "-" - } - }, - { - dataIndex: 'OPERATE_DATE', - title: '操作时间', - width: 200, - align: 'center', - ellipsis: true, - hideInSearch: true, - render: (_, record) => { - return record?.OPERATE_DATE ? moment(record?.OPERATE_DATE).format('YYYY-MM-DD HH:mm:ss') : "-" - } - }, + { dataIndex: 'USERDEFINEDTYPE_DESC', title: '备注说明', @@ -136,6 +115,28 @@ const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefine ellipsis: true, hideInSearch: true, }, + { + dataIndex: 'OPERATE_DATE', + title: '修改时间', + width: 200, + align: 'center', + ellipsis: true, + hideInSearch: true, + render: (_, record) => { + return record?.OPERATE_DATE ? moment(record?.OPERATE_DATE).format('YYYY-MM-DD HH:mm:ss') : "-" + } + }, + { + dataIndex: 'USERDEFINEDTYPE_DATE', + title: '新增时间', + width: 200, + ellipsis: true, + align: 'center', + hideInSearch: true, + render: (_, record) => { + return record?.USERDEFINEDTYPE_DATE ? moment(record?.USERDEFINEDTYPE_DATE).format('YYYY-MM-DD HH:mm:ss') : "-" + } + }, { dataIndex: 'option', title: '操作', @@ -389,6 +390,10 @@ const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefine } destroyOnClose={true} width={900} + bodyStyle={{ + height: '700px', // 你可以根据需要调整高度 + overflowY: 'auto', + }} visible={modalVisible} confirmLoading={confirmLoading} afterClose={() => { @@ -423,6 +428,7 @@ const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefine autoFocusFirstInput submitter={false} preserve={false} + labelCol={{ style: { width: 80 } }} // initialValues={currentRow} request={async () => { return currentRow ? { diff --git a/src/pages/travelMember/RegistrationRetentionAnalysis/index.tsx b/src/pages/travelMember/RegistrationRetentionAnalysis/index.tsx index f44bb1f..75ed906 100644 --- a/src/pages/travelMember/RegistrationRetentionAnalysis/index.tsx +++ b/src/pages/travelMember/RegistrationRetentionAnalysis/index.tsx @@ -1,15 +1,443 @@ // 注册留存分析 -import { ConnectState } from "@/models/connect"; -import { connect, CurrentUser } from "umi"; -const RegistrationRetentionAnalysis: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { +import { connect, Link } from "umi"; +import type { CurrentUser } from "umi"; +import type { ConnectState } from "@/models/connect"; +import React, { useEffect, useRef, useState } from "react"; +import ProCard from "@ant-design/pro-card"; +import { MenuFoldOutlined } from "@ant-design/icons"; +import { FormInstance, Tooltip } from "antd"; +import { Button, message, 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 moment from 'moment' +import PageTitleBox from "@/components/PageTitleBox"; +import { handleGetBEHAVIORRECORDList } from "@/pages/Setting/OperationLog/service"; + + +const RegistrationRetentionAnalysis: React.FC<{ currentUser: CurrentUser }> = (props) => { + const { dispatch, children, currentUser } = props + const downloadBtnRef = useRef() + const actionRef = useRef(); + const formRef = useRef(); + const [reqDetailList, setReqDetailList] = useState(); // 合计项数据源 + const [printOut, setPrintOut] = useState(); // 打印数据的内容 + const [printIndex, setPrintIndex] = useState(new Date().getTime()) + + + // 树相关的属性和方法 + const [selectedId, setSelectedId] = useState() + // 导出的加载效果 + const [showLoading, setShowLoading] = useState(false) + // 是否显示打印的表格 + const [showExportTable, setShowExportTable] = useState(false) + // 查询的条件 + const [searchParams, setSearchParams] = useState() + // 表格数据 + const [tableData, setTableData] = useState() + // 表格加载效果 + const [tableLoading, setTableLoading] = useState(false) + // 判断是否是第一次 + const [isFirst, setIsFirst] = useState(true) + + + const [columnsStateMap, setColumnsStateMap] = useState({ + BEHAVIORRECORD_ID: { show: false }, + OPERATING_SYSTEM: { show: false }, + BROWSER_VERSION: { show: false }, + }); + + // 改变panes + const handleTabsPanes = (payload: any): void => { + if (dispatch) { + dispatch({ + type: 'global/changeTabsRoutes', + payload: { data: payload, action: 'add' }, + }); + } + }; + + const columns: any = [ + { + title: '日志编号', + width: 120, + hideInSearch: true, + dataIndex: 'BEHAVIORRECORD_ID' + }, + { + title: '查询内容', + hideInTable: true, + dataIndex: 'searchValue' + }, + { + title: '系统模块', + width: 150, + hideInSearch: true, + ellipsis: true, + dataIndex: 'BEHAVIORRECORD_ROUTNAME', + render: (_, record) => { + // return record?.BEHAVIORRECORD_ROUTNAME ? { + // console.log('record', record); + // const req: any = { + // key: record.BEHAVIORRECORD_ROUT, + // path: record.BEHAVIORRECORD_ROUT, + // title: record.BEHAVIORRECORD_ROUTNAME, + // children: children + // } + // console.log('req', req); + // handleTabsPanes(req) + // }}> + // {record?.BEHAVIORRECORD_ROUTNAME || ""} + // : "-" + + return record?.BEHAVIORRECORD_ROUTNAME ? + {record?.BEHAVIORRECORD_ROUTNAME} + : "" + } + }, + { + title: '操作类型', + dataIndex: 'BEHAVIORRECORD_TYPE', + // hideInSearch: true, + width: 100, + valueType: 'select', + align: 'center', + valueEnum: { + "1000": '操作', + "1001": '编辑', + "1002": '删除', + "2000": '查询' + }, + initialValue: "2000", + }, + { + title: '操作人员', + hideInSearch: true, + dataIndex: 'USER_NAME', + ellipsis: true, + width: 120, + // render: (_, record) => { + // return + // {record?.USER_NAME || '-'} + // + // } + }, + { + title: '操作地址', + hideInSearch: true, + dataIndex: 'USER_LOGINIP', + width: 150, + }, + { + title: '操作地点', + hideInSearch: true, + dataIndex: 'USER_LOGINPLACE', + width: 160, + ellipsis: true, + }, + { + title: '响应时间(s)', + hideInSearch: true, + dataIndex: 'BEHAVIORRECORD_DURATION', + width: 120, + align: 'center', + sorter: (a, b) => a.BEHAVIORRECORD_DURATION - b.BEHAVIORRECORD_DURATION, + render: (_, record) => { + return `${record?.BEHAVIORRECORD_DURATION ? record?.BEHAVIORRECORD_DURATION : ""}` + } + }, + { + title: '操作内容', + hideInSearch: true, + dataIndex: 'BEHAVIORRECORD_EXPLAIN', + width: 250, + align: 'center', + ellipsis: true, + }, + // { + // title: '操作状态', + // dataIndex: 'status', + // hideInSearch: true, + // width: 100, + // render: (_, record) => { + // return '成功' + // } + // }, + { + title: '操作日期', + width: 160, + valueType: 'date', + dataIndex: 'BEHAVIORRECORD_TIME', + initialValue: moment(), + render: (_, record) => { + return record?.BEHAVIORRECORD_TIME + } + }, + { + title: '操作平台', + width: 160, + dataIndex: 'SOURCE_PLATFORM', + valueType: 'select', + valueEnum: { + // "驿商云平台": "驿商云平台", + // "数智化看板": "数智化看板", + // "驿行畅旅": "驿行畅旅", + // "驿付商家版": "驿付商家版", + // "微信公众号": "微信公众号", + // "驿商云客户端": "驿商云客户端", + "彩云驿出行": "彩云驿出行", + }, + initialValue: '彩云驿出行' + }, + { + title: '操作系统', + width: 150, + hideInSearch: true, + dataIndex: 'OPERATING_SYSTEM', + }, + { + title: '浏览器版本', + width: 150, + hideInSearch: true, + dataIndex: 'BROWSER_VERSION', + }, + { + title: '接口信息', + width: 150, + hideInSearch: true, + dataIndex: 'REQUEST_INFO', + ellipsis: true, + }, + // { + // title: '调用入参', + // width: 150, + // hideInSearch: true, + // dataIndex: 'BEHAVIORRECORD_DESC', + // ellipsis: true, + // }, + // { + // title: '操作', + // width: 120, + // dataIndex: 'options' + // } + ] + + const exportTable = (e) => { + e.stopPropagation(); // 防止Collapse组件收起 + const main = document.getElementsByClassName(`saleReportHideBox${printIndex}`)[0] + const thead = main.querySelector('thead').cloneNode(true); // 深克隆DOM节点 + const tbody = main.querySelector('tbody').cloneNode(true); // 深克隆DOM节点 + const container = document.querySelector('#hiddenBox'); + + const tempTable = document.createElement('table'); + tempTable.appendChild(thead); + tempTable.appendChild(tbody); + + tempTable.setAttribute('id', 'table-to-xls-saleRankReport'); // 给table添加id,值与按钮上的table字段对应 + + container.appendChild(tempTable); // 把创建的节点添加到页面容器中 + + setShowLoading(false) + + downloadBtnRef.current.handleDownload(); + setShowExportTable(false) + tempTable.remove() // 防止重复打印一个内容 + } + + + + const handleGetTableData = async () => { + const res: any = formRef.current?.getFieldsValue() + console.log('resresres', res); + let params: any = { + BEHAVIORRECORD_TIME: moment(res.BEHAVIORRECORD_TIME._d).format('YYYY-MM-DD'), + SOURCE_PLATFORM: res.SOURCE_PLATFORM, + BEHAVIORRECORD_TYPE: res.BEHAVIORRECORD_TYPE, + ...res + } + + setTableLoading(true) + const req: any = { + SearchParameter: { + BEHAVIORRECORD_TIME_Start: moment(params?.BEHAVIORRECORD_TIME).format('YYYY-MM-DD'), + BEHAVIORRECORD_TIME_End: moment(params?.BEHAVIORRECORD_TIME).format('YYYY-MM-DD'), + SOURCE_PLATFORMS: params?.SOURCE_PLATFORM, + // BEHAVIORRECORD_TYPE: params?.BEHAVIORRECORD_TYPE + }, + SortStr: 'BEHAVIORRECORD_TIME desc', + KeyWord: { + Key: 'BEHAVIORRECORD_ROUTNAME,USER_NAME,VISIT_CHANNELS,BEHAVIORRECORD_PREROUT', + Value: params?.searchValue || '' + }, + PageIndex: 1, + PageSize: 100 + } + setSearchParams(params) + const data = await handleGetBEHAVIORRECORDList(req) + setTableData(data) + setTableLoading(false) + + + + const allReq: any = { + SearchParameter: { + BEHAVIORRECORD_TIME_Start: moment(params?.BEHAVIORRECORD_TIME).format('YYYY-MM-DD'), + BEHAVIORRECORD_TIME_End: moment(params?.BEHAVIORRECORD_TIME).format('YYYY-MM-DD'), + SOURCE_PLATFORMS: params?.SOURCE_PLATFORM, + // BEHAVIORRECORD_TYPE: params?.BEHAVIORRECORD_TYPE + }, + SortStr: 'BEHAVIORRECORD_TIME desc', + KeyWord: { + Key: 'BEHAVIORRECORD_ROUTNAME,USER_NAME,VISIT_CHANNELS,BEHAVIORRECORD_PREROUT', + Value: params?.searchValue || '' + }, + PageIndex: 1, + PageSize: 999999 + } + const allData = await handleGetBEHAVIORRECORDList(allReq) + setTableData(allData) + setIsFirst(false) + } + + useEffect(async () => { + handleGetTableData() + }, []) + return ( -
+
{ + // 打印报表 + if (!reqDetailList || reqDetailList.length === 0) return; + setPrintOut(el); + }} > + { + showLoading ? +
+
+ + 数据导出中... +
+
: '' + } + +
+ { + showExportTable && reqDetailList && reqDetailList.length > 0 ? + : '' + } +
+
+ +
+
+ } // 列表表头 + search={{ span: 6 }} + pagination={{ pageSize: 100 }} + dataSource={tableData} + loading={tableLoading} + request={async (params) => { + if (!isFirst) { + handleGetTableData() + } + + // console.log('data', data); + // if (data && data.length > 0) { + // setReqDetailList(data) + // return { data, success: true } + // } + // return { data: [], success: true } + }} + toolbar={{ + actions: [ + + + , + + ] + }} + columnsState={{ + value: columnsStateMap, + onChange: setColumnsStateMap, + }} + onChange={(pagination, filters, sorter, extra) => { + if (extra.action === 'sort') { + return; + } + }} + /> +
+
) } export default connect(({ user }: ConnectState) => ({ currentUser: user.currentUser -}))(RegistrationRetentionAnalysis); \ No newline at end of file +}))(RegistrationRetentionAnalysis); diff --git a/src/pages/travelMember/SupplierMerchantManage/index.tsx b/src/pages/travelMember/SupplierMerchantManage/index.tsx index 60f282a..d8e6a92 100644 --- a/src/pages/travelMember/SupplierMerchantManage/index.tsx +++ b/src/pages/travelMember/SupplierMerchantManage/index.tsx @@ -12,6 +12,7 @@ import Draggable from "react-draggable"; import React from "react"; import ProForm, { ProFormSelect, ProFormText, ProFormTextArea } from "@ant-design/pro-form"; import moment from 'moment' +import ModalFooter from "../scenicSpotConfig/component/modalFooter"; const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { const { currentUser } = props @@ -29,6 +30,8 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }> const [disabled, setDraggleDisabled] = useState() // 是否拖动 const [currentRow, setCurrentRow] = useState(); const [confirmLoading, handleConfirmLoading] = useState(false) // 弹出框的内容表单是否在提交 + // 当前查询的文字 + const [currentSearchText, setCurrentSearchText] = useState('') const onDraggaleStart = (event, uiData) => { const { clientWidth, clientHeight } = window.document.documentElement; @@ -71,6 +74,14 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }> hideInSearch: true, width: 300, ellipsis: true, + render: (_, record) => { + return record?.MERCHANTS_NAME ? { + setCurrentRow({ ...record }); + handleModalVisible(true); + }}> + {highlightText(record?.MERCHANTS_NAME, currentSearchText)} + : "-" + } }, { dataIndex: 'MERCHANTS_EN', @@ -79,6 +90,9 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }> hideInSearch: true, width: 150, ellipsis: true, + render: (_, record) => { + return highlightText(record?.MERCHANTS_EN, currentSearchText) + } }, { dataIndex: 'MERCHANTS_TYPE', @@ -117,6 +131,14 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }> }, initialValue: "1" }, + { + dataIndex: 'searchText', + title: '查询内容', + align: 'center', + hideInTable: true, + width: 120, + ellipsis: true, + }, { dataIndex: 'MERCHANTS_TELEPHONE', title: '联系电话', @@ -125,40 +147,57 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }> width: 120, ellipsis: true, }, - { - dataIndex: 'option', - title: '操作', - valueType: 'option', - align: 'center', - hideInSearch: true, - width: 120, - fixed: "right", - ellipsis: true, - render: (_, record) => { - return ( - - { - setCurrentRow({ ...record }); - handleModalVisible(true); - }} - > - 编辑 - - { - await handelDelete(record.MERCHANTS_ID); - }} - > - 删除 - - - ); - }, - }, + // { + // dataIndex: 'option', + // title: '操作', + // valueType: 'option', + // align: 'center', + // hideInSearch: true, + // width: 120, + // fixed: "right", + // ellipsis: true, + // render: (_, record) => { + // return ( + // + // { + // setCurrentRow({ ...record }); + // handleModalVisible(true); + // }} + // > + // 编辑 + // + // { + // await handelDelete(record.MERCHANTS_ID); + // }} + // > + // 删除 + // + // + // ); + // }, + // }, ] + + // 给颜色标红的 + const highlightText = (text: string, searchText: string) => { + if (!text || !searchText) return text; + const regex = new RegExp(`(${searchText})`, 'gi'); + const parts = text.split(regex); + return ( + + {parts.map((part, i) => + part.toLowerCase() === searchText.toLowerCase() ? + {part} : + part + )} + + ); + }; + const handelDelete = async (MERCHANTS_ID: number) => { const result = await handeDeleteMERCHANTS({ MERCHANTSId: MERCHANTS_ID }); @@ -166,6 +205,8 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }> message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`); } else { message.success('删除成功!'); + handleConfirmLoading(false) + handleModalVisible(false) actionRef.current?.reload() } }; @@ -241,9 +282,14 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }> MERCHANTS_AUTOTYPE: selectedId, MERCHANTS_STATE: params?.MERCHANTS_STATE === '-1' ? '' : params?.MERCHANTS_STATE }, + keyWord: { + key: "MERCHANTS_NAME,MERCHANTS_EN", + value: params?.searchText || "" + }, PageIndex: 1, PageSize: 999999, } + setCurrentSearchText(params?.searchText || "") const data = await handeGetMERCHANTSList(req); console.log('datadatadatadatadata', data); if (data.List && data.List.length > 0) { @@ -296,7 +342,11 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }>
} destroyOnClose={true} - width={1200} + width={900} + bodyStyle={{ + height: '700px', // 你可以根据需要调整高度 + overflowY: 'auto', + }} visible={modalVisible} confirmLoading={confirmLoading} afterClose={() => { @@ -307,6 +357,22 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }> handleConfirmLoading(false) handleModalVisible(false) }} + footer={ { + handelDelete(currentRow?.MERCHANTS_ID) + }} + handleCancel={() => { + handleConfirmLoading(false) + handleModalVisible(false) + }} + handleOK={() => { + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} + />} onOk={async () => { // 提交框内的数据 formRef?.current?.validateFields().then(() => { @@ -328,6 +394,7 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }> layout={'horizontal'} formRef={formRef} autoFocusFirstInput + labelCol={{ style: { width: 80 } }} submitter={false} preserve={false} initialValues={currentRow ? { diff --git a/src/pages/travelMember/memberInfor/index.tsx b/src/pages/travelMember/memberInfor/index.tsx index a7f8a2f..0d78f55 100644 --- a/src/pages/travelMember/memberInfor/index.tsx +++ b/src/pages/travelMember/memberInfor/index.tsx @@ -23,6 +23,7 @@ import './style.less' import memberInfoIcon from '@/assets/detail/memberInfoIcon.png' import closeIcon from '@/assets/detail/closeIcon.png' import memberDetailIcon from '@/assets/detail/memberDetailIcon.png' +import AddressDetail from "../MemberAddress/components/addressDetail"; @@ -76,7 +77,6 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => { MEMBERSHIP_ADDRESS: { show: false }, PLUS_EXPIRYDATE: { show: false }, RECOMMEND_NAME: { show: false }, - ADDTIME: { show: false }, MEMBERSHIP_DESC: { show: false }, }); const onDraggaleStart = (event, uiData) => { @@ -95,21 +95,20 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => { const columns: any = [ { - title: "查询内容", + title: "用户昵称", width: 200, dataIndex: "MEMBERSHIP_NAME", ellipsis: true, align: 'center', fixed: 'left', - // render: (_, record) => { - // return { - // console.log('recordrecord', record); - // setCurrentRow(record) - // setShowDetailDrawer(true) - // }}> - // {record?.MEMBERSHIP_NAME || ""} - // - // } + render: (_, record) => { + return { + setCurrentRow(record) + setShowDetailDrawer(true) + }}> + {record?.MEMBERSHIP_NAME || ""} + + }, fieldProps: { placeholder: "请输入要查询的内容" } @@ -247,21 +246,22 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => { dataIndex: "MEMBERSHIP_POINT", hideInSearch: true, ellipsis: true, + sorter: true, align: 'center', }, - { - title: "付费会员", - width: 120, - dataIndex: "ISPLUS", - hideInSearch: true, - ellipsis: true, - align: 'center', - valueType: 'select', - valueEnum: { - 0: "否", - 1: "是" - } - }, + // { + // title: "付费会员", + // width: 120, + // dataIndex: "ISPLUS", + // hideInSearch: true, + // ellipsis: true, + // align: 'center', + // valueType: 'select', + // valueEnum: { + // 0: "否", + // 1: "是" + // } + // }, { title: "付费有效期", width: 120, @@ -276,6 +276,7 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => { dataIndex: "ACCOUNT_BALANCE", hideInSearch: true, ellipsis: true, + sorter: true, align: 'center', }, { @@ -286,24 +287,31 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => { ellipsis: true, align: 'center', }, + // { + // title: "会员状态", + // width: 120, + // dataIndex: "MEMBERSHIP_STATE", + // ellipsis: true, + // align: 'center', + // valueType: 'select', + // valueEnum: COMPANY_STATEObj, + // initialValue: "1000" + // }, { - title: "会员状态", - width: 120, - dataIndex: "MEMBERSHIP_STATE", - ellipsis: true, - align: 'center', - valueType: 'select', - valueEnum: COMPANY_STATEObj, - initialValue: "1000" - }, - { - title: "添加时间", + title: "注册时间", width: 150, dataIndex: "ADDTIME", align: 'center', hideInSearch: true, ellipsis: true, - align: 'center', + sorter: true, + // sorter: (a, b) => { + // const timeA = new Date(a.ADDTIME).getTime(); + // const timeB = new Date(b.ADDTIME).getTime(); + // return timeB - timeA; // 倒序排序 + // }, + // 默认排序配置 + defaultSortOrder: 'descend', render: (_, record) => { return record?.ADDTIME ? moment(record?.ADDTIME).format('YYYY-MM-DD') : '-' } @@ -315,23 +323,23 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => { hideInSearch: true, ellipsis: true, }, - { - title: "操作", - width: 120, - dataIndex: "options", - hideInSearch: true, - align: 'center', - ellipsis: true, - fixed: "right", - render: (_, record) => { - return - { - setCurrentRow(record) - setShowDetailDrawer(true) - }}>详情 - - } - } + // { + // title: "操作", + // width: 120, + // dataIndex: "options", + // hideInSearch: true, + // align: 'center', + // ellipsis: true, + // fixed: "right", + // render: (_, record) => { + // return + // { + // setCurrentRow(record) + // setShowDetailDrawer(true) + // }}>详情 + // + // } + // } ] const exportTable = (e) => { @@ -660,8 +668,11 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => { scroll={{ x: '100%', y: 'calc(100vh - 450px)' }} headerTitle={} search={{ span: 6 }} - request={async (params) => { - console.log('paramsparamsparams', params); + request={async (params, sorter) => { + const sortstr = Object.keys(sorter).map(n => { + const value = sorter[n] + return value ? `${n} ${value.replace('end', '')}` : '' + }) const req: any = { SearchParameter: { PROVINCE_CODE: currentUser?.ProvinceCode || "", @@ -676,6 +687,7 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => { }, PageIndex: params.current || 1, PageSize: 20, + sortstr: sortstr.length ? sortstr.toString() : "", } setSearchParams(params) const data = await handleGetMEMBERSHIPList(req) @@ -744,6 +756,10 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => { modalRef.current?.resetFields(); setCurrentRow(undefined); }} + bodyStyle={{ + maxHeight: '700px', // 你可以根据需要调整高度 + overflowY: 'auto', + }} onCancel={() => { setShowDetailDrawer(false) setCurrentRow(undefined); @@ -753,7 +769,7 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => { disabled={disabled} bounds={bounds} onStart={(event, uiData) => onDraggaleStart(event, uiData)} - handle=".modal-drag-title" + handle=".modalTop" >
{modal}
@@ -767,10 +783,10 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => { initialValues={currentRow ? { ...currentRow, MEMBERSHIP_BIRTHDAY: currentRow?.MEMBERSHIP_BIRTHDAY ? moment(currentRow?.MEMBERSHIP_BIRTHDAY).format('YYYY-MM-DD') : '', - ADDTIME: currentRow?.ADDTIME ? moment(currentRow?.ADDTIME).format('YYYY-MM-DD HH:mm:ss') : '' + ADDTIME: currentRow?.ADDTIME ? moment(currentRow?.ADDTIME).format('YYYY-MM-DD') : '', } : {}} > -
+
会员详情 @@ -781,7 +797,7 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => { }} />
-
+
@@ -799,6 +815,15 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => {
+ + + = (props) => { style={{ marginBottom: '16px' }} /> - + + + + {/* - + */}
@@ -859,6 +892,9 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => { { setSelectTab(4) }}>成长值记录 + { + setSelectTab(5) + }}>地址管理
@@ -944,14 +980,14 @@ const memberInfor: React.FC<{ currentUser: CurrentUser }> = (props) => { style={{ marginBottom: '16px' }} /> - + {/* - + */} = (props) => { /> : '' } + + { + selectTab === 5 ? : '' + } diff --git a/src/pages/travelMember/scenicSpotConfig/component/modalFooter.tsx b/src/pages/travelMember/scenicSpotConfig/component/modalFooter.tsx new file mode 100644 index 0000000..6bb45af --- /dev/null +++ b/src/pages/travelMember/scenicSpotConfig/component/modalFooter.tsx @@ -0,0 +1,51 @@ +import { connect } from "umi"; +import type { ConnectState } from "@/models/connect"; +import { Button } from "antd"; + +type DetailProps = { + hideDelete?: boolean + handleDelete?: any + hideCancel?: boolean + handleCancel?: any + hideOK?: boolean + handleOK?: any +} +const ModalFooter = ({ hideDelete, handleDelete, hideCancel, handleCancel, hideOK, handleOK }: DetailProps) => { + + return ( +
+
+ { + hideDelete ? "" : + + } +
+
+ { + hideCancel ? '' : + + } + { + hideOK ? '' : + + } +
+
+ ) +} + +export default connect(({ user, }: ConnectState) => ({ + currentUser: user.currentUser, +}))(ModalFooter); diff --git a/src/pages/travelMember/scenicSpotConfig/index.tsx b/src/pages/travelMember/scenicSpotConfig/index.tsx index b69dc03..adbc1d2 100644 --- a/src/pages/travelMember/scenicSpotConfig/index.tsx +++ b/src/pages/travelMember/scenicSpotConfig/index.tsx @@ -25,6 +25,7 @@ import PageTitleBox from "@/components/PageTitleBox"; import { handeDeleteSCENICAREA, handeGetSCENICAREAList, handeSynchroSCENICAREA } from '../service'; import session from '@/utils/session'; import { deletePicture, uploadPicture } from '@/services/picture'; +import ModalFooter from './component/modalFooter'; const beforeUpload = (file: any) => { @@ -93,6 +94,29 @@ const scenicSpotConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr hideInSearch: true, hideInDescriptions: true, fixed: "left", + render: (_, record) => { + return { + let imgList: any = [] + if (record?.ImageList && record?.ImageList.length > 0) { + record?.ImageList.forEach((item: any) => { + let obj = JSON.parse(JSON.stringify(item)) + obj.url = obj.ImageUrl + obj.name = obj.ImageName + obj.uid = item.ImageId + obj.status = 'done' + imgList.push(obj) + }) + } + setCurrentRow({ + ...record, + SCENICAREA_Image: imgList + }); + setFileList(imgList); + handleModalVisible(true); + }}> + {record?.SCENICAREA_NAME || ""} + + } }, { dataIndex: 'SCENICAREA_TYPE', @@ -196,53 +220,53 @@ const scenicSpotConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr return record?.OPERATE_DATE ? moment(record?.OPERATE_DATE).format('YYYY-MM-DD HH:mm:ss') : "-" } }, - { - dataIndex: 'option', - title: '操作', - width: 120, - ellipsis: true, - valueType: 'option', - hideInSearch: true, - align: 'center', - fixed: "right", - render: (_, record) => { - return ( - - { - let imgList: any = [] - if (record?.ImageList && record?.ImageList.length > 0) { - record?.ImageList.forEach((item: any) => { - let obj = JSON.parse(JSON.stringify(item)) - obj.url = obj.ImageUrl - obj.name = obj.ImageName - obj.uid = item.ImageId - obj.status = 'done' - imgList.push(obj) - }) - } - setCurrentRow({ - ...record, - SCENICAREA_Image: imgList - }); - setFileList(imgList); - handleModalVisible(true); - }} - > - 编辑 - - { - await handelDelete(record.SCENICAREA_ID); - }} - > - 删除 - - - ); - }, - }, + // { + // dataIndex: 'option', + // title: '操作', + // width: 120, + // ellipsis: true, + // valueType: 'option', + // hideInSearch: true, + // align: 'center', + // fixed: "right", + // render: (_, record) => { + // return ( + // + // { + // let imgList: any = [] + // if (record?.ImageList && record?.ImageList.length > 0) { + // record?.ImageList.forEach((item: any) => { + // let obj = JSON.parse(JSON.stringify(item)) + // obj.url = obj.ImageUrl + // obj.name = obj.ImageName + // obj.uid = item.ImageId + // obj.status = 'done' + // imgList.push(obj) + // }) + // } + // setCurrentRow({ + // ...record, + // SCENICAREA_Image: imgList + // }); + // setFileList(imgList); + // handleModalVisible(true); + // }} + // > + // 编辑 + // + // { + // await handelDelete(record.SCENICAREA_ID); + // }} + // > + // 删除 + // + // + // ); + // }, + // }, ]; // 预览上传后的图片 @@ -261,6 +285,9 @@ const scenicSpotConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`); } else { message.success('删除成功!'); + handleConfirmLoading(false) + handleModalVisible(false) + setFileList([]) actionRef.current?.reload() } }; @@ -422,7 +449,7 @@ const scenicSpotConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr destroyOnClose={true} width={900} bodyStyle={{ - maxHeight: '700px', // 你可以根据需要调整高度 + height: '700px', // 你可以根据需要调整高度 overflowY: 'auto', }} visible={modalVisible} @@ -436,7 +463,19 @@ const scenicSpotConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr handleModalVisible(false) setFileList([]) }} + footer={ { + await handelDelete(currentRow?.SCENICAREA_ID); + }} handleCancel={() => { + handleConfirmLoading(false) + handleModalVisible(false) + setFileList([]) + }} handleOK={() => { + formRef?.current?.validateFields().then(() => { + handleConfirmLoading(true) + formRef?.current?.submit() + }) + }} />} onOk={async () => { // 提交框内的数据 formRef?.current?.validateFields().then(() => { handleConfirmLoading(true) @@ -460,6 +499,7 @@ const scenicSpotConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr autoFocusFirstInput submitter={false} preserve={false} + labelCol={{ style: { width: 80 } }} initialValues={currentRow ? { ...currentRow, SCENICAREA_Image: currentRow?.ImageList @@ -667,8 +707,8 @@ const scenicSpotConfig: React.FC<{ currentUser: CurrentUser | undefined }> = (pr - -
+ +
); }; export default connect(({ user }: ConnectState) => ({ diff --git a/src/pages/travelMember/serverpartInfo/components/serverpartInfo.tsx b/src/pages/travelMember/serverpartInfo/components/serverpartInfo.tsx index e649db3..4807b9b 100644 --- a/src/pages/travelMember/serverpartInfo/components/serverpartInfo.tsx +++ b/src/pages/travelMember/serverpartInfo/components/serverpartInfo.tsx @@ -44,6 +44,7 @@ const SERVERPARTTable = ({ currentRow, onShow, onRef, pageType }: DetailProps) = // 选择的tab const [selectTab, setSelectTab] = useState() + const shopregionObj: any = session.get('shopregionObj') const LOADBEARINGList = session.get('LOADBEARINGList') // 拖动结束 @@ -183,6 +184,68 @@ const SERVERPARTTable = ({ currentRow, onShow, onRef, pageType }: DetailProps) = onFinish={async (values) => { }} > + {/* + + + + { + setServerPartType(Number(e.target.value)) + }} value={serverPartType}> + 服务区单侧 + 服务区双侧 + + + */} + + { + pageType === 2 ? +
+ { + setSelectTab(e) + }} items={areaTabList} /> +
: '' + } + +
+ + + + + { + if (currentRow?.SERVERPART_ID) { + const req: any = { + ServerpartId: currentRow?.SERVERPART_ID + } + const regData = await handleNewGetSERVERPARTDetail(req) + const list: any = regData.ServerPartInfo + + console.log('regData', regData); + console.log('formDetailAll222', formDetailAll); + + if (list && list.length > 0) { + const obj: any = session.get('shopregionObj') + const res: any = [] + list.forEach((item: any) => { + if (item.SERVERPART_REGION) { + res.push({ label: obj[item.SERVERPART_REGION], value: item.SERVERPART_REGION }) + } + }) + console.log('res', res); + formRef.current?.setFieldsValue({ currentArea: res[0].value }) + return res + } + } + }} + /> + + + + +
基本信息 @@ -190,6 +253,7 @@ const SERVERPARTTable = ({ currentRow, onShow, onRef, pageType }: DetailProps) = @@ -202,6 +266,7 @@ const SERVERPARTTable = ({ currentRow, onShow, onRef, pageType }: DetailProps) = dropdownStyle={{ maxHeight: 300, overflow: 'auto' }} treeData={serverpart_typeTree} allowClear + disabled /> @@ -250,6 +315,7 @@ const SERVERPARTTable = ({ currentRow, onShow, onRef, pageType }: DetailProps) = @@ -289,12 +355,14 @@ const SERVERPARTTable = ({ currentRow, onShow, onRef, pageType }: DetailProps) = @@ -339,70 +407,7 @@ const SERVERPARTTable = ({ currentRow, onShow, onRef, pageType }: DetailProps) = - - - - - { - setServerPartType(Number(e.target.value)) - }} value={serverPartType}> - 服务区单侧 - 服务区双侧 - - - - - { - pageType === 2 ? -
- { - setSelectTab(e) - }} items={areaTabList} /> -
: '' - } - -
- - - - - { - if (currentRow?.SERVERPART_ID) { - const req: any = { - ServerpartId: currentRow?.SERVERPART_ID - } - const regData = await handleNewGetSERVERPARTDetail(req) - const list: any = regData.ServerPartInfo - - console.log('regData', regData); - console.log('formDetailAll222', formDetailAll); - - if (list && list.length > 0) { - const obj: any = session.get('shopregionObj') - const res: any = [] - list.forEach((item: any) => { - if (item.SERVERPART_REGION) { - res.push({ label: obj[item.SERVERPART_REGION], value: item.SERVERPART_REGION }) - } - }) - console.log('res', res); - formRef.current?.setFieldsValue({ currentArea: res[0].value }) - return res - } - } - }} - /> - - - - -
- - +
{shopregionObj[selectTab] || ""}
0 && selectTab === areaTabList[0].key ? 'block' : 'none' }}> 面积相关 diff --git a/src/pages/travelMember/serverpartInfo/index.tsx b/src/pages/travelMember/serverpartInfo/index.tsx index 72933d3..ab9330f 100644 --- a/src/pages/travelMember/serverpartInfo/index.tsx +++ b/src/pages/travelMember/serverpartInfo/index.tsx @@ -14,11 +14,14 @@ import { handleSynchroSERVERPART } from "@/pages/newDataAnalysis/service"; import useRequest from "@ahooksjs/use-request"; import { getServerpartTree } from "@/services/options"; import { handleSynchroNOTICEINFO } from "@/pages/basicManage/highwayHeadlines/service"; -import ProForm, { ProFormUploadButton } from "@ant-design/pro-form"; +import ProForm, { ProFormText, ProFormUploadButton } from "@ant-design/pro-form"; import { deletePicture, getPictureList, uploadPicture } from "@/services/picture"; import { handeGetPictureList } from "../service"; import SubMenu from "antd/lib/menu/SubMenu"; import Draggable from "react-draggable"; +import searchIcon from '@/assets/ai/searchIcon.png' +import close from '@/assets/ai/close.png' +import './style.less' const beforeUpload = (file: any) => { const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'; @@ -35,6 +38,7 @@ const beforeUpload = (file: any) => { const serverpartInfo: React.FC<{ currentUser: CurrentUser }> = (props) => { const { confirm } = Modal; const { currentUser } = props + const searchTreeRef = useRef(); const modalRef = useRef(); const [collapsible, setCollapsible] = useState(false) const [treeView, setTreeView] = useState() @@ -62,6 +66,14 @@ const serverpartInfo: React.FC<{ currentUser: CurrentUser }> = (props) => { const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置 const [disabled, setDraggleDisabled] = useState() // 是否拖动 const draggleRef = React.createRef() + // 默认展开的菜单 + const [defaultOpenKeys, setDefaultOpenKeys] = useState(); + // 显示服务区树搜索框 + const [showServiceSearchBox, setShowServiceSearchBox] = useState(false) + // 初始的最全的左侧菜单树 数据 + const [menuData, setMenuData] = useState(); + // 判断左侧数据是否加载好了 + const [showLeftTreeData, setShowLeftTreeData] = useState(false) const onDraggaleStart = (event, uiData) => { const { clientWidth, clientHeight } = window.document.documentElement; @@ -86,7 +98,31 @@ const serverpartInfo: React.FC<{ currentUser: CurrentUser }> = (props) => { list.push(item) } }) + setTreeView(list) + setMenuData(list) + + let obj: any = handleGetTreeFirst(list) + if (obj && obj.length > 0) { + let defaultKey: any = [] + if (obj && obj.length > 0) { + obj.forEach((item: any) => { + defaultKey.push(item.key) + }) + } + setDefaultOpenKeys(defaultKey) + let lastObj: any = obj[obj.length - 1] + + setCurrenMenu(lastObj.value) + setSelectedId('') + setCurrenRegion('') + // 只有修改服务区的时候 触发刷新 + setShowRightForm(false) + setTimeout(() => { + setShowRightForm(true) + }, 10) + } + setShowLeftTreeData(true) return data }) // 根据左侧选中的菜单加载右侧数据 @@ -388,6 +424,108 @@ const serverpartInfo: React.FC<{ currentUser: CurrentUser }> = (props) => { })) } + // 拿到树形的第一个数据 + interface TreeNode { + [key: string]: any; + children?: TreeNode[]; + } + type TreeData = TreeNode | TreeNode[] | any; + const handleGetTreeFirst = (node: TreeData): TreeData[] => { + // 处理数组情况 + if (Array.isArray(node)) { + return node.length > 0 ? handleGetTreeFirst(node[0]) : []; + } + // 处理对象情况 + else if (typeof node === 'object' && node !== null) { + // 如果没有children或者children为空,返回包含当前节点的数组 + if (!node.children || node.children.length === 0) { + return [node]; + } + // 否则递归处理第一个子节点,并将当前节点添加到结果数组前面 + const childResult = handleGetTreeFirst(node.children[0]); + return [node, ...childResult]; + } + // 基本数据类型直接返回包含该值的数组 + return [node]; + }; + + // 筛选左侧的服务区树 + const handleFilterServiceTree = async (value?: string) => { + if (value) { + setShowLeftTreeData(false) + setTreeView([]) + setTimeout(() => { + let treeViewData: any = JSON.parse(JSON.stringify(menuData)) + let res = handleSearch(treeViewData, value) + console.log('resresresres', res); + let keyList: any = [] + if (res && res.length > 0) { + res.forEach((item: any) => { + keyList.push(item.key) + }) + setDefaultOpenKeys(keyList) + setTreeView(res) + setCurrenMenu("") + setSelectedId('') + setCurrenRegion('') + setShowLeftTreeData(true) + } + }, 10) + } else { + setTreeView(menuData) + } + console.log('valuevaluevaluevalue', value); + console.log('treeView', treeView); + console.log('menuData', menuData); + + } + + + // 搜索方法 + const handleSearch = (tree: any, searchLabel: string): TreeNode[] => { + const results: TreeNode[] = []; + + // 处理数组情况(遍历每棵树) + if (Array.isArray(tree)) { + for (const node of tree) { + const nodeResults = handleSearch(node, searchLabel); + if (nodeResults.length > 0) { + results.push(...nodeResults); + } + } + return results; + } + + // 检查当前节点是否是叶子节点且label匹配 + const isLeaf = !tree.children || tree.children.length === 0; + if (isLeaf && tree.label.includes(searchLabel)) { + return [{ ...tree }]; // 返回当前节点的副本(作为一条独立路径) + } + + // 如果不是叶子节点,递归检查子节点 + if (tree.children && tree.children.length > 0) { + const matchedChildren: TreeNode[] = []; + + for (const child of tree.children) { + const childResults = handleSearch(child, searchLabel); + if (childResults.length > 0) { + matchedChildren.push(...childResults); + } + } + + // 如果有匹配的子节点,构造当前节点 + 所有匹配的子路径 + if (matchedChildren.length > 0) { + return [{ + ...tree, + children: matchedChildren, // 保留所有匹配的子节点(不拆分) + }]; + } + } + + return results; // 默认返回空数组(无匹配) + } + + return (
@@ -395,19 +533,58 @@ const serverpartInfo: React.FC<{ currentUser: CurrentUser }> = (props) => { style={{ width: !collapsible ? "300px" : "60px" }} className="pageTable-leftnav" bodyStyle={{ padding: 0, paddingTop: 20, paddingLeft: 20, width: !collapsible ? "300px" : "60px" }} + extra={
+ { + setShowServiceSearchBox(true) + }} /> + { + setCollapsible(!collapsible); + }} /> +
+ { + return [] + } + }} + isKeyPressSubmit + onFinish={(values: any) => { + return handleFilterServiceTree(values?.searchValue || '') + }} + > + + + + + + + + + + + { + setShowServiceSearchBox(false) + }} /> +
+
} colSpan={!collapsible ? "300px" : "60px"} title={!collapsible ? "请选择服务区" : ""} headerBordered collapsed={collapsible} - extra={ - { - setCollapsible(!collapsible); - }} rev={undefined} /> - } > - {!treeLoading && = (props) => { onSelect={(item, key, keyPath, selectedKeys, domEvent) => { loadSelectedId(item) }} + defaultOpenKeys={defaultOpenKeys} > {getMenuDom(treeView, loadSelectedId)} } @@ -465,7 +643,7 @@ const serverpartInfo: React.FC<{ currentUser: CurrentUser }> = (props) => { paddingRight: 0, overflowY: "auto" }}> -
+
{ showRightForm ? : @@ -560,9 +738,9 @@ const serverpartInfo: React.FC<{ currentUser: CurrentUser }> = (props) => {
} destroyOnClose={true} - width={1200} + width={900} bodyStyle={{ - maxHeight: '700px', // 你可以根据需要调整高度 + height: '700px', // 你可以根据需要调整高度 overflowY: 'auto', }} visible={showUploadImgModal} @@ -633,30 +811,28 @@ const serverpartInfo: React.FC<{ currentUser: CurrentUser }> = (props) => { activeKey={selectActiveKey} items={[ { - label: `服务区图片上传`, + label: `服务区`, key: '1', }, { - label: `母婴室图片上传`, + label: `母婴室`, key: '2', }, { - label: `司机之家图片上传`, + label: `司机之家`, key: '3', }, { - label: `住宿客房图片上传`, + label: `住宿客房`, key: '4', }, { - label: `便利店图片上传`, + label: `便利店`, key: '5', }, ]} /> - - { + // const FieldExplain = session.get(params.sessionName ? params.sessionName : params.FieldExplainField); + // if (FieldExplain) { + // return [...FieldExplain]; + // } + const data = await requestEncryption(`/FrameWork/GetFieldEnumByField`, { + method: 'GET', + params, + }); + if (data.Result_Code !== 100) { + return []; + } + + const options = params.notformate ? data.Result_Data.List : formateField(data.Result_Data.List); + // session.set(params.sessionName ? params.sessionName : params.FieldExplainField, options); + return options; +} + // 服务区树对象类 export interface ServerpartTree { label: string; // 名称 , diff --git a/src/services/options/typings.d.ts b/src/services/options/typings.d.ts index 0bff003..0ac1a49 100644 --- a/src/services/options/typings.d.ts +++ b/src/services/options/typings.d.ts @@ -9,7 +9,7 @@ // 字段枚举 model( 下拉框数据字典) type FieldParamsModel = { FieldExplainField: string; - FieldEnumStatus?: string | Boolean; + FieldEnumStatus?: any; FieldEnumValue?: string; notformate?: boolean; sessionName?: string;