This commit is contained in:
ylj20011123 2025-12-15 18:31:12 +08:00
parent 1e71004070
commit fc695d48d3
10 changed files with 1020 additions and 21 deletions

View File

@ -73,6 +73,11 @@ export default [
name: '租金对比',
component: "@/pages/rentComparison/index",
},
{
path: '/realEstate/index',
name: '不动产管理',
component: "@/pages/realEstate/index",
},
]

View File

@ -299,6 +299,12 @@ const UserModel: UserModelType = {
name: '租金对比',
component: "@/pages/rentComparison/index",
},
{
path: '/realEstate/index',
redirect: '',
name: '不动产管理',
component: "@/pages/realEstate/index",
},
]
}
@ -381,6 +387,7 @@ const UserModel: UserModelType = {
"/operationReport/rectificationStatus",
"/RentCalculation/index",
"/rentComparison/index",
"/realEstate/index",
// '/examine/index',
// '/examine/modal',
// '/examine/question',

View File

@ -236,7 +236,6 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
handleInvoice(record)
handleSynchroAPPLYAPPROVEFun(1, record)
}
}
}
onCancel={() => { }}
@ -269,7 +268,6 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
title="确认手动开票?"
onConfirm={async () => {
// 通知金蝶 手动开票!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
let data = await hanleManualInvoicing(record)
if (data.success) {
@ -340,6 +338,7 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
}
let responseOld = await handleGetForwardJDPJInterface(newTokenReq2)
responseOld = JSON.parse(responseOld as any)
if (responseOld && (responseOld.success || responseOld.errorCode == 10905)) {

View File

@ -13,6 +13,7 @@ const authority: PageAuthority = {
'/operationReport/rectificationStatus': ['/operationReport/rectificationStatus'],
'/RentCalculation/index': ['/RentCalculation/index'],
'/rentComparison/index': ['/rentComparison/index'],
'/realEstate/index': ['/realEstate/index'],
};

View File

@ -0,0 +1,59 @@
import { connect } from "umi";
import { ConnectState } from "@/models/global";
import { Button } from "antd";
import Popconfirm from "antd/es/popconfirm";
type DetailProps = {
hideDelete?: boolean
handleDelete?: any
hideCancel?: boolean
handleCancel?: any
hideOK?: boolean
handleOK?: any
confirmLoading?: boolean // 确认按钮的加载效果
}
const ModalFooter = ({ hideDelete, handleDelete, hideCancel, handleCancel, hideOK, handleOK, confirmLoading }: DetailProps) => {
return (
<div style={{ width: '100%', boxSizing: 'border-box', padding: '0 12px', display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
<div>
{
hideDelete ? "" :
<Popconfirm
title="确认删除?"
onConfirm={async () => {
if (handleDelete) {
handleDelete()
}
}}
>
<Button type="primary" danger loading={confirmLoading}></Button>
</Popconfirm>
}
</div>
<div>
{
hideCancel ? '' :
<Button onClick={() => {
if (handleCancel) {
handleCancel()
}
}}></Button>
}
{
hideOK ? '' :
<Button type={"primary"} style={{ marginLeft: '8px' }} loading={confirmLoading} onClick={() => {
if (handleOK) {
handleOK()
}
}}></Button>
}
</div>
</div>
)
}
export default connect(({ user }: ConnectState) => ({
currentUser: user.data
}))(ModalFooter);

View File

@ -0,0 +1,560 @@
// 不动产管理
import { useEffect, useImperativeHandle, useRef, useState } from "react";
import LeftSelectTree from "@/components/leftSelectTree/leftSelectTree";
import { ActionType, FormInstance, ProForm, ProFormDatePicker, ProFormDateRangePicker, ProFormDigitRange, ProFormSelect, ProFormText, ProFormTextArea, ProTable } from "@ant-design/pro-components";
import { handleDeleteREALESTATE, handleGetREALESTATEList, handleSynchroREALESTATE } from "./service";
import moment from "moment";
import { encryptAES } from "@/utils/handleAes";
import { Button, Col, message, Modal, Row } from "antd";
import ModalFooter from "./components/modalFooter";
import { handleGetPassportInfoById } from "../DigitalElectronics/service";
// 引入地址解析工具
import { handleAddressChange, parseAddress } from "@/utils/addressParser";
import { handleGetServerpartDDL } from "../serverpartAssets/service";
import { handleGetSERVERPARTDetail } from "../operationReport/service";
const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { serverPartId: string, isComponent: boolean, onRef?: any, selectRealEstateId?: any }) => {
const actionRef = useRef<ActionType>();
const formRef = useRef<FormInstance>();
const modalFormRef = useRef<FormInstance>();
// 树相关的属性和方法
const [selectedId, setSelectedId] = useState<string>()
const [collapsible, setCollapsible] = useState<boolean>(false)
// 添加不动产内容的悬浮框
const [showDetail, setShowDetail] = useState<boolean>(false)
// 当前行数据
const [currentRow, setCurrentRow] = useState<any>()
// 判断是不是第一次进入到页面
const [isFirst, setIsFirst] = useState<boolean>(true)
// 获取用户信息
const [userInfo, setUserInfo] = useState<any>()
// 拿到服务区列表
const [serverPartList, setServerPartList] = useState<any>()
// 悬浮框点击确认的按钮加载效果
const [confirmLoading, setConfirmLoading] = useState<boolean>(false)
// 选中的行数据详情
const [selectRowDetail, setSelectRowDetail] = useState<any>()
// 列表配置
const columns: any = [
{
title: "统计日期",
dataIndex: "staticDate",
hideInTable: true,
valueType: "dateRange",
initialValue: [moment().startOf('M'), moment()],
search: {
transform: (value: any) => {
return {
START_LEASEDATE_End: moment().startOf('y').format('YYYY-MM-DD'),
END_LEASEDATE_Start: moment().format('YYYY-MM-DD')
};
},
},
fieldProps: {
picker: "day",
format: 'YYYY-MM-DD',
}
},
{
title: "服务区名称",
dataIndex: "SERVERPART_NAME",
hideInSearch: true,
ellipsis: true,
width: 180,
align: 'center'
},
{
title: "不动产类型",
dataIndex: "REALESTATE_TYPE",
width: 150,
valueType: "select",
align: 'center',
valueEnum: {
1000: "房屋租赁",
2000: "车辆资产",
}
},
{
title: "产权证号",
dataIndex: "ESTATE_IDENTITY",
hideInSearch: true,
ellipsis: true,
width: 150,
align: 'center',
render: (_, record) => {
return record?.ESTATE_IDENTITY ? isComponent ? record?.ESTATE_IDENTITY : <a onClick={() => {
setCurrentRow(record)
setShowDetail(true)
}}>
{record?.ESTATE_IDENTITY}
</a> : ""
}
},
{
title: "资料编码",
dataIndex: "SPECIALINDUSTRY_NUMBER",
hideInSearch: true,
ellipsis: true,
width: 150,
align: 'center',
render: (_, record) => {
return record?.SPECIALINDUSTRY_NUMBER ? isComponent ? record?.ESTATE_IDENTITY : <a onClick={() => {
setCurrentRow(record)
setShowDetail(true)
}}>
{record?.SPECIALINDUSTRY_NUMBER}
</a> : ""
}
},
{
title: "查询内容",
dataIndex: "searchText",
hideInTable: true,
fieldProps: {
placeholder: "请输入省份名称/城市名称",
}
},
{
title: "省份名称",
dataIndex: "PROVINCE_NAME",
hideInSearch: true,
ellipsis: true,
width: 150,
align: 'center'
},
{
title: "城市名称",
dataIndex: "CITY_NAME",
hideInSearch: true,
ellipsis: true,
width: 150,
align: 'center'
},
{
title: "详细地址",
dataIndex: "REALESTATE_ADDRESS",
hideInSearch: true,
ellipsis: true,
width: 180,
align: 'center'
},
{
title: "是否跨地",
dataIndex: "CROSS_CITYSIGN",
hideInSearch: true,
ellipsis: true,
width: 120,
align: 'center',
render: (_: any, record: any) => {
return record?.CROSS_CITYSIGN ? "是" : "否"
}
},
{
title: "面积单位",
dataIndex: "AREA_UNIT",
hideInSearch: true,
ellipsis: true,
width: 120,
align: 'center'
},
{
title: "租赁期限",
dataIndex: "LEASEDATE",
hideInSearch: true,
ellipsis: true,
width: 250,
align: 'center',
render: (_: any, record: any) => {
return `${record?.START_LEASEDATE || ""}${record?.END_LEASEDATE ? `-${record?.END_LEASEDATE}` : ''}`
}
}
]
// 获取当前用户信息的方法
const handleGetUserInfo = async () => {
const search = window.location.search;
const addressParams: any = Object.fromEntries(new URLSearchParams(search).entries());
const req: any = {
UserIdEncrypted: addressParams.UserIdEncrypted
}
const data = await handleGetPassportInfoById(req)
console.log('dsajikajds', data);
setUserInfo(data)
}
// 新增和同步不动产的方法
const handleAddOrUpdate = async (values: any) => {
// 准备入参
let req: any = {}
console.log('valuesvalues', values);
let [start, end] = [moment(values?.LEASEDATE[0].$d).format('YYYY-MM-DD HH:mm:ss'), moment(values?.LEASEDATE[1].$d).format('YYYY-MM-DD HH:mm:ss')]
if (currentRow?.REALESTATE_ID) {
req = {
...currentRow,
...values,
LEASEDATE: "",
START_LEASEDATE: start || "",
END_LEASEDATE: end || "",
REALESTATE_STATE: 1,
STAFF_ID: userInfo?.ID,
STAFF_NAME: userInfo?.Name,
OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss')
}
} else {
req = {
...values,
LEASEDATE: "",
REALESTATE_STATE: 1,
START_LEASEDATE: start || "",
END_LEASEDATE: end || "",
STAFF_ID: userInfo?.ID,
STAFF_NAME: userInfo?.Name,
OPERATE_DATE: moment().format('YYYY-MM-DD HH:mm:ss')
}
}
console.log('reqreqreqreq', req);
let reqData: any = {
name: "",
value: encryptAES(JSON.stringify(req))
}
const data: any = await handleSynchroREALESTATE(reqData)
setConfirmLoading(false)
if (data?.Result_Code === 100) {
message.success('添加成功!');
setCurrentRow(undefined)
setShowDetail(false)
actionRef.current?.reload()
} else {
message.error(data?.Result_Desc || '添加失败')
}
}
// 删除不动产
const handleDeleteOrUpdate = async (id: string) => {
const req: any = {
REALESTATEId: id
}
let reqData: any = {
name: "",
value: encryptAES(JSON.stringify(req))
}
const data: any = await handleDeleteREALESTATE(reqData)
setConfirmLoading(false)
if (data?.Result_Code === 100) {
message.success('删除成功!');
setCurrentRow(undefined)
setShowDetail(false)
actionRef.current?.reload()
} else {
message.error(data?.Result_Desc || '删除失败')
}
}
useEffect(() => {
if (isFirst) {
handleGetUserInfo()
setIsFirst(false)
}
}, [])
useImperativeHandle(onRef, () => ({
selectRowDetail
}));
return <div style={{ height: isComponent ? '600px' : 'calc(100vh - 100px)', backgroundColor: '#fff', display: 'flex' }}>
{
isComponent ? '' :
<LeftSelectTree setSelectedId={setSelectedId} setCollapsible={setCollapsible} collapsible={collapsible} />
}
<div style={{
width: isComponent ? 'calc(100%)' : !collapsible ? 'calc(100% - 300px)' : 'calc(100% - 60px)',
paddingTop: 0,
paddingBottom: 0,
paddingRight: 0
}}>
<ProTable
actionRef={actionRef}
formRef={formRef}
columns={columns}
bordered
rowKey={'REALESTATE_ID'}
scroll={{ x: '100%', y: 'calc(100vh - 450px)' }}
headerTitle={'不动产列表'}
search={isComponent ? false : { span: 6, }}
request={async (params) => {
if (!selectedId && !isComponent) {
return []
}
const req: any = {
searchParameter: {
REALESTATE_TYPE: isComponent ? '' : params?.REALESTATE_TYPE || "",// 不动产类型
SERVERPART_IDS: isComponent ? serverPartId : selectedId,
START_LEASEDATE_End: isComponent ? '' : params?.END_LEASEDATE_Start || "",
END_LEASEDATE_Start: isComponent ? '' : params?.START_LEASEDATE_End || "",
REALESTATE_STATE: 1
},
PageIndex: 1,
PageSize: 999999,
keyWord: {
Key: "PROVINCE_NAME,CITY_NAME",
Value: params?.searchText || ""
}
}
let newReq: any = {
name: "",
value: encryptAES(JSON.stringify(req))
}
const data: any = await handleGetREALESTATEList(newReq)
console.log('datadatadata', data);
if (data && data.length > 0) {
return { data, success: true }
}
return { data: [], success: true }
}}
rowSelection={isComponent ? {
type: 'checkbox',
defaultSelectedRowKeys: selectRealEstateId || [],
onChange: (_, row) => {
console.log('__', _);
console.log('row', row);
setSelectRowDetail(row)
}
} : false}
toolbar={{
actions: [
<Button type="primary" onClick={() => {
setShowDetail(true)
}}></Button>
]
}}
/>
</div>
<Modal
title={currentRow?.REALESTATE_ID ? '编辑不动产' : '添加不动产'}
destroyOnClose
width={1200}
open={showDetail}
className="realEstateModalBox"
onCancel={() => {
setCurrentRow(undefined)
setShowDetail(false)
}}
confirmLoading={confirmLoading}
footer={
<ModalFooter
confirmLoading={confirmLoading}
hideDelete={!currentRow?.REALESTATE_ID}
handleDelete={async () => {
setConfirmLoading(true)
await handleDeleteOrUpdate(currentRow?.REALESTATE_ID)
}}
handleCancel={() => {
setCurrentRow(undefined)
setShowDetail(false)
}}
handleOK={() => {
modalFormRef.current?.validateFields().then(async (res) => {
setConfirmLoading(true)
await handleAddOrUpdate(res)
})
}}
/>
}
>
<ProForm
formRef={modalFormRef}
submitter={false}
request={async () => {
if (currentRow?.REALESTATE_ID) {
return {
...currentRow,
SERVERPART_ID: currentRow?.SERVERPART_ID.toString(),
LEASEDATE: [moment(currentRow?.START_LEASEDATE), moment(currentRow?.END_LEASEDATE)]
}
} else {
return {}
}
}}
onFinish={() => {
}}
>
<Row gutter={16}>
<Col span={8}>
<ProFormSelect
label={'不动产类型'}
name={'REALESTATE_TYPE'}
options={[
{ label: "房屋租赁", value: 1000 },
{ label: "车辆资产", value: 2000 },
]}
rules={[{
required: true,
message: '请选择不动产类型!'
}]}
/>
</Col>
<Col span={8}>
<ProFormSelect
label={'服务区'}
name={'SERVERPART_ID'}
options={[
{ label: "房屋租赁", value: 1000 },
{ label: "车辆资产", value: 2000 },
]}
request={async () => {
if (serverPartList && serverPartList.length > 0) {
return serverPartList
} else {
const req: any = {
ProvinceCode: "530000",
}
let list: any = []
const data = await handleGetServerpartDDL(req)
if (data && data.length > 0) {
list = data
setServerPartList(list)
} else {
setServerPartList([])
}
return list
}
}}
fieldProps={{
showSearch: true,
filterOption: (input, option) =>
(option?.label ?? '').toLowerCase().includes(input.toLowerCase()),
optionFilterProp: 'label',
onChange: async (value, option: any) => {
modalFormRef.current?.setFieldsValue({ SERVERPART_NAME: option.title })
// 顺便拿个 服务区详情
let detail: any = await handleGetSERVERPARTDetail({ SERVERPARTId: value })
// 从地址里面 解出 城市(市区)
let address: any = parseAddress(detail?.SERVERPART_ADDRESS);
modalFormRef.current?.setFieldsValue({ PROVINCE_NAME: detail?.PROVINCE_NAME, CITY_NAME: address?.city, REALESTATE_ADDRESS: detail?.SERVERPART_ADDRESS })
}
}}
rules={[{
required: true,
message: '请选择服务区!'
}]}
/>
</Col>
<Col span={8} style={{ display: 'none' }}>
<ProFormText
label={'服务区'}
name={'SERVERPART_NAME'}
/>
</Col>
<Col span={8}>
<ProFormDateRangePicker
label={'租赁日期'}
name={"LEASEDATE"}
style={{ width: '100%' }}
/>
</Col>
<Col span={8} >
<ProFormText
label={'省份名称'}
name={'PROVINCE_NAME'}
/>
</Col>
<Col span={8} >
<ProFormText
label={'城市名称'}
name={'CITY_NAME'}
/>
</Col>
<Col span={8} >
<ProFormSelect
label={'跨地标志'}
name={'CROSS_CITYSIGN'}
options={[
{ label: "是", value: 1 },
{ label: "否", value: 0 },
]}
/>
</Col>
<Col span={24} >
<ProFormTextArea
label={'详细地址'}
name={'REALESTATE_ADDRESS'}
/>
</Col>
<Col span={8} >
<ProFormSelect
label={'面积单位'}
name={'AREA_UNIT'}
options={[
{ label: "平方千米", value: 1 },
{ label: "平方米", value: 2 },
{ label: "公顷", value: 3 },
{ label: "亩", value: 4 },
{ label: "h㎡", value: 5 },
{ label: "k㎡", value: 6 },
{ label: "㎡", value: 7 }
]}
/>
</Col>
<Col span={8} >
<ProFormText
label={'产权证号'}
name={'ESTATE_IDENTITY'}
rules={[
({ getFieldValue }) => ({
validator(_: any, value: any) {
if (value || getFieldValue('SPECIALINDUSTRY_NUMBER')) {
return Promise.resolve();
}
return Promise.reject(new Error('产权证号和资料编码至少填写一个'));
},
}),
]}
/>
</Col>
<Col span={8} >
<ProFormText
label={'资料编码'}
name={'SPECIALINDUSTRY_NUMBER'}
rules={[
({ getFieldValue }) => ({
validator(_: any, value: any) {
if (value || getFieldValue('ESTATE_IDENTITY')) {
return Promise.resolve();
}
return Promise.reject(new Error('产权证号和资料编码至少填写一个'));
},
}),
]}
/>
</Col>
</Row>
</ProForm>
</Modal>
</div >
}
export default RealEstate

View File

@ -0,0 +1,44 @@
import requestOld from "@/utils/requestOld"
// 获取不动产信息表列表
export async function handleGetREALESTATEList(params: any) {
const data = await requestOld(`/Invoice/GetREALESTATEList`, {
method: 'POST',
data: params
})
if (data.Result_Code !== 100) {
return data
}
return data.Result_Data.List
}
// 同步不动产信息表
export async function handleSynchroREALESTATE(params: any) {
const data = await requestOld(`/Invoice/SynchroREALESTATE`, {
method: 'POST',
data: params
})
if (data.Result_Code !== 100) {
return data
}
return data
}
// 删除不动产信息
export async function handleDeleteREALESTATE(params: any) {
const data = await requestOld(`/Invoice/DeleteREALESTATE`, {
method: 'POST',
data: params
})
if (data.Result_Code !== 100) {
return data
}
return data
}

View File

@ -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 } from "antd";
import { Col, Drawer, FormInstance, Row, Table, Typography, Space, Button, Empty, Divider, Input, message, Select, Modal } from "antd";
import { connect } from "umi";
import { ActionType, ProTable } from "@ant-design/pro-components";
import { handleGetAPPLYAPPROVEList, handleGetBILLDETAILList, handleSynchroBILLDETAILList } from "@/pages/DigitalElectronics/service";
@ -8,6 +8,8 @@ import moment from "moment";
import { encryptAES } from "@/utils/handleAes";
import { exportXlsxFromProColumnsExcelJS } from "@/utils/exportExcelFun";
import { getFieldEnum } from "@/pages/serverpartAssets/service";
import RealEstate from "@/pages/realEstate";
import { handleGetREALESTATEList } from "@/pages/realEstate/service";
const { Text } = Typography;
@ -24,6 +26,7 @@ interface ParamsType {
const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: ParamsType) => {
const realEstateRef = useRef<any>();
const formRef = useRef<FormInstance<any>>();
const detailActionRef = useRef<ActionType>();
// 保存的加载效果
@ -49,6 +52,15 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P
const [tableEditData, setTableEditData] = useState<any>();
// 税率枚举列表
const [taxRateList, setTaxRateList] = useState<any>();
// 不动产信息
const [realEstateData, setRealEstateData] = useState<any>();
// 选择不动产的悬浮框
const [selectRealEstateModal, setSelectRealEstateModal] = useState<any>();
// 选择的不动产id
const [selectRealEstateId, setSelectRealEstateId] = useState<any>();
// 选择不动产的loading
const [realEstateLoading, setRealEstateLoading] = useState<boolean>(false);
const detailColumns: any = [
{
@ -221,16 +233,107 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P
}
];
// 不动产列表配置
const realEstateColumns: any = [
{
title: "服务区名称",
dataIndex: "SERVERPART_NAME",
hideInSearch: true,
ellipsis: true,
width: 180,
align: 'center'
},
{
title: "不动产类型",
dataIndex: "REALESTATE_TYPE",
width: 150,
valueType: "select",
align: 'center',
valueEnum: {
1000: "房屋租赁",
2000: "车辆资产",
}
},
{
title: "产权证号",
dataIndex: "ESTATE_IDENTITY",
hideInSearch: true,
ellipsis: true,
width: 150,
align: 'center',
},
{
title: "资料编码",
dataIndex: "SPECIALINDUSTRY_NUMBER",
hideInSearch: true,
ellipsis: true,
width: 150,
align: 'center',
},
{
title: "省份名称",
dataIndex: "PROVINCE_NAME",
hideInSearch: true,
ellipsis: true,
width: 150,
align: 'center'
},
{
title: "城市名称",
dataIndex: "CITY_NAME",
hideInSearch: true,
ellipsis: true,
width: 150,
align: 'center'
},
{
title: "详细地址",
dataIndex: "REALESTATE_ADDRESS",
hideInSearch: true,
ellipsis: true,
width: 180,
align: 'center'
},
{
title: "是否跨地",
dataIndex: "CROSS_CITYSIGN",
hideInSearch: true,
ellipsis: true,
width: 120,
align: 'center',
render: (_: any, record: any) => {
return record?.CROSS_CITYSIGN ? "是" : "否"
}
},
{
title: "面积单位",
dataIndex: "AREA_UNIT",
hideInSearch: true,
ellipsis: true,
width: 120,
align: 'center'
},
{
title: "租赁期限",
dataIndex: "LEASEDATE",
hideInSearch: true,
ellipsis: true,
width: 250,
align: 'center',
render: (_: any, record: any) => {
return `${record?.START_LEASEDATE || ""}${record?.END_LEASEDATE ? `-${record?.END_LEASEDATE}` : ''}`
}
}
]
// 保存税务代码触发的事件
const handleSaveTaxCode = async () => {
// 当前的表格数据
console.log('tableEditDatatableEditDatatableEditData', tableEditData);
let newreqResult: any = {
name: "",
value: encryptAES(JSON.stringify({ list: tableEditData }))
}
setSaveLoading(true)
console.log('newreqResultnewreqResult', newreqResult);
const data = await handleSynchroBILLDETAILList(newreqResult)
setSaveLoading(false)
@ -243,6 +346,11 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P
}
}
// 拿到选择的不动产 给表格显示
const handleGetSelectRealEstate = (data: any) => {
setRealEstateData(data)
}
return (
<Drawer
width="70%"
@ -362,6 +470,8 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P
</Col>
</Row>
{/* 发票明细 */}
<div style={{ marginTop: 24 }}>
<Space direction="vertical" style={{ width: '100%' }}>
@ -374,7 +484,6 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P
scroll={{ x: "100%", y: '500px' }}
pagination={false}
request={async () => {
console.log('parentRowparentRowparentRow', parentRow);
const billDetail = await handleGetBILLDETAILList({
SearchParameter: {
BILL_ID: parentRow?.BILL_ID
@ -383,9 +492,15 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P
PageSize: 999999,
SortStr: "BILLDETAIL_ID"
})
console.log('billDetailbillDetailbillDetail', billDetail);
if (billDetail && billDetail.length > 0) {
let idList: any = billDetail[0].REALESTATE_ID ? billDetail[0].REALESTATE_ID.split(',') : ""
console.log('idListidListidList', idList);
if (idList && idList.length > 0) {
detailActionRef.current?.reload()
setSelectRealEstateId(idList)
}
setTableEditData(billDetail)
setReqDetailList(billDetail)
return { data: billDetail, success: true }
@ -400,20 +515,24 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P
actions: [
<>
{
isEdit && parentRow?.BILL_STATE < 9000 ?
parentRow?.BILL_STATE <= 2000 ?
<>
<Button type="primary" loading={saveLoading} style={{ marginRight: '4px' }} onClick={() => {
handleSaveTaxCode()
}}></Button>
<Button onClick={() => {
setIsEdit(false)
}}></Button>
</> :
<Button type="primary" onClick={() => {
setIsEdit(true)
}}></Button>
{
isEdit && parentRow?.BILL_STATE < 9000 ?
<>
<Button type="primary" loading={saveLoading} style={{ marginRight: '4px' }} onClick={() => {
handleSaveTaxCode()
}}></Button>
<Button onClick={() => {
setIsEdit(false)
}}></Button>
</> :
<Button type="primary" onClick={() => {
setIsEdit(true)
}}></Button>
}
</> : ""
}
</>,
<Button type={'primary'} onClick={async () => {
exportXlsxFromProColumnsExcelJS(detailColumns,
@ -433,6 +552,68 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P
</Space>
</div>
{/* 不动产信息 */}
<div style={{ marginTop: 24 }}>
<Space direction="vertical" style={{ width: '100%' }}>
<Text strong></Text>
</Space>
<div>
<ProTable
actionRef={detailActionRef}
search={false}
columns={realEstateColumns}
bordered
scroll={{ x: "100%", y: '500px' }}
pagination={false}
// dataSource={realEstateData}
request={async () => {
if (selectRealEstateId && selectRealEstateId.length > 0) {
const req: any = {
searchParameter: {
REALESTATE_IDS: selectRealEstateId.toString()
},
PageIndex: 1,
PageSize: 999999,
}
let newReq: any = {
name: "",
value: encryptAES(JSON.stringify(req))
}
const data: any = await handleGetREALESTATEList(newReq)
if (data && data.length > 0) {
return { data, success: true }
}
return { data: [], success: true }
} else {
return { data: [], success: true }
}
}}
columnsState={{
value: columnsStateMap,
onChange: setColumnsStateMap,
}}
toolbar={{
actions: [
<>
{
parentRow?.BILL_STATE <= 2000 ?
<Button type={'primary'} onClick={async () => {
// 点击开的时候判断一下 当前是否已经有选择的不动产内容了 有的话 要带回去给表格默认勾选
// let rowKey: any = []
// if (realEstateData && realEstateData.length > 0) {
// rowKey = realEstateData.map((item: any) => item.REALESTATE_ID)
// }
// setSelectRealEstateId(rowKey)
setSelectRealEstateModal(true)
}}></Button> : ''
}
</>
]
}}
/>
</div>
</div>
{/* 审批意见 */}
<div style={{ marginTop: 24 }}>
<Space direction="vertical" style={{ width: '100%' }}>
@ -444,7 +625,6 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P
options={false}
bordered
request={async () => {
console.log('parentRowparentRowparentRow', parentRow);
// 拿个税率的枚举
const taxRateLabel: any = await getFieldEnum({ FieldExplainField: 'DUTY_PARAGRAPH', notformate: true })
setTaxRateList(taxRateLabel)
@ -464,7 +644,6 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P
}
const data = await handleGetAPPLYAPPROVEList(reqData)
console.log('data', data);
if (data && data.length > 0) {
return { data, success: true }
}
@ -474,7 +653,57 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P
</Space>
</div>
</ProForm>
{/* 不动产的悬浮框 */}
<Modal
width={1200}
title={"选择不动产"}
open={selectRealEstateModal}
destroyOnClose
onCancel={() => {
setSelectRealEstateModal(false)
}}
confirmLoading={realEstateLoading}
onOk={async () => {
let data = realEstateRef?.current?.selectRowDetail
console.log('32131', data);
// 开始保存内容
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) => item.REALESTATE_ID)
}
list.forEach((item: any) => {
item.REALESTATE_ID = idList ? 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()
} else {
message.error(data.Result_Desc)
}
}
setSelectRealEstateModal(false)
setRealEstateLoading(false)
}}
>
<RealEstate serverPartId={parentRow?.SERVERPART_ID} isComponent={true} onRef={realEstateRef} selectRealEstateId={selectRealEstateId} />
</Modal>
</Drawer>
);
};

View File

@ -229,6 +229,24 @@ export async function handleGetServerpartTree(params?: any) {
return data.Result_Data.List;
}
// 拿到服务区的非树形列表
export async function handleGetServerpartDDL(params?: any) {
const data = await requestSamember(`/BaseInfo/GetServerpartDDL`, {
method: 'GET',
params
});
if (data.Result_Code !== 100) {
return {
data: [],
}
}
return data.Result_Data.List;
}
export async function getFieldEnumTreeNoSession(params: any) {
const data = await requestSamember(`/FrameWork/GetFieldEnumTree`, {
method: 'GET',

View File

@ -0,0 +1,77 @@
/**
*
*/
/**
*
* @param fullAddress (格式: 省市区街道****)
* @returns {city: string, district: string, cityDistrict: string}
* - city: 市级信息
* - district: 区级信息
* - cityDistrict: 市区组合+
*/
export const parseAddress = (fullAddress: string) => {
let city = '';
let district = '';
let cityDistrict = '';
// 先尝试匹配常见的省份模式,然后从剩余字符串中提取市区信息
// 省份通常在地址开头,格式如"江苏省南京市鼓楼区..."
const provincePattern = /^(\S+省|\S+自治区|\S+特别行政区)/;
const addressWithoutProvince = fullAddress.replace(provincePattern, '');
// 市级匹配模式:市、自治州(在去除省份后的地址中查找)
const cityPatterns = [
/(\S+自治州)/, // 匹配自治州
/(\S+市)/ // 匹配市
];
// 区级匹配模式:区、县、自治县、第二个市
const districtPatterns = [
/(?:自治州|市)(\S+区)/, // 自治州或市后面的区
/(?:自治州|市)(\S+自治县)/, // 自治州或市后面的自治县
/(?:自治州|市)(\S+县)/, // 自治州或市后面的县
/(?:自治州|市)(\S+市)/ // 自治州或市后面的第二个市
];
// 查找市级信息(在去除省份后的地址中查找)
for (const pattern of cityPatterns) {
const match = addressWithoutProvince.match(pattern);
if (match) {
city = match[1];
break;
}
}
// 查找区级信息(在去除省份后的地址中查找)
for (const pattern of districtPatterns) {
const match = addressWithoutProvince.match(pattern);
if (match) {
district = match[1];
break;
}
}
// 组合市区信息(不包含省份)
if (city && district) {
cityDistrict = city + district;
} else if (city) {
cityDistrict = city;
} else if (district) {
cityDistrict = district;
}
return { city, district, cityDistrict };
};
/**
*
* @param value
* @returns
*/
export const handleAddressChange = (value: string) => {
if (value) {
return parseAddress(value);
}
return { city: '', district: '', cityDistrict: '' };
};