import { connect } from "umi"; import type { CurrentUser } from "umi"; import type { ConnectState } from "@/models/connect"; import React, { useRef, useState } from "react"; import ProCard from "@ant-design/pro-card"; import { MenuFoldOutlined } from "@ant-design/icons"; import type { FormInstance } from "antd"; import { Button, Card, message, Row, Steps, Tooltip, Typography } from "antd"; import { Drawer } from "antd"; import { Space, Tree } from "antd"; import useRequest from "@ahooksjs/use-request"; import { getServerpartTree } from "@/services/options"; import type { ActionType } from "@ant-design/pro-table"; import ProTable from "@ant-design/pro-table"; import { handleGetExamineList, handleGetMonthAccountProinst } from "@/pages/examine/examineList/service"; import moment from "moment"; import { PageContainer } from "@ant-design/pro-layout"; import ReactHTMLTableToExcel from "react-html-table-to-excel"; import ProDescriptions from "@ant-design/pro-descriptions"; import { handleGetGetBUSINESSAPPROVALDetail, handleGetTableMonthlyReconciliation } from "@/pages/reports/ShopExpenseDetail/service"; import { wrapTreeNode } from "@/utils/format"; import RevenueList from "@/pages/BussinessProject/components/RevenueList"; import './style.less' import ProjectDetailDrawer from "@/pages/reports/component/ProjectDetailDrawer"; import { handleGetAPPROVALROUTEList } from "@/pages/Setting/serviceConfig/service"; const { Step } = Steps const examineList: React.FC<{ currentUser: CurrentUser }> = (props) => { const { currentUser } = props const actionRef = useRef(); const actionDetailRef = useRef(); const formRef = useRef(); const formDetailRef = useRef(); const [reqDetailList, setReqDetailList] = useState(); // 合计项数据源 const [reqDetailListDetail, setReqDetailListDetail] = useState(); // 合计项数据源 const [printOut, setPrintOut] = useState(); // 打印数据的内容 const [collapsible, setCollapsible] = useState(false) const [treeView, setTreeView] = useState() // 加载服务区树 const { loading: treeLoading, data: treeViews } = useRequest(async () => { const data = await getServerpartTree(currentUser?.ProvinceCode, currentUser?.CityAuthority, true, true, true) setTreeView(data) return data }) // 树相关的属性和方法 const [selectedId, setSelectedId] = useState() // 显示详情抽屉 const [showDeatilDrawer, setShowDetailDrawer] = useState(false) const [currentRow, setCurrentRow] = useState() // 详情的加载效果 const [detailLoading, setDetailLoading] = useState(false) // 详情里面表格加载效果 const [tableLoading, setTableLoading] = useState(false) const [otherData, setOtherData] = useState();// 显示表格上方内容 // 流程进度的当前状态 const [progressState, setProgressState] = useState(0) // 流程进度的数组 const [progressList, setProgressList] = useState() // 进度流畅的详情信息 const [progressDetail, setProgressDetail] = useState() const [showDetail, setShowDetail] = useState(false) // 是否显示详情 const [detailCurrentRow, setDetailCurrentRow] = useState() const [tableAllData, setTableAllData] = useState() const columns: any = [ { title: '业务名称', ellipsis: true, dataIndex: 'BusinessProcess_Name', hideInSearch: true, render: (_, record) => { return { console.log('record', record) setCurrentRow(record) handleGetProcessProgress(record?.BusinessApproval_ID) handleGetTableData(record?.BusinessProcess_ID, record?.Proinst_ID) setShowDetailDrawer(true) }}>{record?.BusinessProcess_Name} } }, { title: '服务区名称', width: 200, ellipsis: true, dataIndex: 'Serverpart_Name', hideInSearch: true }, { title: '经办人', width: 140, dataIndex: 'Staff_Name', hideInSearch: true, ellipsis: true, }, // { // title: '统计时间', // dataIndex: 'search_date', // valueType: 'dateRange', // hideInTable: true, // hideInDescriptions: true, // initialValue: [moment().format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')], // search: { // transform: (value) => { // return { // StartDate: value[0], // EndDate: value[1], // }; // }, // }, // fieldProps: { // disabledDate: (current: any) => current && current > moment().endOf('day') // } // }, { title: '业务时间', dataIndex: '', width: 140, hideInSearch: true, render: (_, record) => { return record.BusinessProcess_StartDate ? `${moment(record.BusinessProcess_StartDate).format('YYYY-MM-DD')}` : '' } }, { title: '业务状态', width: 150, dataIndex: 'BusinessProcess_State', valueType: 'select', request: async () => { const req: any = { SearchParameter: { APPROVALROUTE_VALID: 1, OPERATION_TYPES: 11 }, SortStr: 'APPROVALROUTE_STATE asc', PageIndex: 1, PageSize: 999999 } const data = await handleGetAPPROVALROUTEList(req) console.log('data2222', data) 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 } } }) return list } return [] } }, { title: '待审核人名称', width: 180, ellipsis: true, dataIndex: 'ApproveStaff_Name', hideInSearch: true, render: (_, record) => { return record?.BusinessProcess_State === 9000 ? '' : record?.ApproveStaff_Name } }, { title: '备注说明', width: 250, ellipsis: true, dataIndex: 'BusinessProcess_Desc', hideInSearch: true }, // { // dataIndex: 'option', // title: '操作', // width: 120, // valueType: 'option', // align: 'center', // fixed:'right', // hideInSearch: true, // render: (_,record)=>{ // return ( // // // // ) // } // } ] const detailColumns: any = [ { title: '期限', dataIndex: '', hideInSearch: true, children: [ { title:
期数
, dataIndex: 'PeriodIndexStr', align: 'left', width: 150, hideInSearch: true, render: (_, record) => { return {record.PeriodIndexStr} } }, { title:
期限
, dataIndex: 'PeriodDesc', align: 'left', width: 200, hideInSearch: true, render: (_, record) => { return record?.PeriodDesc !== '合计' ? { console.log('record', record) if (new Date(record.EndDate).getTime() < new Date().getTime()) { const obj: any = { ...record, ...tableAllData, STARTDATE: record.StartDate } console.log('obj', obj) setDetailCurrentRow(obj); setShowDetail(true); } }}> {`${record?.StartDate}-${record?.EndDate}`} : {`${record?.PeriodDesc}`} } }, ] }, { title: '租金信息', dataIndex: '', hideInSearch: true, children: [ { title:
保底/固定租金
, dataIndex: 'MinturnOver', valueType: 'digit', align: 'right', width: 170, hideInSearch: true, }, { title:
提成比率
, dataIndex: 'GuaranteeRatio', hideInSearch: true, align: 'right', width: 120, render: (_, record) => { return record?.GuaranteeRatio ? `${record?.GuaranteeRatio}%` : '' } } ] }, { title: '营业额', dataIndex: '', hideInSearch: true, children: [ { title:
现金
, dataIndex: 'CashAmount', valueType: 'digit', align: 'right', width: 100, hideInSearch: true, }, { title:
微支付
, dataIndex: 'MobilePayAmount', valueType: 'digit', align: 'right', width: 100, hideInSearch: true, }, { title:
小计
, dataIndex: 'RevenueAmount', valueType: 'digit', align: 'right', width: 100, hideInSearch: true, } ] }, { title:
业主收款
, dataIndex: 'RoyaltyAmount', valueType: 'digit', width: 100, align: 'right', hideInSearch: true, }, { title: '应收费用', dataIndex: '', hideInSearch: true, children: [ { title:
租金
, dataIndex: 'GuaranteeFee', valueType: 'digit', align: 'right', width: 100, hideInSearch: true, }, { title:
物业费
, dataIndex: 'PropertyFee', valueType: 'digit', align: 'right', width: 100, hideInSearch: true, }, { title:
房租
, dataIndex: 'HouseRent', valueType: 'digit', align: 'right', width: 100, hideInSearch: true, }, { title:
罚款
, dataIndex: 'BreachPenalty', valueType: 'digit', align: 'right', width: 100, hideInSearch: true, }, { title:
电费
, dataIndex: 'ElectricityCharge', valueType: 'digit', align: 'right', width: 100, hideInSearch: true, }, { title:
水费
, dataIndex: 'WaterCharge', valueType: 'digit', align: 'right', width: 100, hideInSearch: true, }, { title:
其他
, dataIndex: 'OtherFee', valueType: 'digit', align: 'right', width: 100, hideInSearch: true, }, { title:
合计
, dataIndex: 'ReceivableAmount', valueType: 'digit', align: 'right', width: 100, hideInSearch: true, }, ] }, { title:
退补款
, dataIndex: 'RefundSupplement', valueType: 'digit', align: 'right', width: 100, hideInSearch: true, } ] // 拿到流程进度的数据 const handleGetProcessProgress = async (id: any) => { const req: any = { BUSINESSAPPROVALId: id || currentRow?.BUSINESSAPPROVAL_ID } const data = await handleGetGetBUSINESSAPPROVALDetail(req) console.log('data', data) setProgressDetail(data) setProgressState(data.BUSINESSAPPROVAL_STATE) const list = [] if (data.approveList && data.approveList.length > 0) { const length: number = data.approveList.length data.approveList.forEach((item: any, index: number) => { if (index + 1 < length) { item.status = 'process' } if (item.APPLYAPPROVE_TYPE === 3000) { item.status = 'error' } list.push(item) }) // const list: any = [] // data.approveList.forEach((item: any)=>{ // list.push({title: item.APPLYAPPROVE_NAME,subTitle: item.APPLYAPPROVE_DATE, status: 'finish',description: item.APPLYAPPROVE_INFO}) // }) } list.push({ status: 'wait', APPLYAPPROVE_NAME: data.BUSINESSAPPROVAL_NAME || '', APPLYAPPROVE_INFO: '', STAFF_NAME: '', APPLYAPPROVE_DATE: '', }) console.log('list', list) setProgressList(list) } // 外面表格的请求数据的方法 const handleGetTableData = async (id?: any, SHOPROYALTY_ID?: any) => { if (!id) { return } setTableLoading(true) const req = { BUSINESSPROJECT_ID: id, SHOPROYALTY_ID } const data = await handleGetTableMonthlyReconciliation(req) let res: any = {} let list: any = [] let otherMessage: any = {} if (data.List && data.List.length > 0) { res = data.List[0] setTableAllData(res) if (data.List[0].ProjectPeriodList) { otherMessage = data.List[0].ProjectPeriodList.node const resObj: any = data.List[0].ProjectPeriodList if (resObj.children && resObj.children.length > 0) { list = wrapTreeNode(resObj.children) } } } list.unshift({ PeriodIndexStr: '', PeriodDesc: '合计', MinturnOver: otherMessage?.MinturnOver, GuaranteeRatio: otherMessage?.GuaranteeRatio, CashAmount: otherMessage?.CashAmount, MobilePayAmount: otherMessage?.MobilePayAmount, RevenueAmount: otherMessage?.RevenueAmount, RoyaltyAmount: otherMessage?.RoyaltyAmount, GuaranteeFee: otherMessage?.GuaranteeFee, PropertyFee: otherMessage?.PropertyFee, HouseRent: otherMessage?.HouseRent, BreachPenalty: otherMessage?.BreachPenalty, ElectricityCharge: otherMessage?.ElectricityCharge, WaterCharge: otherMessage?.WaterCharge, OtherFee: otherMessage?.OtherFee, ReceivableAmount: otherMessage?.ReceivableAmount, RefundSupplement: otherMessage?.RefundSupplement, }) console.log('list', list) setReqDetailListDetail(list) setOtherData({ ...data.OtherData, Dates: `${moment(data.OtherData.PROJECT_STARTDATE).format('YYYY/MM/DD')}-${moment(data.OtherData.PROJECT_ENDDATE).format('YYYY/MM/DD')}` }) // setOtherData({ // SPREGIONTYPE_NAME: res?.SpregionType_Name, // SERVERPART_NAME: res?.ServerPart_Name, // SERVERPARTSHOP_NAME: res?.ServerPartShop_Name, // MERCHANTS_NAME: res?.Merchants_Name, // Dates: res?.Dates, // }) setTableLoading(false) } return (
{ // 打印报表 if (!reqDetailList || reqDetailList.length === 0) return; setPrintOut(el); }} >
{/* { setCollapsible(!collapsible) }}/>} colSpan={!collapsible ? "300px" : "60px"} title={!collapsible ? "请选择服务区" : ""} headerBordered collapsed={collapsible} > {treeView && treeView.length > 0 ? { const selectedIds = info.checkedNodes.filter(n => n?.type === 1) setSelectedId(selectedIds.map(n => n?.value)?.toString() || '') // actionRef?.current?.reload() // getData(selectedIds.map(n => n?.value)?.toString() || '') }} // switcherIcon={} /> : ''} */}
{ // if (!selectedId){ // return // } const req: any = { SearchParameter: { // BusinessProcess_Name: params.BusinessProcess_Name, BusinessProcess_StateSearch: params.BusinessProcess_State || '', Operation_Type: 11, PendState: 2 }, keyWord: params.BusinessProcess_Name ? { key: "BusinessProcess_Name", value: params.BusinessProcess_Name } : '', SortStr: "BusinessProcess_StartDate desc", pageindex: 1, pagesize: 999999 } const data = await handleGetMonthAccountProinst(req) console.log('data', data) if (data && data.length > 0) { data.forEach((item: any) => { item.BusinessProcess_States = item.BusinessProcess_State }) return { data, success: true } } return { data: [], success: true } }} />
{ // 关闭抽屉 则在清空选中行数据 并 设置抽屉状态为关闭 setCurrentRow(undefined); setShowDetailDrawer(false); setOtherData(undefined) setProgressState(0) setProgressList([]) }} destroyOnClose bodyStyle={{ backgroundColor: "#fff", padding: 0 }} closable={false} > } > { progressState !== 1000 ?

{`${progressDetail?.BUSINESS_STARTDATE}`}

} /> { progressList && progressList.length > 0 ? progressList.map((item: any, index: number) => { return

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

: ''} /> // index+1===progressState && progressState!==6?'审批中':''} }) : '' } : '' } { return `${record?.SHOPROYALTY_ID}-${record?.PeriodIndexStr}-${record?.PeriodDesc}` }} actionRef={actionDetailRef} formRef={formDetailRef} columns={detailColumns} bordered search={false} loading={tableLoading} request={async (params: any) => { handleGetTableData() }} scroll={{ x: 1800 }} headerTitle={`合作商户合同期结算明细表`} // 列表表头 dataSource={reqDetailListDetail} pagination={false} tableExtraRender={() => { return
{otherData?.SPREGIONTYPE_NAME} {otherData?.SERVERPART_NAME} {otherData?.SERVERPARTSHOP_NAME} {otherData?.MERCHANTS_NAME} {otherData?.Dates}
}} >
{/* 查看项目详情 右侧弹出的抽屉 */} { // 关闭抽屉 则在清空选中行数据 并 设置抽屉状态为关闭 setDetailCurrentRow(undefined); setShowDetail(false); }} bodyStyle={{ backgroundColor: "#f9f9f9", padding: 0 }} closable={false} > {/* 抽屉打开时 加载项目详情组件 */} {showDetail && } ) } export default connect(({ user }: ConnectState) => ({ currentUser: user.currentUser }))(examineList);