/* * @Author: cclu 1106109051@qq.com * @Date: 2024-08-13 18:25:53 * @LastEditors: cclu 1106109051@qq.com * @LastEditTime: 2025-01-02 10:11:42 * @FilePath: \cloud-platform\src\pages\reports\settlementAccount\component\monthExamine.tsx * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ import { connect } from "umi"; import type { ConnectState } from "@/models/connect"; import ProTable, { ActionType } from "@ant-design/pro-table"; import { useImperativeHandle, useRef, useState } from "react"; import { Col, Drawer, FormInstance, message, Modal, Row, Spin } from "antd"; import moment from 'moment' import session from "@/utils/session"; import { handleGetAPPROVALROUTEDetail, handleGetGetBUSINESSAPPROVALDetail, handleGetProjectAccountList, handleGetProjectPeriodAccount, handleGetTableRevenueRecognition, } from "../../ShopExpenseDetail/service"; import { handleGetMonthAccountProinst } from "@/pages/examine/examineList/service"; import useRequest from '@ahooksjs/use-request'; // 请求数据的引用 import { handleGetAPPROVALROUTEList } from "@/pages/Setting/serviceConfig/service"; import numeral from 'numeral' import ProjectEditor from "@/pages/BussinessProject/editor"; import ProjectDetail from '@/pages/BussinessProject/detail' import CompareList from "../../revenueConfirmation/components/compareList"; import MonthExamineProcess from "./monthExamineProcess"; import ProForm, { ProFormSelect, ProFormTextArea } from "@ant-design/pro-form"; import { handleGetBUSINESSAPPROVALDetail } from "@/pages/examine/monthSettlement/service"; import { handleApproveMAPList } from "../service"; import printIcon from '@/assets/ai/printIcon.png' import LoadingBox from "../../Finance/businessAnalysis/components/loading"; import { getMoney, handleFormatNumber } from "@/services/options"; import { handleNewPrint, wrapTreeNode } from "@/utils/format"; import PrintContent from "./printContent"; import { handleGetProjectPeriodIncome } from "../../revenueConfirmation/components/service"; import { handleRejectMonthAccountProinst } from "@/pages/examine/reconciliationApproval/base/service"; type DetailProps = { searchParams: any parentRow: any examineState: any searchContent: any currentUser?: any parentRef?: any // 父级表格 isChangeFile?: any // 判断附件是否能删除 endReject?: any // 办结后撤回 } const MonthExamine = ({ searchParams, parentRow, examineState, searchContent, currentUser, parentRef, isChangeFile, endReject }: DetailProps) => { const actionRef = useRef(); const formRef = useRef(); const formRejectRef = useRef(); const batchFormRef = useRef(); // 月度状态的对象 const [monthStateObj, setMonthStateObj] = useState() // 默认展开的数据 const [defaultExpand, setDefaultExpand] = useState() // 点击行的数据 const [currentRow, setCurrentRow] = useState() // 显示添加项目功能 const [modalVisible, handleModalVisible] = useState(false) // 是否显示编辑 // 出来项目详情的抽屉 const [showProjectDrawer, setShowProjectDrawer] = useState(false) // 当前状态 const [currentApprovalstate, setCurrentApprovalstate] = useState() // 月度结算抽屉 const [showDetailDrawer, setShowDetailDrawer] = useState(false) // 当前月份 const [monthTime, setMonthTime] = useState() // 显示批量审批 const [batchModal, setBatchModal] = useState(false) // 批量审批的加载 const [batchLoading, setBatchLoading] = useState(false) // 下一状态 const [currentNextState, setCurrentNextState] = useState() // 当前状态 const [currentNowState, setCurrentNowState] = useState() // 导出报表的表格数据 const [printData, setPrintData] = useState() // 导出的合计行数据 const [exportSumRow, setExportSumRow] = useState() // 复核驳回的悬浮框 const [reviewRejected, setReviewRejected] = useState(false) // 打印的加载效果 const [printLoading, setPrintLoading] = useState(false) // 加载服务区树 const { loading: stateLoading, data: busninessState = [] } = useRequest(async () => { const req: any = { SearchParameter: { APPROVALROUTE_VALID: 1, OPERATION_TYPES: 12 }, SortStr: 'APPROVALROUTE_STATE asc', PageIndex: 1, PageSize: 999999 } const data = await handleGetAPPROVALROUTEList(req) if (data && data.length > 0) { const list: any = [] data.forEach((item: any) => { list.push({ label: item.APPROVALROUTE_NAME, value: item.APPROVALROUTE_STATE }) }) list.push({ label: '已审结', value: 9000 }) list.push({ label: '已驳回', value: 3000 }) let str: string = '' list.forEach((item: any) => { if (item.value === 3000) { } else { if (str) { str += `,${item.value}` } else { str = item.value } } }) console.log('list22', list); if (list && list.length > 0) { let obj: any = {} list.forEach((item: any) => { obj[item.value] = item.label }) console.log('month', obj); setMonthStateObj(obj) } } }) // 打印的columns const exportColumns: any = [ { title:
期限
, dataIndex: 'PeriodDescBig', children: [ { dataIndex: 'IndexStr', title:
期数
, align: 'center', hideInSearch: true }, { title:
期限
, dataIndex: 'IndexDesc', align: 'left', hideInSearch: true, // render: (_, record) => { // return record?.IndexDesc !== '合计' && record?.IndexDesc === '精算数据' ? // {`${record?.StartDate}-${record?.EndDate}`} : // {`${record?.IndexDesc}`} // } } ] }, { title:
租金信息
, dataIndex: 'PeriodDescBig', hideInSearch: true, children: [ { title:
保底/固定租金
, dataIndex: 'RENTFEE', valueType: 'digit', align: 'right', hideInSearch: true, render: (_, record) => { return record?.RENTFEE ? handleFormatNumber(record?.RENTFEE) : '0.00' } }, { title:
提成比率
, dataIndex: 'GUARANTEERATIO', hideInSearch: true, align: 'right', render: (_, record) => { return record?.GUARANTEERATIO ? `${record?.GUARANTEERATIO}%` : '' } } ] }, { title:
营业额
, dataIndex: 'turnover', hideInSearch: true, children: [ { title:
现金
, dataIndex: 'CASHPAY_AMOUNT', valueType: 'digit', align: 'right', hideInSearch: true, render: (_, record) => { return record?.CASHPAY_AMOUNT ? handleFormatNumber(record?.CASHPAY_AMOUNT) : '0.00' } }, { title:
微支付
, dataIndex: 'MOBILEPAY_AMOUNT', valueType: 'digit', align: 'right', hideInSearch: true, render: (_, record) => { return record?.MOBILEPAY_AMOUNT ? handleFormatNumber(record?.MOBILEPAY_AMOUNT) : '0.00' } }, { title:
小计
, dataIndex: 'REVENUEDAILY_AMOUNTTotal', valueType: 'digit', align: 'right', hideInSearch: true, render: (_, record) => { return {record?.REVENUEDAILY_AMOUNTTotal ? handleFormatNumber(record?.REVENUEDAILY_AMOUNTTotal) : '0.00'} } }, { title:
提成金额
, dataIndex: 'GUARANTEERATIOAMOUNT', valueType: 'digit', align: 'right', hideInSearch: true, render: (_, record) => { return record?.GUARANTEERATIOAMOUNT ? handleFormatNumber(record?.GUARANTEERATIOAMOUNT) : '0.00' } // render: (_, record) => { // return record.RevenueAmount * (record.GuaranteeRatio / 100) // } }, ] }, { title:
业主收款
, dataIndex: 'BANKACCOUNT_AMOUNT', valueType: 'digit', align: 'right', hideInSearch: true, render: (_, record) => { return record?.BANKACCOUNT_AMOUNT ? handleFormatNumber(record?.BANKACCOUNT_AMOUNT) : '0.00' } }, { title:
应收租金
, dataIndex: 'ROYALTYTHEORYMUST', valueType: 'digit', align: 'right', hideInSearch: true, render: (_, record) => { return record?.ROYALTYTHEORYMUST ? handleFormatNumber(record?.ROYALTYTHEORYMUST) : '0.00' } }, { title:
应收费用
, dataIndex: 'SHOPEXPENSE_AMOUNT', valueType: 'digit', align: 'right', hideInSearch: true, render: (_, record) => { return record?.SHOPEXPENSE_AMOUNT ? handleFormatNumber(record?.SHOPEXPENSE_AMOUNT) : '0.00' } // render: (_, record) => { // return numeral(record?.SHOPEXPENSE_AMOUNT).format('0,0.00') // } }, { title:
已缴费用
, dataIndex: 'PAID_AMOUNTSum', valueType: 'digit', align: 'right', hideInSearch: true, // render: (_, record) => { // return record?.PAID_AMOUNT || '' // }, children: [ { title:
合计
, dataIndex: 'PAID_AMOUNT', valueType: 'digit', align: 'right', hideInSearch: true, render: (_, record) => { return record?.PAID_AMOUNT ? handleFormatNumber(record?.PAID_AMOUNT) : '0.00' } }, { title:
水费
, dataIndex: 'PAID_AMOUNT_9010', valueType: 'digit', align: 'right', hideInSearch: true, render: (_, record) => { return record?.PAID_AMOUNT_9010 ? handleFormatNumber(record?.PAID_AMOUNT_9010) : record?.PAID_AMOUNT_9010 === 0 ? 0.00 : '' } }, { title:
电费
, dataIndex: 'PAID_AMOUNT_9020', valueType: 'digit', align: 'right', hideInSearch: true, render: (_, record) => { return record?.PAID_AMOUNT_9020 ? handleFormatNumber(record?.PAID_AMOUNT_9020) : record?.PAID_AMOUNT_9020 === 0 ? 0.00 : '' } }, { title:
房租
, dataIndex: 'PAID_AMOUNT_9030', valueType: 'digit', align: 'right', hideInSearch: true, render: (_, record) => { return record?.PAID_AMOUNT_9030 ? handleFormatNumber(record?.PAID_AMOUNT_9030) : '0.00' } }, { title:
物业费
, dataIndex: 'PAID_AMOUNT_9050', valueType: 'digit', align: 'right', hideInSearch: true, render: (_, record) => { return record?.PAID_AMOUNT_9050 ? handleFormatNumber(record?.PAID_AMOUNT_9050) : record?.PAID_AMOUNT_9050 === 0 ? 0.00 : '' } } ] }, { title:
退补款
, dataIndex: 'RefundSupplement', valueType: 'digit', align: 'right', hideInSearch: true, render: (_, record) => { const number: number = record?.BANKACCOUNT_AMOUNT - record?.RECEIVABLEAMOUNT - record?.SHOPEXPENSE_AMOUNT + record?.PAID_AMOUNT return {number ? handleFormatNumber(number) : '0.00'} } }, { title:
备注
, width: 100, dataIndex: 'desc', valueType: 'digit', align: 'right', hideInSearch: true, } ] const columns: any = [ { title: '统计时间', dataIndex: 'search_date', valueType: 'dateRange', hideInTable: true, hideInDescriptions: true, initialValue: [moment(parentRow?.STARTDATE).format("YYYY-MM"), moment(searchParams?.EndDate).format('YYYY-MM')], search: { transform: (value: any) => { return { StartDate: value[0], EndDate: value[1], }; }, }, fieldProps: { picker: "month", format: 'YYYY-MM', allowClear: true // disabledDate: (current: any) => current && current > moment() } }, { dataIndex: 'CURRENT_PERIOD', title:
期数
, align: 'center', width: 140, hideInSearch: true, render: (_, record) => { return record?.level === 1 ? record?.CURRENT_PERIOD : record?.SETTLEMENT_DATE } }, { dataIndex: 'SETTLEMENT_STATE', title:
结算状态
, align: 'center', width: 120, valueType: 'select', valueEnum: { '3': { text: '全部' }, '0': { text: '待结算' }, '1': { text: '已结算' }, '2': { text: '审批中' }, }, hideInSearch: true, render: (_, record) => { return record?.level === 1 ? record?.SETTLEMENT_STATE : record?.BUSINESSPROJECT_ID ? record?.SETTLEMENT_STATE === 1 ? : record?.SETTLEMENT_STATE === 2 ? { console.log('record', record); setCurrentApprovalstate(1) setCurrentRow({ ...record, Approvalstate: 1, startTime: record?.STARTDATE, endTime: record?.ENDDATE, ShopRoyaltyId: record?.SHOPROYALTY_ID, BUSINESSPROJECT_ID: record?.BUSINESSPROJECT_ID, Id: record?.SERVERPARTSHOP_ID, SERVERPART_ID: record?.SERVERPART_ID, STATISTICS_MONTH: record?.SETTLEMENT_DATE, }) console.log('dsad', { ...record, Approvalstate: 1, startTime: record?.STARTDATE, endTime: record?.ENDDATE, ShopRoyaltyId: record?.SHOPROYALTY_ID, BUSINESSPROJECT_ID: record?.BUSINESSPROJECT_ID, Id: record?.SERVERPARTSHOP_ID, SERVERPART_ID: record?.SERVERPART_ID, STATISTICS_MONTH: record?.SETTLEMENT_DATE, }); setMonthTime(record?.SETTLEMENT_DATE) setShowDetailDrawer(true) }} style={{ color: '#faad14' }}> 审批中 : record?.SETTLEMENT_STATE === 0 ? { setCurrentApprovalstate(0) setCurrentRow({ ...record, Approvalstate: 0, startTime: record?.STARTDATE, endTime: record?.ENDDATE, ShopRoyaltyId: record?.SHOPROYALTY_ID, BUSINESSPROJECT_ID: record?.BUSINESSPROJECT_ID, Id: record?.SERVERPARTSHOP_ID, SERVERPART_ID: record?.SERVERPART_ID, STATISTICS_MONTH: record?.SETTLEMENT_DATE, }) setMonthTime(record?.SETTLEMENT_DATE) setShowDetailDrawer(true) }}>待结算 : '' : { handleModalVisible(true) setCurrentRow({ ...record, SERVERPART_IDS: [Number(record?.SERVERPART_ID)], serverpartShopIds: record?.SERVERPARTSHOP_ID ? record?.SERVERPARTSHOP_ID.split(',') : '', projectRangeDate: [record?.PROJECT_STARTDATE, record?.PROJECT_ENDDATE], }) }}>添加项目 } }, { dataIndex: 'BUSINESSPROJECT_NAME', title:
项目名称
, width: 250, hideInSearch: true, ellipsis: true, render: (_, record) => { return record?.level === 1 ? { console.log('r', record); setCurrentRow(record) setShowProjectDrawer(true) }}> {record?.BUSINESSPROJECT_NAME} : '' } }, { title:
累计营业额
, dataIndex: 'REVENUE_AMOUNT', width: 120, valueType: 'digit', align: 'right', hideInSearch: true, hideInTable: true, }, { title:
本月营业额
, dataIndex: 'CURREVENUE_AMOUNT', width: 120, hideInSearch: true, align: 'right', valueType: 'digit', render: (_, record) => { return record.level === 1 ? <> {/* 批量审批的显示条件 这一期必须要已经是完整的一起 且 都是待审核中 且 不是商家 且 全部审批人都是同一个人 才会在这个人进入的时候显示按钮 */} {/* appovedIdList 状态的数组 判断是不是全部是同一个状态 */} { record?.children && record?.children.length >= 12 && (Number(record?.pendingList.toString()) === Number(currentUser.ID)) && record?.appovedIdList && record?.appovedIdList.length === 1 && (Number(record?.appovedIdList.toString()) !== 9000) && (Number(record?.appovedIdList.toString()) !== 1000) ? { setCurrentRow(record) setBatchModal(true) }}>批量审核 : '' } { record?.children && record?.children.length >= 12 && record?.appovedIdList && record?.appovedIdList.length === 1 && (Number(record?.appovedIdList.toString()) !== 1000) && currentUser?.UserPattern !== 2000 && record?.pendingList && record?.pendingList.length === 1 && (Number(record?.pendingList.toString()) === Number(currentUser.ID)) ? '' : '' } : {record?.CURREVENUE_AMOUNT ? numeral(record?.CURREVENUE_AMOUNT).format('0,0.00') : ''} } }, { title:
本月应缴费用
, dataIndex: 'SHOPEXPENSE_AMOUNT', width: 120, ellipsis: true, align: 'right', hideInSearch: true, }, { dataIndex: 'MERCHANTS_NAME', title:
经营商户
, ellipsis: true, hideInSearch: true, render: (_, record) => { return record?.level === 1 ? record?.MERCHANTS_NAME : record?.BusinessProcess_State ?
{record?.BusinessProcess_State > 1000 && record?.BusinessProcess_State < 9000 ? `待审核:` : ''} {`${record?.ApproveStaff_Name || ''}【${monthStateObj[record?.BusinessProcess_State]}】`}
: '' } }, { dataIndex: 'SERVERPARTSHOP_NAME', title:
门店名称
, hideInSearch: true, ellipsis: true, render: (_, record) => { return record?.level === 1 ? record?.SERVERPARTSHOP_NAME : record?.Staff_Name ? {`发起人:`} {record?.Staff_Name ? record?.Staff_Name : ''}{record?.BusinessProcess_StartDate ? `【${record?.BusinessProcess_StartDate}】` : ''} : '' } }, { title: '操作', hideInTable: !endReject, dataIndex: 'option', align: 'center', render: (_, record) => { return record?.level === 1 ? '' : { console.log('record', record); setCurrentRow(record) setReviewRejected(true) }}> 驳回 } } ] // 打印报表的方法 const handlePrintReport = async (obj: any) => { setPrintLoading(true) let res: any = [] const otherReq: any = { ServerpartIds: obj?.SERVERPART_ID, ShopRoyaltyId: obj?.SHOPROYALTY_ID, BusinessProjectId: obj?.BUSINESSPROJECT_ID, startDate: obj.SETTLEMENT_DATE ? moment(obj.SETTLEMENT_DATE).format('YYYYMM') : '', endDate: obj.SETTLEMENT_DATE ? moment(obj.SETTLEMENT_DATE).format('YYYYMM') : '', } console.log('otherReq', otherReq); const otherData = await handleGetTableRevenueRecognition(otherReq) console.log('otherData', otherData); if (otherData && otherData.length > 0) { const list: any = wrapTreeNode(otherData) let newObj: any = {} if (list && list.length > 0) { newObj = list[0].children[0].children[0] } console.log('newObj', newObj); let [start, end] = newObj.IndexDesc.split('-') let newIndexDesc: string = '' let newEnd: string = '' if (moment(obj.SETTLEMENT_DATE).format('YYYYMM') === moment(end).format('YYYYMM')) { newEnd = moment(end).format('YYYY/MM/DD') } else { newEnd = moment(obj.SETTLEMENT_DATE).endOf('month').format('YYYY/MM/DD') } newIndexDesc = start + '-' + newEnd newObj.IndexDesc = newIndexDesc // 取现金 微支付 应收租金 应收费用 已缴费用 const incomeReq: any = { BusinessProjectId: obj?.BUSINESSPROJECT_ID, StatisticsMonth: obj?.SETTLEMENT_DATE ? moment(obj?.SETTLEMENT_DATE).format('YYYYMM') : '', ShopRoyaltyId: obj?.SHOPROYALTY_ID, } const income = await handleGetProjectPeriodIncome(incomeReq) console.log('income', income); let incomObj: any = income[0] newObj.CASHPAY_AMOUNT = incomObj.CASHPAY_AMOUNT newObj.MOBILEPAY_AMOUNT = incomObj.MOBILEPAY_AMOUNT newObj.ROYALTYTHEORYMUST = incomObj.RECEIVABLEAMOUNT res = [newObj] } console.log('res', res); setPrintData(res) const req: any = { BUSINESSAPPROVALId: obj?.BUSINESSAPPROVAL_ID } const data = await handleGetGetBUSINESSAPPROVALDetail(req) // 给导出弄签字 const signature: any = { financeName: '',// 财务部签名 financeRealName: '',// 财务部签名(只有人名) developmentName: '',// 经发部签名 developmentRealName: '',// 经发部签名(只有人名) directorName: '',// 中心主任签名 directorRealName: '',// 中心主任签名(只有人名) centralFinanceName: '',// 中心财务签名 centralFinanceRealName: '',// 中心财务签名(只有人名) operationsSuperName: '',// 中心经营主管签名 operationsSuperRealName: '',// 中心经营主管签名(只有人名) areaManagerName: '',// 服务区经理签名 areaManagerRealName: '',// 服务区经理签名(只有人名) confirmationName: '',// 商户确认签名 confirmationRealName: '',// 商户确认签名(只有人名) developManagerName: data.STAFF_NAME,// 经发人签名 developManagerRealName: data.STAFF_NAME.split('【')[0] + ` ${data.BUSINESS_STARTDATE || ''}`,// 经发人签名(只有人名) } if (data.approveList && data.approveList.length > 0) { data.approveList.forEach((item: any) => { // if (item.APPLYAPPROVE_TYPE === 1000) { // obj.developManagerName = item.STAFF_NAME // obj.developManagerRealName = item.STAFF_NAME.split('【')[0] + ` ${item.APPLYAPPROVE_DATE}` // } else if (item.APPLYAPPROVE_TYPE === 2000) { signature.confirmationName = item.STAFF_NAME signature.confirmationRealName = item.STAFF_NAME.split('【')[0] + ` ${item.APPLYAPPROVE_DATE}` } else if (item.APPLYAPPROVE_TYPE === 2010) { signature.areaManagerName = item.STAFF_NAME signature.areaManagerRealName = item.STAFF_NAME.split('【')[0] + ` ${item.APPLYAPPROVE_DATE}` } else if (item.APPLYAPPROVE_TYPE === 2020) { signature.operationsSuperName = item.STAFF_NAME signature.operationsSuperRealName = item.STAFF_NAME.split('【')[0] + ` ${item.APPLYAPPROVE_DATE}` } else if (item.APPLYAPPROVE_TYPE === 2030) { signature.centralFinanceName = item.STAFF_NAME signature.centralFinanceRealName = item.STAFF_NAME.split('【')[0] + ` ${item.APPLYAPPROVE_DATE}` } else if (item.APPLYAPPROVE_TYPE === 2040) { signature.directorName = item.STAFF_NAME signature.directorRealName = item.STAFF_NAME.split('【')[0] + ` ${item.APPLYAPPROVE_DATE}` } else if (item.APPLYAPPROVE_TYPE === 2050) { signature.developmentName = item.STAFF_NAME signature.developmentRealName = item.STAFF_NAME.split('【')[0] + ` ${item.APPLYAPPROVE_DATE}` } else if (item.APPLYAPPROVE_TYPE === 2060) { signature.financeName = item.STAFF_NAME signature.financeRealName = item.STAFF_NAME.split('【')[0] + ` ${item.APPLYAPPROVE_DATE}` } }) } let printName: string = `${obj?.SERVERPART_NAME}-${obj?.SERVERPARTSHOP_NAME}-${obj?.SETTLEMENT_DATE}月度结算` let neckList: any = [ { label: '管理中心', value: obj?.SPREGIONTYPE_NAME }, { label: '服务区', value: obj?.SERVERPART_NAME }, { label: '经营商户', value: obj?.MERCHANTS_NAME }, { label: '门店名称', value: obj?.SERVERPARTSHOP_NAME }, { label: '合同期限', value: `${obj?.PROJECT_STARTDATE ? `${moment(obj?.PROJECT_STARTDATE).format('YYYY.MM.DD')}` : ''}${obj?.PROJECT_ENDDATE ? `-${moment(obj?.PROJECT_ENDDATE).format('YYYY.MM.DD')}` : ''}` }, ] const styles = Array.from(document.styleSheets) // 获取页面的CSS样式 .map((sheet) => Array.from(sheet.cssRules).map((rule) => rule.cssText).join('\n') ) .join('\n'); let originalTable: any = document.getElementsByClassName('monthExamineTestTable')[0] // 拿到要打印的数据表格 const clonedTable = originalTable.cloneNode(true) as HTMLElement;// 克隆表格元素,包括其子元素 // 修改克隆后的表格样式 clonedTable.style.display = 'block'; // 遍历克隆表格的 和 以及它们的所有子元素,设置字体大小为 16px const setFontSizeRecursively = (element: HTMLElement) => { element.style.fontSize = '10px'; // 设置字体大小为 16px element.style.padding = '4px'; // 设置字体大小为 16px Array.from(element.children).forEach((child) => setFontSizeRecursively(child as HTMLElement) ); }; // 遍历克隆表格的 和 单元格,并设置字体大小为 16px const tableCells = clonedTable.querySelectorAll('thead th, tbody td,tfoot td'); tableCells.forEach((cell) => setFontSizeRecursively(cell as HTMLElement)); // 获取克隆后的 HTML 内容 const clonedHTML = clonedTable.getElementsByClassName('ant-table-content')[0].innerHTML; console.log('clonedHTML', clonedHTML); const footer: string = `
财务部: ${signature?.financeRealName || ''}
经发部: ${signature?.developmentRealName || ''}
中心主任: ${signature?.directorRealName || ''}
中心财务: ${signature?.centralFinanceRealName || ''}
中心经营主管: ${signature?.operationsSuperRealName || ''}
服务区经理: ${signature?.areaManagerRealName || ''}
商户确认: ${signature?.confirmationRealName || ''}
发起人: ${signature?.developManagerRealName || ''}
` setPrintLoading(false) handleNewPrint(printName, `${obj?.BUSINESSPROJECT_NAME}结算表(${obj?.SETTLEMENT_DATE})月`, neckList, styles, clonedHTML, footer) } return (
{ printLoading ?
{'加载打印内容中...'}
: '' } { return `${record?.CURRENT_PERIOD}-${record?.level}-${record?.SETTLEMENT_DATE}` }} expandable={{ expandedRowKeys: defaultExpand, onExpand: (expanded, record) => { console.log('expanded', expanded); console.log('record', record); if (defaultExpand && defaultExpand.length > 0) { // 展开还是闭合 if (expanded) { // 展开 let old: any = JSON.parse(JSON.stringify(defaultExpand)) old.push(`${record?.CURRENT_PERIOD}-1-undefined`) setDefaultExpand(old) } else { // 闭合 let old: any = JSON.parse(JSON.stringify(defaultExpand)) let newList: any = [] old.forEach((item: any) => { console.log('item', item); console.log('neew', `${record?.CURRENT_PERIOD}-1-undefined`); if (item === `${record?.CURRENT_PERIOD}-1-undefined`) { } else { newList.push(item) } }) console.log('newList', newList); setDefaultExpand(newList) } } else { // 本身没有 那只能是新增 let old: any = [] old.push(`${record?.CURRENT_PERIOD}-1-undefined`) setDefaultExpand(old) } } }} request={async (params) => { const req = { ServerpartId: parentRow?.SERVERPART_ID, ServerpartShopId: parentRow?.SERVERPARTSHOP_ID, StartDate: params?.StartDate ? moment(params?.StartDate).format('YYYYMM') : '', EndDate: params?.EndDate ? moment(params?.EndDate).format('YYYYMM') : '', SettlementMode: parentRow?.SETTLEMENT_MODES || '', SettlementState: examineState === 0 ? '' : examineState, SettlementType: 2, PageIndex: 1, PageSize: 999999, SortStr: '', SearchKeyValue: parentRow?.SERVERPARTSHOP_ID ? '' : parentRow?.MERCHANTS_NAME, SearchKeyName: 'MERCHANTS_NAME' } const data = await handleGetProjectAccountList(req) const stateReq: any = { SearchParameter: { BusinessProcess_StateSearch: "1000,2000,2010,2020,2030,2040,2050,2060,9000", Operation_Type: 12, Serverpart_IDS: parentRow?.SERVERPART_ID, ServerpartShop_ID: parentRow?.SERVERPARTSHOP_ID, PendState: 2 }, PageIndex: 1, PageSize: 999999 } const stateData = await handleGetMonthAccountProinst(stateReq) console.log('stateData', stateData); console.log('month', data); if (data && data.length > 0) { let res: any = [] let periodList: any = [] data.forEach((item: any) => { if (periodList.indexOf(item.CURRENT_PERIOD) === -1) { periodList.push(item.CURRENT_PERIOD) } if (stateData && stateData.length > 0) { stateData.forEach((subItem: any) => { if (subItem.BusinessApproval_ID === item.BUSINESSAPPROVAL_ID) { item.ApproveStaff_Name = subItem.ApproveStaff_Name item.BusinessProcess_State = subItem.BusinessProcess_State item.Staff_Name = subItem.Staff_Name item.Staff_ID = subItem.Staff_ID item.BusinessProcess_StartDate = subItem.BusinessProcess_StartDate } }) } }) console.log('periodList', periodList); let defaultRow: any = [] periodList.forEach((item: any) => { let children: any = [] let obj: any = {} // 待审批的状态 let APPOVED_IDSLIST: any = [] // 拿到当前用户可以审批的申请id数组 业务id let idList: any = [] // 待审批人数组 只有一个的时候才可以批量审批 let pendingList: any = [] // 那第一个业务的 作为当前的业务状态 let firstState: any = 0 data.forEach((subItem: any, subIndex: number) => { if (item === subItem.CURRENT_PERIOD) { obj = subItem children.push(subItem) if (pendingList.indexOf(Number(subItem.APPOVED_IDS)) === -1) { pendingList.push(Number(subItem.APPOVED_IDS)) } idList.push(subItem.BUSINESSAPPROVAL_ID) } if (Number(subItem.APPOVED_IDS) === Number(currentUser.ID)) { if (APPOVED_IDSLIST.indexOf(subItem.BusinessProcess_State) === -1) { APPOVED_IDSLIST.push(subItem.BusinessProcess_State) } if (subIndex === 0) { firstState = subItem.BusinessProcess_State } } }) console.log('APPOVED_IDSLIST', APPOVED_IDSLIST); console.log('idList', idList); res.push({ CURRENT_PERIOD: item, children: children, level: 1, SETTLEMENT_STATE: children.length, BUSINESSPROJECT_NAME: obj.BUSINESSPROJECT_NAME, MERCHANTS_NAME: obj.MERCHANTS_NAME, SERVERPARTSHOP_NAME: obj.SERVERPARTSHOP_NAME, BUSINESSPROJECT_ID: obj.BUSINESSPROJECT_ID, appovedIdList: APPOVED_IDSLIST, SHOPROYALTY_ID: obj.SHOPROYALTY_ID, BUSINESSAPPROVAL_IDS: idList, pendingList: pendingList,// 待审批人列表 currentState: firstState, BUSINESSAPPROVAL_ID: obj.BUSINESSAPPROVAL_ID }) defaultRow.push(`${item}-1-undefined`) }) console.log('defaultRow', defaultRow); console.log('res321312', res); setDefaultExpand(defaultRow) return { data: res, success: true } } return { data: [], success: true } }} /> {/* { return <> {exportSumRow?.PeriodIndexStr} {exportSumRow?.MinturnOver ? numeral(exportSumRow?.MinturnOver).format('0,0') : ''} {exportSumRow?.CashAmount ? numeral(exportSumRow?.CashAmount).format('0,0.00') : ''} {exportSumRow?.MobilePayAmount ? numeral(exportSumRow?.MobilePayAmount).format('0,0.00') : ''} {exportSumRow?.RevenueAmount ? numeral(exportSumRow?.RevenueAmount).format('0,0.00') : ''} {exportSumRow?.amount ? numeral(exportSumRow?.amount).format('0,0.00') : ''} {exportSumRow?.RoyaltyAmount ? numeral(exportSumRow?.RoyaltyAmount).format('0,0.00') : ''} {exportSumRow?.GuaranteeFee ? numeral(exportSumRow?.GuaranteeFee).format('0,0.00') : ''} {exportSumRow?.accountsReceivable ? numeral(exportSumRow?.accountsReceivable).format('0,0.00') : ''} {exportSumRow?.PaidFee ? numeral(exportSumRow?.PaidFee).format('0,0.00') : ''} {exportSumRow?.PaidFee_9010 ? numeral(exportSumRow?.PaidFee_9010).format('0,0.00') : ''} {exportSumRow?.PaidFee_9020 ? numeral(exportSumRow?.PaidFee_9020).format('0,0.00') : ''} {exportSumRow?.PaidFee_9030 ? numeral(exportSumRow?.PaidFee_9030).format('0,0.00') : ''} {exportSumRow?.PaidFee_9050 ? numeral(exportSumRow?.PaidFee_9050).format('0,0.00') : ''} {exportSumRow?.RefundSupplement ? numeral(exportSumRow?.RefundSupplement).format('0,0.00') : ''} {exportSumRow?.desc} }} /> */} {/* 项目详情抽屉 */} { // 关闭抽屉 则在清空选中行数据 并 设置抽屉状态为关闭 setCurrentRow(undefined); setShowProjectDrawer(false); }} bodyStyle={{ backgroundColor: "#f9f9f9", padding: 0 }} closable={false} > {/* 抽屉打开时 加载项目详情组件 */} {showProjectDrawer && } {/* 月度结算抽屉 */} {/* 批量审批 */} { batchFormRef.current?.validateFields().then(async (res: any) => { setBatchLoading(true) console.log('currentRow', currentRow); const req: any = { businessApprovalID: currentRow?.BUSINESSAPPROVAL_IDS.toString(), curProinstState: currentNowState, approveedInfo: res?.desc, approveedStaffId: currentUser?.ID, approveedStaffName: currentUser?.Name, nextId: res?.nextPerson } console.log('req', req); const data = await handleApproveMAPList(req) if (data.Result_Code === 100) { message.success(data.Result_Desc) actionRef.current?.reload() setBatchLoading(false) setCurrentRow(undefined) setBatchModal(false) setCurrentNowState(undefined) setCurrentNextState(undefined) } else { message.error(data.Result_Desc) setBatchLoading(false) } }) }} onCancel={() => { setCurrentRow(undefined) setBatchModal(false) setBatchLoading(false) }} // setBatchLoading > { return [] } }} > { currentNextState?.NEXT_STATE !== 9000 ? { // merchantState 判断哪几个状态是商户的 商户调用拿到 商户下面的全部人列表选择一个 不是商户的 就根据选择了的人去指定一个人 // 接口直接返回就不用判断了 const req: any = { BUSINESSAPPROVALId: currentRow?.BUSINESSAPPROVAL_ID || currentRow?.BUSINESSAPPROVAL_IDS[0] } console.log('req', req); const data = await handleGetBUSINESSAPPROVALDetail(req) setCurrentNowState(data.BUSINESSAPPROVAL_STATE) // 拿到下一环节 const nextReq: any = { OperationType: 12, CurState: data.BUSINESSAPPROVAL_STATE, IsValid: 1 } const nextData = await handleGetAPPROVALROUTEDetail(nextReq) setCurrentNextState(nextData) const list: any = [] if (data.UserList && data.UserList.length > 0) { data.UserList.forEach((item: any) => { if (item.USER_STATUS === 1) { list.push({ label: item.USER_NAME, value: item.USER_ID }) } }) } if (list && list.length > 0 && list.length === 1) { batchFormRef.current?.setFieldsValue({ nextPerson: list[0].value }) } if (currentUser?.ID === 2785) { list.push({ label: '严琅杰', value: 2785 }) } return list }} /> : '' } {/* 办结后的驳回 */} { formRejectRef.current?.resetFields(); }} onCancel={() => { setCurrentRow(undefined) setReviewRejected(false) }} onOk={(value) => { // 提交框内的数据 formRejectRef.current.validateFields().then(async (res: any) => { let req: any = { businessApprovalID: currentRow?.BUSINESSAPPROVAL_ID, approveedStaffId: currentUser?.ID, approveedStaffName: currentUser?.Name, approveedInfo: res.desc, endReject: true, targetProinstState: res.RejectState } const data = await handleRejectMonthAccountProinst(req) if (data.Result_Code === 100) { message.success(data.Result_Desc) setCurrentRow(undefined) setReviewRejected(false) actionRef.current?.reload() if (parentRef) { parentRef.current?.reload() } } else { message.error(data.Result_Desc) } }) }} > { const req: any = { SearchParameter: { OPERATION_TYPES: '12', APPROVALROUTE_VALID: 1 }, PageIndex: 1, PageSize: 999999 } const data = await handleGetAPPROVALROUTEList(req) let list: any = [] if (data && data.length > 0) { data.forEach((item: any) => { list.push({ label: item.APPROVALROUTE_NAME, value: item.APPROVALROUTE_STATE }) }) } console.log('list', list); return list }} required />
) } export default connect(({ user, }: ConnectState) => ({ currentUser: user.currentUser, }))(MonthExamine);