diff --git a/src/pages/ahjgPage/servicePartAudit/index.tsx b/src/pages/ahjgPage/servicePartAudit/index.tsx index fdd584a..ff2ee02 100644 --- a/src/pages/ahjgPage/servicePartAudit/index.tsx +++ b/src/pages/ahjgPage/servicePartAudit/index.tsx @@ -19,6 +19,8 @@ import session from "@/utils/session"; import { handleGetCASHWORKERList } from "@/pages/DataVerification/list/service"; import { handleNewGetSERVERPARTDetail } from "@/pages/newDataAnalysis/service"; import { handleGetCASHWORKERDetail, handleGetServerpartShopList, handleSynchroCASHWORKER } from "@/pages/newDataAnalysis/serviceAreaPersonnel/service"; +import { formatTreeData } from "@/utils/format"; +import { exportXlsxFromProColumnsExcelJS } from "@/utils/exportExcelFun"; const servicePartAudit: React.FC<{ currentUser: CurrentUser }> = (props) => { @@ -288,46 +290,79 @@ const servicePartAudit: React.FC<{ currentUser: CurrentUser }> = (props) => { } const data = await handleGetCASHWORKERList(req) if (data && data.length > 0) { - console.log('data', data); - let res = JSON.parse(JSON.stringify(data)) - let list: any = [] - data.forEach((item: any) => { - item.CASHWORKER_LOGINNAME = `"${item.CASHWORKER_LOGINNAME}"` - item.CASHWORKER_LOGINPWD = `"${item.CASHWORKER_LOGINPWD}"` - list.push(item) - }) - setReqDetailList(list) - return { data: res, success: true } + // console.log('data', data); + // let res = JSON.parse(JSON.stringify(data)) + // let list: any = [] + // data.forEach((item: any) => { + // item.CASHWORKER_LOGINNAME = `"${item.CASHWORKER_LOGINNAME}"` + // item.CASHWORKER_LOGINPWD = `"${item.CASHWORKER_LOGINPWD}"` + // list.push(item) + // }) + // setReqDetailList(list) + let CASHWORKER_TYPEObj: any = { + "1": "收银员", + "2": "管理员", + "20": "店长", + "25": "稽核人员", + } + + let WORKER_VALIDObj: any = { + '1': "有效", + '0': "无效" + } + + let fieldData: any = [] + let enumList: any = [ + "CASHWORKER_TYPE", + "WORKER_VALID", + "BUSINESS_STATE" + ] + let newPrintData: any = formatTreeData(JSON.parse(JSON.stringify(data)), fieldData, enumList, [CASHWORKER_TYPEObj, WORKER_VALIDObj], []) + + setReqDetailList(newPrintData) + return { data: data, success: true } } setReqDetailList([]) return { data: [], success: true } }} toolbar={{ actions: [ - - - , + // + // + // , } @@ -216,11 +557,38 @@ const NewApplicationModal = ({ parentRow, tableRef, onShow, handleCencel, curren modalApproveFormRef?.current?.submit() }) } else { - modalFormRef?.current?.validateFields().then(() => { + if (modalType === 1) { + modalFormRef?.current?.validateFields().then(() => { + modalFormRef?.current?.submit() + }) + } else if (modalType === 2) { + // 判断表格里面的现价 是不是都已经输入了 + 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() - }) + // }) + } else if (modalType === 3) { + modalFormRef?.current?.validateFields().then(() => { + modalFormRef?.current?.submit() + }) + } } }} + bodyStyle={{ + height: '700px', // 你可以根据需要调整高度 + overflowY: 'auto', + }} > 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) + }) + } + if (handleChangeShopData) { + handleChangeShopData(list) + } } return { @@ -276,27 +661,48 @@ const NewApplicationModal = ({ parentRow, tableRef, onShow, handleCencel, curren onFinish={async (res) => { setConfirmLoading(true) let data: any = {} + let list: any = [] + if (modalType === 2) { + if (shopData && shopData.length > 0) { + shopData.forEach((item: any) => { + let obj: any = JSON.parse(JSON.stringify(item)) + let oldPrice = JSON.parse(JSON.stringify(obj.COMMODITY_RETAILPRICE)) + obj.COMMODITY_ORIPRICE = oldPrice + obj.COMMODITY_RETAILPRICE = item.newPrice + obj.COMMODITY_CURRPRICE = item.newPrice + list.push(obj) + }) + } + } else if (modalType === 3) { + if (shopData && shopData.length > 0) { + + } else { + message.error('请选择要修改的商品!') + return + } + } + if (parentRow?.BusinessApproval_ID) { const req: any = { ProinstId: parentRow?.BusinessApproval_ID, ProinstName: res.reasonForApplication, UserId: currentUser?.ID, - OperateType: "100100", + OperateType: modalType === 1 ? "100100" : modalType === 2 ? '100200' : modalType === 3 ? '100210' : '', ServerpartId: res.ServerpartId, NextApproveStaffId: res.NextApproveStaffId, NextApproveState: 2000, - CommodityRunningList: shopData + CommodityRunningList: modalType === 1 ? shopData : modalType === 2 ? list : modalType === 3 ? shopData : '', } data = await handleReapplyCommodityProInst(req) } else { const req: any = { ProinstName: res.reasonForApplication, UserId: currentUser?.ID, - OperateType: "100100", + OperateType: modalType === 1 ? "100100" : modalType === 2 ? '100200' : modalType === 3 ? '100210' : '', ServerpartId: res.ServerpartId, NextApproveStaffId: res.NextApproveStaffId, NextApproveState: 2000, - CommodityRunningList: shopData + CommodityRunningList: modalType === 1 ? shopData : modalType === 2 ? list : modalType === 3 ? shopData : '', } data = await handleCreateCommodityProInst(req) console.log('dsaidjaskda', data); @@ -369,7 +775,7 @@ const NewApplicationModal = ({ parentRow, tableRef, onShow, handleCencel, curren PROVINCE_CODE: currentUser?.ProvinceCode, APPROVALROUTE_STATES: "", APPROVALROUTE_VALID: 1, - OPERATION_TYPES: "100100", + OPERATION_TYPES: modalType === 1 ? '100100' : modalType === 2 ? '100200' : modalType === 3 ? '100210' : '' }, PageIndex: 1, PageSize: 999999 @@ -380,6 +786,7 @@ const NewApplicationModal = ({ parentRow, tableRef, onShow, handleCencel, curren // 下面的环节 let nextList: any = [] console.log('dataState', dataState); + console.log('parentRowparentRowparentRow', parentRow); dataState.forEach((item: any) => { if (item.APPROVALROUTE_STATE === 2000) { @@ -413,6 +820,7 @@ const NewApplicationModal = ({ parentRow, tableRef, onShow, handleCencel, curren + { parentRow?.BusinessProcess_State > 1000 ? 1000 || (parentRow?.BusinessApproval_ID && parentRow?.ApproveStaff_ID !== currentUser?.ID) ? '' : - ] + ] : modalType === 2 ? [ + parentRow?.BusinessProcess_State > 1000 || (parentRow?.BusinessApproval_ID && parentRow?.ApproveStaff_ID !== currentUser?.ID) ? '' : + ] : modalType === 3 ? [ + parentRow?.BusinessProcess_State > 1000 || (parentRow?.BusinessApproval_ID && parentRow?.ApproveStaff_ID !== currentUser?.ID) ? '' : + ] : [] }} /> diff --git a/src/pages/reports/productControl/ProductChangeInfoApproval/index.tsx b/src/pages/reports/productControl/ProductChangeInfoApproval/index.tsx index 9c64956..d45de5c 100644 --- a/src/pages/reports/productControl/ProductChangeInfoApproval/index.tsx +++ b/src/pages/reports/productControl/ProductChangeInfoApproval/index.tsx @@ -20,11 +20,15 @@ import moment from 'moment' import { handleApproveCommodityProInst, handleCreateCommodityProInst, handleDeleteCOMMODITY_RUNNING, handleDeleteCommodityProInst, handleGetApprovalCommodityList, handleGetBUSINESSAPPROVALDetail, handleGetCOMMODITYRUNNINGList, handleReapplyCommodityProInst, handleRejectCommodityProInst } from "../ProductApprovalProcess/service"; import session from "@/utils/session"; import './style.less' +import NewApplicationModal from "../NewProductApproval/components/newApplicationModal"; +import SelectShopModal from "../ProductChangePriceApproval/components/selectShopModal"; +import EditShopModal from "../ProductChangePriceApproval/components/editShopModal"; const { Step } = Steps const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props) => { const { currentUser } = props const downloadBtnRef = useRef() + const NewApplicationRef = useRef() const actionRef = useRef(); const formRef = useRef(); const modalFormRef = useRef(); @@ -573,6 +577,23 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props console.log('data', data) } + //修改商品信息 + const handleProductChangeInfoModal = () => { + setShowApplyFor(false) + setCurrentRow(undefined) + setShopData([]) + setSelectRowList([]) + setSelectedOrderRowKeys([]) + setShowDetailType(null) + + setApprovaType(0) + } + + const handleCancelShopInfo = () => { + setEditSelectRow(undefined) + setEditShopModal(false) + } + useEffect(async () => { const req: any = { SearchParameter: { @@ -670,1226 +691,18 @@ const ProductChangeInfoApproval: React.FC<{ currentUser: CurrentUser }> = (props - {/* 审批的悬浮框 */} - {/* { - setApproveCurrentRow(undefined) - setApproveModal(false) - setApprovaType(0) - }} - onOk={() => { - modalApproveFormRef?.current?.validateFields().then(() => { - modalApproveFormRef?.current?.submit() - }) - }} - > - { - console.log('approveCurrentRowapproveCurrentRowapproveCurrentRow', approveCurrentRow); - 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 === approveCurrentRow.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: approveCurrentRow?.BusinessApproval_ID, - UserId: currentUser?.ID, - ApproveInfo: res.ApproveInfo, - nextApproveStaffId: res.nextApproveStaffId || "", - nextApproveState: nextApproval || "" - } - - data = await handleApproveCommodityProInst(req) - } else { - // 驳回 - const req: any = { - businessApprovalId: approveCurrentRow?.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) - 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 ? - - - - - - - - - : "" - } - - */} - {/* 新增申请的悬浮框 */} - - - - - } - onCancel={() => { - setShowApplyFor(false) - setCurrentRow(undefined) - setShopData([]) - setSelectRowList([]) - setSelectedOrderRowKeys([]) - setShowDetailType(null) - }} - onOk={() => { - if (currentRow?.BusinessProcess_State > 1000) { - modalApproveFormRef?.current?.validateFields().then(() => { - modalApproveFormRef?.current?.submit() - }) - } else { - modalFormRef?.current?.validateFields().then(() => { - modalFormRef?.current?.submit() - }) - } - }} - > - { - 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) { - - } else { - message.error('请选择要修改的商品!') - return - } - - 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) { - message.success(data.Result_Desc) - setShowApplyFor(false) - setCurrentRow(undefined) - actionRef.current?.reload() - setShopData([]) - setSelectRowList([]) - setSelectedOrderRowKeys([]) - setShowDetailType(null) - } else { - message.error(data.Result_Desc) - } - } - } - > - - - 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)} - /> - - - { - const ServerpartIdsTree = session.get('ServerpartIdsTree') - return ServerpartIdsTree - // 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)} - fieldProps={{ - showSearch: true, // 启用搜索框 - filterOption: (inputValue: any, option: any) => { - // 通过 label 搜索 - return option.label.toLowerCase().includes(inputValue.toLowerCase()); - } - }} - /> - - 1000 && ApprovalType !== 0 ? "none" : "" }}> - { - const reqState: any = { - SearchParameter: { - PROVINCE_CODE: currentUser?.ProvinceCode, - 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)} - /> - - - - - - - { - currentRow?.BusinessProcess_State > 1000 ? - { - console.log('approveCurrentRowapproveCurrentRowapproveCurrentRow', currentRow); - const reqState: any = { - SearchParameter: { - PROVINCE_CODE: currentUser?.ProvinceCode, - 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) => ( - - )) : '' - } - - -
- : '' - } -
+ {/* 选择商品 */} - { - setShowAddShopModal(false) - setShopData(selectRowList) - }} - onCancel={() => { - setShowAddShopModal(false) - }} - > - { - let formRes = modalFormRef.current?.getFieldsValue() - const req: any = { - SearchType: 3, - ProvinceCode: currentUser?.ProvinceCode, - // CommodityTypeId: currenMenu, - CommodityState: 1, - ServerpartID: formRes?.ServerpartId, - PageIndex: 1, - PageSize: 999999, - SortStr: "OPERATE_DATE desc" - // PageSize: 20 - } - const data = await handleGetCommodityList(req) - console.log('shdasidh', data); - if (data.List && data.List.length > 0) { - return { data: data.List, success: true, total: data.TotalCount } - } - return { data: [], success: true } - }} - columns={selectShopColumns} - rowSelection={{ - type: 'checkbox', - selectedRowKeys: selectedOrderRowKeys, - onChange: (selectedRowKeys: any, selectedRows: any) => { - setSelectRowList(selectedRows) - setSelectedOrderRowKeys(selectedRowKeys) - }, - }} - /> - - - + {/* 编辑商品的悬浮框 */} - 1000 ? '' : -
- {/* 审批过程中只能看 所以把底部隐藏 这样即使修改也没用 */} -
-
- - - -
-
- } - onOk={() => { - modalShopFormRef.current?.validateFields().then(async (res: any) => { - let oldData: any = shopData && shopData.length > 0 ? JSON.parse(JSON.stringify(shopData)) : [] - let newList: any = [] - // 判断当前的里面有没有一样的 - if (oldData && oldData.length > 0) { - oldData.forEach((item: any, index: number) => { - if (item.ADDTIME === res.ADDTIME) { - newList.push({ - ...item, - ...res - }) - } else { - newList.push(item) - } - }) - } else { - newList.push(res) - } - - setShopData(newList) - setEditSelectRow(undefined) - setEditShopModal(false) - }) - }} - onCancel={() => { - setEditSelectRow(undefined) - setEditShopModal(false) - }} - > - - { - // !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) - // } : { - - // }} - > -
商品基本信息
- - - - - - - - - - { - 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 - }} - rules={[ - { - required: true, - message: '请选择服务区', - }, - ]} - fieldProps={{ - onChange: async (e: any) => { - console.log('e', e) - if (e) { - setSelectSERVERPARTID(e) - await handleGetCommodity(e) - if (selectBUSINESSTYPE) { - await handleGetCustomClassList(e) - } - } else { - setSelectSERVERPARTID(undefined) - setCommodityList([]) - setCustomClassList([]) - } - } - }} - /> - - - { - if (e) { - setSelectBUSINESSTYPE(e) - if (selectSERVERPARTID) { - await handleGetCustomClassList(e) - } - } else { - setSelectBUSINESSTYPE(undefined) - } - } - }} - /> - - - { - return treeView - }} - fieldProps={{ - treeDefaultExpandAll: true - }} - /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
商品状态信息
- - - - - - - - - - - - - - - - - - - - - - -
商品价格信息
- - - - - - - - - - - - - - - - - - - - - -
商品进销信息
- - - - - - - - - - - -
-
) } diff --git a/src/pages/reports/productControl/ProductChangePriceApproval/components/editShopModal.tsx b/src/pages/reports/productControl/ProductChangePriceApproval/components/editShopModal.tsx new file mode 100644 index 0000000..16cde54 --- /dev/null +++ b/src/pages/reports/productControl/ProductChangePriceApproval/components/editShopModal.tsx @@ -0,0 +1,558 @@ +import { connect } from "umi"; +import type { ConnectState } from "@/models/connect"; +import { Button, Col, FormInstance, Modal, Row } from "antd"; +import { useRef, useState } from "react"; +import ProForm, { ProFormDateTimePicker, ProFormDigit, ProFormSelect, ProFormText, ProFormTextArea, ProFormTreeSelect } from "@ant-design/pro-form"; +import { handleGetServerpartShopTrade } from "../../commodityInfo/service"; +import moment from 'moment' +import { getServerpartTree } from "@/services/options"; +import { handleGetUSERDEFINEDTYPEList } from "../../userDefinedType/service"; + + +type DetailProps = { + modalType: any // 2 为调价 3 为信息修改 + onShow: any // 是否显示 + currentShopRow: any // 当前选中的商品信息 + handleCencel: any // 关闭触发的方法 + currentUser: any // 一些公参 + parentRow: any // 当前最大的数据 + treeView: any // 商品类别 数据 + setShopData: any // 改变商品信息 + shopData: any // 当前的商品信息 +} +const EditShopModal = ({ modalType, onShow, currentShopRow, handleCencel, currentUser, parentRow, treeView, setShopData, shopData }: DetailProps) => { + const modalShopFormRef = useRef(); + // 商品业态的搜索框内容 + const [commodityList, setCommodityList] = useState([]) + const [selectSERVERPARTID, setSelectSERVERPARTID] = useState() + const [selectBUSINESSTYPE, setSelectBUSINESSTYPE] = useState() + const [customClassList, setCustomClassList] = useState() + + // 请求自定义类的选择列表 + const handleGetCustomClassList = async (id: any) => { + const req: any = { + SearchParameter: { + USERDEFINEDTYPE_STATE: 1, + SERVERPART_ID: id, + BUSINESSTYPE: selectBUSINESSTYPE + }, + PageIndex: 1, + PageSize: 999999, + pageSize: 999999, + } + const data = await handleGetUSERDEFINEDTYPEList(req) + if (data && data.length > 0) { + const list: any = [] + data.forEach((item: any) => { + list.push({ label: item.USERDEFINEDTYPE_NAME, value: item.USERDEFINEDTYPE_ID }) + }) + setCustomClassList(list) + } + console.log('data', data) + } + // 拿到对应的商品业态 + const handleGetCommodity = async (id: any) => { + const req: any = { + ProvinceCode: currentUser?.ProvinceCode, + ServerpartId: id + } + const data = await handleGetServerpartShopTrade(req) + console.log('data', data) + setCommodityList(data) + } + + return ( +
+ { + modalShopFormRef.current?.validateFields().then(async (res: any) => { + if (handleCencel) { + handleCencel() + } + }) + }} + footer={modalType === 3 ? parentRow?.BusinessProcess_State > 1000 ? '' : +
+ {/* 审批过程中只能看 所以把底部隐藏 这样即使修改也没用 */} +
+
+ + + +
+
: false} + onCancel={() => { + if (handleCencel) { + handleCencel() + } + }} + bodyStyle={{ + height: '700px', // 你可以根据需要调整高度 + overflowY: 'auto', + }} + > + { + // !currentShopRow?.COMMODITY_ID && + if (currentShopRow?.SERVERPART_ID) { + await handleGetCommodity(currentShopRow?.SERVERPART_ID) + } + return { + ...currentShopRow, + BUSINESSTYPE: currentShopRow?.BUSINESSTYPE.toString(), + COMMODITY_GRADE: Number(currentShopRow?.COMMODITY_GRADE), + ADDTIME: moment(currentShopRow?.ADDTIME).format('YYYY-MM-DD HH:mm:ss') + } + }} + disabled={parentRow?.BusinessProcess_State === 9000} + > +
商品基本信息
+ + + + + + + + + + { + 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 + }} + rules={[ + { + required: true, + message: '请选择服务区', + }, + ]} + fieldProps={{ + onChange: async (e: any) => { + console.log('e', e) + if (e) { + setSelectSERVERPARTID(e) + await handleGetCommodity(e) + if (selectBUSINESSTYPE) { + await handleGetCustomClassList(e) + } + } else { + setSelectSERVERPARTID(undefined) + setCommodityList([]) + setCustomClassList([]) + } + }, + showSearch: true, // 启用搜索框 + filterOption: (inputValue: any, option: any) => { + // 通过 label 搜索 + return option.label.toLowerCase().includes(inputValue.toLowerCase()); + } + }} + /> + + + { + if (e) { + setSelectBUSINESSTYPE(e) + if (selectSERVERPARTID) { + await handleGetCustomClassList(e) + } + } else { + setSelectBUSINESSTYPE(undefined) + } + } + }} + /> + + + { + return treeView + }} + fieldProps={{ + treeDefaultExpandAll: true + }} + /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
商品状态信息
+ + + + + + + + + + + + + + + + + + + + + + +
商品价格信息
+ + + + + + + + + + + + + + + + + + + + + +
商品进销信息
+ + + + + + + + + + + +
+
+
+ ) +} + +export default connect(({ user, }: ConnectState) => ({ + currentUser: user.currentUser, +}))(EditShopModal); diff --git a/src/pages/reports/productControl/ProductChangePriceApproval/components/selectShopModal.tsx b/src/pages/reports/productControl/ProductChangePriceApproval/components/selectShopModal.tsx new file mode 100644 index 0000000..6d25569 --- /dev/null +++ b/src/pages/reports/productControl/ProductChangePriceApproval/components/selectShopModal.tsx @@ -0,0 +1,213 @@ +import { connect } from "umi"; +import type { ConnectState } from "@/models/connect"; +import { FormInstance, Modal } from "antd"; +import ProTable from "@ant-design/pro-table"; +import { useRef } from "react"; +import { handleGetCommodityList } from "../../commodityInfo/service"; +import { getFieldEnum } from "@/services/options"; + +type DetailProps = { + onShow: any // 显示悬浮框 + setShowAddShopModal: any // 关闭悬浮框 + setShopData: any // 改变当前商品 + selectRowList: any // 当前选择的商品行 + currentUser: any // 公参信息 + CommodityData: any // 枚举值 + selectedOrderRowKeys: any // 选择的行值 + setSelectRowList: any // 改变选择的行 + setSelectedOrderRowKeys: any // 改变选择的行号 + formRef?: any // 申请的表单数据 +} +const SelectShopModal = ({ onShow, setShowAddShopModal, setShopData, selectRowList, currentUser, CommodityData, selectedOrderRowKeys, setSelectRowList, setSelectedOrderRowKeys, formRef }: DetailProps) => { + // 选择商品的表格结构 + const selectShopColumns: any = [ + { + title: "商品查询", + dataIndex: "searchText", + hideInTable: true, + fieldProp: { + fieldholder: "请输入商品名称" + } + }, + { + title:
序号
, + width: 70, + dataIndex: 'index', + hideInSearch: true, + valueType: 'index' + }, + // { + // title:
服务区
, + // width: 150, + // ellipsis: true, + // align: 'center', + // dataIndex: 'SERVERPART_NAME', + // hideInSearch: true, + // valueType: "select", + // valueEnum: ServerpartIdsList + // }, + { + title:
商品业态
, + width: 120, + ellipsis: true, + dataIndex: 'BUSINESSTYPE', + align: 'center', + valueType: 'select', + request: async () => { + const BUSINESSTYPERes = await getFieldEnum({ FieldExplainField: 'BUSINESSTYPE', sessionName: 'SHOPTRADE', notformate: true }) + return BUSINESSTYPERes + }, + fieldProps: { + showSearch: true, + filterOption: (input, option) => + (option?.label ?? '').toLowerCase().includes(input.toLowerCase()), + } + }, + { + title:
商品类型
, + width: 120, + ellipsis: true, + dataIndex: 'COMMODITY_TYPE', + align: 'center', + hideInSearch: true, + valueEnum: CommodityData + }, + { + title:
商品名称
, + width: 200, + ellipsis: true, + align: 'left', + dataIndex: 'COMMODITY_NAME', + hideInSearch: true, + // render: (_, record) => { + // return record?.COMMODITY_NAME ? { + // setCurrentShopRow(record) + // setShowEditShopModal(true) + // }}> + // {record?.COMMODITY_NAME} + // : "-" + // } + }, + { + title:
商品条码
, + width: 150, + ellipsis: true, + align: 'left', + dataIndex: 'COMMODITY_BARCODE', + hideInSearch: true, + }, + { + title:
零售价
, + width: 70, + ellipsis: true, + align: 'right', + dataIndex: 'COMMODITY_RETAILPRICE', + hideInSearch: true, + }, + { + title:
进货价
, + width: 70, + ellipsis: true, + align: 'right', + dataIndex: 'COMMODITY_PURCHASEPRICE', + hideInSearch: true, + }, + { + title:
商品单位
, + width: 80, + ellipsis: true, + align: 'right', + dataIndex: 'COMMODITY_UNIT', + hideInSearch: true, + }, + { + title:
状态
, + width: 100, + ellipsis: true, + dataIndex: 'COMMODITY_STATE', + align: 'center', + valueType: 'select', + valueEnum: { 0: { text: '无效', status: 'error' }, 1: { text: '有效', status: 'success' }, 2: { text: '不可选', status: 'default' } }, + initialValue: '1', + }, + { + title:
审核时间
, + width: 150, + align: 'center', + ellipsis: true, + dataIndex: 'OPERATE_DATE', + hideInSearch: true, + } + ] + + return ( +
+ { + setShowAddShopModal(false) + setShopData(selectRowList) + }} + onCancel={() => { + setShowAddShopModal(false) + }} + bodyStyle={{ + height: '700px', // 你可以根据需要调整高度 + overflowY: 'auto', + }} + > + { + console.log('formRefformRefformRef', formRef.current); + let formRes = formRef.current.modalFormRef.current?.getFieldsValue() + const req: any = { + SearchType: 3, + ShopTrade: params?.BUSINESSTYPE || "", + ProvinceCode: currentUser?.ProvinceCode, + // CommodityTypeId: currenMenu, + CommodityState: params?.COMMODITY_STATE || "", + ServerpartID: formRes?.ServerpartId, + PageIndex: 1, + PageSize: 999999, + SortStr: "OPERATE_DATE desc", + SearchKey: "COMMODITY_NAME", + SearchValue: params?.searchText || "" + // PageSize: 20 + } + const data = await handleGetCommodityList(req) + console.log('shdasidh', data); + if (data.List && data.List.length > 0) { + return { data: data.List, success: true, total: data.TotalCount } + } + return { data: [], success: true } + }} + columns={selectShopColumns} + rowSelection={{ + type: 'checkbox', + selectedRowKeys: selectedOrderRowKeys, + onChange: (selectedRowKeys: any, selectedRows: any) => { + console.log('selectedRowKeysselectedRowKeys', selectedRowKeys); + console.log('selectedRowsselectedRowsselectedRows', selectedRows); + + setSelectRowList(selectedRows) + setSelectedOrderRowKeys(selectedRowKeys) + }, + }} + /> + +
+ ) +} + +export default connect(({ user }: ConnectState) => ({ + currentUser: user.currentUser, +}))(SelectShopModal); diff --git a/src/pages/reports/productControl/ProductChangePriceApproval/index.tsx b/src/pages/reports/productControl/ProductChangePriceApproval/index.tsx index 255757e..085071d 100644 --- a/src/pages/reports/productControl/ProductChangePriceApproval/index.tsx +++ b/src/pages/reports/productControl/ProductChangePriceApproval/index.tsx @@ -20,10 +20,14 @@ import moment from 'moment' import { handleApproveCommodityProInst, handleCreateCommodityProInst, handleDeleteCOMMODITY_RUNNING, handleDeleteCommodityProInst, handleGetApprovalCommodityList, handleGetBUSINESSAPPROVALDetail, handleGetCOMMODITYRUNNINGList, handleReapplyCommodityProInst, handleRejectCommodityProInst } from "../ProductApprovalProcess/service"; import session from "@/utils/session"; import './style.less' +import NewApplicationModal from "../NewProductApproval/components/newApplicationModal"; +import SelectShopModal from "./components/selectShopModal"; +import EditShopModal from "./components/editShopModal"; const { Step } = Steps const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (props) => { const { currentUser } = props const downloadBtnRef = useRef() + const NewApplicationRef = useRef() const actionRef = useRef(); const formRef = useRef(); const modalFormRef = useRef(); @@ -289,139 +293,7 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop }, ] - const modalColumns: any = [ - { - title: "序号", - width: 70, - dataIndex: "index", - valueType: "index", - align: 'center', - ellipsis: true, - }, - { - title: "名称", - width: 300, - dataIndex: "COMMODITY_NAME", - ellipsis: true, - align: 'center', - render: (_, record) => { - return record?.COMMODITY_NAME ? { - setCurrentShopRow(record) - setShowEditShopModal(true) - }}> - {record?.COMMODITY_NAME} - : "-" - } - }, - { - title: "条码", - width: 150, - dataIndex: "COMMODITY_BARCODE", - ellipsis: true, - align: 'center', - }, - { - title: "原价", - width: 150, - dataIndex: "COMMODITY_CURRPRICE", - ellipsis: true, - align: 'center', - }, - { - title: "现价", - width: 150, - dataIndex: "newPrice", - ellipsis: true, - align: 'center', - render: (_, record) => { - 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) => { - if (item.COMMODITY_ID === record?.COMMODITY_ID) { - item.newPrice = e.target.value - } - list.push(item) - }) - setShopData(list) - }} /> - } - }, - { - title: "单位", - width: 150, - dataIndex: "COMMODITY_UNIT", - ellipsis: true, - align: 'center', - }, - { - dataIndex: 'option', - title: '操作', - valueType: 'option', - align: 'center', - hideInSearch: true, - width: 180, - fixed: "right", - ellipsis: true, - render: (_, record) => { - return ( - - { - 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) - } - }} - > - 删除 - - - } - - ); - }, - }, - ] // 选择商品的表格结构 const selectShopColumns: any = [ { @@ -609,6 +481,24 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop console.log('data', data) } + // 关闭申请悬浮框的方法 + const handleProductChangePricModal = () => { + setShowApplyFor(false) + setCurrentRow(undefined) + setSelectRowList([]) + setSelectedOrderRowKeys([]) + setShopData([]) + setShowDetailType(null) + setApprovaType(0) + } + + // 编辑商品信息的关闭方法 + const handleEditShopPriceCancel = () => { + setShowEditShopModal(false) + setCommodityList([]) + setCurrentShopRow(undefined) + } + return (
@@ -674,1262 +564,19 @@ const ProductChangePriceApproval: React.FC<{ currentUser: CurrentUser }> = (prop
- {/* 审批的悬浮框 */} - {/* { - setApproveCurrentRow(undefined) - setApproveModal(false) - setApprovaType(0) - }} - onOk={() => { - modalApproveFormRef?.current?.validateFields().then(() => { - modalApproveFormRef?.current?.submit() - }) - }} - > - { - console.log('approveCurrentRowapproveCurrentRowapproveCurrentRow', approveCurrentRow); - 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 === approveCurrentRow.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: approveCurrentRow?.BusinessApproval_ID, - UserId: currentUser?.ID, - ApproveInfo: res.ApproveInfo, - nextApproveStaffId: res.nextApproveStaffId || "", - nextApproveState: nextApproval || "" - } - - data = await handleApproveCommodityProInst(req) - } else { - // 驳回 - const req: any = { - businessApprovalId: approveCurrentRow?.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) - 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 ? - - - - - - - - - : "" - } - - */} {/* 新增申请的悬浮框 */} - { - setShowApplyFor(false) - setCurrentRow(undefined) - setSelectRowList([]) - setSelectedOrderRowKeys([]) - setShopData([]) - setShowDetailType(null) - }} - confirmLoading={showApplyForLoading} - 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 { - // 判断表格里面的现价 是不是都已经输入了 - 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 (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 = [] - if (shopData && shopData.length > 0) { - shopData.forEach((item: any) => { - let obj: any = JSON.parse(JSON.stringify(item)) - let oldPrice = JSON.parse(JSON.stringify(obj.COMMODITY_RETAILPRICE)) - obj.COMMODITY_ORIPRICE = oldPrice - obj.COMMODITY_RETAILPRICE = item.newPrice - obj.COMMODITY_CURRPRICE = item.newPrice - 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); - - data = await handleCreateCommodityProInst(req) - } - setShowApplyForLoading(false) - console.log('dsaidjaskda', data); - if (data.Result_Code === 100) { - message.success(data.Result_Desc) - setShowApplyFor(false) - setCurrentRow(undefined) - actionRef.current?.reload() - setSelectRowList([]) - setSelectedOrderRowKeys([]) - setShopData([]) - } else { - message.error(data.Result_Desc) - } - - } - } - > - - - 1000 || (currentRow?.BusinessApproval_ID && currentRow?.ApproveStaff_ID !== currentUser?.ID)} - /> - - - { - const ServerpartIdsTree = session.get('ServerpartIdsTree') - return ServerpartIdsTree - // 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)} - fieldProps={{ - showSearch: true, // 启用搜索框 - filterOption: (inputValue: any, option: any) => { - // 通过 label 搜索 - return option.label.toLowerCase().includes(inputValue.toLowerCase()); - } - }} - /> - - 1000 && ApprovalType !== 0 ? "none" : "" }}> - { - const reqState: any = { - SearchParameter: { - PROVINCE_CODE: currentUser?.ProvinceCode, - APPROVALROUTE_STATES: "", - APPROVALROUTE_VALID: 1, - OPERATION_TYPES: "100200", - }, - PageIndex: 1, - PageSize: 999999 - } - const dataState = await handleGetAPPROVALROUTEList(reqState) - if (dataState && dataState.length > 0) { - let obj: any = {} - // 下面的环节 - 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(',') - 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)} - /> - - - - - { - currentRow?.BusinessProcess_State > 1000 ? - { - const reqState: any = { - SearchParameter: { - PROVINCE_CODE: currentUser?.ProvinceCode, - 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) => ( - - )) : '' - } - - -
- : '' - } -
- + {/* 选择商品的悬浮框 */} - { - setShowAddShopModal(false) - setShopData(selectRowList) - }} - onCancel={() => { - setShowAddShopModal(false) - }} - > - { - let formRes = modalFormRef.current?.getFieldsValue() - const req: any = { - SearchType: 3, - ShopTrade: params?.BUSINESSTYPE || "", - ProvinceCode: currentUser?.ProvinceCode, - // CommodityTypeId: currenMenu, - CommodityState: params?.COMMODITY_STATE || "", - ServerpartID: formRes?.ServerpartId, - PageIndex: 1, - PageSize: 999999, - SortStr: "OPERATE_DATE desc", - SearchKey: "COMMODITY_NAME", - SearchValue: params?.searchText || "" - // PageSize: 20 - } - const data = await handleGetCommodityList(req) - console.log('shdasidh', data); - if (data.List && data.List.length > 0) { - return { data: data.List, success: true, total: data.TotalCount } - } - return { data: [], success: true } - }} - columns={selectShopColumns} - rowSelection={{ - type: 'checkbox', - selectedRowKeys: selectedOrderRowKeys, - onChange: (selectedRowKeys: any, selectedRows: any) => { - console.log('selectedRowKeysselectedRowKeys', selectedRowKeys); - console.log('selectedRowsselectedRowsselectedRows', selectedRows); - - setSelectRowList(selectedRows) - setSelectedOrderRowKeys(selectedRowKeys) - }, - }} - /> - - + {/* 新增商品的悬浮框 */} - { - modalShopFormRef.current?.validateFields().then(async (res: any) => { - setShowEditShopModal(false) - setCommodityList([]) - setCurrentShopRow(undefined) - }) - }} - footer={false} - onCancel={() => { - setShowEditShopModal(false) - setCommodityList([]) - setCurrentShopRow(undefined) - }} - > + - { - // !currentShopRow?.COMMODITY_ID && - if (currentShopRow?.SERVERPART_ID) { - await handleGetCommodity(currentShopRow?.SERVERPART_ID) - } - return { - ...currentShopRow, - BUSINESSTYPE: currentShopRow?.BUSINESSTYPE.toString(), - COMMODITY_GRADE: Number(currentShopRow?.COMMODITY_GRADE), - ADDTIME: moment(currentShopRow?.ADDTIME).format('YYYY-MM-DD HH:mm:ss') - } - }} - disabled={currentRow?.BusinessProcess_State === 9000} - > -
商品基本信息
- - - - - - - - - - { - 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 - }} - rules={[ - { - required: true, - message: '请选择服务区', - }, - ]} - fieldProps={{ - onChange: async (e: any) => { - console.log('e', e) - if (e) { - setSelectSERVERPARTID(e) - await handleGetCommodity(e) - if (selectBUSINESSTYPE) { - await handleGetCustomClassList(e) - } - } else { - setSelectSERVERPARTID(undefined) - setCommodityList([]) - setCustomClassList([]) - } - }, - showSearch: true, // 启用搜索框 - filterOption: (inputValue: any, option: any) => { - // 通过 label 搜索 - return option.label.toLowerCase().includes(inputValue.toLowerCase()); - } - }} - /> - - - { - if (e) { - setSelectBUSINESSTYPE(e) - if (selectSERVERPARTID) { - await handleGetCustomClassList(e) - } - } else { - setSelectBUSINESSTYPE(undefined) - } - } - }} - /> - - - { - return treeView - }} - fieldProps={{ - treeDefaultExpandAll: true - }} - /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
商品状态信息
- - - - - - - - - - - - - - - - - - - - - - -
商品价格信息
- - - - - - - - - - - - - - - - - - - - - -
商品进销信息
- - - - - - - - - - - -
-
) } diff --git a/src/pages/reports/productControl/commoditySearch/index.tsx b/src/pages/reports/productControl/commoditySearch/index.tsx index 045714f..c52fb6e 100644 --- a/src/pages/reports/productControl/commoditySearch/index.tsx +++ b/src/pages/reports/productControl/commoditySearch/index.tsx @@ -31,6 +31,8 @@ import session from "@/utils/session"; import './style.less' import Detail from "@/pages/reports/productControl/components/detail"; import PageTitleBox from "@/components/PageTitleBox"; +import { exportXlsxFromProColumnsExcelJS } from "@/utils/exportExcelFun"; +import { formatTreeData } from "@/utils/format"; const commoditySearch: React.FC<{ currentUser: CurrentUser }> = (props) => { const { currentUser } = props @@ -78,7 +80,7 @@ const commoditySearch: React.FC<{ currentUser: CurrentUser }> = (props) => { const [showModal, setShowModal] = useState(false) const [showDetail, setShowDetail] = useState(false) - + const SHOPTRADEObj = session.get('SHOPTRADEObj') const ServerpartIdsList: any = session.get('ServerpartIdsList') @@ -153,7 +155,7 @@ const commoditySearch: React.FC<{ currentUser: CurrentUser }> = (props) => { width: 150, ellipsis: true, align: 'center', - dataIndex: 'SERVERPART_NAME', + dataIndex: 'SERVERPART_ID', hideInSearch: true, render: (_, record) => { return @@ -429,37 +431,60 @@ const commoditySearch: React.FC<{ currentUser: CurrentUser }> = (props) => { if (data.List && data.List.length > 0) { console.log('data', data) // setAllTotal(data.TotalCount) - setReqDetailList(data.List) + + let fieldData: any = [ + "COMMODITY_RETAILPRICE", + "COMMODITY_PURCHASEPRICE", + ] + + + let enumList: any = ["BUSINESSTYPE", "SERVERPART_ID"] + let newPrintData: any = formatTreeData(JSON.parse(JSON.stringify(data.List)), fieldData, enumList, [SHOPTRADEObj, ServerpartIdsList], []) + + setReqDetailList(newPrintData) return { data: data.List, success: true } } return { data: [], success: true } }} toolbar={{ actions: [ - - - , + // + // + // ,