From 7fe7fe34e3ef8fa2316f63e5554e50fc861e5bba Mon Sep 17 00:00:00 2001 From: ylj20011123 Date: Fri, 4 Jul 2025 20:26:45 +0800 Subject: [PATCH] update --- src/layouts/BasicLayout.tsx | 2 +- .../NewProductApproval/index.tsx | 716 ++++++++++++++--- .../NewProductApproval/style.less | 16 + .../ProductApprovalProcess/index.tsx | 342 +++++++- .../ProductApprovalProcess/service.ts | 85 +- .../ProductApprovalProcess/style.less | 16 + .../ProductChangeInfoApproval/index.tsx | 708 +++++++++++++--- .../ProductChangeInfoApproval/style.less | 16 + .../ProductChangePriceApproval/index.tsx | 759 +++++++++++++++--- .../ProductChangePriceApproval/style.less | 16 + .../ProductListingManagement/index.tsx | 257 ++++-- .../ProductSpecificationManage/index.tsx | 552 +++++++++---- .../SupplierClassification/index.tsx | 119 ++- .../component/LeftSelectMerchantType.tsx | 30 +- .../SupplierMerchantManage/index.tsx | 11 + src/pages/travelMember/service.ts | 76 +- src/utils/requestEncryption.ts | 2 +- 17 files changed, 3050 insertions(+), 673 deletions(-) create mode 100644 src/pages/reports/productControl/NewProductApproval/style.less create mode 100644 src/pages/reports/productControl/ProductApprovalProcess/style.less create mode 100644 src/pages/reports/productControl/ProductChangeInfoApproval/style.less create mode 100644 src/pages/reports/productControl/ProductChangePriceApproval/style.less diff --git a/src/layouts/BasicLayout.tsx b/src/layouts/BasicLayout.tsx index eea14b6..88d2c47 100644 --- a/src/layouts/BasicLayout.tsx +++ b/src/layouts/BasicLayout.tsx @@ -320,7 +320,7 @@ const BasicLayout: React.FC = (props) => { list.push({ label: item.label, value: item.value }) obj[item.value] = item.label }) - session.set('CCOMMODITYNATUREList', list); + session.set('COMMODITYNATUREList', list); session.set('COMMODITYNATUREObj', obj); session.set('COMMODITYNATURETree', COMMODITYNATURE); } diff --git a/src/pages/reports/productControl/NewProductApproval/index.tsx b/src/pages/reports/productControl/NewProductApproval/index.tsx index ea44394..ee5bce9 100644 --- a/src/pages/reports/productControl/NewProductApproval/index.tsx +++ b/src/pages/reports/productControl/NewProductApproval/index.tsx @@ -2,9 +2,9 @@ import { connect } from "umi"; import type { CurrentUser } from "umi"; import type { ConnectState } from "@/models/connect"; -import React, { useRef, useState } from "react"; +import React, { useEffect, useRef, useState } from "react"; import type { FormInstance } from "antd"; -import { Button, Col, message, Modal, Popconfirm, Row, Space, Spin, Tree } from "antd"; +import { Button, Card, Col, message, Modal, Popconfirm, Row, Space, Spin, Steps, Tooltip, Tree } from "antd"; import type { ActionType } from "@ant-design/pro-table"; import ProTable from "@ant-design/pro-table"; import PageTitleBox from "@/components/PageTitleBox"; @@ -16,8 +16,11 @@ import { handleGetNestingCOMMODITYTYPETree, handleGetServerpartShopTrade } from import { handleGetUSERDEFINEDTYPEList } from "../userDefinedType/service"; import useRequest from "@ahooksjs/use-request"; import moment from 'moment' -import { handleApproveCommodityProInst, handleCreateCommodityProInst, handleGetBUSINESSAPPROVALDetail, handleGetCOMMODITYRUNNINGList, handleRejectCommodityProInst } from "../ProductApprovalProcess/service"; +import { handleApproveCommodityProInst, handleCreateCommodityProInst, handleDeleteCOMMODITY_RUNNING, handleDeleteCommodityProInst, handleGetApprovalCommodityList, handleGetBUSINESSAPPROVALDetail, handleGetCOMMODITYRUNNINGList, handleReapplyCommodityProInst, handleRejectCommodityProInst } from "../ProductApprovalProcess/service"; +import './style.less' + +const { Step } = Steps const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props) => { const { currentUser } = props const downloadBtnRef = useRef() @@ -31,8 +34,10 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props const [showApplyFor, setShowApplyFor] = useState(false); // 显示新增商品的悬浮框 const [showAddShopModal, setShowAddShopModal] = useState(false); - // 选择的当前商品行 + // 选择记录行的数据 const [currentRow, setCurrentRow] = useState() + // 选择商品行的数据 + const [currentShopRow, setCurrentShopRow] = useState() // 商品列表数据 const [shopData, setShopData] = useState() const [selectSERVERPARTID, setSelectSERVERPARTID] = useState() @@ -55,6 +60,12 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props const [ApprovalType, setApprovaType] = useState(0) // 审批记录详情 const [BUSINESSAPPROVALDETAIL, setBUSINESSAPPROVALDETAIL] = useState() + // 还有几个环节 拼在流程进度后面 + const [nextStepsList, setNextStepsList] = useState() + // 判断有无发起申请的权限 + const [InitiateApplication, setInitiateApplication] = useState(false) + // 显示类型 + const [showDetailType, setShowDetailType] = useState() // 加载服务区树 const { loading: treeLoading, data: treeViews } = useRequest(async () => { const req = { @@ -67,6 +78,7 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props return data }) + let statusList: string[] = ["0", "1000", "2000", "2010,2020,2030,2040,2050,2060,2070,2080,2090", "9000"] const columns: any = [ { dataIndex: 'BusinessProcess_StateSearch', @@ -75,12 +87,20 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props ellipsis: true, align: 'center', hideInTable: true, + // valueEnum: { + // "0": "全部", + // "2000": "待审核", + // "2010,2020,2030,2040,2050,2060,2070,2080,2090": "审核中", + // "9000": "已审结" + // }, valueEnum: { - "0": "全部", - "2000": "待审核", - "2010,2020,2030,2040,2050,2060,2070,2080,2090": "审核中", - "9000": "已审结" + 0: "全部", + 1: "待申请", + 2: "待审核", + 3: "审核中", + 4: "已审结" }, + initialValue: "0" }, { dataIndex: 'BusinessProcess_Name', @@ -121,15 +141,27 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props ellipsis: true, align: 'center', hideInSearch: true, + render: (_, record) => { + return { + console.log('recordrecordrecord', record); + setShowDetailType('detail') + setCurrentRow(record) + setShowApplyFor(true) + }}>{record?.BusinessProcess_StateText || "-"} + } }, - { - dataIndex: 'Accept_Code', - title: '业务类别', - width: 200, - ellipsis: true, - align: 'center', - hideInSearch: true, - }, + // { + // dataIndex: 'Accept_Code', + // title: '业务类别', + // width: 200, + // ellipsis: true, + // align: 'center', + // hideInSearch: true, + // }, { dataIndex: 'BusinessProcess_EndDate', title: '办结时间', @@ -152,7 +184,7 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props valueType: 'option', align: 'center', hideInSearch: true, - width: 120, + width: 180, fixed: "right", ellipsis: true, render: (_, record) => { @@ -163,29 +195,61 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props { record?.BusinessProcess_State === 1000 ? - { - setShowApplyFor(true) - setCurrentRow(record) - }} - > - 编辑 - : "" + <> + { + console.log('recordrecordrecord', record); + + setCurrentRow(record) + setShowApplyFor(true) + }} + > + 编辑 + + { + const req: any = { + businessApprovalId: record?.BusinessApproval_ID, + UserId: currentUser?.ID + } + const data = await handleDeleteCommodityProInst(req) + if (data.Result_Code === 100) { + message.success(data.Result_Desc) + actionRef.current?.reload() + } else { + message.error(data.Result_Desc) + } + }} + > + 删除 + + + : "" + } + { + record?.BusinessProcess_State > 1000 ? + <> + { + setApprovaType(1) + setCurrentRow(record) + // setApproveCurrentRow(record) + // setApproveModal(true) + setShowApplyFor(true) + }} + > + 审批 + + { + setApprovaType(2) + setCurrentRow(record) + // setApproveCurrentRow(record) + // setApproveModal(true) + setShowApplyFor(true) + }}> + 驳回 + + : "" } - { - setApprovaType(1) - setApproveCurrentRow(record) - setApproveModal(true) - }} - > - 审批 - - { - setApprovaType(2) - setApproveCurrentRow(record) - setApproveModal(true) - }}> - 驳回 - : "" ); @@ -249,31 +313,65 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props render: (_, record) => { return ( - { - setCurrentRow(record) - setShowAddShopModal(true) - }} - > - 编辑 - - { - console.log('record', record); - let oldData: any = JSON.parse(JSON.stringify(shopData)) - let list: any = [] - oldData.forEach((item: any) => { - if (item.ADDTIME !== record?.ADDTIME) { - list.push(item) - } - }) - setShopData(list) + { + currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID) ? '' : + <> + { + setCurrentShopRow(record) + setShowAddShopModal(true) + }} + > + 编辑 + + { + if (currentRow?.BusinessApproval_ID) { + // 申请回到发起时候的真删 + const req: any = { + COMMODITY_RUNNINGId: record?.COMMODITY_ID + } + const data = await handleDeleteCOMMODITY_RUNNING(req) + console.log('datadatadatadata', data); + actionRef.current?.reload() + // 实现直接删除的效果 + let oldData: any = JSON.parse(JSON.stringify(shopData)) + let list: any = [] + oldData.forEach((item: any) => { + if (item.COMMODITY_ID !== record?.COMMODITY_ID) { + list.push(item) + } + }) + setShopData(list) + } else { + // 还未发起申请的假删 + console.log('record', record); + let oldData: any = JSON.parse(JSON.stringify(shopData)) + let list: any = [] + oldData.forEach((item: any) => { + if (item.ADDTIME !== record?.ADDTIME) { + list.push(item) + } + }) + setShopData(list) + } + }} + > + 删除 + + + } + + { + currentRow?.BusinessProcess_State === 9000 ? + { + setCurrentShopRow(record) + setShowAddShopModal(true) + }}>详情 + : '' + } - }} - > - 删除 - ); }, @@ -315,6 +413,37 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props } + useEffect(async () => { + const req: any = { + SearchParameter: { + APPROVALROUTE_STATES: "", + APPROVALROUTE_VALID: 1, + OPERATION_TYPES: "100100", + } + } + const data = await handleGetAPPROVALROUTEList(req) + console.log('datadatadatadata', data); + // 拿到发起申请的人 + let firstSetp: any = {} + if (data && data.length > 0) { + data.forEach((item: any) => { + if (item.APPROVALROUTE_STATE === 1000) { + firstSetp = item + } + }) + } + // 判断当前用户 是否有新增权限 + let have: boolean = false + let idList: any = firstSetp.APPROVALSTAFF_ID.split(',') + console.log('idList', idList); + + if (idList.indexOf(currentUser?.ID.toString()) !== -1) { + have = true + } + setInitiateApplication(have) + + }, []) + return (
@@ -341,7 +470,7 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props SearchParameter: { Operation_Type: 6, Accept_Code: "6-100100", - BusinessProcess_StateSearch: params?.BusinessProcess_StateSearch === 0 ? '' : params?.BusinessProcess_StateSearch + BusinessProcess_StateSearch: statusList[params?.BusinessProcess_StateSearch] === "0" ? '' : statusList[params?.BusinessProcess_StateSearch] }, PageIndex: 1, PageSize: 999999 @@ -351,7 +480,7 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props if (data.data && data.data.length > 0) { data.data.forEach((item: any) => { if (item.BusinessProcess_State === 1000) { - item.BusinessProcess_StateText = "待审核" + item.BusinessProcess_StateText = "待发起" } else if (item.BusinessProcess_State === 2000) { item.BusinessProcess_StateText = "待审核" } else if (item.BusinessProcess_State > 2000 && item.BusinessProcess_State < 9000) { @@ -368,11 +497,12 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props }} toolbar={{ actions: [ - + InitiateApplication ? + : "" ] }} /> @@ -380,7 +510,7 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
{/* 审批的悬浮框 */} - = (props : "" } - + */} {/* 新增申请的悬浮框 */} { @@ -579,12 +710,46 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props setCurrentRow(undefined) setShopData([]) setBUSINESSAPPROVALDETAIL(undefined) - }} - onOk={() => { - formRef?.current?.validateFields().then(() => { - modalFormRef?.current?.submit() - }) + setShowDetailType(null) + + setApprovaType(0) + }} + footer={showDetailType === 'detail' || !InitiateApplication || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID) ? false : +
+ + + +
} + onOk={() => { + if (currentRow?.BusinessProcess_State > 1000) { + modalApproveFormRef?.current?.validateFields().then(() => { + modalApproveFormRef?.current?.submit() + }) + } else { + modalFormRef?.current?.validateFields().then(() => { + modalFormRef?.current?.submit() + }) + } }} > = (props console.log('datadatadata', data); setBUSINESSAPPROVALDETAIL(data.Result_Data) - const shopData = await handleGetCOMMODITYRUNNINGList({ - SearchParameter: { - BUSINESSAPPROVAL_ID: currentRow?.BusinessApproval_ID, - }, - PageIndex: 1, - pageSize: 999999, - }) + let shopData: any = [] + + if (currentRow?.BusinessProcess_State === 9000) { + shopData = await handleGetApprovalCommodityList({ + ProvinceCode: currentUser?.ProvinceCode, + // CommodityId: currentUser?.ProvinceCode, + BusinessApprovalId: currentRow?.BusinessApproval_ID, + PageIndex: 1, + PageSize: 999999, + }) + } else { + shopData = await handleGetCOMMODITYRUNNINGList({ + SearchParameter: { + BUSINESSAPPROVAL_ID: currentRow?.BusinessApproval_ID, + }, + PageIndex: 1, + pageSize: 999999, + }) + } + + console.log('shopDatashopDatashopDatashopData', shopData); setShopData(shopData.Result_Data.List) return { @@ -616,31 +795,54 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props NextApproveStaffId: data.Result_Data.APPOVED_IDS } } else { - return false + return {} } }} onFinish={async (res) => { - const req: any = { - ProinstName: res.reasonForApplication, - UserId: currentUser?.ID, - OperateType: "100100", - ServerpartId: res.ServerpartId, - NextApproveStaffId: res.NextApproveStaffId, - NextApproveState: 2000, - CommodityRunningList: shopData + let data: any = {} + if (currentRow?.BusinessApproval_ID) { + const req: any = { + ProinstId: currentRow?.BusinessApproval_ID, + ProinstName: res.reasonForApplication, + UserId: currentUser?.ID, + OperateType: "100100", + ServerpartId: res.ServerpartId, + NextApproveStaffId: res.NextApproveStaffId, + NextApproveState: 2000, + CommodityRunningList: shopData + } + data = await handleReapplyCommodityProInst(req) + } else { + const req: any = { + ProinstName: res.reasonForApplication, + UserId: currentUser?.ID, + OperateType: "100100", + ServerpartId: res.ServerpartId, + NextApproveStaffId: res.NextApproveStaffId, + NextApproveState: 2000, + CommodityRunningList: shopData + } + data = await handleCreateCommodityProInst(req) + console.log('dsaidjaskda', data); } - const data = await handleCreateCommodityProInst(req) - console.log('dsaidjaskda', data); if (data.Result_Code === 100) { message.success(data.Result_Desc) + // setShowApplyFor(false) + // setCurrentRow(undefined) setShowApplyFor(false) setCurrentRow(undefined) + setShopData([]) + setBUSINESSAPPROVALDETAIL(undefined) + setShowDetailType(null) + setApprovaType(0) actionRef.current?.reload() } else { message.error(data.Result_Desc) } + + }} > @@ -652,6 +854,7 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props required: true, message: "请输入申请原因!" }]} + disabled={currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)} /> @@ -679,9 +882,10 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props } return list }} + disabled={currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)} /> - + 1000 && ApprovalType !== 0 ? "none" : "" }}> = (props const dataState = await handleGetAPPROVALROUTEList(reqState) if (dataState && dataState.length > 0) { let obj: any = {} + // 下面的环节 + let nextList: any = [] console.log('dataState', dataState); dataState.forEach((item: any) => { if (item.APPROVALROUTE_STATE === 2000) { obj = item } + if (item.APPROVALROUTE_STATE >= currentRow?.BusinessProcess_State) { + if (item.APPROVALROUTE_STATE === currentRow?.BusinessProcess_State) { + item.status = "process" + } + nextList.push(item) + } }) + setNextStepsList(nextList) + console.log('next', nextList); + let personTotal: number = obj.APPROVALSTAFF_ID.split(',').length || 0 if (personTotal > 0) { let STAFFIDList: number[] = obj.APPROVALSTAFF_ID.split(',') @@ -721,30 +936,268 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props } } }} + disabled={currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)} /> - - { - setShowAddShopModal(true) - }}> - 新增商品 - - ] - }} - /> + { + currentRow?.BusinessProcess_State > 1000 ? + { + console.log('approveCurrentRowapproveCurrentRowapproveCurrentRow', approveCurrentRow); + const reqState: any = { + SearchParameter: { + APPROVALROUTE_STATES: "", + APPROVALROUTE_VALID: 1, + OPERATION_TYPES: "100100", + }, + PageIndex: 1, + PageSize: 999999 + } + const dataState = await handleGetAPPROVALROUTEList(reqState) + console.log('dataStatedataStatedataState', dataState); + let obj: any = {} + let currentIndex: number = 0 + if (dataState && dataState.length > 0) { + dataState.forEach((item: any, index: number) => { + if (item.APPROVALROUTE_STATE === currentRow.BusinessProcess_State) { + obj = item + currentIndex = index + } + }) + } + if (obj) { + // 审批的时候 拿到当前状态 去找下一个状态 + if (ApprovalType === 1) { + // 拿到当前状态的信息 判断下一状态 是不是结束了 结束了 就不显示 下一结算审批人 不是结束 就拿到下一流程的审批人 + setNextApproval(obj.NEXT_STATE) + let nextObj: any = currentIndex + 1 <= dataState.length ? dataState[currentIndex + 1] : {} + if (nextObj) { + let personTotal: number = nextObj.APPROVALSTAFF_ID.split(',').length || 0 + if (personTotal > 0) { + let STAFFIDList: number[] = nextObj.APPROVALSTAFF_ID.split(',') + let STAFFNAMEList: string[] = nextObj.APPROVALSTAFF_NAME.split(',') + let list: any = [] + for (let i = 0; i < personTotal; i++) { + list.push({ label: STAFFNAMEList[i], value: STAFFIDList[i] }) + } + setNextApprovalPerson(list) + } + } + } else { + // 驳回的话 去找历史状态 + if (dataState && dataState.length > 0) { + let list: any = [] + dataState.forEach((item: any, index: number) => { + if (obj.APPROVALROUTE_STATE > item.APPROVALROUTE_STATE) { + list.push({ label: item.APPROVALROUTE_NAME, value: item.APPROVALROUTE_STATE }) + } + }) + setNextApprovalPerson(list) + } + } + + } + return {} + }} + onFinish={async (res) => { + setAddApprovalLoading(true) + let data: any = {} + + if (ApprovalType === 1) { + // 审批 + const req: any = { + businessApprovalId: currentRow?.BusinessApproval_ID, + UserId: currentUser?.ID, + ApproveInfo: res.ApproveInfo, + nextApproveStaffId: res.nextApproveStaffId || "", + nextApproveState: nextApproval || "" + } + + data = await handleApproveCommodityProInst(req) + } else { + // 驳回 + const req: any = { + businessApprovalId: currentRow?.BusinessApproval_ID, + UserId: currentUser?.ID, + RejectInfo: res.ApproveInfo, + nextApproveState: res.nextApproveState || "" + } + console.log('reqreqreqreq', req); + + data = await handleRejectCommodityProInst(req) + } + setAddApprovalLoading(false) + console.log('datadatadata', data); + if (data.Result_Code === 100) { + message.success(data.Result_Desc) + + setShowApplyFor(false) + setCurrentRow(undefined) + setShopData([]) + setBUSINESSAPPROVALDETAIL(undefined) + setShowDetailType(null) + + + // setApproveCurrentRow(undefined) + // setApproveModal(false) + setNextApproval(null) + setNextApprovalPerson(null) + setApprovaType(0) + actionRef.current?.reload() + } else { + message.error(data.Result_Desc) + } + + }} + > + { + ApprovalType === 1 ? + + { + nextApproval === 9000 ? '' : + + + + + } + + + + : ApprovalType === 2 ? + + + + + + + + + : "" + } + : "" + } + + 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID) ? '' : + ] + }} + /> + + { + currentRow?.BusinessProcess_State > 1000 ? + +
+ + {/* 1000 ? 'finish' : 'wait'} + title="发起申请" + description={ +
+ +

{`${currentRow?.BusinessProcess_StartDate || ''}`}

+
+
+ } + /> */} + { + BUSINESSAPPROVALDETAIL?.approveList && BUSINESSAPPROVALDETAIL?.approveList.length > 0 ? + BUSINESSAPPROVALDETAIL?.approveList.map((item: any, index: number) => ( + + +

{`${item.APPLYAPPROVE_DATE || ''}`}

+
+
} + /> + )) : '' + } + + { + nextStepsList && nextStepsList.length > 0 ? + nextStepsList.map((item: any, index: number) => ( + + )) : '' + } + +
+ + : '' + } {/* 新增商品的悬浮框 */} @@ -753,43 +1206,66 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props width={1200} wrapClassName={'shopModal'} destroyOnClose - title={currentRow ? '编辑商品' : '添加商品'} + title={currentShopRow?.COMMODITY_ID ? '编辑商品' : '添加商品'} onOk={() => { modalShopFormRef.current?.validateFields().then(async (res: any) => { let oldData: any = shopData && shopData.length > 0 ? JSON.parse(JSON.stringify(shopData)) : [] + + console.log('oldDataoldDataoldData', oldData); + console.log('resresresresresres', res); + let newList: any = [] // 判断当前的里面有没有一样的 if (oldData && oldData.length > 0) { + let same: boolean = false oldData.forEach((item: any, index: number) => { if (item.ADDTIME === res.ADDTIME) { - newList.push(res) + same = true + newList.push({ + ...item, + ...res + }) } else { newList.push(item) } }) + if (!same) { + newList.push(res) + } + } else { newList.push(res) } + console.log('newList', newList); + setShopData(newList) setShowAddShopModal(false) setCommodityList([]) setCustomClassList([]) - setCurrentRow(undefined) + setCurrentShopRow(undefined) }) }} onCancel={() => { setShowAddShopModal(false) setCommodityList([]) setCustomClassList([]) - setCurrentRow(undefined) + setCurrentShopRow(undefined) }} > { + // !currentShopRow?.COMMODITY_ID && + if (currentShopRow?.SERVERPART_ID) { + await handleGetCommodity(currentShopRow?.SERVERPART_ID) + } + return { ...currentShopRow, BUSINESSTYPE: currentShopRow?.BUSINESSTYPE.toString() } + }} + disabled={currentRow?.BusinessProcess_State === 9000} >
商品基本信息
diff --git a/src/pages/reports/productControl/NewProductApproval/style.less b/src/pages/reports/productControl/NewProductApproval/style.less new file mode 100644 index 0000000..c9742a3 --- /dev/null +++ b/src/pages/reports/productControl/NewProductApproval/style.less @@ -0,0 +1,16 @@ +.addProductModal { + .ant-modal-content { + .ant-modal-body { + .ProcessProgress { + .ant-card-body { + .ProcessProgressBox { + .multi-line-steps { + flex-wrap: wrap !important; + display: flex !important; + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/pages/reports/productControl/ProductApprovalProcess/index.tsx b/src/pages/reports/productControl/ProductApprovalProcess/index.tsx index 567c245..f5c4a18 100644 --- a/src/pages/reports/productControl/ProductApprovalProcess/index.tsx +++ b/src/pages/reports/productControl/ProductApprovalProcess/index.tsx @@ -6,7 +6,7 @@ import React, { useEffect, useRef, useState } from "react"; import ProCard from "@ant-design/pro-card"; import { MenuFoldOutlined } from "@ant-design/icons"; import type { FormInstance } from "antd"; -import { Button, message, Space, Spin, Tree } from "antd"; +import { Button, Card, Col, message, Modal, Row, Space, Spin, Steps, Tooltip, Tree } from "antd"; import useRequest from "@ahooksjs/use-request"; import { getServerpartTree } from "@/services/options"; import type { ActionType } from "@ant-design/pro-table"; @@ -16,11 +16,15 @@ import LeftSelectTree from "@/pages/reports/settlementAccount/component/leftSele import PageTitleBox from "@/components/PageTitleBox"; import { handleGetExamineList } from "@/pages/examine/examineList/service"; import { handleGetAPPROVALROUTEList } from "@/pages/Setting/serviceConfig/service"; +import ProForm, { ProFormSelect, ProFormTextArea } from "@ant-design/pro-form"; +import { handleGetApprovalCommodityList, handleGetBUSINESSAPPROVALDetail, handleGetCOMMODITYRUNNINGList } from "./service"; +import './style.less' - +const { Step } = Steps const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) => { const { currentUser } = props const actionRef = useRef(); + const modalFormRef = useRef(); const formRef = useRef(); const [reqDetailList, setReqDetailList] = useState(); // 合计项数据源 const [printOut, setPrintOut] = useState(); // 打印数据的内容 @@ -30,10 +34,27 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) = const [currentExamine, setCurrentExamine] = useState() // 判断当前用户是否有发起按钮 const [currentShowInitiate, setCurrentShowInitiate] = useState(false) + // 选择的当前商品行 + const [currentRow, setCurrentRow] = useState() + // 新增商品申请 + const [showApplyFor, setShowApplyFor] = useState(false); + // 商品列表数据 + const [shopData, setShopData] = useState() + // 选中的行数据 + const [selectRowList, setSelectRowList] = useState() + // 选中的行 + const [selectedOrderRowKeys, setSelectedOrderRowKeys] = useState() + // 显示类型 + const [showDetailType, setShowDetailType] = useState() + // 审批记录详情 + const [BUSINESSAPPROVALDETAIL, setBUSINESSAPPROVALDETAIL] = useState() + // 还有几个环节 拼在流程进度后面 + const [nextStepsList, setNextStepsList] = useState() useEffect(async () => { await handleChangeType("6-100100") }, []) + let statusList: string[] = ["0", "1000", "2000", "2010,2020,2030,2040,2050,2060,2070,2080,2090", "9000"] const columns: any = [ { @@ -49,7 +70,7 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) = "6-100200": "商品调价流程", "6-100210": "信息修改流程" }, - initialValue: "6-100100", + initialValue: "0", }, { dataIndex: 'BusinessProcess_StateSearch', @@ -59,11 +80,13 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) = align: 'center', hideInTable: true, valueEnum: { - "0": "全部", - "2000": "待审核", - "2010,2020,2030,2040,2050,2060,2070,2080,2090": "审核中", - "9000": "已审结" + 0: "全部", + 1: "待申请", + 2: "待审核", + 3: "审核中", + 4: "已审结" }, + initialValue: "0" }, { dataIndex: 'BusinessProcess_Name', @@ -72,6 +95,12 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) = ellipsis: true, align: 'center', hideInSearch: true, + render: (_, record) => { + return { + setCurrentRow(record) + setShowApplyFor(true) + }}>{record?.BusinessProcess_Name} + } }, { dataIndex: 'Serverpart_Name', @@ -104,6 +133,18 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) = ellipsis: true, align: 'center', hideInSearch: true, + render: (_, record) => { + return { + console.log('recordrecordrecord', record); + setShowDetailType('detail') + setCurrentRow(record) + setShowApplyFor(true) + }}>{record?.BusinessProcess_StateText || "-"} + } }, { dataIndex: 'Accept_Code', @@ -112,6 +153,12 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) = ellipsis: true, align: 'center', hideInSearch: true, + valueType: "select", + valueEnum: { + "6-100100": "新增商品审批", + "6-100200": "商品调价审批", + "6-100210": "商品信息修改审批" + }, }, { dataIndex: 'BusinessProcess_EndDate', @@ -131,6 +178,52 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) = }, ] + const modalColumns: any = [ + { + title: "序号", + width: 70, + dataIndex: "index", + valueType: "index", + align: 'center', + ellipsis: true, + }, + { + title: "名称", + width: 300, + dataIndex: "COMMODITY_NAME", + ellipsis: true, + align: 'center', + }, + { + title: "条码", + width: 150, + dataIndex: "COMMODITY_BARCODE", + ellipsis: true, + align: 'center', + }, + { + title: "零售价", + width: 150, + dataIndex: "COMMODITY_RETAILPRICE", + ellipsis: true, + align: 'center', + }, + { + title: "规格", + width: 150, + dataIndex: "COMMODITY_RULE", + ellipsis: true, + align: 'center', + }, + { + title: "单位", + width: 150, + dataIndex: "COMMODITY_UNIT", + ellipsis: true, + align: 'center', + }, + ] + // 修改审批类型 const handleChangeType = async (type: string) => { // 查出当前类型里面的流程数据 @@ -189,7 +282,7 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) = SearchParameter: { Operation_Type: 6, Accept_Code: params?.searchType === "0" ? '' : params?.searchType, - BusinessProcess_StateSearch: params?.BusinessProcess_StateSearch === 0 ? '' : params?.BusinessProcess_StateSearch + BusinessProcess_StateSearch: statusList[params?.BusinessProcess_StateSearch] === "0" ? '' : statusList[params?.BusinessProcess_StateSearch] }, PageIndex: 1, PageSize: 999999 @@ -198,7 +291,9 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) = console.log('data', data) if (data.data && data.data.length > 0) { data.data.forEach((item: any) => { - if (item.BusinessProcess_State === 2000) { + if (item.BusinessProcess_State === 1000) { + item.BusinessProcess_StateText = "待发起" + } else if (item.BusinessProcess_State === 2000) { item.BusinessProcess_StateText = "待审核" } else if (item.BusinessProcess_State > 2000 && item.BusinessProcess_State < 9000) { item.BusinessProcess_StateText = "审核中" @@ -219,6 +314,235 @@ const ProductApprovalProcess: React.FC<{ currentUser: CurrentUser }> = (props) = /> + + + { + setShowApplyFor(false) + setCurrentRow(undefined) + setShopData([]) + setSelectRowList([]) + setSelectedOrderRowKeys([]) + setShowDetailType(null) + }} + footer={false} + > + { + if (currentRow?.BusinessApproval_ID) { + const req: any = { + BUSINESSAPPROVALId: currentRow?.BusinessApproval_ID, + } + const data = await handleGetBUSINESSAPPROVALDetail(req) + console.log('datadatadata', data); + setBUSINESSAPPROVALDETAIL(data.Result_Data) + let shopData: any = [] + if (currentRow?.BusinessProcess_State === 9000) { + shopData = await handleGetApprovalCommodityList({ + ProvinceCode: currentUser?.ProvinceCode, + // CommodityId: currentUser?.ProvinceCode, + BusinessApprovalId: currentRow?.BusinessApproval_ID, + PageIndex: 1, + PageSize: 999999, + }) + } else { + shopData = await handleGetCOMMODITYRUNNINGList({ + SearchParameter: { + BUSINESSAPPROVAL_ID: currentRow?.BusinessApproval_ID, + }, + PageIndex: 1, + pageSize: 999999, + }) + } + setShopData(shopData.Result_Data.List) + return { + reasonForApplication: data.Result_Data.BUSINESSAPPROVAL_DESC, + ServerpartId: data.Result_Data.SERVERPART_ID, + NextApproveStaffId: data.Result_Data.APPOVED_IDS + } + } else { + return {} + } + }} + + > + + + 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)} + /> + + + { + const data = await getServerpartTree(currentUser?.ProvinceCode, currentUser?.CityAuthority, true, true, true) + const list: any = [] + if (data && data.length > 0) { + data.forEach((item: any) => { + if (item.children && item.children.length > 0) { + item.children.forEach((subItem: any) => { + list.push({ label: subItem.label, value: subItem.value }) + }) + } + }) + data.forEach((item: any) => { + list.push({ label: item.label, value: item.value }) + }) + } + return list + }} + disabled={currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)} + /> + + 1000 ? "none" : "" }}> + { + const reqState: any = { + SearchParameter: { + APPROVALROUTE_STATES: "", + APPROVALROUTE_VALID: 1, + OPERATION_TYPES: "100210", + }, + PageIndex: 1, + PageSize: 999999 + } + const dataState = await handleGetAPPROVALROUTEList(reqState) + if (dataState && dataState.length > 0) { + let obj: any = {} + // 下面的环节 + let nextList: any = [] + console.log('dataState', dataState); + + dataState.forEach((item: any) => { + if (item.APPROVALROUTE_STATE === 2000) { + obj = item + } + if (item.APPROVALROUTE_STATE >= currentRow?.BusinessProcess_State) { + if (item.APPROVALROUTE_STATE === currentRow?.BusinessProcess_State) { + item.status = "process" + } + nextList.push(item) + } + }) + + setNextStepsList(nextList) + + let personTotal: number = obj.APPROVALSTAFF_ID.split(',').length || 0 + if (personTotal > 0) { + let STAFFIDList: number[] = obj.APPROVALSTAFF_ID.split(',') + let STAFFNAMEList: string[] = obj.APPROVALSTAFF_NAME.split(',') + let list: any = [] + for (let i = 0; i < personTotal; i++) { + list.push({ label: STAFFNAMEList[i], value: STAFFIDList[i] }) + } + return list + } + } + }} + disabled={currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)} + /> + + + + + + 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID) ? '' : + ] + }} + /> + + { + currentRow?.BusinessProcess_State > 1000 ? + +
+ + { + BUSINESSAPPROVALDETAIL?.approveList && BUSINESSAPPROVALDETAIL?.approveList.length > 0 ? + BUSINESSAPPROVALDETAIL?.approveList.map((item: any, index: number) => ( + + +

{`${item.APPLYAPPROVE_DATE || ''}`}

+
+
} + /> + )) : '' + } + + { + nextStepsList && nextStepsList.length > 0 ? + nextStepsList.map((item: any, index: number) => ( + + )) : '' + } + + +
+ : '' + } +
) } diff --git a/src/pages/reports/productControl/ProductApprovalProcess/service.ts b/src/pages/reports/productControl/ProductApprovalProcess/service.ts index fc5b19f..e31417e 100644 --- a/src/pages/reports/productControl/ProductApprovalProcess/service.ts +++ b/src/pages/reports/productControl/ProductApprovalProcess/service.ts @@ -17,6 +17,23 @@ export async function handleCreateCommodityProInst(params?: any) { return data; } +// 重新发起审批流程 +export async function handleReapplyCommodityProInst(params?: any) { + const data = await request('/BusinessProcess/ReapplyCommodityProInst', { + method: 'POST', + data: { + ...params, + requestEncryption: true + }, + }) + + if (data.Result_Code !== 100) { + return data + } + return data; +} + + // 审核服务区商品审批流程 export async function handleApproveCommodityProInst(params?: any) { const data = await request('/BusinessProcess/ApproveCommodityProInst', { @@ -79,4 +96,70 @@ export async function handleGetCOMMODITYRUNNINGList(params?: any) { return data; } return data; -} \ No newline at end of file +} + +// 获取办结之后的商品 +export async function handleGetApprovalCommodityList(params?: any) { + const data = await request('/Commodity/GetApprovalCommodityList', { + method: 'POST', + data: { + ...params, + requestEncryption: true + }, + }) + + if (data.Result_Code !== 100) { + return data; + } + return data; +} + +// 删除商品审批流程 +export async function handleDeleteCommodityProInst(params?: any) { + const data = await request('/BusinessProcess/DeleteCommodityProInst', { + method: 'POST', + data: { + ...params, + requestEncryption: true + }, + }) + + if (data.Result_Code !== 100) { + return data; + } + return data; +} + + +// 同步编辑申请流程时的商品 +export async function handleSynchroCOMMODITY_RUNNING(params?: any) { + const data = await request('/Commodity/SynchroCOMMODITY_RUNNING', { + method: 'POST', + data: { + ...params, + requestEncryption: true + }, + }) + + if (data.Result_Code !== 100) { + return data; + } + return data; +} + +// 删除审批过程中的商品 +export async function handleDeleteCOMMODITY_RUNNING(params?: any) { + const data = await request('/Commodity/DeleteCOMMODITY_RUNNING', { + method: 'POST', + data: { + ...params, + requestEncryption: true + }, + }) + + if (data.Result_Code !== 100) { + return data; + } + return data; +} + diff --git a/src/pages/reports/productControl/ProductApprovalProcess/style.less b/src/pages/reports/productControl/ProductApprovalProcess/style.less new file mode 100644 index 0000000..c9742a3 --- /dev/null +++ b/src/pages/reports/productControl/ProductApprovalProcess/style.less @@ -0,0 +1,16 @@ +.addProductModal { + .ant-modal-content { + .ant-modal-body { + .ProcessProgress { + .ant-card-body { + .ProcessProgressBox { + .multi-line-steps { + flex-wrap: wrap !important; + display: flex !important; + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/pages/reports/productControl/ProductChangeInfoApproval/index.tsx b/src/pages/reports/productControl/ProductChangeInfoApproval/index.tsx index 62845d7..b8515bb 100644 --- a/src/pages/reports/productControl/ProductChangeInfoApproval/index.tsx +++ b/src/pages/reports/productControl/ProductChangeInfoApproval/index.tsx @@ -3,9 +3,9 @@ import { connect } from "umi"; import type { CurrentUser } from "umi"; import type { ConnectState } from "@/models/connect"; -import React, { useRef, useState } from "react"; +import React, { useEffect, useRef, useState } from "react"; import type { FormInstance } from "antd"; -import { Button, Col, message, Modal, Popconfirm, Row, Space, Spin, Tree } from "antd"; +import { Button, Card, Col, message, Modal, Popconfirm, Row, Space, Spin, Steps, Tooltip, Tree } from "antd"; import type { ActionType } from "@ant-design/pro-table"; import ProTable from "@ant-design/pro-table"; import PageTitleBox from "@/components/PageTitleBox"; @@ -17,9 +17,11 @@ import { handleGetCommodityList, handleGetNestingCOMMODITYTYPETree, handleGetSer import { handleGetUSERDEFINEDTYPEList } from "../userDefinedType/service"; import useRequest from "@ahooksjs/use-request"; import moment from 'moment' -import { handleApproveCommodityProInst, handleCreateCommodityProInst, handleRejectCommodityProInst } from "../ProductApprovalProcess/service"; +import { handleApproveCommodityProInst, handleCreateCommodityProInst, handleDeleteCOMMODITY_RUNNING, handleDeleteCommodityProInst, handleGetApprovalCommodityList, handleGetBUSINESSAPPROVALDetail, handleGetCOMMODITYRUNNINGList, handleReapplyCommodityProInst, handleRejectCommodityProInst } from "../ProductApprovalProcess/service"; import session from "@/utils/session"; +import './style.less' +const { Step } = Steps const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props) => { const { currentUser } = props const downloadBtnRef = useRef() @@ -66,6 +68,14 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props const [editSelectRow, setEditSelectRow] = useState() // 新增申请的加载效果 const [handleAddLoading, setHandleAddLoading] = useState(false); + // 审批记录详情 + const [BUSINESSAPPROVALDETAIL, setBUSINESSAPPROVALDETAIL] = useState() + // 还有几个环节 拼在流程进度后面 + const [nextStepsList, setNextStepsList] = useState() + // 判断有无发起申请的权限 + const [InitiateApplication, setInitiateApplication] = useState(false) + // 显示类型 + const [showDetailType, setShowDetailType] = useState() // 加载服务区树 const { loading: treeLoading, data: treeViews } = useRequest(async () => { @@ -100,6 +110,7 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props return obj }) + let statusList: string[] = ["0", "1000", "2000", "2010,2020,2030,2040,2050,2060,2070,2080,2090", "9000"] const columns: any = [ { dataIndex: 'BusinessProcess_StateSearch', @@ -108,12 +119,20 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props ellipsis: true, align: 'center', hideInTable: true, + // valueEnum: { + // "0": "全部", + // "2000": "待审核", + // "2010,2020,2030,2040,2050,2060,2070,2080,2090": "审核中", + // "9000": "已审结" + // }, valueEnum: { - "0": "全部", - "2000": "待审核", - "2010,2020,2030,2040,2050,2060,2070,2080,2090": "审核中", - "9000": "已审结" + 0: "全部", + 1: "待申请", + 2: "待审核", + 3: "审核中", + 4: "已审结" }, + initialValue: "0" }, { dataIndex: 'BusinessProcess_Name', @@ -154,15 +173,27 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props ellipsis: true, align: 'center', hideInSearch: true, + render: (_, record) => { + return { + console.log('recordrecordrecord', record); + setShowDetailType('detail') + setCurrentRow(record) + setShowApplyFor(true) + }}>{record?.BusinessProcess_StateText || "-"} + } }, - { - dataIndex: 'Accept_Code', - title: '业务类别', - width: 200, - ellipsis: true, - align: 'center', - hideInSearch: true, - }, + // { + // dataIndex: 'Accept_Code', + // title: '业务类别', + // width: 200, + // ellipsis: true, + // align: 'center', + // hideInSearch: true, + // }, { dataIndex: 'BusinessProcess_EndDate', title: '办结时间', @@ -185,7 +216,7 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props valueType: 'option', align: 'center', hideInSearch: true, - width: 120, + width: 180, fixed: "right", ellipsis: true, render: (_, record) => { @@ -193,21 +224,63 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props record?.ApproveStaff_ID === currentUser?.ID && record?.BusinessProcess_State !== 9000 ? - { - setApprovaType(1) - setApproveCurrentRow(record) - setApproveModal(true) - }} - > - 审批 - - { - setApprovaType(2) - setApproveCurrentRow(record) - setApproveModal(true) - }}> - 驳回 - + { + record?.BusinessProcess_State === 1000 + ? + <> + { + setCurrentRow(record) + setShowApplyFor(true) + }} + > + 编辑 + + { + const req: any = { + businessApprovalId: record?.BusinessApproval_ID, + UserId: currentUser?.ID + } + const data = await handleDeleteCommodityProInst(req) + if (data.Result_Code === 100) { + message.success(data.Result_Desc) + actionRef.current?.reload() + } else { + message.error(data.Result_Desc) + } + }} + > + 删除 + + + : "" + } + { + record?.BusinessProcess_State > 1000 ? + <> + { + setApprovaType(1) + // setApproveCurrentRow(record) + // setApproveModal(true) + setCurrentRow(record) + setShowApplyFor(true) + }} + > + 审批 + + { + setApprovaType(2) + // setApproveCurrentRow(record) + // setApproveModal(true) + setCurrentRow(record) + setShowApplyFor(true) + }}> + 驳回 + + : "" + } + : "" ); @@ -271,37 +344,70 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props render: (_, record) => { return ( - { - let obj: any = {} - if (shopData && shopData.length > 0) { - obj = shopData.filter((item: any) => item.COMMODITY_ID === record?.COMMODITY_ID)[0] - } - console.log('shopData', shopData); - console.log('obj', obj); + { + currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID) ? '' : + <> + { + let obj: any = {} + if (shopData && shopData.length > 0) { + obj = shopData.filter((item: any) => item.COMMODITY_ID === record?.COMMODITY_ID)[0] + } + setEditSelectRow(obj) + setEditShopModal(true) + }} + > + 编辑 + + { + if (currentRow?.BusinessApproval_ID) { + // 申请回到发起时候的真删 + const req: any = { + COMMODITY_RUNNINGId: record?.COMMODITY_ID + } + const data = await handleDeleteCOMMODITY_RUNNING(req) + console.log('datadatadatadata', data); + actionRef.current?.reload() + // 实现直接删除的效果 + let oldData: any = JSON.parse(JSON.stringify(shopData)) + let list: any = [] + oldData.forEach((item: any) => { + if (item.COMMODITY_ID !== record?.COMMODITY_ID) { + list.push(item) + } + }) + setShopData(list) + } else { + // 还未发起申请的假删 + console.log('record', record); + let oldData: any = JSON.parse(JSON.stringify(shopData)) + let list: any = [] + oldData.forEach((item: any) => { + if (item.ADDTIME !== record?.ADDTIME) { + list.push(item) + } + }) + setShopData(list) + } + }} + > + 删除 + + + } - setEditSelectRow(obj) - setEditShopModal(true) - }} - > - 编辑 - - { - console.log('record', record); - let oldData: any = JSON.parse(JSON.stringify(shopData)) - let list: any = [] - oldData.forEach((item: any) => { - if (item.ADDTIME !== record?.ADDTIME) { - list.push(item) - } - }) - setShopData(list) - }} - > - 删除 - + { + currentRow?.BusinessProcess_State === 9000 ? + { + // setCurrentShopRow(record) + // setShowAddShopModal(true) + setEditSelectRow(record) + setEditShopModal(true) + }}>详情 + : '' + } ); }, @@ -443,7 +549,36 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props console.log('data', data) } + useEffect(async () => { + const req: any = { + SearchParameter: { + APPROVALROUTE_STATES: "", + APPROVALROUTE_VALID: 1, + OPERATION_TYPES: "100200", + } + } + const data = await handleGetAPPROVALROUTEList(req) + console.log('datadatadatadata', data); + // 拿到发起申请的人 + let firstSetp: any = {} + if (data && data.length > 0) { + data.forEach((item: any) => { + if (item.APPROVALROUTE_STATE === 1000) { + firstSetp = item + } + }) + } + // 判断当前用户 是否有新增权限 + let have: boolean = false + let idList: any = firstSetp.APPROVALSTAFF_ID.split(',') + console.log('idList', idList); + if (idList.indexOf(currentUser?.ID.toString()) !== -1) { + have = true + } + setInitiateApplication(have) + + }, []) return (
@@ -471,7 +606,7 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props SearchParameter: { Operation_Type: 6, Accept_Code: "6-100210", - BusinessProcess_StateSearch: params?.BusinessProcess_StateSearch === 0 ? '' : params?.BusinessProcess_StateSearch + BusinessProcess_StateSearch: statusList[params?.BusinessProcess_StateSearch] === "0" ? '' : statusList[params?.BusinessProcess_StateSearch] }, PageIndex: 1, PageSize: 999999 @@ -481,7 +616,7 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props if (data.data && data.data.length > 0) { data.data.forEach((item: any) => { if (item.BusinessProcess_State === 1000) { - item.BusinessProcess_StateText = "待审核" + item.BusinessProcess_StateText = "待发起" } else if (item.BusinessProcess_State === 2000) { item.BusinessProcess_StateText = "待审核" } else if (item.BusinessProcess_State > 2000 && item.BusinessProcess_State < 9000) { @@ -498,11 +633,12 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props }} toolbar={{ actions: [ - + InitiateApplication ? + : "" ] }} /> @@ -510,7 +646,7 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props
{/* 审批的悬浮框 */} - = (props
: "" }
- + */} {/* 新增申请的悬浮框 */} + + + + } onCancel={() => { setShowApplyFor(false) setCurrentRow(undefined) setShopData([]) setSelectRowList([]) setSelectedOrderRowKeys([]) + setShowDetailType(null) }} onOk={() => { - formRef?.current?.validateFields().then(() => { - modalFormRef?.current?.submit() - }) - + if (currentRow?.BusinessProcess_State > 1000) { + modalApproveFormRef?.current?.validateFields().then(() => { + modalApproveFormRef?.current?.submit() + }) + } else { + modalFormRef?.current?.validateFields().then(() => { + modalFormRef?.current?.submit() + }) + } }} > = (props formRef={modalFormRef} submitter={false} preserve={false} + request={async () => { + if (currentRow?.BusinessApproval_ID) { + const req: any = { + BUSINESSAPPROVALId: currentRow?.BusinessApproval_ID, + } + const data = await handleGetBUSINESSAPPROVALDetail(req) + console.log('datadatadata', data); + setBUSINESSAPPROVALDETAIL(data.Result_Data) + let shopData: any = [] + if (currentRow?.BusinessProcess_State === 9000) { + shopData = await handleGetApprovalCommodityList({ + ProvinceCode: currentUser?.ProvinceCode, + // CommodityId: currentUser?.ProvinceCode, + BusinessApprovalId: currentRow?.BusinessApproval_ID, + PageIndex: 1, + PageSize: 999999, + }) + } else { + shopData = await handleGetCOMMODITYRUNNINGList({ + SearchParameter: { + BUSINESSAPPROVAL_ID: currentRow?.BusinessApproval_ID, + }, + PageIndex: 1, + pageSize: 999999, + }) + } + console.log('shopDatashopDatashopDatashopData', shopData); + setShopData(shopData.Result_Data.List) + return { + reasonForApplication: data.Result_Data.BUSINESSAPPROVAL_DESC, + ServerpartId: data.Result_Data.SERVERPART_ID, + NextApproveStaffId: data.Result_Data.APPOVED_IDS + } + } else { + return {} + } + }} + onFinish={async (res) => { if (shopData && shopData.length > 0) { @@ -731,19 +934,37 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props message.error('请选择要修改的商品!') return } - setHandleAddLoading(true) - const req: any = { - ProinstName: res.reasonForApplication, - UserId: currentUser?.ID, - OperateType: "100210", - ServerpartId: res.ServerpartId, - NextApproveStaffId: res.NextApproveStaffId, - NextApproveState: 2000, - CommodityRunningList: shopData - } - console.log('reqreq', req); - const data = await handleCreateCommodityProInst(req) + let data: any = {} + setHandleAddLoading(true) + console.log('currentRowcurrentRowcurrentRow', currentRow); + + if (currentRow?.BusinessApproval_ID) { + const req: any = { + ProinstId: currentRow?.BusinessApproval_ID, + ProinstName: res.reasonForApplication, + UserId: currentUser?.ID, + OperateType: "100210", + ServerpartId: res.ServerpartId, + NextApproveStaffId: res.NextApproveStaffId, + NextApproveState: 2000, + CommodityRunningList: shopData + } + data = await handleReapplyCommodityProInst(req) + } else { + const req: any = { + ProinstName: res.reasonForApplication, + UserId: currentUser?.ID, + OperateType: "100210", + ServerpartId: res.ServerpartId, + NextApproveStaffId: res.NextApproveStaffId, + NextApproveState: 2000, + CommodityRunningList: shopData + } + console.log('reqreq', req); + + data = await handleCreateCommodityProInst(req) + } setHandleAddLoading(false) console.log('dsaidjaskda', data); if (data.Result_Code === 100) { @@ -754,11 +975,12 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props setShopData([]) setSelectRowList([]) setSelectedOrderRowKeys([]) + setShowDetailType(null) } else { message.error(data.Result_Desc) } - - }} + } + } > @@ -769,6 +991,7 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props required: true, message: "请输入申请原因!" }]} + disabled={currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)} /> @@ -796,9 +1019,10 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props } return list }} + disabled={currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)} /> - + 1000 && ApprovalType !== 0 ? "none" : "" }}> = (props const dataState = await handleGetAPPROVALROUTEList(reqState) if (dataState && dataState.length > 0) { let obj: any = {} + // 下面的环节 + let nextList: any = [] console.log('dataState', dataState); dataState.forEach((item: any) => { if (item.APPROVALROUTE_STATE === 2000) { obj = item } + if (item.APPROVALROUTE_STATE >= currentRow?.BusinessProcess_State) { + if (item.APPROVALROUTE_STATE === currentRow?.BusinessProcess_State) { + item.status = "process" + } + nextList.push(item) + } }) + + setNextStepsList(nextList) + let personTotal: number = obj.APPROVALSTAFF_ID.split(',').length || 0 if (personTotal > 0) { let STAFFIDList: number[] = obj.APPROVALSTAFF_ID.split(',') @@ -838,36 +1073,264 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props } } }} + disabled={currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)} /> - { - // 判断服务区是否已选择 - const values = modalFormRef.current?.getFieldsValue(); - if (!values?.ServerpartId) { - message.error("请先选择服务区!"); - return; - } - setShowAddShopModal(true); - }}> - 选择商品 - - ] - }} - /> - + + { + currentRow?.BusinessProcess_State > 1000 ? + { + console.log('approveCurrentRowapproveCurrentRowapproveCurrentRow', currentRow); + const reqState: any = { + SearchParameter: { + APPROVALROUTE_STATES: "", + APPROVALROUTE_VALID: 1, + OPERATION_TYPES: "100210", + }, + PageIndex: 1, + PageSize: 999999 + } + const dataState = await handleGetAPPROVALROUTEList(reqState) + console.log('dataStatedataStatedataState', dataState); + let obj: any = {} + let currentIndex: number = 0 + if (dataState && dataState.length > 0) { + dataState.forEach((item: any, index: number) => { + if (item.APPROVALROUTE_STATE === currentRow.BusinessProcess_State) { + obj = item + currentIndex = index + } + }) + } + if (obj) { + // 审批的时候 拿到当前状态 去找下一个状态 + if (ApprovalType === 1) { + // 拿到当前状态的信息 判断下一状态 是不是结束了 结束了 就不显示 下一结算审批人 不是结束 就拿到下一流程的审批人 + setNextApproval(obj.NEXT_STATE) + let nextObj: any = currentIndex + 1 <= dataState.length ? dataState[currentIndex + 1] : {} + if (nextObj) { + let personTotal: number = nextObj.APPROVALSTAFF_ID.split(',').length || 0 + if (personTotal > 0) { + let STAFFIDList: number[] = nextObj.APPROVALSTAFF_ID.split(',') + let STAFFNAMEList: string[] = nextObj.APPROVALSTAFF_NAME.split(',') + let list: any = [] + for (let i = 0; i < personTotal; i++) { + list.push({ label: STAFFNAMEList[i], value: STAFFIDList[i] }) + } + setNextApprovalPerson(list) + } + } + } else { + // 驳回的话 去找历史状态 + if (dataState && dataState.length > 0) { + let list: any = [] + dataState.forEach((item: any, index: number) => { + if (obj.APPROVALROUTE_STATE > item.APPROVALROUTE_STATE) { + list.push({ label: item.APPROVALROUTE_NAME, value: item.APPROVALROUTE_STATE }) + } + }) + setNextApprovalPerson(list) + } + + } + + } + return {} + }} + onFinish={async (res) => { + setAddApprovalLoading(true) + let data: any = {} + + if (ApprovalType === 1) { + // 审批 + const req: any = { + businessApprovalId: currentRow?.BusinessApproval_ID, + UserId: currentUser?.ID, + ApproveInfo: res.ApproveInfo, + nextApproveStaffId: res.nextApproveStaffId || "", + nextApproveState: nextApproval || "" + } + + data = await handleApproveCommodityProInst(req) + } else { + // 驳回 + const req: any = { + businessApprovalId: currentRow?.BusinessApproval_ID, + UserId: currentUser?.ID, + RejectInfo: res.ApproveInfo, + nextApproveState: res.nextApproveState || "" + } + console.log('reqreqreqreq', req); + + data = await handleRejectCommodityProInst(req) + } + setAddApprovalLoading(false) + console.log('datadatadata', data); + if (data.Result_Code === 100) { + message.success(data.Result_Desc) + + setShowApplyFor(false) + setCurrentRow(undefined) + actionRef.current?.reload() + setShopData([]) + setSelectRowList([]) + setSelectedOrderRowKeys([]) + + setApproveCurrentRow(undefined) + setApproveModal(false) + setNextApproval(null) + setNextApprovalPerson(null) + setApprovaType(0) + actionRef.current?.reload() + } else { + message.error(data.Result_Desc) + } + + }} + > + { + ApprovalType === 1 ? + + { + nextApproval === 9000 ? '' : + + + + + } + + + + : ApprovalType === 2 ? + + + + + + + + + : "" + } + : "" + } + + 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID) ? '' : + ] + }} + /> + + { + currentRow?.BusinessProcess_State > 1000 ? + +
+ + { + BUSINESSAPPROVALDETAIL?.approveList && BUSINESSAPPROVALDETAIL?.approveList.length > 0 ? + BUSINESSAPPROVALDETAIL?.approveList.map((item: any, index: number) => ( + + +

{`${item.APPLYAPPROVE_DATE || ''}`}

+
+
} + /> + )) : '' + } + + { + nextStepsList && nextStepsList.length > 0 ? + nextStepsList.map((item: any, index: number) => ( + + )) : '' + } + + +
+ : '' + }
{/* 选择商品 */} @@ -880,8 +1343,6 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props onOk={() => { setShowAddShopModal(false) setShopData(selectRowList) - console.log('selectRowListselectRowList', selectRowList); - }} onCancel={() => { setShowAddShopModal(false) @@ -968,7 +1429,20 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props { + // !currentShopRow?.COMMODITY_ID && + if (editSelectRow?.SERVERPART_ID) { + await handleGetCommodity(editSelectRow?.SERVERPART_ID) + } + return { ...editSelectRow, BUSINESSTYPE: editSelectRow?.BUSINESSTYPE.toString(), COMMODITY_GRADE: Number(editSelectRow?.COMMODITY_GRADE) } + }} + disabled={currentRow?.BusinessProcess_State === 9000} + // initialValues={editSelectRow ? { + // ...editSelectRow, + // COMMODITY_GRADE: Number(editSelectRow?.COMMODITY_GRADE) + // } : { + + // }} >
商品基本信息
diff --git a/src/pages/reports/productControl/ProductChangeInfoApproval/style.less b/src/pages/reports/productControl/ProductChangeInfoApproval/style.less new file mode 100644 index 0000000..c9742a3 --- /dev/null +++ b/src/pages/reports/productControl/ProductChangeInfoApproval/style.less @@ -0,0 +1,16 @@ +.addProductModal { + .ant-modal-content { + .ant-modal-body { + .ProcessProgress { + .ant-card-body { + .ProcessProgressBox { + .multi-line-steps { + flex-wrap: wrap !important; + display: flex !important; + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/pages/reports/productControl/ProductChangePriceApproval/index.tsx b/src/pages/reports/productControl/ProductChangePriceApproval/index.tsx index 8a41c78..1c7ddd3 100644 --- a/src/pages/reports/productControl/ProductChangePriceApproval/index.tsx +++ b/src/pages/reports/productControl/ProductChangePriceApproval/index.tsx @@ -3,9 +3,9 @@ import { connect } from "umi"; import type { CurrentUser } from "umi"; import type { ConnectState } from "@/models/connect"; -import React, { useRef, useState } from "react"; +import React, { useEffect, useRef, useState } from "react"; import type { FormInstance } from "antd"; -import { Button, Col, Input, message, Modal, Popconfirm, Row, Space, Spin, Tree } from "antd"; +import { Button, Card, Col, Input, message, Modal, Popconfirm, Row, Space, Spin, Steps, Tooltip, Tree } from "antd"; import type { ActionType } from "@ant-design/pro-table"; import ProTable from "@ant-design/pro-table"; import PageTitleBox from "@/components/PageTitleBox"; @@ -17,9 +17,10 @@ import { handleGetCommodityList, handleGetNestingCOMMODITYTYPETree, handleGetSer import { handleGetUSERDEFINEDTYPEList } from "../userDefinedType/service"; import useRequest from "@ahooksjs/use-request"; import moment from 'moment' -import { handleApproveCommodityProInst, handleCreateCommodityProInst, handleRejectCommodityProInst } from "../ProductApprovalProcess/service"; +import { handleApproveCommodityProInst, handleCreateCommodityProInst, handleDeleteCOMMODITY_RUNNING, handleDeleteCommodityProInst, handleGetApprovalCommodityList, handleGetBUSINESSAPPROVALDetail, handleGetCOMMODITYRUNNINGList, handleReapplyCommodityProInst, handleRejectCommodityProInst } from "../ProductApprovalProcess/service"; import session from "@/utils/session"; - +import './style.less' +const { Step } = Steps const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (props) => { const { currentUser } = props const downloadBtnRef = useRef() @@ -55,6 +56,14 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop const [ApprovalType, setApprovaType] = useState(0) // 新增申请的加载效果 const [addApprovalLoading, setAddApprovalLoading] = useState(false); + // 审批记录详情 + const [BUSINESSAPPROVALDETAIL, setBUSINESSAPPROVALDETAIL] = useState() + // 还有几个环节 拼在流程进度后面 + const [nextStepsList, setNextStepsList] = useState() + // 判断有无发起申请的权限 + const [InitiateApplication, setInitiateApplication] = useState(false) + // 显示类型 + const [showDetailType, setShowDetailType] = useState() const { loading: CommodityLoading, data: CommodityData } = useRequest(async () => { const data = await getFieldEnumTree({ FieldExplainField: 'CommodityTypeIds' }) @@ -76,7 +85,7 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop } return obj }) - + let statusList: string[] = ["0", "1000", "2000", "2010,2020,2030,2040,2050,2060,2070,2080,2090", "9000"] const columns: any = [ { dataIndex: 'BusinessProcess_StateSearch', @@ -85,12 +94,20 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop ellipsis: true, align: 'center', hideInTable: true, + // valueEnum: { + // "0": "全部", + // "2000": "待审核", + // "2010,2020,2030,2040,2050,2060,2070,2080,2090": "审核中", + // "9000": "已审结" + // }, valueEnum: { - "0": "全部", - "2000": "待审核", - "2010,2020,2030,2040,2050,2060,2070,2080,2090": "审核中", - "9000": "已审结" + 0: "全部", + 1: "待申请", + 2: "待审核", + 3: "审核中", + 4: "已审结" }, + initialValue: "0" }, { dataIndex: 'BusinessProcess_Name', @@ -131,15 +148,27 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop ellipsis: true, align: 'center', hideInSearch: true, + render: (_, record) => { + return { + console.log('recordrecordrecord', record); + setShowDetailType('detail') + setCurrentRow(record) + setShowApplyFor(true) + }}>{record?.BusinessProcess_StateText || "-"} + } }, - { - dataIndex: 'Accept_Code', - title: '业务类别', - width: 200, - ellipsis: true, - align: 'center', - hideInSearch: true, - }, + // { + // dataIndex: 'Accept_Code', + // title: '业务类别', + // width: 200, + // ellipsis: true, + // align: 'center', + // hideInSearch: true, + // }, { dataIndex: 'BusinessProcess_EndDate', title: '办结时间', @@ -170,22 +199,65 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop record?.ApproveStaff_ID === currentUser?.ID && record?.BusinessProcess_State !== 9000 ? - { - setApprovaType(1) - setApproveCurrentRow(record) - setApproveModal(true) - }} - > - 审批 - - { - setApprovaType(2) - setApproveCurrentRow(record) - setApproveModal(true) - }}> - 驳回 - + { + record?.BusinessProcess_State === 1000 + ? + <> + { + setCurrentRow(record) + setShowApplyFor(true) + }} + > + 编辑 + + { + const req: any = { + businessApprovalId: record?.BusinessApproval_ID, + UserId: currentUser?.ID + } + const data = await handleDeleteCommodityProInst(req) + if (data.Result_Code === 100) { + message.success(data.Result_Desc) + actionRef.current?.reload() + } else { + message.error(data.Result_Desc) + } + }} + > + 删除 + + + : "" + } + { + record?.BusinessProcess_State > 1000 ? + <> + { + setApprovaType(1) + // setApproveCurrentRow(record) + // setApproveModal(true) + + setCurrentRow(record) + setShowApplyFor(true) + }} + > + 审批 + + { + setApprovaType(2) + // setApproveCurrentRow(record) + // setApproveModal(true) + + setCurrentRow(record) + setShowApplyFor(true) + }}> + 驳回 + + : "" + } : "" ); }, @@ -229,7 +301,7 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop ellipsis: true, align: 'center', render: (_, record) => { - return { + return 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)} onChange={(e: any) => { let oldData: any = JSON.parse(JSON.stringify(shopData)) let list: any = [] oldData.forEach((item: any) => { @@ -255,33 +327,63 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop valueType: 'option', align: 'center', hideInSearch: true, - width: 120, + width: 180, fixed: "right", ellipsis: true, render: (_, record) => { return ( - - { - console.log('record', record); - let oldData: any = JSON.parse(JSON.stringify(shopData)) - let list: any = [] - let rowKeyList: number[] = [] - oldData.forEach((item: any) => { - if (item.COMMODITY_ID !== record?.COMMODITY_ID) { - list.push(item) - rowKeyList.push(item.COMMODITY_ID) - } - }) - setShopData(list) - setSelectRowList(list) - setSelectedOrderRowKeys(rowKeyList) - }} - > - 删除 - + { + currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID) ? '' : + <> + { + + if (currentRow?.BusinessApproval_ID) { + console.log('record', record); + // 申请回到发起时候的真删 + const req: any = { + COMMODITY_RUNNINGId: record?.COMMODITY_ID + } + const data = await handleDeleteCOMMODITY_RUNNING(req) + console.log('datadatadatadata', data); + actionRef.current?.reload() + // 实现直接删除的效果 + console.log('record', record); + let oldData: any = JSON.parse(JSON.stringify(shopData)) + let list: any = [] + let rowKeyList: number[] = [] + oldData.forEach((item: any) => { + if (item.COMMODITY_ID !== record?.COMMODITY_ID) { + list.push(item) + rowKeyList.push(item.COMMODITY_ID) + } + }) + setShopData(list) + setSelectRowList(list) + setSelectedOrderRowKeys(rowKeyList) + } else { + console.log('record', record); + let oldData: any = JSON.parse(JSON.stringify(shopData)) + let list: any = [] + let rowKeyList: number[] = [] + oldData.forEach((item: any) => { + if (item.COMMODITY_ID !== record?.COMMODITY_ID) { + list.push(item) + rowKeyList.push(item.COMMODITY_ID) + } + }) + setShopData(list) + setSelectRowList(list) + setSelectedOrderRowKeys(rowKeyList) + } + }} + > + 删除 + + + } ); }, @@ -297,16 +399,16 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop hideInSearch: true, valueType: 'index' }, - { - title:
服务区
, - width: 150, - ellipsis: true, - align: 'center', - dataIndex: 'SERVERPART_NAME', - hideInSearch: true, - valueType: "select", - valueEnum: ServerpartIdsList - }, + // { + // title:
服务区
, + // width: 150, + // ellipsis: true, + // align: 'center', + // dataIndex: 'SERVERPART_NAME', + // hideInSearch: true, + // valueType: "select", + // valueEnum: ServerpartIdsList + // }, { title:
商品业态
, width: 120, @@ -389,7 +491,36 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop } ] + useEffect(async () => { + const req: any = { + SearchParameter: { + APPROVALROUTE_STATES: "", + APPROVALROUTE_VALID: 1, + OPERATION_TYPES: "100200", + } + } + const data = await handleGetAPPROVALROUTEList(req) + console.log('datadatadatadata', data); + // 拿到发起申请的人 + let firstSetp: any = {} + if (data && data.length > 0) { + data.forEach((item: any) => { + if (item.APPROVALROUTE_STATE === 1000) { + firstSetp = item + } + }) + } + // 判断当前用户 是否有新增权限 + let have: boolean = false + let idList: any = firstSetp.APPROVALSTAFF_ID.split(',') + console.log('idList', idList); + if (idList.indexOf(currentUser?.ID.toString()) !== -1) { + have = true + } + setInitiateApplication(have) + + }, []) return (
@@ -417,7 +548,7 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop SearchParameter: { Operation_Type: 6, Accept_Code: "6-100200", - BusinessProcess_StateSearch: params?.BusinessProcess_StateSearch === 0 ? '' : params?.BusinessProcess_StateSearch + BusinessProcess_StateSearch: statusList[params?.BusinessProcess_StateSearch] === "0" ? '' : statusList[params?.BusinessProcess_StateSearch] }, PageIndex: 1, PageSize: 999999 @@ -427,7 +558,7 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop if (data.data && data.data.length > 0) { data.data.forEach((item: any) => { if (item.BusinessProcess_State === 1000) { - item.BusinessProcess_StateText = "待审核" + item.BusinessProcess_StateText = "待申请" } else if (item.BusinessProcess_State === 2000) { item.BusinessProcess_StateText = "待审核" } else if (item.BusinessProcess_State > 2000 && item.BusinessProcess_State < 9000) { @@ -444,11 +575,12 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop }} toolbar={{ actions: [ - + InitiateApplication ? + : "" ] }} /> @@ -456,7 +588,7 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop
{/* 审批的悬浮框 */} - = (prop
: "" }
- + */} {/* 新增申请的悬浮框 */} { @@ -656,36 +789,128 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop setSelectRowList([]) setSelectedOrderRowKeys([]) setShopData([]) + setShowDetailType(null) }} confirmLoading={showApplyForLoading} - onOk={() => { - // 判断表格里面的现价 是不是都已经输入了 - let allRight: boolean = true - console.log('shopData', shopData); + footer={showDetailType === 'detail' || !InitiateApplication || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID) ? false :
+ - if (shopData && shopData.length > 0) { - shopData.forEach((item: any) => { - if (!item.newPrice) { - allRight = false + +
} + onOk={() => { + if (currentRow?.BusinessProcess_State > 1000) { + modalApproveFormRef?.current?.validateFields().then(() => { + modalApproveFormRef?.current?.submit() + }) + } else { + // 判断表格里面的现价 是不是都已经输入了 + let allRight: boolean = true + if (shopData && shopData.length > 0) { + shopData.forEach((item: any) => { + if (!item.newPrice) { + allRight = false + } + }) + } + if (!allRight) { + message.error("请先完善表格数据!") + return + } + formRef?.current?.validateFields().then(() => { + modalFormRef?.current?.submit() }) } - if (!allRight) { - message.error("请先完善表格数据!") - return - } - - formRef?.current?.validateFields().then(() => { - modalFormRef?.current?.submit() - }) - }} > + { + console.log('currentRowcurrentRowdsada', currentRow); + + if (currentRow?.BusinessApproval_ID) { + const req: any = { + BUSINESSAPPROVALId: currentRow?.BusinessApproval_ID, + } + const data = await handleGetBUSINESSAPPROVALDetail(req) + console.log('datadatadata', data); + setBUSINESSAPPROVALDETAIL(data.Result_Data) + + let shopData: any = [] + if (currentRow?.BusinessProcess_State === 9000) { + shopData = await handleGetApprovalCommodityList({ + ProvinceCode: currentUser?.ProvinceCode, + // CommodityId: currentUser?.ProvinceCode, + BusinessApprovalId: currentRow?.BusinessApproval_ID, + PageIndex: 1, + PageSize: 999999, + }) + } else { + shopData = await handleGetCOMMODITYRUNNINGList({ + SearchParameter: { + BUSINESSAPPROVAL_ID: currentRow?.BusinessApproval_ID, + }, + PageIndex: 1, + pageSize: 999999, + }) + } + console.log('shopDatashopDatashopDatashopData', shopData); + let shopList: any = shopData.Result_Data.List + + let list: any = [] + if (shopList && shopList.length > 0) { + shopList.forEach((item: any) => { + let obj: any = JSON.parse(JSON.stringify(item)) + obj.newPrice = item.COMMODITY_CURRPRICE + obj.COMMODITY_RETAILPRICE = item.COMMODITY_ORIPRICE + obj.COMMODITY_CURRPRICE = item.COMMODITY_ORIPRICE + obj.COMMODITY_ORIPRICE = null + list.push(obj) + }) + } + setShopData(list) + return { + reasonForApplication: data.Result_Data.BUSINESSAPPROVAL_DESC, + ServerpartId: data.Result_Data.SERVERPART_ID, + NextApproveStaffId: data.Result_Data.APPOVED_IDS + } + } else { + return {} + } + }} onFinish={async (res) => { setShowApplyForLoading(true) let list: any = [] @@ -699,20 +924,35 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop list.push(obj) }) } + let data: any = {} + if (currentRow?.BusinessApproval_ID) { + const req: any = { + ProinstId: currentRow?.BusinessApproval_ID, + ProinstName: res.reasonForApplication, + UserId: currentUser?.ID, + OperateType: "100200", + ServerpartId: res.ServerpartId, + NextApproveStaffId: res.NextApproveStaffId, + NextApproveState: 2000, + CommodityRunningList: list + } + console.log('req', req); + data = await handleReapplyCommodityProInst(req) + } else { + const req: any = { + ProinstName: res.reasonForApplication, + UserId: currentUser?.ID, + OperateType: "100200", + ServerpartId: res.ServerpartId, + NextApproveStaffId: res.NextApproveStaffId, + NextApproveState: 2000, + CommodityRunningList: list + } + console.log('req', req); - const req: any = { - ProinstName: res.reasonForApplication, - UserId: currentUser?.ID, - OperateType: "100200", - ServerpartId: res.ServerpartId, - NextApproveStaffId: res.NextApproveStaffId, - NextApproveState: 2000, - CommodityRunningList: list + data = await handleCreateCommodityProInst(req) } - console.log('req', req); - - const data = await handleCreateCommodityProInst(req) setShowApplyForLoading(false) console.log('dsaidjaskda', data); if (data.Result_Code === 100) { @@ -727,7 +967,8 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop message.error(data.Result_Desc) } - }} + } + } > @@ -738,6 +979,7 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop required: true, message: "请输入申请原因!" }]} + disabled={currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)} /> @@ -765,9 +1007,10 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop } return list }} + disabled={currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)} /> - + 1000 && ApprovalType !== 0 ? "none" : "" }}> = (prop const dataState = await handleGetAPPROVALROUTEList(reqState) if (dataState && dataState.length > 0) { let obj: any = {} - console.log('dataState', dataState); + // 下面的环节 + let nextList: any = [] dataState.forEach((item: any) => { if (item.APPROVALROUTE_STATE === 2000) { obj = item } + if (item.APPROVALROUTE_STATE >= currentRow?.BusinessProcess_State) { + if (item.APPROVALROUTE_STATE === currentRow?.BusinessProcess_State) { + item.status = "process" + } + nextList.push(item) + } }) + + setNextStepsList(nextList) + let personTotal: number = obj.APPROVALSTAFF_ID.split(',').length || 0 if (personTotal > 0) { let STAFFIDList: number[] = obj.APPROVALSTAFF_ID.split(',') @@ -807,36 +1060,276 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop } } }} + disabled={currentRow?.BusinessProcess_State > 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)} /> - - - { - // 判断服务区是否已选择 - const values = modalFormRef.current?.getFieldsValue(); - if (!values?.ServerpartId) { - message.error("请先选择服务区!"); - return; - } - setShowAddShopModal(true); - }}> - 选择商品 - - ] - }} - /> + + { + currentRow?.BusinessProcess_State > 1000 ? + { + const reqState: any = { + SearchParameter: { + APPROVALROUTE_STATES: "", + APPROVALROUTE_VALID: 1, + OPERATION_TYPES: "100200", + }, + PageIndex: 1, + PageSize: 999999 + } + const dataState = await handleGetAPPROVALROUTEList(reqState) + console.log('dataStatedataStatedataState', dataState); + let obj: any = {} + let currentIndex: number = 0 + if (dataState && dataState.length > 0) { + dataState.forEach((item: any, index: number) => { + if (item.APPROVALROUTE_STATE === currentRow.BusinessProcess_State) { + obj = item + currentIndex = index + } + }) + } + if (obj) { + // 审批的时候 拿到当前状态 去找下一个状态 + if (ApprovalType === 1) { + // 拿到当前状态的信息 判断下一状态 是不是结束了 结束了 就不显示 下一结算审批人 不是结束 就拿到下一流程的审批人 + setNextApproval(obj.NEXT_STATE) + let nextObj: any = currentIndex + 1 <= dataState.length ? dataState[currentIndex + 1] : {} + if (nextObj) { + let personTotal: number = nextObj.APPROVALSTAFF_ID.split(',').length || 0 + if (personTotal > 0) { + let STAFFIDList: number[] = nextObj.APPROVALSTAFF_ID.split(',') + let STAFFNAMEList: string[] = nextObj.APPROVALSTAFF_NAME.split(',') + let list: any = [] + for (let i = 0; i < personTotal; i++) { + list.push({ label: STAFFNAMEList[i], value: STAFFIDList[i] }) + } + setNextApprovalPerson(list) + } + } + } else { + // 驳回的话 去找历史状态 + if (dataState && dataState.length > 0) { + let list: any = [] + dataState.forEach((item: any, index: number) => { + if (obj.APPROVALROUTE_STATE > item.APPROVALROUTE_STATE) { + list.push({ label: item.APPROVALROUTE_NAME, value: item.APPROVALROUTE_STATE }) + } + }) + setNextApprovalPerson(list) + } + + } + + } + return {} + }} + onFinish={async (res) => { + setAddApprovalLoading(true) + let data: any = {} + + if (ApprovalType === 1) { + // 审批 + const req: any = { + businessApprovalId: currentRow?.BusinessApproval_ID, + UserId: currentUser?.ID, + ApproveInfo: res.ApproveInfo, + nextApproveStaffId: res.nextApproveStaffId || "", + nextApproveState: nextApproval || "" + } + + data = await handleApproveCommodityProInst(req) + } else { + // 驳回 + const req: any = { + businessApprovalId: currentRow?.BusinessApproval_ID, + UserId: currentUser?.ID, + RejectInfo: res.ApproveInfo, + nextApproveState: res.nextApproveState || "" + } + console.log('reqreqreqreq', req); + + data = await handleRejectCommodityProInst(req) + } + setAddApprovalLoading(false) + console.log('datadatadata', data); + if (data.Result_Code === 100) { + message.success(data.Result_Desc) + + setShowApplyFor(false) + setCurrentRow(undefined) + setSelectRowList([]) + setSelectedOrderRowKeys([]) + setShopData([]) + setShowDetailType(null) + + + setApproveCurrentRow(undefined) + setApproveModal(false) + setNextApproval(null) + setNextApprovalPerson(null) + setApprovaType(0) + actionRef.current?.reload() + } else { + message.error(data.Result_Desc) + } + + }} + > + { + ApprovalType === 1 ? + + { + nextApproval === 9000 ? '' : + + + + + } + + + + : ApprovalType === 2 ? + + + + + + + + + : "" + } + + : "" + } + + 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID) ? '' : + ] + }} + /> + + { + currentRow?.BusinessProcess_State > 1000 ? + +
+ + {/* 1000 ? 'finish' : 'wait'} + title="发起申请" + description={ +
+ +

{`${currentRow?.BusinessProcess_StartDate || ''}`}

+
+
+ } + /> */} + { + BUSINESSAPPROVALDETAIL?.approveList && BUSINESSAPPROVALDETAIL?.approveList.length > 0 ? + BUSINESSAPPROVALDETAIL?.approveList.map((item: any, index: number) => ( + + +

{`${item.APPLYAPPROVE_DATE || ''}`}

+
+
} + /> + )) : '' + } + + { + nextStepsList && nextStepsList.length > 0 ? + nextStepsList.map((item: any, index: number) => ( + + )) : '' + } + + +
+ : '' + }
diff --git a/src/pages/reports/productControl/ProductChangePriceApproval/style.less b/src/pages/reports/productControl/ProductChangePriceApproval/style.less new file mode 100644 index 0000000..c9742a3 --- /dev/null +++ b/src/pages/reports/productControl/ProductChangePriceApproval/style.less @@ -0,0 +1,16 @@ +.addProductModal { + .ant-modal-content { + .ant-modal-body { + .ProcessProgress { + .ant-card-body { + .ProcessProgressBox { + .multi-line-steps { + flex-wrap: wrap !important; + display: flex !important; + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/pages/travelMember/ProductListingManagement/index.tsx b/src/pages/travelMember/ProductListingManagement/index.tsx index 903f30c..1dfb397 100644 --- a/src/pages/travelMember/ProductListingManagement/index.tsx +++ b/src/pages/travelMember/ProductListingManagement/index.tsx @@ -19,13 +19,12 @@ 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 type { COMMODITYModel } from './data'; import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除 import { getList, delcommodity, updatecommodity } from './service'; // 接口相关对象的引用 import PageTitleBox from "@/components/PageTitleBox"; import LeftSelectMallType from './component/LeftSelectMallType'; -import { handeDeleteCOMMODITY, handeGetCOMMODITY_MULTIList, handeGetCOMMODITYDetail, handeGetCOMMODITYList, handeSynchroCOMMODITY, handleGetBRANDList } from '../service'; +import { handeDeleteCOMMODITY, handeGetCOMMODITY_MULTIList, handeGetCOMMODITYDetail, handeGetCOMMODITYList, handeGetMERCHANTSList, handeGetRTCOMMODITY_MULTIList, handeSynchroCOMMODITY, handleGetBRANDList, handlGetUSERDEFINEDTYPEList } from '../service'; import session from '@/utils/session'; @@ -33,7 +32,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop const { currentUser } = props const actionRef = useRef(); const formRef = useRef(); - const [currentRow, setCurrentRow] = useState(); + const [currentRow, setCurrentRow] = useState(); const [showDetail, setShowDetail] = useState(); const [modalVisible, handleModalVisible] = useState(); const [confirmLoading, handleConfirmLoading] = useState(false) // 弹出框的内容表单是否在提交 @@ -56,16 +55,21 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop const COMMODITYGRADEList = session.get('COMMODITYGRADEList') // 在proform里面的品牌查询列表 const [BRAND_NAMEList, setBRAND_NAMEList] = useState() + // 供货商户数据 + const [COMMODITYSUPPLIERLIST, setCOMMODITYSUPPLIERLIST] = useState() // 拿到左侧树的数据 const [leftTreeData, setLeftTreeData] = useState() // 多规格 const [showMoreSpecs, setShowMoreSpecs] = useState(false) // 新增规格的 悬浮框 const [showAddSpecsModal, setShowAddSpecsModal] = useState(false) - - // 树相关的属性和方法 const [selectedId, setSelectedId] = useState() + // 选择的规格内容 + const [selectedRowKeys, setSelectedRowKeys] = useState() + const [selectedRows, setSelectedRows] = useState() + + const onDraggaleStart = (event, uiData) => { const { clientWidth, clientHeight } = window.document.documentElement; @@ -302,21 +306,21 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop valueType: 'index', }, { - dataIndex: '', + dataIndex: 'USERDEFINEDTYPE_NAME', title: '规格分类', align: 'center', width: 150, ellipsis: true, }, { - dataIndex: '', + dataIndex: 'COMMODITY_NAME', title: '规格名称', align: 'center', width: 200, ellipsis: true, }, { - dataIndex: '', + dataIndex: 'supplier', title: '供应商', align: 'center', width: 200, @@ -341,24 +345,40 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop req = { ...currentRow, ...res, + BRAND_ID: res.BRAND_ID.split('-')[1], + BRAND_NAME: res.BRAND_ID.split('-')[0], + MERCHANTS_ID: res.MERCHANTS_ID.split('-')[1], + MERCHANTS_NAME: res.MERCHANTS_ID.split('-')[0], OWNERUNIT_ID: currentUser?.OwnerUnitId, OWNERUNIT_NAME: currentUser?.OwnerUnitName, PROVINCE_CODE: currentUser?.ProvinceCode, OPERATE_PERSON: currentUser?.ID, COMMODITY_TYPE: 4000, + COMMODITY_STATE: 1, OPERATE_TIME: moment().format('YYYY-MM-DD HH:mm:ss'), + UPPER_DATE: res.UPPER_DATE && res.UPPER_DATE.length > 0 ? moment(res.UPPER_DATE[0]).format('YYYY-MM-DD HH:mm:ss') : "", + OFF_DATE: res.UPPER_DATE && res.UPPER_DATE.length > 0 ? moment(res.UPPER_DATE[1]).format('YYYY-MM-DD HH:mm:ss') : "", } } else { req = { ...res, + BRAND_ID: res.BRAND_ID.split('-')[1], + BRAND_NAME: res.BRAND_ID.split('-')[0], + MERCHANTS_ID: res.MERCHANTS_ID.split('-')[1], + MERCHANTS_NAME: res.MERCHANTS_ID.split('-')[0], OWNERUNIT_ID: currentUser?.OwnerUnitId, OWNERUNIT_NAME: currentUser?.OwnerUnitName, PROVINCE_CODE: currentUser?.ProvinceCode, OPERATE_PERSON: currentUser?.ID, COMMODITY_TYPE: 4000, + COMMODITY_STATE: 1, OPERATE_TIME: moment().format('YYYY-MM-DD HH:mm:ss'), + UPPER_DATE: res.UPPER_DATE && res.UPPER_DATE.length > 0 ? moment(res.UPPER_DATE[0]).format('YYYY-MM-DD HH:mm:ss') : "", + OFF_DATE: res.UPPER_DATE && res.UPPER_DATE.length > 0 ? moment(res.UPPER_DATE[1]).format('YYYY-MM-DD HH:mm:ss') : "", } } + console.log('reqreqreqreq', req); + const data = await handeSynchroCOMMODITY(req) handleConfirmLoading(false) if (data.Result_Code === 100) { @@ -372,6 +392,31 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop } }; + // 拿到类别列表里面得规格 + const collectItemsWithCommodityMultiId = (data: any, result = []) => { + // 检查输入是否为数组 + if (!Array.isArray(data)) { + return result; + } + + // 遍历数组中的每一项 + for (const item of data) { + // 检查是否是对象且包含 COMMODITY_MULTI_ID 属性 + if (typeof item === 'object' && item !== null && 'COMMODITY_MULTI_ID' in item && item.COMMODITY_MULTI_ID) { + result.push(item); + } + + // 递归检查所有可能包含子数组的属性 + for (const key in item) { + if (Array.isArray(item[key])) { + collectItemsWithCommodityMultiId(item[key], result); + } + } + } + + return result; + } + return (
@@ -383,7 +428,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop paddingRight: 0 }}> {/* 最外层的列表 */} - + { return `${record?.COMMODITY_ID}` @@ -405,7 +450,8 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop USERDEFINEDTYPE_IDS: selectedId, UPPER_STATE: params?.UPPER_STATE, DUTY_PARAGRAPH: params?.DUTY_PARAGRAPH === "-1" ? "" : params?.DUTY_PARAGRAPH, - COMMODITY_TYPE: 4000 + COMMODITY_TYPE: 4000, + COMMODITY_STATE: 1, }, PageIndex: 1, PageSize: 999999, @@ -454,27 +500,28 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop
{/* 添加商品的悬浮框 */} { - if (disabled) { - setDraggleDisabled(false) - } - }} - onMouseOut={() => { - setDraggleDisabled(true) - }} + title={currentRow ? '更新商品管理' : '新建商品管理'} + // title={ + //
{ + // if (disabled) { + // setDraggleDisabled(false) + // } + // }} + // onMouseOut={() => { + // setDraggleDisabled(true) + // }} - onFocus={() => { }} - onBlur={() => { }} - > - {currentRow ? '更新商品管理' : '新建商品管理'} -
- } + // onFocus={() => { }} + // onBlur={() => { }} + // > + // {currentRow ? '更新商品管理' : '新建商品管理'} + //
+ // } destroyOnClose={true} width={'70%'} visible={modalVisible} @@ -486,7 +533,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop onCancel={() => { handleConfirmLoading(false) handleModalVisible(false) - setBRAND_NAMEList([]) + // setBRAND_NAMEList([]) }} footer={
@@ -506,7 +553,7 @@ const COMMODITYTable: React.FC<{ currentUser: CurrentUser | undefined }> = (prop handleModalVisible(false) setBRAND_NAMEList([]) }}>取 消 -
); diff --git a/src/pages/travelMember/ProductSpecificationManage/index.tsx b/src/pages/travelMember/ProductSpecificationManage/index.tsx index 42f1068..b970cc3 100644 --- a/src/pages/travelMember/ProductSpecificationManage/index.tsx +++ b/src/pages/travelMember/ProductSpecificationManage/index.tsx @@ -9,7 +9,7 @@ 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, ProFormMoney, ProFormSelect, ProFormText, ProFormTextArea, ProFormUploadButton } from '@ant-design/pro-form'; +import ProForm, { ProFormDatePicker, ProFormDateTimePicker, 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'; @@ -22,6 +22,8 @@ import type { FormInstance } from 'antd'; import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除 import PageTitleBox from "@/components/PageTitleBox"; +import { handeDeleteCOMMODITY_MULTI, handeSynchroCOMMODITY_MULTI, handlDeleteUSERDEFINEDTYPE, handlGetUSERDEFINEDTYPEList, handlSynchroUSERDEFINEDTYPE } from '../service'; +import { render } from 'react-dom'; const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefined }> = (props) => { @@ -38,6 +40,10 @@ const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefine const [bounds, setBounds] = useState<{ left: number, right: number, top: number, bottom: number }>() // 移动的位置 const [disabled, setDraggleDisabled] = useState() // 是否拖动 const draggleRef = React.createRef() + // 添加处理的类型 1 为类别 2 为 规格 + const [dataType, setDataType] = useState(0) + // 表格数据 + const [tableData, setTableData] = useState() const onDraggaleStart = (event, uiData) => { const { clientWidth, clientHeight } = window.document.documentElement; @@ -55,59 +61,100 @@ const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefine // 定义列表字段内容 const columns: any = [ - { - dataIndex: 'PROVINCE_CODE', - title: '省份编码', - align: 'center', - hideInSearch: true, - }, - { - dataIndex: 'COMMODITY_NAME', - title: '商品名称', - align: 'center', - hideInSearch: true, - }, { dataIndex: 'USERDEFINEDTYPE_NAME', title: '类别名称', align: 'center', hideInSearch: true, + width: 200, + ellipsis: true, + render: (_, record) => { + return record?.COMMODITY_NAME || record?.USERDEFINEDTYPE_NAME || "-" + } }, { - dataIndex: 'COMMODITY_STATE', - title: '商品状态', + dataIndex: 'USERDEFINEDTYPE_INDEX', + title: '类别索引', align: 'center', hideInSearch: true, + width: 150, + ellipsis: true, + }, + { + dataIndex: 'USERDEFINEDTYPE_STATE', + title: '有效状态', + align: 'center', + width: 150, + ellipsis: true, + valueEnum: { + "1": "有效", + "0": "无效" + }, + initialValue: "1", + render: (_, record) => { + 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: '操作时间', - valueType: 'fromNow', + 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: 'COMMODITY_DESC', + dataIndex: 'USERDEFINEDTYPE_DESC', title: '备注说明', + width: 250, align: 'center', + ellipsis: true, hideInSearch: true, + render: (_, record) => { + return record?.COMMODITY_DESC || record?.USERDEFINEDTYPE_DESC + } }, { dataIndex: 'STAFF_NAME', title: '操作员名称', + width: 150, align: 'center', + ellipsis: true, hideInSearch: true, }, { dataIndex: 'option', title: '操作', + width: 150, valueType: 'option', + align: 'center', hideInSearch: true, render: (_, record) => { return ( { + if (record?.COMMODITY_MULTI_ID) { + setDataType(2) + } else { + setDataType(1) + } + console.log('recordrecord', record); + setCurrentRow({ ...record }); handleModalVisible(true); }} @@ -117,7 +164,11 @@ const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefine { - await handelDelete(record.COMMODITY_MULTI_ID); + if (record?.COMMODITY_MULTI_ID) { + await handelDeleteSpecifications(record.COMMODITY_MULTI_ID); + } else { + await handelDelete(record.USERDEFINEDTYPE_ID); + } }} > 删除 @@ -128,53 +179,161 @@ const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefine }, ]; - // const handelDelete = async (commodity_multiid: number) => { - // const result = await delcommodity_multi({ commodity_multiid: commodity_multiid }); - // if (result.Result_Code !== 100) { - // message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`); - // } else { - // message.success('删除成功!'); - // actionRef.current?.reload() - // } - // }; + // 删除类别 + const handelDelete = async (id: number) => { + const result = await handlDeleteUSERDEFINEDTYPE({ USERDEFINEDTYPEId: id }); - // const handleAddUpdate = async (fields: COMMODITY_MULTIModel) => { - // const hide = message.loading('正在提交...'); + if (result.Result_Code !== 100) { + message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`); + } else { + message.success('删除成功!'); + actionRef.current?.reload() + } + }; + // 删除规格 + const handelDeleteSpecifications = async (id: any) => { + const result = await handeDeleteCOMMODITY_MULTI({ COMMODITY_MULTIId: id }); - // const result = await updatecommodity_multi(fields); - // hide(); - // if (result.Result_Code !== 100) { - // message.error(`${result.Result_Desc}` || `${result.Result_Code}:提交失败`); - // return false; - // } - // return result.Result_Data ? result.Result_Data : true; - // }; + if (result.Result_Code !== 100) { + message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`); + } else { + message.success('删除成功!'); + actionRef.current?.reload() + } + } + + // 同步类别 + const handleAddUpdate = async (res: any) => { + let req: any = {} + if (currentRow?.USERDEFINEDTYPE_ID) { + req = { + ...currentRow, + ...res, + GOODSTYPE: 6000, + OPERATE_TIME: moment().format('YYYY-MM-DD HH:mm:ss'), + STAFF_ID: currentUser?.ID, + STAFF_NAME: currentUser?.Name + } + } else { + req = { + ...res, + GOODSTYPE: 6000, + OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + STAFF_ID: currentUser?.ID, + STAFF_NAME: currentUser?.Name, + USERDEFINEDTYPE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + OWNERUNIT_ID: currentUser?.OwnerUnitId, + PROVINCE_CODE: currentUser?.ProvinceCode + } + } + console.log('reqreqreqreq', req); + + const data = await handlSynchroUSERDEFINEDTYPE(req) + handleConfirmLoading(false) + if (data.Result_Code === 100) { + message.success("新增成功!") + setCurrentRow(undefined) + formRef?.current?.resetFields() + handleModalVisible(false) + actionRef.current?.reload() + } else { + message.error(data.Result_Desc) + } + }; + + const handleAddUpdateSpecifications = async (res: any) => { + console.log('res', res); + + let req: any = {} + if (currentRow?.COMMODITY_MULTI_ID) { + req = { + ...currentRow, + ...res, + OPERATE_TIME: moment().format('YYYY-MM-DD HH:mm:ss'), + STAFF_ID: currentUser?.ID, + STAFF_NAME: currentUser?.Name + } + } else { + req = { + ...res, + OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + STAFF_ID: currentUser?.ID, + STAFF_NAME: currentUser?.Name, + PROVINCE_CODE: currentUser?.ProvinceCode + } + } + console.log('reqreqreqreq', req); + + const data = await handeSynchroCOMMODITY_MULTI(req) + handleConfirmLoading(false) + if (data.Result_Code === 100) { + message.success("新增成功!") + setCurrentRow(undefined) + formRef?.current?.resetFields() + handleModalVisible(false) + actionRef.current?.reload() + } else { + message.error(data.Result_Desc) + } + } + + // 递归处理表格数据 + const transformMultiRuleToChildren = (data: any) => { + if (!Array.isArray(data)) { + return data; + } + return data.map(item => { + // 创建新对象,避免修改原对象 + const newItem = { ...item }; + // 如果存在 MultiRuleList,则转换为 children + if (newItem.MultiRuleList) { + newItem.children = transformMultiRuleToChildren(newItem.MultiRuleList); + // 如果需要保留原 MultiRuleList 可以注释下面这行 + // delete newItem.MultiRuleList; + } + // 递归处理其他可能的嵌套数组 + Object.keys(newItem).forEach(key => { + if (Array.isArray(newItem[key]) && key !== 'children') { + newItem[key] = transformMultiRuleToChildren(newItem[key]); + } + }); + return newItem; + }); + } return (
- - style={{ height: 'calc(100vh - 135px)', background: '#fff' }} - scroll={{ y: 'calc(100vh - 410px)' }} + { - return `${record?.COMMODITY_MULTI_ID}` + return `${record?.USERDEFINEDTYPE_ID}-${record?.COMMODITY_MULTI_ID}` }} formRef={formRef} headerTitle={} // 列表表头 actionRef={actionRef} + bordered search={{ span: 6, labelWidth: 'auto' }} + pagination={false} // 请求数据 request={async (params, sorter) => { - - const searchWholeParams = { - searchParameter: { ...params }, - sortstr: sortstr.length ? sortstr.toString() : "", - pagesize: 999999 + const req = { + OWNERUNIT_ID: currentUser?.OwnerUnitId, + PROVINCE_CODE: "", + GOODSTYPE: 6000, + USERDEFINEDTYPE_STATE: params?.USERDEFINEDTYPE_STATE } - setSearchParams(searchWholeParams) - const data = await getList(searchWholeParams); - return data; + console.log('req', req); + + const data = await handlGetUSERDEFINEDTYPEList(req); + setTableData(data) + if (data && data.length > 0) { + let list: any = transformMultiRuleToChildren(data) + console.log('listlistlistlist', list); + return { data: list, success: true, total: data.length } + } + return { data: [], success: true } }} columns={columns} toolbar={{ @@ -185,15 +344,27 @@ const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefine icon={} type="primary" onClick={() => { + setDataType(1) handleModalVisible(true); }} > - 商品多规格 + 新增类别 + , + , ], }} /> - + { }} onBlur={() => { }} > - {currentRow ? '更新商品多规格' : '新建商品多规格'} + {dataType === 1 ? currentRow ? '编辑商品类别' : '新建商品类别' : currentRow ? '编辑规格类型' : '新建规格类型'}
} destroyOnClose={true} @@ -227,6 +398,7 @@ const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefine onCancel={() => { handleConfirmLoading(false) handleModalVisible(false) + setDataType(0) }} onOk={async () => { // 提交框内的数据 @@ -247,112 +419,190 @@ const ProductSpecificationManage: React.FC<{ currentUser: CurrentUser | undefine > { - let newValue: COMMODITY_MULTIModel = { ...values }; - if (currentRow) { - // 编辑数据 - newValue = { ...values, COMMODITY_MULTI_ID: currentRow.COMMODITY_MULTI_ID }; - } - // 如果有开关,要把开关的代码写进去 - const success = await handleAddUpdate(newValue as COMMODITY_MULTIModel); - - handleConfirmLoading(false) - if (success) { - if (actionRef.current) { - actionRef.current.reload(); - } - handleModalVisible(false); + // initialValues={currentRow} + request={async () => { + return currentRow ? { + ...currentRow, + } : dataType === 1 ? { + USERDEFINEDTYPE_STATE: 1 + } : { + COMMODITY_STATE: 1 } }} + onFinish={async (values) => { + let newValue: any = { ...values }; + if (currentRow) { + // 编辑数据 + if (dataType === 1) { + // 同步类别 + newValue = { ...values, USERDEFINEDTYPE_ID: currentRow?.USERDEFINEDTYPE_ID }; + } else if (dataType === 2) { + // 同步规格 + newValue = { ...values, COMMODITY_MULTI_ID: currentRow?.COMMODITY_MULTI_ID }; + } + + } + + console.log('dataTypedataTypedataTypedataType', dataType); + + if (dataType === 1) { + // 同步类别 + await handleAddUpdate(newValue); + } else if (dataType === 2) { + // 同步规格 + await handleAddUpdateSpecifications(newValue); + } + + handleConfirmLoading(false) + }} > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + { + dataType === 1 ? + // 新增编辑类别 + + + { + let list: any = JSON.parse(JSON.stringify(tableData)) + list.unshift({ USERDEFINEDTYPE_NAME: "默认类别", USERDEFINEDTYPE_ID: "-1" }) + return list + }} + fieldProps={{ + fieldNames: { + label: 'USERDEFINEDTYPE_NAME', + value: 'USERDEFINEDTYPE_ID', + children: 'MultiRuleList' + }, + showSearch: true, + filterTreeNode: (input, node) => + (node.USERDEFINEDTYPE_NAME || '').toLowerCase().includes(input.toLowerCase()) + }} + /> + + + + + + + + + + + + + + + + + : + // 新增编辑规格 + + + { + let list: any = JSON.parse(JSON.stringify(tableData)) + list.unshift({ USERDEFINEDTYPE_NAME: "默认类别", USERDEFINEDTYPE_ID: "-1" }) + console.log('listlistlist', list); + + return list + }} + fieldProps={{ + fieldNames: { + label: 'USERDEFINEDTYPE_NAME', + value: 'USERDEFINEDTYPE_ID', + children: 'MultiRuleList' + }, + showSearch: true, + filterTreeNode: (input, node) => + (node.USERDEFINEDTYPE_NAME || '').toLowerCase().includes(input.toLowerCase()), + onChange: (value, label, extra) => { + // 设置label到表单 + formRef.current?.setFieldsValue({ + USERDEFINEDTYPE_NAME: label[0] + }); + } + }} + /> + + + + + + + + + + + + + + + } +
diff --git a/src/pages/travelMember/SupplierClassification/index.tsx b/src/pages/travelMember/SupplierClassification/index.tsx index 6dcbbc3..d5d4e5e 100644 --- a/src/pages/travelMember/SupplierClassification/index.tsx +++ b/src/pages/travelMember/SupplierClassification/index.tsx @@ -1,5 +1,4 @@ // 供应商分类 - import React, { useRef, useState, Suspense } from 'react'; import moment from 'moment'; // 时间相关引用,没有使用可以删除 import numeral from "numeral"; // 数字相关引用,没有使用可以删除 @@ -22,7 +21,7 @@ import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions'; import type { FormInstance } from 'antd'; import { getFieldEnumTree, getFieldEnumName } from "@/services/options"; // 枚举的引用,没有使用可以删除 -import { handlDeleteUSERDEFINEDTYPE, handlGetUSERDEFINEDTYPEList, handlSynchroUSERDEFINEDTYPE } from '../service'; +import { handlDeleteAUTOTYPE, handlDeleteUSERDEFINEDTYPE, handlGetNestingAUTOTYPEList, handlGetUSERDEFINEDTYPEList, handlSynchroAUTOTYPE, handlSynchroUSERDEFINEDTYPE } from '../service'; import PageTitleBox from '@/components/PageTitleBox'; import { uploadPicture } from '@/services/picture'; import defaultIcon from '../../../assets/brand/defaultIcon.png' @@ -91,22 +90,16 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }> // hideInDescriptions: true, // }, { - dataIndex: 'USERDEFINEDTYPE_NAME', + dataIndex: 'AUTOTYPE_NAME', title: '供应商名称', align: 'center', width: 300, ellipsis: true, hideInSearch: true, hideInDescriptions: true, - render: (_, record) => { - return
- - {record?.USERDEFINEDTYPE_NAME} -
- } }, { - dataIndex: '', + dataIndex: 'AUTOTYPE_CODE', title: '类别代码', align: 'center', width: 120, @@ -114,7 +107,7 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }> hideInSearch: true, }, { - dataIndex: 'USERDEFINEDTYPE_INDEX', + dataIndex: 'AUTOTYPE_INDEX', title: '类别索引', align: 'center', width: 120, @@ -122,7 +115,7 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }> hideInSearch: true, }, { - dataIndex: 'USERDEFINEDTYPE_STATE', + dataIndex: 'AUTOTYPE_VALID', title: '有效状态', align: 'center', width: 120, @@ -166,14 +159,6 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }> { - console.log('recordrecordrecord', record); - if (record?.USERDEFINEDTYPE_ICO) { - setFileList([{ - name: "", - url: record?.USERDEFINEDTYPE_ICO - }]) - } - setCurrentRow({ ...record }); handleModalVisible(true); }} @@ -183,7 +168,7 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }> { - handelDelete(record.USERDEFINEDTYPE_ID); + handelDelete(record.AUTOTYPE_ID); }} > 删除 @@ -206,9 +191,9 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }> // 删除商品类别 const handelDelete = async (id: any) => { const req: any = { - USERDEFINEDTYPEId: id + AUTOTYPEId: id } - const result = await handlDeleteUSERDEFINEDTYPE(req) + const result = await handlDeleteAUTOTYPE(req) if (result.Result_Code !== 100) { message.error(`${result.Result_Desc}` || `${result.Result_Code}:删除失败`); } else { @@ -220,15 +205,14 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }> // 同步商品列表 const handleAddUpdate = async (res: any) => { let req: any = {} - if (currentRow?.USERDEFINEDTYPE_ID) { + if (currentRow?.AUTOTYPE_ID) { req = { ...currentRow, ...res, - GOODSTYPE: 1000, - USERDEFINEDTYPE_ICO: fileList && fileList.length > 0 ? fileList[0].url : "", - PRESALE_STARTTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? res.PRESALE_TIME[0] : "", - PRESALE_ENDTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? res.PRESALE_TIME[1] : "", - PROVINCE_CODE: currentUser?.ProvinceCode, + AUTOTYPE_TYPEID: 4000, + // PRESALE_STARTTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? res.PRESALE_TIME[0] : "", + // PRESALE_ENDTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? res.PRESALE_TIME[1] : "", + // PROVINCE_CODE: currentUser?.ProvinceCode, STAFF_ID: currentUser?.ID, STAFF_NAME: currentUser?.Name, OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), @@ -236,18 +220,17 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }> } else { req = { ...res, - GOODSTYPE: 1000, - USERDEFINEDTYPE_ICO: fileList && fileList.length > 0 ? fileList[0].url : "", - PRESALE_STARTTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? res.PRESALE_TIME[0] : "", - PRESALE_ENDTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? res.PRESALE_TIME[1] : "", + AUTOTYPE_TYPEID: 4000, + // PRESALE_STARTTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? res.PRESALE_TIME[0] : "", + // PRESALE_ENDTIME: res.PRESALE_TIME && res.PRESALE_TIME.length > 0 ? res.PRESALE_TIME[1] : "", PROVINCE_CODE: currentUser?.ProvinceCode, STAFF_ID: currentUser?.ID, STAFF_NAME: currentUser?.Name, OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), - USERDEFINEDTYPE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + // USERDEFINEDTYPE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), } } - const data = await handlSynchroUSERDEFINEDTYPE(req) + const data = await handlSynchroAUTOTYPE(req) handleConfirmLoading(false) if (data.Result_Code === 100) { message.success("新增成功!") @@ -271,7 +254,7 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }> style={{ height: 'calc(100vh - 135px)', background: '#fff' }} scroll={{ y: 'calc(100vh - 410px)' }} rowKey={(record) => { - return `${record?.USERDEFINEDTYPE_PID}-${record?.USERDEFINEDTYPE_ID}` + return `${record?.USERDEFINEDTYPE_PID}-${record?.AUTOTYPE_ID}` }} formRef={formRef} headerTitle={} // 列表表头 @@ -283,13 +266,13 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }> const req = { OWNERUNIT_ID: currentUser?.OwnerUnitId, PROVINCE_CODE: "", - GOODSTYPE: 1000, - USERDEFINEDTYPE_STATE: params?.USERDEFINEDTYPE_STATE + AUTOTYPE_TYPEID: 4000, + AUTOTYPE_VALID: params?.AUTOTYPE_VALID // SearchKey: "" } console.log('reqreq', req); - const data = await handlGetUSERDEFINEDTYPEList(req); + const data = await handlGetNestingAUTOTYPEList(req); console.log('datadatadatadatadata', data); if (data && data.length > 0) { setTypeTreeData(data) @@ -391,20 +374,17 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }> submitter={false} preserve={false} initialValues={currentRow ? currentRow : { - USERDEFINEDTYPE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), - OWNERUNIT_NAME: currentUser?.OwnerUnitName + OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss'), + OWNERUNIT_NAME: currentUser?.OwnerUnitName, + AUTOTYPE_VALID: 1 }} onFinish={async (values) => { let newValue = { ...values }; if (currentRow) { // 编辑数据 - newValue = { ...values, USERDEFINEDTYPE_ID: currentRow.USERDEFINEDTYPE_ID }; + newValue = { ...values, AUTOTYPE_ID: currentRow.AUTOTYPE_ID }; } - - console.log('fileListfileList', fileList); - console.log('newValuenewValuenewValue', newValue); - // 如果有开关,要把开关的代码写进去 await handleAddUpdate(newValue); @@ -415,38 +395,51 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }> { + // 获取数据 + let list: any[] = []; if (typeTreeData && typeTreeData.length > 0) { - let list: any = [{ USERDEFINEDTYPE_NAME: "默认类别", USERDEFINEDTYPE_ID: -1 }, ...typeTreeData] - return list + list = [{ AUTOTYPE_NAME: "默认类别", AUTOTYPE_ID: -1 }, ...typeTreeData]; } else { const req = { OWNERUNIT_ID: currentUser?.OwnerUnitId, PROVINCE_CODE: "", GOODSTYPE: 1000, - } + }; const data = await handlGetUSERDEFINEDTYPEList(req); - console.log('datadatadatadatadata', data); if (data.List && data.List.length > 0) { - data.List.unshirft({ USERDEFINEDTYPE_NAME: "默认类别", USERDEFINEDTYPE_ID: -1 }) - setTypeTreeData(data.List) - return data.List + data.List.unshift({ AUTOTYPE_NAME: "默认类别", AUTOTYPE_ID: -1 }); + setTypeTreeData(data.List); + list = data.List; } else { - return [{ USERDEFINEDTYPE_NAME: "默认类别", USERDEFINEDTYPE_ID: -1 }] + list = [{ AUTOTYPE_NAME: "默认类别", AUTOTYPE_ID: -1 }]; } } + + // 递归禁用当前节点 + const disableCurrent = (nodes: any[]): any[] => + nodes.map(node => { + const disabled = node.AUTOTYPE_ID === currentRow?.AUTOTYPE_ID; + return { + ...node, + disabled, + children: node.children ? disableCurrent(node.children) : undefined, + }; + }); + + return disableCurrent(list); }} fieldProps={{ fieldNames: { - label: 'USERDEFINEDTYPE_NAME', - value: 'USERDEFINEDTYPE_ID', + label: 'AUTOTYPE_NAME', + value: 'AUTOTYPE_ID', children: 'children' }, showSearch: true, filterTreeNode: (input, node) => - (node.USERDEFINEDTYPE_NAME || '').toLowerCase().includes(input.toLowerCase()) + (node.AUTOTYPE_NAME || '').toLowerCase().includes(input.toLowerCase()) }} rules={[ { @@ -458,7 +451,7 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }> @@ -510,7 +503,7 @@ const SupplierClassification: React.FC<{ currentUser: CurrentUser | undefined }> diff --git a/src/pages/travelMember/SupplierMerchantManage/component/LeftSelectMerchantType.tsx b/src/pages/travelMember/SupplierMerchantManage/component/LeftSelectMerchantType.tsx index dd33d0d..0a651fa 100644 --- a/src/pages/travelMember/SupplierMerchantManage/component/LeftSelectMerchantType.tsx +++ b/src/pages/travelMember/SupplierMerchantManage/component/LeftSelectMerchantType.tsx @@ -11,7 +11,7 @@ import { getServerpartTree } from "@/services/options"; import useRequest from "@ahooksjs/use-request"; import './style.less' import { getMerchantShopTree } from "@/pages/Setting/Users/service"; -import { handlGetUSERDEFINEDTYPEList } from "../../service"; +import { handlGetNestingAUTOTYPEList, handlGetUSERDEFINEDTYPEList } from "../../service"; type DetailProps = { @@ -37,7 +37,25 @@ const LeftSelectMallType = ({ setSelectedId, reload, actionRef, currentUser, wid const [isShowAllInTree, setIsShowAllInTree] = useState(false) // 加载服务区树 const { loading: treeLoading, data: treeViews } = useRequest(async () => { - + const req = { + OWNERUNIT_ID: currentUser?.OwnerUnitId, + PROVINCE_CODE: "", + AUTOTYPE_TYPEID: 4000, + AUTOTYPE_VALID: 1 + } + console.log('reqreq', req); + + const data = await handlGetNestingAUTOTYPEList(req); + console.log('datadatadatadatadata212', data); + setTreeView(data) + // 拿个类型的枚举 + if (data && data.length > 0) { + let obj: any = {} + data.forEach((item: any) => { + obj[item.AUTOTYPE_CODE] = item.AUTOTYPE_NAME + }) + setData(obj) + } }) // 显示服务区树搜索框 const [showServiceSearchBox, setShowServiceSearchBox] = useState(false) @@ -193,13 +211,9 @@ const LeftSelectMallType = ({ setSelectedId, reload, actionRef, currentUser, wid // defaultExpandAll={isShowAllInTree ? false : true} // defaultExpandedKeys={isShowAllInTree ? treeShowRow && treeShowRow.length > 0 ? treeShowRow : ['0-0'] : []} onCheck={(checkedKeys: React.Key[] | any, info) => { - console.log('checkedKeyscheckedKeyscheckedKeys', checkedKeys); - console.log('infoinfoinfoinfoinfoinfo', info); - // 多选逻辑 // const selectedIds = info.checkedNodes.filter((n: any) => n?.USERDEFINEDTYPE_PID !== -1) const selectedIds = info.checkedNodes.filter((n: any) => n?.USERDEFINEDTYPE_ID) - console.log('selectedIdsselectedIds', selectedIds); setSelectedId(selectedIds.map((n: any) => n?.USERDEFINEDTYPE_ID)?.toString() || '') if (reload) { actionRef?.current?.reload() @@ -209,8 +223,8 @@ const LeftSelectMallType = ({ setSelectedId, reload, actionRef, currentUser, wid } }} fieldNames={{ - title: "USERDEFINEDTYPE_NAME", - key: "USERDEFINEDTYPE_ID" + title: "AUTOTYPE_NAME", + key: "AUTOTYPE_CODE" }} /> : ''} diff --git a/src/pages/travelMember/SupplierMerchantManage/index.tsx b/src/pages/travelMember/SupplierMerchantManage/index.tsx index c27cdbb..65175b9 100644 --- a/src/pages/travelMember/SupplierMerchantManage/index.tsx +++ b/src/pages/travelMember/SupplierMerchantManage/index.tsx @@ -61,6 +61,8 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }> hideInSearch: true, width: 150, ellipsis: true, + valueType: "select", + valueEnum: leftTreeData }, { dataIndex: 'MERCHANTS_NAME', @@ -213,6 +215,7 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }> searchParameter: { OWNERUNIT_ID: currentUser?.OwnerUnitId, PROVINCE_CODE: currentUser?.ProvinceCode, + MERCHANTS_TYPE: params?.MERCHANTS_TYPE ? params?.MERCHANTS_TYPE : "" }, PageIndex: 1, PageSize: 999999, @@ -224,6 +227,7 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }> } return { data: [], success: true } }} + pagination={false} columns={columns} toolbar={{ actions: [ @@ -338,6 +342,13 @@ const SupplierMerchantManage: React.FC<{ currentUser: CurrentUser | undefined }> { + let list: any = [] + for (let key in leftTreeData) { + list.push({ label: leftTreeData[key], value: key }) + } + return list + }} rules={[ { required: true, diff --git a/src/pages/travelMember/service.ts b/src/pages/travelMember/service.ts index c679d50..05a8fe8 100644 --- a/src/pages/travelMember/service.ts +++ b/src/pages/travelMember/service.ts @@ -203,6 +203,42 @@ export async function handlDeleteBRAND(params: any) { return data } +// 获取供应商的分类列表 树形 +export async function handlGetNestingAUTOTYPEList(params: any) { + const data = await requestEncryption(`/MemberBasic/GetNestingAUTOTYPEList`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return wrapTreeNode(data.Result_Data.List) +} + +// 同步供应商信息 +export async function handlSynchroAUTOTYPE(params: any) { + const data = await requestEncryption(`/MemberBasic/SynchroAUTOTYPE`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data +} + +// 删除供应商信息 +export async function handlDeleteAUTOTYPE(params: any) { + const data = await requestEncryption(`/MemberBasic/DeleteAUTOTYPE`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data +} + // 获取商城分类管理(自定义类别的那个) 树形 export async function handlGetUSERDEFINEDTYPEList(params: any) { @@ -439,4 +475,42 @@ export async function handeDeleteSCENICAREA(params: any) { return [] } return data -} \ No newline at end of file +} + +// 同步规格 +export async function handeSynchroCOMMODITY_MULTI(params: any) { + const data = await requestEncryption(`/MallBasic/SynchroCOMMODITY_MULTI`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data +} + +// 删除多规格 +export async function handeDeleteCOMMODITY_MULTI(params: any) { + const data = await requestEncryption(`/MallBasic/DeleteCOMMODITY_MULTI`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data +} + +// 获取商品多规格关联表列表 +export async function handeGetRTCOMMODITY_MULTIList(params: any) { + const data = await requestEncryption(`/MemberConfig/GetRTCOMMODITY_MULTIList`, { + method: 'POST', + data: { ...params, requestEncryption: true } + }) + if (data.Result_Code !== 100) { + return [] + } + return data +} + + diff --git a/src/utils/requestEncryption.ts b/src/utils/requestEncryption.ts index 9f13453..ab7f62c 100644 --- a/src/utils/requestEncryption.ts +++ b/src/utils/requestEncryption.ts @@ -104,7 +104,7 @@ requestEncryption.interceptors.request.use((url, opt: any) => { } } else { if ((url.indexOf('Synchro') > -1 || url.indexOf('Save') > -1) && - url.indexOf('Picture/SaveImgFile') === -1) { + url.indexOf('Picture/SaveImgFile') === -1 && !requestEncryption) { options.data = { ...options.data, STAFF_ID: currentUser.ID,