From 3357d03316771399af5b5a9334e47c894193c9b3 Mon Sep 17 00:00:00 2001 From: ylj20011123 Date: Fri, 6 Feb 2026 09:47:13 +0800 Subject: [PATCH] update --- package.json | 3 +- src/21/~$打印表单.docx | Bin 0 -> 162 bytes src/pages/DigitalElectronics/index.tsx | 50 ++- src/pages/InvoiceInquiry/index.tsx | 2 +- src/pages/realEstate/index.tsx | 219 +++++++-- .../redReversal/components/InvoiceDetial.tsx | 414 ++++++++++++------ yarn.lock | 2 +- 7 files changed, 498 insertions(+), 192 deletions(-) create mode 100644 src/21/~$打印表单.docx diff --git a/package.json b/package.json index aad90d7..194ff45 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "antd": "^5.21.2", "axios": "^1.7.7", "crypto-js": "^4.2.0", + "dayjs": "1.11.13", "dva": "^3.0.0-alpha.1", "exceljs": "^4.4.0", "moment": "^2.30.1", @@ -37,4 +38,4 @@ "husky": "^9.1.6", "typescript": "^5.6.2" } -} +} \ No newline at end of file diff --git a/src/21/~$打印表单.docx b/src/21/~$打印表单.docx new file mode 100644 index 0000000000000000000000000000000000000000..8e3f65685d5624353ad73dd51cf93f104aaf2285 GIT binary patch literal 162 jcmZRJ4EFXiFk~PNurWk31T%Oucrh3-kgAt7n-~}Xu!jRt literal 0 HcmV?d00001 diff --git a/src/pages/DigitalElectronics/index.tsx b/src/pages/DigitalElectronics/index.tsx index 8bc9255..8a805bb 100644 --- a/src/pages/DigitalElectronics/index.tsx +++ b/src/pages/DigitalElectronics/index.tsx @@ -10,6 +10,8 @@ import { encryptAES } from "@/utils/handleAes"; import { ProForm, ProFormSelect, ProFormTextArea } from "@ant-design/pro-components"; import InvoiceDetial from "../redReversal/components/InvoiceDetial"; import { handleGetREALESTATEList } from "../realEstate/service"; +import { handleGetServerpartDDL } from "../serverpartAssets/service"; +import useRequest from "@ahooksjs/use-request"; interface ConnectState { user: { @@ -63,6 +65,25 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => { BANK_NAME: { show: false }, BANK_ACCOUNT: { show: false }, }); + // 搜索的全部服务区 + const [serverPartObj, setServerPartObj] = useState({}) + + const { loading, data: serverpart } = useRequest(async () => { + const req: any = { + ProvinceCode: "530000", + ServerpartType: "1000,1001,1010,2000,3000,4000,5000" + } + const data = await handleGetServerpartDDL(req) + let obj: any = {} + if (data && data.length > 0) { + data.forEach((item: any) => { + obj[item.value] = item.label + }) + } + setServerPartObj(obj) + return data + }) + const columns: any = [ { @@ -81,6 +102,20 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => { placeholder: "请输入含税开票金额", } }, + { + title: '服务区名称', + dataIndex: 'SERVERPART_IDS', + width: 150, + align: 'center', + ellipsis: true, + hideInTable: true, + valueType: 'select', + valueEnum: serverPartObj, + fieldProps: { + showSearch: true, + filterOption: (input, option) => (option?.label ?? '').toLowerCase().includes(input.toLowerCase()) + } + }, { title: '服务区名称', dataIndex: 'SERVERPART_NAME', @@ -113,6 +148,14 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => { } }, // { + // title: "原单据号", + // dataIndex: "ORIBILL_NO", + // width: 180, + // align: 'center', + // ellipsis: true, + // hideInSearch: true + // }, + // { // title: '流水号', // dataIndex: 'SERIAL_NO', // width: 180, @@ -441,8 +484,6 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => { }) } - - let obj: any = { billNo: record?.BILL_NO ? `HC-${record?.BILL_NO}` : "", // 单据编号 billDate: moment(record?.BILL_DATE).format('YYYY-MM-DD'), // 单据日期 @@ -665,7 +706,7 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => { includeTaxFlag: record?.ACCOUNTED_TYPE,// 判断是否含税 autoInvoice: "1",// 自动开票标记 invoiceType: record?.BILL_TYPE == 1000 ? '08xdp' : record?.BILL_TYPE == 2000 ? '10xdp' : '', //发票种类 - + invoiceProperty: record?.BILL_TYPE === 3000 ? '1' : '0', //发票属性 buyerTaxpayerId: cleanString(record?.TAXPAYER_IDENTIFYCODE),// 购方税号 buyerName: record?.MERCHANTS_NAME, // 购买方名称 buyerProperty: "0", // 购买方性质 0-企业,1-个人,2-非企业单位 @@ -1089,12 +1130,13 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => { const value = sorter[n] return value ? `${n} ${value.replace('end', '')}` : '' }) + console.log('userInfouserInfo', userInfo); // 获取票据信息表列表 const req: any = { SearchParameter: { - SERVERPART_IDS: userInfo?.ServerpartIds, + SERVERPART_IDS: params?.SERVERPART_IDS || userInfo?.ServerpartIds, BILL_STATES: "2000,9000", BILL_TYPES: "", INVOICE_TAXAMOUNT: params?.INVOICE_TAXAMOUNT || "" diff --git a/src/pages/InvoiceInquiry/index.tsx b/src/pages/InvoiceInquiry/index.tsx index 8c5d209..9a337e3 100644 --- a/src/pages/InvoiceInquiry/index.tsx +++ b/src/pages/InvoiceInquiry/index.tsx @@ -1142,7 +1142,7 @@ const InvoiceInquiry: React.FC<{ currentUser: any }> = (props) => { - + ) diff --git a/src/pages/realEstate/index.tsx b/src/pages/realEstate/index.tsx index 521984a..47f0f07 100644 --- a/src/pages/realEstate/index.tsx +++ b/src/pages/realEstate/index.tsx @@ -5,21 +5,35 @@ import { ActionType, FormInstance, ProForm, ProFormDatePicker, ProFormDateRangeP import { handleDeleteREALESTATE, handleGetREALESTATEList, handleSynchroREALESTATE } from "./service"; import moment from "moment"; import { encryptAES } from "@/utils/handleAes"; -import { Button, Col, message, Modal, Row } from "antd"; +import { Button, Col, ConfigProvider, DatePicker, message, Modal, Row } from "antd"; +import zhCN from 'antd/locale/zh_CN'; import ModalFooter from "./components/modalFooter"; import { handleGetPassportInfoById } from "../DigitalElectronics/service"; // 引入地址解析工具 import { handleAddressChange, parseAddress } from "@/utils/addressParser"; import { handleGetServerpartDDL, handleGetServerpartInfo, handleGetServerpartTree } from "../serverpartAssets/service"; import { handleGetSERVERPARTDetail } from "../operationReport/service"; +import dayjs from "dayjs"; +import 'dayjs/locale/zh-cn'; +import weekday from "dayjs/plugin/weekday"; +import localeData from "dayjs/plugin/localeData"; +import customParseFormat from 'dayjs/plugin/customParseFormat'; +import updateLocale from 'dayjs/plugin/updateLocale'; +dayjs.extend(updateLocale); +dayjs.updateLocale('zh-cn', { + weekStart: 0, +}); +dayjs.extend(weekday); +dayjs.extend(localeData); +dayjs.extend(customParseFormat); - -const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { serverPartId: string, isComponent: boolean, onRef?: any, selectRealEstateId?: any }) => { +const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId, parentRow }: { serverPartId: string, isComponent: boolean, onRef?: any, selectRealEstateId?: any, parentRow?: any }) => { const actionRef = useRef(); const formRef = useRef(); const modalFormRef = useRef(); + const { RangePicker } = DatePicker; // 树相关的属性和方法 const [selectedId, setSelectedId] = useState() const [collapsible, setCollapsible] = useState(false) @@ -36,9 +50,12 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { // 悬浮框点击确认的按钮加载效果 const [confirmLoading, setConfirmLoading] = useState(false) // 选中的行数据详情 + const [selectRowKey, setSelectRowKey] = useState() const [selectRowDetail, setSelectRowDetail] = useState() // 当前服务区下的方位 const [SERVERPARTREGION, setSERVERPARTREGION] = useState() + // 表格数据 + const [tableData, setTableData] = useState() // 服务区列表 const [searchServerPartList, setSearchServerPartList] = useState() const [columnsState, setColumnsState] = useState({ @@ -46,6 +63,8 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { CITY_NAME: { show: false }, SPECIALINDUSTRY_NUMBER: { show: false }, }) + // 当前组件的可以选择的全部服务区 + const [currentServerPartList, setCurrentServerPartList] = useState() // 列表配置 const columns: any = [ @@ -102,7 +121,40 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { width: 250, align: 'center', render: (_: any, record: any) => { - return `${record?.START_LEASEDATE || ""}${record?.END_LEASEDATE ? `-${record?.END_LEASEDATE}` : ''}` + return isComponent ? + + { + console.log('eee', e); + let [start, end] = [moment(e[0].$d).format('YYYY-MM-DD'), moment(e[1].$d).format('YYYY-MM-DD')] + console.log('2321321', [start, end]); + console.log('tableDatatableData', tableData); + let list: any = JSON.parse(JSON.stringify(tableData)) + list.forEach((item: any) => { + if (item.REALESTATE_ID === record.REALESTATE_ID) { + item.START_LEASEDATE = start + item.END_LEASEDATE = end + } + }) + setTableData(list) + }} + /> + + // + // { + // console.log('eee', e); + // let [start, end] = [moment(e[0].$d).format('YYYY-MM-DD'), moment(e[1].$d).format('YYYY-MM-DD')] + // console.log('2321321', [start, end]); + // } + // }} /> + // + : `${record?.START_LEASEDATE || ""}${record?.END_LEASEDATE ? `-${record?.END_LEASEDATE}` : ''}` } }, @@ -326,17 +378,44 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { setSearchServerPartList(data) } + // 遍历找出全部type为1 的 + const collectTypeOne = (list: any) => { + const result: any = []; + + function dfs(arr: any) { + if (!Array.isArray(arr)) return; + + arr.forEach(item => { + if (item && item.type === 1) { + result.push(item); + } + + // 关键:层级不确定,递归遍历 + if (Array.isArray(item?.children)) { + dfs(item.children); + } + }); + } + + dfs(list); + return result; + } + useEffect(() => { - if (isFirst) { - handleGetUserInfo() - setIsFirst(false) - handleGetServerPartList() + if (!isComponent) { + if (isFirst) { + handleGetUserInfo() + setIsFirst(false) + handleGetServerPartList() + } } }, []) useImperativeHandle(onRef, () => ({ - selectRowDetail + selectRowKey, + selectRowDetail, + tableData })); return
@@ -358,15 +437,18 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { columns={columns} bordered rowKey={'REALESTATE_ID'} - scroll={{ x: '100%', y: isComponent ? '400px' : 'calc(100vh - 450px)' }} + scroll={{ x: '100%', y: isComponent ? '370px' : 'calc(100vh - 450px)' }} headerTitle={'不动产列表'} // search={isComponent && Number(serverPartId) !== 1269 ? false : { span: 6 }} - search={isComponent ? false : { span: 6 }} + // search={isComponent ? false : { span: 6 }} + search={{ span: 6 }} + dataSource={tableData} request={async (params) => { // 如果是组件的话 它下面的服务区 可能是单个服务区 或者是 一个片区下面的全部服务区 let isComponentSelect = '' // 服务区详情的信息 let detail: any = {} + console.log('paramsparamsparamsparams', params); if (!isComponent) { if (!selectedId) { @@ -376,46 +458,52 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { console.log('selectRealEstateIdselectRealEstateId', selectRealEstateId); console.log('paramsparamsparamsparams', params); console.log('serverPartIdserverPartIdserverPartId', serverPartId); + setSelectRowKey(selectRealEstateId) + if (isFirst) { + // 先调用一下服务区详情 判断是管理单元 还是服务区 + detail = await handleGetSERVERPARTDetail({ SERVERPARTId: serverPartId }) + console.log('detaildetaildetaildetail', detail); + let nowShowSelectServerPartList: any = [] + // 先判断一下 是服务区还是管理单元 1000 说明是服务区 那么直接去请求即可 + if (Number(detail.STATISTICS_TYPE) === 1000) { + isComponentSelect = serverPartId + nowShowSelectServerPartList.push({ + label: detail.SERVERPART_NAME, + value: Number(detail.SERVERPART_ID) + }) + } else { + // 如果不是 那么就拿它的片区id 去请求下面的全部服务区 当作选择了的服务区id + const serverPart: any = await handleGetServerpartTree({ + ProvinceCode: "530000", + SPRegionType_ID: detail.SPREGIONTYPE_ID, + ServerpartType: "1000,1001,1010,2000,3000,4000,5000", + StatisticsType: 1000 + }) + console.log('serverPartserverPartserverPart', serverPart); + if (serverPart && serverPart.length > 0) { + const selectedIds = collectTypeOne(serverPart) + console.log('selectedIdsselectedIds', selectedIds); + isComponentSelect = selectedIds.map((n: any) => n?.value)?.toString() || '' + setSelectedId(isComponentSelect) - // 先调用一下服务区详情 判断是管理单元 还是服务区 - detail = await handleGetSERVERPARTDetail({ SERVERPARTId: serverPartId }) - console.log('detaildetaildetaildetail', detail); - // 先判断一下 是服务区还是管理单元 1000 说明是服务区 那么直接去请求即可 - if (Number(detail.STATISTICS_TYPE) === 1000) { - isComponentSelect = serverPartId - } else { - // 如果不是 那么就拿它的片区id 去请求下面的全部服务区 当作选择了的服务区id - const serverPart: any = await handleGetServerpartTree({ - ProvinceCode: "530000", - SPRegionType_ID: detail.SPREGIONTYPE_ID, - ServerpartType: 1000, - StatisticsType: 1000 - }) - console.log('serverPartserverPartserverPart', serverPart); - if (serverPart && serverPart.length > 0) { - serverPart.forEach((item: any) => { - if (item.children && item.children.length > 0) { - item.children.forEach((subItem: any) => { - if (isComponentSelect) { - isComponentSelect += `,${subItem.value}` - } else { - isComponentSelect = `${subItem.value}` - } + if (selectedIds && selectedIds.length > 0) { + selectedIds.forEach((item: any) => { + nowShowSelectServerPartList.push({ + label: item.label, + value: Number(item.value) + }) }) } - }) + } } + console.log('isComponentSelectisComponentSelectisComponentSelect', isComponentSelect); + + formRef.current?.setFieldsValue({ serverPartId: Number(detail.SERVERPART_ID) }) + setSearchServerPartList(nowShowSelectServerPartList) + setIsFirst(false) + setCurrentServerPartList(isComponentSelect) } - // if (selectRealEstateId && selectRealEstateId.length > 0) { - - // } else { - // if (Number(serverPartId) === 1269 && params?.serverPartId) { - - // } else { - // return [] - // } - // } } console.log('isComponentSelectisComponentSelect', isComponentSelect); @@ -423,7 +511,9 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { const req: any = { searchParameter: { REALESTATE_TYPE: isComponent ? '' : params?.REALESTATE_TYPE || "",// 不动产类型 - SERVERPART_IDS: isComponent ? isComponentSelect : selectedId, + // 当不是组件的时候 就根据左侧选择的服务区 selectedId + // 是组件的时候 如果选择的服务区里面有值 那就按照选择的走 没有值的话 就按照 当前片区的默认权限请求服务区 isComponentSelect是仅第一次生效 currentServerPartList是存好了的 之后生效 + SERVERPART_IDS: isComponent ? params?.serverPartId ? params?.serverPartId : isComponentSelect ? isComponentSelect : currentServerPartList : selectedId, // START_LEASEDATE_End: isComponent ? '' : params?.END_LEASEDATE_Start || "", // END_LEASEDATE_Start: isComponent ? '' : params?.START_LEASEDATE_End || "", REALESTATE_STATE: 1, @@ -445,8 +535,30 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { const data: any = await handleGetREALESTATEList(newReq) console.log('datadatadata', data); if (data && data.length > 0) { - return { data, success: true } + console.log('parentRowparentRow', parentRow); + if (parentRow) { + let NewData: any = [] + data.forEach((item: any) => { + if (Number(item.REALESTATE_ID) === Number(parentRow.REALESTATE_ID)) { + item = { + ...item, + ...parentRow, + REALESTATE_ID: Number(parentRow.REALESTATE_ID) + } + NewData.push(item) + } else { + NewData.push(item) + } + }) + console.log('NewDataNewData', NewData); + setTableData(NewData) + return { data: NewData, success: true } + } else { + setTableData(data) + return { data, success: true } + } } + setTableData([]) return { data: [], success: true } }} rowSelection={isComponent ? { @@ -455,8 +567,19 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { onChange: (_, row) => { console.log('__', _); console.log('row', row); + setSelectRowKey(_) - setSelectRowDetail(row) + // // 确保取最新的数据 不拿row 拿tableData + // let list: any = JSON.parse(JSON.stringify(tableData)) + // let newRow: any = {} + // list.forEach((item: any) => { + // if (item.REALESTATE_ID === row[0].REALESTATE_ID) { + // newRow = item + // } + // }) + // console.log('newRownewRow', newRow); + + // setSelectRowDetail(newRow) } } : false} toolbar={{ diff --git a/src/pages/redReversal/components/InvoiceDetial.tsx b/src/pages/redReversal/components/InvoiceDetial.tsx index 98ac134..5d2c2ab 100644 --- a/src/pages/redReversal/components/InvoiceDetial.tsx +++ b/src/pages/redReversal/components/InvoiceDetial.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useRef, useState } from "react"; import ProForm, { ProFormSelect, ProFormText, ProFormTextArea } from "@ant-design/pro-form"; -import { Col, Drawer, FormInstance, Row, Table, Typography, Space, Button, Empty, Divider, Input, message, Select, Modal, Tooltip } from "antd"; +import { Col, Drawer, FormInstance, Row, Table, Typography, Space, Button, Empty, Divider, Input, message, Select, Modal, Tooltip, ConfigProvider, DatePicker } from "antd"; import { connect } from "umi"; import { ActionType, ProTable } from "@ant-design/pro-components"; import { handleGetAPPLYAPPROVEList, handleGetBILLDETAILList, handleSynchroBILLDETAILList } from "@/pages/DigitalElectronics/service"; @@ -10,7 +10,20 @@ import { exportXlsxFromProColumnsExcelJS } from "@/utils/exportExcelFun"; import { getFieldEnum } from "@/pages/serverpartAssets/service"; import RealEstate from "@/pages/realEstate"; import { handleGetREALESTATEList } from "@/pages/realEstate/service"; - +import zhCN from 'antd/locale/zh_CN'; +import dayjs from "dayjs"; +import 'dayjs/locale/zh-cn'; +import weekday from "dayjs/plugin/weekday"; +import localeData from "dayjs/plugin/localeData"; +import customParseFormat from 'dayjs/plugin/customParseFormat'; +import updateLocale from 'dayjs/plugin/updateLocale'; +dayjs.extend(updateLocale); +dayjs.updateLocale('zh-cn', { + weekStart: 0, +}); +dayjs.extend(weekday); +dayjs.extend(localeData); +dayjs.extend(customParseFormat); const { Text } = Typography; interface ConnectState { @@ -23,13 +36,16 @@ interface ParamsType { parentRow: any; setParentRow: (v: any) => void; parentTableRef?: any; // 父表格实例 + showType?: string; // 没值 开票审核页面 search 票据查询页面 } -const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow, parentTableRef }: ParamsType) => { +const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow, parentTableRef, showType }: ParamsType) => { const realEstateRef = useRef(); const formRef = useRef>(); const detailActionRef = useRef(); + + const { RangePicker } = DatePicker; // 保存的加载效果 const [saveLoading, setSaveLoading] = useState(false) // 明细表格默认隐藏的内容 @@ -65,7 +81,8 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow, par const [currentRow, setCurrentRow] = useState(); // 解析不动产的枚举 const [realEstateEnum, setRealEstateEnum] = useState(); - + // 判断当前的发票明细里面 有没有不动产 + const [haveRealEstate, setHaveRealEstate] = useState(false) const detailColumns: any = [ { @@ -107,10 +124,43 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow, par }} /> : currentItem.TABLE_NAME } }, + { + title:
租赁日期
, + dataIndex: "LEASEDATE", + width: 200, + align: 'center', + hideInTable: !haveRealEstate && showType === 'search', + render: (_, record) => { + const currentItem = tableEditData?.find((item: any) => item.BILLDETAIL_ID === record.BILLDETAIL_ID) || record; + return isEdit ? + + { + console.log('eee', e); + let [start, end] = [moment(e[0].$d).format('YYYY-MM-DD'), moment(e[1].$d).format('YYYY-MM-DD')] + console.log('2321321', [start, end]); + + let tableData: any = JSON.parse(JSON.stringify(tableEditData)) + console.log('tableDatatableData', tableData); + tableData.forEach((item: any) => { + if (item.BILLDETAIL_ID === record.BILLDETAIL_ID) { + item.START_LEASEDATE = start + item.END_LEASEDATE = end + } + }) + setTableEditData(tableData) + }} + /> + + : + `${record?.START_LEASEDATE || ""}${record?.END_LEASEDATE ? `-${record?.END_LEASEDATE}` : ''}` + } + }, { title:
税率
, align: 'center', - width: 80, + width: 70, fixed: 'left', dataIndex: "DUTY_PARAGRAPH", render: (_, record) => { @@ -138,7 +188,7 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow, par { title:
商品条码
, align: 'left', - width: 120, + width: 100, fixed: 'left', dataIndex: "ITEM_ID", ellipsis: true @@ -146,7 +196,7 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow, par { title:
规格型号
, align: 'center', - width: 120, + width: 80, dataIndex: "ITEM_RULE", ellipsis: true, render: (_, record) => { @@ -168,7 +218,7 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow, par { title:
计量单位
, align: 'center', - width: 100, + width: 80, dataIndex: "ITEM_UNIT", ellipsis: true, render: (_, record) => { @@ -190,7 +240,7 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow, par { title:
数量
, align: 'right', - width: 80, + width: 60, valueType: 'digit', dataIndex: "INVOICE_COUNT" }, @@ -224,8 +274,9 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow, par { title: "不动产", dataIndex: "option", - width: 80, + width: 70, align: 'center', + hideInTable: !haveRealEstate && showType === 'search', render: (_: any, record: any) => { return record?.REALESTATE_ID ? { @@ -234,16 +285,16 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow, par setSelectRealEstateModal(true) }}> {realEstateEnum && realEstateEnum[record?.REALESTATE_ID] ? realEstateEnum[record?.REALESTATE_ID] : record?.REALESTATE_ID} - : - - - + setCurrentRow(record) + setSelectRealEstateModal(true) + }}>+ + } } @@ -455,11 +506,12 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow, par }) } setRealEstateEnum(obj) + return data } return ( { @@ -497,14 +549,14 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow, par - + - + - - {/* 发票明细 */}
发票明细 - { - // 调用一次 获取这个服务区里面的全部 不动产信息 - handleGetThisServerpartRealEstateData() - // 拿到发票明细 - const billDetail = await handleGetBILLDETAILList({ - SearchParameter: { - BILL_ID: parentRow?.BILL_ID - }, - PageIndex: 1, - PageSize: 999999, - SortStr: "BILLDETAIL_ID" - }) + { + selectRealEstateModal ? '' : + { + // 调用一次 获取这个服务区里面的全部 不动产信息 + handleGetThisServerpartRealEstateData() - if (billDetail && billDetail.length > 0) { - setTableEditData(billDetail) - setReqDetailList(billDetail) - console.log('billDetailbillDetailbillDetail', billDetail); + // 拿到发票明细 + const billDetail = await handleGetBILLDETAILList({ + SearchParameter: { + BILL_ID: parentRow?.BILL_ID + }, + PageIndex: 1, + PageSize: 999999, + SortStr: "BILLDETAIL_ID" + }) - return { data: billDetail, success: true } - } - return { data: [], success: true } - }} - columnsState={{ - value: columnsStateMap, - onChange: setColumnsStateMap, - }} - toolbar={{ - actions: [ - <> - { - parentRow?.BILL_STATE <= 2000 ? - <> - { - isEdit && parentRow?.BILL_STATE < 9000 ? - <> - - - : - + if (billDetail && billDetail.length > 0) { + setTableEditData(billDetail) + setReqDetailList(billDetail) + console.log('billDetailbillDetailbillDetail', billDetail); + + // 因为要给原先的 不动产信息赋值租赁时间 所以先取出全部的 不动产id + let allREALESTATE_ID: string = '' + billDetail.forEach((item: any) => { + if (item.REALESTATE_ID) { + if (allREALESTATE_ID) { + allREALESTATE_ID += `,${item.REALESTATE_ID}` + } else { + allREALESTATE_ID = `${item.REALESTATE_ID}` } - : "" - } - , - - ] - }} - /> + + // 请求到的当前的全部不动产信息 + const req: any = { + searchParameter: { + REALESTATE_IDS: allREALESTATE_ID, + REALESTATE_STATE: 1 + }, + PageIndex: 1, + PageSize: 999999, + } + let newReq: any = { + name: "", + value: encryptAES(JSON.stringify(req)) + } + const data: any = await handleGetREALESTATEList(newReq) + + // 然后去找一样的不动产id 去匹配上 租赁时间的值 + billDetail.forEach((item: any) => { + data.forEach((subItem: any) => { + if (Number(item.REALESTATE_ID) === Number(subItem.REALESTATE_ID) && !item.START_LEASEDATE && !item.END_LEASEDATE) { + item.START_LEASEDATE = subItem.START_LEASEDATE + item.END_LEASEDATE = subItem.END_LEASEDATE + } + }) + }) + + console.log('最终的结果 ', billDetail); + return { data: billDetail, success: true } + } + return { data: [], success: true } + }} + columnsState={{ + value: columnsStateMap, + onChange: setColumnsStateMap, + }} + toolbar={{ + actions: [ + <> + { + parentRow?.BILL_STATE <= 2000 ? + <> + { + isEdit && parentRow?.BILL_STATE < 9000 ? + <> + + + : + + } + : "" + } + , + + ] + }} + /> + } +
@@ -776,54 +877,93 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow, par setSelectRealEstateModal(false) }} confirmLoading={realEstateLoading} + bodyStyle={{ + height: '700px', // 你可以根据需要调整高度 + overflowY: 'auto', + }} + footer={showType === 'search' ? '' :
+ + +
} + onOk={async () => { - let data = realEstateRef?.current?.selectRowDetail - // 开始保存内容 - handleGetSelectRealEstate(data) - if (tableEditData && tableEditData.length > 0) { - setRealEstateLoading(true) - let list: any = JSON.parse(JSON.stringify(tableEditData)) - let idList: any = [] - if (data && data.length > 0) { - idList = data.map((item: any) => Number(item.REALESTATE_ID)) - } - - list.forEach((item: any) => { - if (item.REALESTATE_ID === currentRow?.REALESTATE_ID) { - item.REALESTATE_ID = idList && idList.length > 0 ? Number(idList.toString()) : "" - } - }) - setSelectRealEstateId(idList) - let newreqResult: any = { - name: "", - value: encryptAES(JSON.stringify({ list: list })) - } - const res: any = await handleSynchroBILLDETAILList(newreqResult) - if (res.Result_Code === 100) { - message.success('同步成功!') - detailActionRef.current?.reload() - setCurrentRow(undefined) - if (parentTableRef) { - parentTableRef.current?.reload() - } - } else { - message.error(data.Result_Desc) - } - } - setSelectRealEstateModal(false) - setRealEstateLoading(false) }} > - +
); diff --git a/yarn.lock b/yarn.lock index 51edb6a..b566def 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5005,7 +5005,7 @@ data-view-byte-offset@^1.0.1: es-errors "^1.3.0" is-data-view "^1.0.1" -dayjs@^1.11.10, dayjs@^1.11.11, dayjs@^1.11.7: +dayjs@1.11.13, dayjs@^1.11.10, dayjs@^1.11.11, dayjs@^1.11.7: version "1.11.13" resolved "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.13.tgz#92430b0139055c3ebb60150aa13e860a4b5a366c" integrity sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==