diff --git a/config/router.ts b/config/router.ts index b073145..48def77 100644 --- a/config/router.ts +++ b/config/router.ts @@ -73,6 +73,11 @@ export default [ name: '租金对比', component: "@/pages/rentComparison/index", }, + { + path: '/realEstate/index', + name: '不动产管理', + component: "@/pages/realEstate/index", + }, ] diff --git a/src/models/user.ts b/src/models/user.ts index a1f4f90..8e01725 100644 --- a/src/models/user.ts +++ b/src/models/user.ts @@ -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', diff --git a/src/pages/DigitalElectronics/index.tsx b/src/pages/DigitalElectronics/index.tsx index 441bd05..6806c61 100644 --- a/src/pages/DigitalElectronics/index.tsx +++ b/src/pages/DigitalElectronics/index.tsx @@ -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)) { diff --git a/src/pages/authority.ts b/src/pages/authority.ts index 8f78c8f..5acffb7 100644 --- a/src/pages/authority.ts +++ b/src/pages/authority.ts @@ -13,6 +13,7 @@ const authority: PageAuthority = { '/operationReport/rectificationStatus': ['/operationReport/rectificationStatus'], '/RentCalculation/index': ['/RentCalculation/index'], '/rentComparison/index': ['/rentComparison/index'], + '/realEstate/index': ['/realEstate/index'], }; diff --git a/src/pages/realEstate/components/modalFooter.tsx b/src/pages/realEstate/components/modalFooter.tsx new file mode 100644 index 0000000..766d1fc --- /dev/null +++ b/src/pages/realEstate/components/modalFooter.tsx @@ -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 ( +
+
+ { + hideDelete ? "" : + { + if (handleDelete) { + handleDelete() + } + }} + > + + + + } +
+
+ { + hideCancel ? '' : + + } + { + hideOK ? '' : + + } +
+
+ ) +} + +export default connect(({ user }: ConnectState) => ({ + currentUser: user.data +}))(ModalFooter); \ No newline at end of file diff --git a/src/pages/realEstate/index.tsx b/src/pages/realEstate/index.tsx new file mode 100644 index 0000000..6ded3e2 --- /dev/null +++ b/src/pages/realEstate/index.tsx @@ -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(); + const formRef = useRef(); + const modalFormRef = useRef(); + // 树相关的属性和方法 + const [selectedId, setSelectedId] = useState() + const [collapsible, setCollapsible] = useState(false) + // 添加不动产内容的悬浮框 + const [showDetail, setShowDetail] = useState(false) + // 当前行数据 + const [currentRow, setCurrentRow] = useState() + // 判断是不是第一次进入到页面 + const [isFirst, setIsFirst] = useState(true) + // 获取用户信息 + const [userInfo, setUserInfo] = useState() + // 拿到服务区列表 + const [serverPartList, setServerPartList] = useState() + // 悬浮框点击确认的按钮加载效果 + const [confirmLoading, setConfirmLoading] = useState(false) + // 选中的行数据详情 + const [selectRowDetail, setSelectRowDetail] = useState() + + + + // 列表配置 + 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 : { + setCurrentRow(record) + setShowDetail(true) + }}> + {record?.ESTATE_IDENTITY} + : "" + } + }, + { + title: "资料编码", + dataIndex: "SPECIALINDUSTRY_NUMBER", + hideInSearch: true, + ellipsis: true, + width: 150, + align: 'center', + render: (_, record) => { + return record?.SPECIALINDUSTRY_NUMBER ? isComponent ? record?.ESTATE_IDENTITY : { + setCurrentRow(record) + setShowDetail(true) + }}> + {record?.SPECIALINDUSTRY_NUMBER} + : "" + } + }, + { + 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
+ { + isComponent ? '' : + + } + +
+ + { + 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: [ + + ] + }} + /> +
+ + { + setCurrentRow(undefined) + setShowDetail(false) + }} + confirmLoading={confirmLoading} + footer={ + { + setConfirmLoading(true) + await handleDeleteOrUpdate(currentRow?.REALESTATE_ID) + }} + handleCancel={() => { + setCurrentRow(undefined) + setShowDetail(false) + }} + handleOK={() => { + modalFormRef.current?.validateFields().then(async (res) => { + setConfirmLoading(true) + await handleAddOrUpdate(res) + }) + }} + /> + } + > + { + if (currentRow?.REALESTATE_ID) { + return { + ...currentRow, + SERVERPART_ID: currentRow?.SERVERPART_ID.toString(), + LEASEDATE: [moment(currentRow?.START_LEASEDATE), moment(currentRow?.END_LEASEDATE)] + } + } else { + return {} + } + }} + onFinish={() => { + }} + > + + + + + + + { + 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: '请选择服务区!' + }]} + /> + + + + + + + + + + + + + + + + + + + + + + + + + ({ + validator(_: any, value: any) { + if (value || getFieldValue('SPECIALINDUSTRY_NUMBER')) { + return Promise.resolve(); + } + return Promise.reject(new Error('产权证号和资料编码至少填写一个')); + }, + }), + ]} + /> + + + ({ + validator(_: any, value: any) { + if (value || getFieldValue('ESTATE_IDENTITY')) { + return Promise.resolve(); + } + return Promise.reject(new Error('产权证号和资料编码至少填写一个')); + }, + }), + ]} + /> + + + + + + + + + +
+} + + +export default RealEstate \ No newline at end of file diff --git a/src/pages/realEstate/service.ts b/src/pages/realEstate/service.ts new file mode 100644 index 0000000..3360191 --- /dev/null +++ b/src/pages/realEstate/service.ts @@ -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 +} \ No newline at end of file diff --git a/src/pages/redReversal/components/InvoiceDetial.tsx b/src/pages/redReversal/components/InvoiceDetial.tsx index 879b032..36bdfea 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 } 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(); const formRef = useRef>(); const detailActionRef = useRef(); // 保存的加载效果 @@ -49,6 +52,15 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow }: P const [tableEditData, setTableEditData] = useState(); // 税率枚举列表 const [taxRateList, setTaxRateList] = useState(); + // 不动产信息 + const [realEstateData, setRealEstateData] = useState(); + // 选择不动产的悬浮框 + const [selectRealEstateModal, setSelectRealEstateModal] = useState(); + // 选择的不动产id + const [selectRealEstateId, setSelectRealEstateId] = useState(); + // 选择不动产的loading + const [realEstateLoading, setRealEstateLoading] = useState(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 ( + + {/* 发票明细 */}
@@ -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 ? <> - - - : - + { + isEdit && parentRow?.BILL_STATE < 9000 ? + <> + + + : + + } + : "" } - ,
+ {/* 不动产信息 */} +
+ + 不动产信息 + +
+ { + 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 ? + : '' + } + + ] + }} + /> +
+
+ {/* 审批意见 */}
@@ -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
+ + + + + {/* 不动产的悬浮框 */} + { + 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) + }} + > + +
); }; diff --git a/src/pages/serverpartAssets/service.ts b/src/pages/serverpartAssets/service.ts index cc84a68..3fb2b53 100644 --- a/src/pages/serverpartAssets/service.ts +++ b/src/pages/serverpartAssets/service.ts @@ -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', diff --git a/src/utils/addressParser.ts b/src/utils/addressParser.ts new file mode 100644 index 0000000..bb944df --- /dev/null +++ b/src/utils/addressParser.ts @@ -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: '' }; +}; \ No newline at end of file