diff --git a/src/components/leftSelectTree/leftSelectTree.tsx b/src/components/leftSelectTree/leftSelectTree.tsx index d5b2023..afc5eae 100644 --- a/src/components/leftSelectTree/leftSelectTree.tsx +++ b/src/components/leftSelectTree/leftSelectTree.tsx @@ -27,8 +27,10 @@ type DetailProps = { haveTest?: boolean;// 是否有测试服务区 handleGetLeftTreeData?: any // 拿到树数据的方法 必须要有输出值的 noWj?: any // 把万佳商贸隐藏 + serverPartType?: any // 查询的服务区的类型 + ServerpartSiteType?: any } -const LeftSelectTree = ({ setSelectedId, reload, actionRef, currentUser, width, otherFun, setCollapsible, collapsible, haveTest, handleGetLeftTreeData, noWj }: DetailProps) => { +const LeftSelectTree = ({ setSelectedId, reload, actionRef, currentUser, width, otherFun, setCollapsible, collapsible, haveTest, handleGetLeftTreeData, noWj, serverPartType, ServerpartSiteType }: DetailProps) => { const searchTreeRef = useRef(); // 默认的服务区树 const [allTreeViews, setAllTreeViews] = useState() @@ -47,7 +49,7 @@ const LeftSelectTree = ({ setSelectedId, reload, actionRef, currentUser, width, if (userInfo?.UserPattern === 2000) { data = await getMerchantShopTree({ BusinessManId: userInfo?.BusinessManID, ShowShop: false }); } else { - data = await getServerpartTree(userInfo?.ProvinceCode, userInfo?.CityAuthority, true, true, true, false, '1000,4000') + data = await getServerpartTree(userInfo?.ProvinceCode, userInfo?.CityAuthority, true, true, true, false, serverPartType ? serverPartType : '1000,4000', ServerpartSiteType) } // 判断是否有多个片区的权限 diff --git a/src/components/leftSelectTree/service.ts b/src/components/leftSelectTree/service.ts index 8a79d67..9b1a8ef 100644 --- a/src/components/leftSelectTree/service.ts +++ b/src/components/leftSelectTree/service.ts @@ -1,12 +1,12 @@ import request from "@/utils/requestOld" export async function getServerpartTree(ProvinceCode?: number | string, ServerpartCodes?: string, - ShowWholePower?: boolean, ShowSPRegion?: boolean, ShowRoyalty?: boolean | false, ShowCompactCount?: boolean | false, StatisticsType?: any): Promise { + ShowWholePower?: boolean, ShowSPRegion?: boolean, ShowRoyalty?: boolean | false, ShowCompactCount?: boolean | false, StatisticsType?: any, ServerpartSiteType?: any): Promise { // ShowRoyalty 无论传入什么都是false const data = await request(`/BaseInfo/GetServerpartTree? ProvinceCode=${ProvinceCode || ''}&ServerpartCodes=${ServerpartCodes || ''}& ShowWholePower=${ShowWholePower || false}&ShowWholePower=${ShowSPRegion || true}& - ShowRoyalty=${false}&ShowCompactCount=${ShowCompactCount || false}&StatisticsType=${StatisticsType || ''}`, { + ShowRoyalty=${false}&ShowCompactCount=${ShowCompactCount || false}&StatisticsType=${StatisticsType || ''}&ServerpartSiteType=${ServerpartSiteType || ''}`, { method: 'GET', }); if (data.Result_Code !== 100) { diff --git a/src/pages/InvoiceInquiry/index.tsx b/src/pages/InvoiceInquiry/index.tsx index 51c5b8b..8c5d209 100644 --- a/src/pages/InvoiceInquiry/index.tsx +++ b/src/pages/InvoiceInquiry/index.tsx @@ -9,6 +9,7 @@ import moment from "moment"; import { encryptAES } from "@/utils/handleAes"; import { ProForm, ProFormSelect, ProFormTextArea } from "@ant-design/pro-components"; import InvoiceDetial from "../redReversal/components/InvoiceDetial"; +import { exportXlsxFromProColumnsExcelJS } from "@/utils/exportExcelFun"; interface ConnectState { user: { @@ -62,6 +63,7 @@ const InvoiceInquiry: React.FC<{ currentUser: any }> = (props) => { BANK_NAME: { show: false }, BANK_ACCOUNT: { show: false }, }); + const [reqDetailList, setReqDetailList] = useState(); // 合计项数据源 const columns: any = [ { title: "查询条件", @@ -194,9 +196,244 @@ const InvoiceInquiry: React.FC<{ currentUser: any }> = (props) => { align: 'center', ellipsis: true, hideInSearch: true, - }, - + } ] + + // 导出的列表数据 + const detailColumns: any = [ + { + title: '序号', + dataIndex: 'index', + valueType: "index", + width: 70, + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + // { + // title: '发票代码', + // dataIndex: 'BILL_NO', + // width: 150, + // align: 'center', + // ellipsis: true, + // hideInSearch: true, + // }, + // { + // title: '发票号码', + // dataIndex: '', + // width: 250, + // align: 'center', + // ellipsis: true, + // hideInSearch: true, + // }, + { + title: '数电发票号码', + dataIndex: 'SERIAL_NO', + width: 180, + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + { + title: '销方识别号', + dataIndex: 'sellerTaxpayerId', + width: 180, + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + { + title: '销方名称', + dataIndex: 'sellerName', + width: 180, + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + { + title: '购方识别号', + dataIndex: 'TAXPAYER_IDENTIFYCODE', + width: 180, + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + { + title: '购买方名称', + dataIndex: 'MERCHANTS_NAME', + width: 180, + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + { + title: '开票日期', + dataIndex: 'BILL_DATE', + width: 180, + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + { + title: '税收分类编码', + dataIndex: 'TABLE_NAMESUM', + width: 180, + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + { + title: '特定业务类型', + dataIndex: 'specificBusinessType', + width: 180, + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + { + title: '货物或应税劳务名称', + dataIndex: 'ITEM_NAMESUM', + width: 180, + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + { + title: '规格型号', + dataIndex: 'ITEM_RULESUM', + width: 180, + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + { + title: '单位', + dataIndex: 'ITEM_UNITSUM', + width: 180, + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + { + title: '数量', + dataIndex: 'INVOICE_COUNTSUM', + width: 180, + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + { + title: '单价', + dataIndex: 'INVOICE_PRICESUM', + width: 180, + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + { + title: '金额', + dataIndex: 'INVOICE_AMOUNTSUM', + width: 180, + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + { + title: '税率', + dataIndex: 'DUTY_PARAGRAPHSUM', + width: 180, + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + { + title: '税额', + dataIndex: 'INVOICE_TAXSUM', + width: 180, + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + { + title: '税额价税合计', + dataIndex: 'BILL_TAXAMOUNT', + width: 180, + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + { + title: '发票来源', + dataIndex: 'InvoiceSource', + width: 180, + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + { + title: '发票票种', + dataIndex: 'BILL_TYPE', + width: 180, + align: 'center', + valueType: "select", + valueEnum: { + 1000: { text: '专票', status: 'warning' }, + 2000: { text: '普票', status: 'default' }, + 3000: { text: '红票', status: 'error' }, + } + }, + { + title: '票据状态', + dataIndex: 'BILL_STATE', + width: 120, + align: 'center', + valueType: 'select', + valueEnum: { + "1000": "填写中", + "2000": "待审核", + "9000": "开票中", + "9100": "手动开票", + "9200": "已开票", + "9990": "红冲申请中", + "9999": "已红冲" + } + // 申请填写 1000 2000 待审核 9000 开票中 9200 已开票 + }, + { + title: '是否正数发票', + dataIndex: 'riskLevel', + width: 100, + align: 'center', + hideInSearch: true, + }, + { + title: '发票风险等级', + dataIndex: '发票风险等级', + width: 120, + valueType: 'digit', + align: 'right', + ellipsis: true, + hideInSearch: true, + }, + { + title: '开票人', + dataIndex: 'BILL_PERSON', + width: 120, + align: 'center', + ellipsis: true, + hideInSearch: true, + }, + { + title: '备注', + dataIndex: 'BILLDETAIL_DESC', + width: 120, + align: 'center', + ellipsis: true, + hideInSearch: true, + sorter: true + } + ] + // 处理税号中的特殊字符 const cleanString = (str: string) => { return str.replace(/[\s]/g, ''); @@ -783,270 +1020,68 @@ const InvoiceInquiry: React.FC<{ currentUser: any }> = (props) => { const data = await handleGetBILLList(req) if (data && data.length > 0) { + console.log('data', data); + let list: any = JSON.parse(JSON.stringify(data)) + let res: any = [] + if (list && list.length > 0) { + list.forEach((item: any) => { + if (item.DetailList && item.DetailList.length > 0) { + item.DetailList.forEach((subItem: any) => { + res.push({ + ...subItem, + sellerTaxpayerId: '91530000336622209K', + sellerName: "云南交投集团经营开发有限公司", + TAXPAYER_IDENTIFYCODE: item.TAXPAYER_IDENTIFYCODE, + MERCHANTS_NAME: item.MERCHANTS_NAME, + BILL_DATE: item.BILL_DATE, + TABLE_NAMESUM: subItem.TABLE_NAME, + specificBusinessType: subItem.REALESTATE_ID ? '不动产经营租赁服务' : '', + ITEM_NAMESUM: subItem.ITEM_NAME, + ITEM_RULESUM: subItem.ITEM_RULE, + ITEM_UNITSUM: subItem.ITEM_UNIT, + INVOICE_COUNTSUM: subItem.INVOICE_COUNT, + INVOICE_PRICESUM: (subItem.INVOICE_AMOUNT / subItem.INVOICE_COUNT).toFixed(2), + INVOICE_AMOUNTSUM: (subItem.INVOICE_AMOUNT - subItem.INVOICE_TAX).toFixed(2), + DUTY_PARAGRAPHSUM: subItem.DUTY_PARAGRAPH, + INVOICE_TAXSUM: subItem.INVOICE_TAX, + BILL_TAXAMOUNT: subItem.INVOICE_AMOUNT, + InvoiceSource: "金蝶", + SERIAL_NO: item.SERIAL_NO, + BILL_PERSON: item.BILL_PERSON, + BILL_TYPE: item.BILL_TYPE, + BILL_STATE: item.BILL_STATE, + riskLevel: item.BILL_TYPE === 3000 ? '否' : '是' + }) + }) + } + }) + } + setReqDetailList(res) + return { data: data, success: true } } return { data: [], success: true } - - - // let req: any = { - // appId: "FPY001", - // appSecret: "FPY001fpy@2023***", - // accountId: "2280459335882518528", - // tenantid: "xhcamzchwbgonerr", - // language: "" - // } - // const token = await handleGetAppToken(req) - - // let appToken: any = token.data.app_token - - // let tokenReq: any = { - // user: "18620126214", - // apptoken: appToken, - // tenantid: "xhcamzchwbgonerr", - // accountId: "2280459335882518528", - // usertype: "" - // } - - // const accessToken: any = await handleGetSDToken(tokenReq) - - // setAppToken(appToken) - // setAccessToken(accessToken.data.access_token) - - - // // 模拟数据 - // const mockData: any = [ - // // // 专票 - // // { - // // billNo: "SRM_202508220957", // 单据编号 - // // billDate: "2025-08-22", // 单据日期 - // // totalAmount: 10, // 单据金额 - // // includeTaxFlag: "1",// 判断是否含税 - // // autoInvoice: "1",// 自动开票标记 - // // invoiceType: "10xdp", //发票种类 - // // buyerName: "深圳市顺丰快运有限公司test01", // 购买方名称 - // // buyerProperty: "0", // 购买方性质 - // // sellerTaxpayerId: "91530112MA7MQ2JR9U", // 销方税号 写死 - // // sellerName: "云南交投集团经营开发有限公司彩云驿商业管理分公司", // 销方名称 写死 - // // sellerBankAndAccount: "13710884704", // 销方银行和账号 写死 - // // sellerAddressAndTel: "", // 销方地址和电话 写死 应该可以不传 - // // drawer: "测试人",// 开票人 - // // buyerRecipientPhone: "18158132615",// 购方收票手机号 - // // buyerRecipientMail: "",// 购方收件邮箱 - // // amount: 10, // 明细金额 明细金额,含税标识includeTaxFlag=1时该金额为含税金额 - // // detailId: "1194121661989796666",// 业务系统明细id 业务系统明细id,用于反写回原业务系统明细 【长度:50】 - // // goodsName: "蜂胶口腔膜",// 商品名称 商品名称,与商品编码2填1,需提前在系统维护【长度:GBK92字节】 - // // lineProperty: 2,// 行性质 行性质,1折扣行(折扣行必须紧跟被折扣的正常商品行),2正常商品行 - // // price: 10,// 单价 单价【长度:整数位加小数位最大16位,小数位最多13,小数点占1位】,price有值则quantity必填,含税标识includeTaxFlag=1时该金额为含税金额 - // // quantity: 1,// 数量 数量【长度:整数位加小数位最大16位,小数位最多13,小数点占1位】,quantity有值则price必填 - // // revenueCode: "1070304990000000000",// 税收分类编码 税收分类编码,开票项补全或映射会补全税收分类编码,未走开票项补全或映射必填 - // // taxRate: "0.13",// 税率 税率,【0.13,0.09,0.06等】。不传时根据开票项匹配税率 - // // units: "个"// 计量单位 计量单位,【长度:GBK22字节】 - - // // // billDetail: [ - // // // { - - // // // } - // // // ] - // // }, - // // { - // // billNo: "SRM_202508220966", // 单据编号 - // // billDate: "2025-08-22", // 单据日期 - // // totalAmount: 10, // 单据金额 - // // includeTaxFlag: "1",// 判断是否含税 - // // autoInvoice: "1",// 自动开票标记 - // // invoiceType: "10xdp", //发票种类 - // // buyerName: "深圳市顺丰快运有限公司test01", // 购买方名称 - // // buyerProperty: "0", // 购买方性质 - // // sellerTaxpayerId: "91530112MA7MQ2JR9U", // 销方税号 写死 - // // sellerName: "云南交投集团经营开发有限公司彩云驿商业管理分公司", // 销方名称 写死 - // // sellerBankAndAccount: "13710884704", // 销方银行和账号 写死 - // // sellerAddressAndTel: "", // 销方地址和电话 写死 应该可以不传 - // // drawer: "测试人",// 开票人 - // // buyerRecipientPhone: "18158132615",// 购方收票手机号 - // // buyerRecipientMail: "",// 购方收件邮箱 - // // amount: 10, // 明细金额 明细金额,含税标识includeTaxFlag=1时该金额为含税金额 - // // detailId: "1194121661989796666",// 业务系统明细id 业务系统明细id,用于反写回原业务系统明细 【长度:50】 - // // goodsName: "蜂胶口腔膜",// 商品名称 商品名称,与商品编码2填1,需提前在系统维护【长度:GBK92字节】 - // // lineProperty: 2,// 行性质 行性质,1折扣行(折扣行必须紧跟被折扣的正常商品行),2正常商品行 - // // price: 10,// 单价 单价【长度:整数位加小数位最大16位,小数位最多13,小数点占1位】,price有值则quantity必填,含税标识includeTaxFlag=1时该金额为含税金额 - // // quantity: 1,// 数量 数量【长度:整数位加小数位最大16位,小数位最多13,小数点占1位】,quantity有值则price必填 - // // revenueCode: "1070304990000000000",// 税收分类编码 税收分类编码,开票项补全或映射会补全税收分类编码,未走开票项补全或映射必填 - // // taxRate: "0.13",// 税率 税率,【0.13,0.09,0.06等】。不传时根据开票项匹配税率 - // // units: "个"// 计量单位 计量单位,【长度:GBK22字节】 - - // // // billDetail: [ - // // // { - - // // // } - // // // ] - // // }, - // // // 普票 - // // { - // // billNo: "SRM_202508221427", // 单据编号 - // // billDate: "2025-08-22", // 单据日期 - // // totalAmount: -10, // 单据金额 - // // includeTaxFlag: "1",// 判断是否含税 - // // invoiceProperty: 0, - // // autoMerge: 1, - // // autoInvoice: 1,// 自动开票标记 - // // invoiceType: "10xdp", //发票种类 - // // buyerName: "深圳市顺丰快运有限公司test01", // 购买方名称 - // // buyerProperty: "0", // 购买方性质 - // // sellerTaxpayerId: "91530112MA7MQ2JR9U", // 销方税号 写死 - // // sellerName: "云南交投集团经营开发有限公司彩云驿商业管理分公司", // 销方名称 写死 - // // sellerBankAndAccount: "13710884704", // 销方银行和账号 写死 - // // sellerAddressAndTel: "", // 销方地址和电话 写死 应该可以不传 - // // drawer: "测试人",// 开票人 - // // buyerRecipientPhone: "18158132615",// 购方收票手机号 - // // buyerRecipientMail: "",// 购方收件邮箱 - // // amount: -10, // 明细金额 明细金额,含税标识includeTaxFlag=1时该金额为含税金额 - // // detailId: "1194121661989796666",// 业务系统明细id 业务系统明细id,用于反写回原业务系统明细 【长度:50】 - // // goodsName: "蜂胶口腔膜",// 商品名称 商品名称,与商品编码2填1,需提前在系统维护【长度:GBK92字节】 - // // lineProperty: 2,// 行性质 行性质,1折扣行(折扣行必须紧跟被折扣的正常商品行),2正常商品行 - // // price: -10,// 单价 单价【长度:整数位加小数位最大16位,小数位最多13,小数点占1位】,price有值则quantity必填,含税标识includeTaxFlag=1时该金额为含税金额 - // // quantity: 1,// 数量 数量【长度:整数位加小数位最大16位,小数位最多13,小数点占1位】,quantity有值则price必填 - // // revenueCode: "1070304990000000000",// 税收分类编码 税收分类编码,开票项补全或映射会补全税收分类编码,未走开票项补全或映射必填 - // // taxRate: "0.13",// 税率 税率,【0.13,0.09,0.06等】。不传时根据开票项匹配税率 - // // units: "个",// 计量单位 计量单位,【长度:GBK22字节】 - // // redReason: "2", - // // blueInvoiceType: "026", - // // originalIssueTime: "2025-08-24 15:00:00", - // // blueinvoiceCode: "testBlueCode2025-08-25", - // // blueinvoiceNo: "testBlueNo2025-08-25" - // // // billDetail: [ - // // // { - - // // // } - // // // ] - // // }, - // // { - // // billNo: "202508220003", - // // billDate: "2025-08-22", - // // autoInvoice: "1", - // // includeTaxFlag: "0", - // // invoiceProperty: "1", - // // invoiceType: "10xdp", - // // totalAmount: -8.85, - // // buyerTaxpayerId: "91440300MA5G9GK78Y", - // // buyerName: "深圳市顺丰快运有限公司test01", - // // sellerTaxpayerId: "91530112MA7MQ2JR9U", - // // sellerName: "云南交投集团经营开发有限公司彩云驿商业管理分公司", - // // sellerBankAndAccount: "13710884704", - // // sellerAddressAndTel: "高新技术产业园南区科技南十二路58996989", - // // drawer: "王协芬", - // // autoMerge: "0", - // // blueinvoiceNo: "SRM_202508220966", - // // redReason: "2", - // // amount: -8.85, - // // goodsName: "通天口服液", - // // lineProperty: 2, - // // price: -12, - // // quantity: 5, - // // revenueCode: "1070304990000000000", - // // taxRate: "0.09", - // // units: "盒" - // // }, - - // // 普票 - // { - // billNo: "SRM_202509011376", - // billDate: "2025-09-01", - // autoInvoice: "1", - // includeTaxFlag: "1", - // invoiceProperty: "0", - // invoiceType: "10xdp", - // totalAmount: 10.00, - // buyerTaxpayerId: "91440300MA5G9GK78Y", - // buyerName: "深圳市顺丰快运有限公司test01", - // sellerTaxpayerId: "91530112MA7MQ2JR9U", - // sellerName: "云南交投集团经营开发有限公司彩云驿商业管理分公司", - // sellerBankAndAccount: "13710884704", - // sellerAddressAndTel: "高新技术产业园南区科技南十二路58996989", - // drawer: "王协芬", - // buyerRecipientPhone: "18158132615", - // buyerRecipientMail: "", - // billDetail: [ - // { - // amount: 5, - // detailId: "11112222333344445555", - // goodsName: "通天口服液", - // lineProperty: 2, - // price: 5, - // quantity: 1, - // revenueCode: "1070304990000000000", - // taxRate: "0.13", - // units: "盒" - // }, - // { - // amount: 5, - // detailId: "55554444333322221111", - // goodsName: "通天口服液2", - // lineProperty: 2, - // price: 5, - // quantity: 1, - // revenueCode: "1070304990000000000", - // taxRate: "0.13", - // units: "盒" - // } - // ] - // }, - - // // 专票 - // { - // billNo: "SRM_202509011377", - // billDate: "2025-09-02", - // autoInvoice: "1", - // includeTaxFlag: "1", - // invoiceProperty: "0", - // invoiceType: "08xdp", - // totalAmount: 10.00, - // buyerTaxpayerId: "91440300MA5G9GK78Y", - // buyerName: "深圳市顺丰快运有限公司test01", - // buyerProperty: "1", - // sellerTaxpayerId: "91530112MA7MQ2JR9U", - // sellerName: "云南交投集团经营开发有限公司彩云驿商业管理分公司", - // sellerBankAndAccount: "13710884704", - // sellerAddressAndTel: "高新技术产业园南区科技南十二路58996989", - // drawer: "王协芬", - // buyerRecipientPhone: "18158132615", - // buyerRecipientMail: "", - // billDetail: [ - // { - // amount: 5, - // detailId: "11112222333344445555", - // goodsName: "通天口服液", - // lineProperty: 2, - // price: 5, - // quantity: 1, - // revenueCode: "1070304990000000000", - // taxRate: "0.13", - // units: "盒" - // }, - // { - // amount: 5, - // detailId: "55554444333322221111", - // goodsName: "通天口服液2", - // lineProperty: 2, - // price: 5, - // quantity: 1, - // revenueCode: "1070304990000000000", - // taxRate: "0.13", - // units: "盒" - // } - // ] - // } - // ]; - - // return { - // data: mockData, - // success: true, - // total: mockData.length - // } }} columnsState={{ value: columnsStateMap, onChange: setColumnsStateMap, }} + toolbar={{ + actions: [ + + ] + }} /> {/* 用来输入红冲原因的 */} diff --git a/src/pages/realEstate/index.tsx b/src/pages/realEstate/index.tsx index 223cce4..6564261 100644 --- a/src/pages/realEstate/index.tsx +++ b/src/pages/realEstate/index.tsx @@ -10,7 +10,7 @@ import ModalFooter from "./components/modalFooter"; import { handleGetPassportInfoById } from "../DigitalElectronics/service"; // 引入地址解析工具 import { handleAddressChange, parseAddress } from "@/utils/addressParser"; -import { handleGetServerpartDDL } from "../serverpartAssets/service"; +import { handleGetServerpartDDL, handleGetServerpartInfo } from "../serverpartAssets/service"; import { handleGetSERVERPARTDetail } from "../operationReport/service"; @@ -37,7 +37,8 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { const [confirmLoading, setConfirmLoading] = useState(false) // 选中的行数据详情 const [selectRowDetail, setSelectRowDetail] = useState() - + // 当前服务区下的方位 + const [SERVERPARTREGION, setSERVERPARTREGION] = useState() // 列表配置 @@ -270,6 +271,25 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { } } + // 获取到服务区方位的方法 + const handleGetSERVERPARTREGION = async (id: string) => { + setSERVERPARTREGION([]) + const req: any = { + SERVERPARTId: id + } + const data = await handleGetServerpartInfo(req) + let list: any = [] + if (data.RegionInfo && data.RegionInfo.length > 0) { + data.RegionInfo.forEach((item: any) => { + list.push({ label: item.SERVERPART_REGIONNAME, value: item.SERVERPART_REGION }) + }) + } + + setSERVERPARTREGION(list) + return data + } + + useEffect(() => { if (isFirst) { handleGetUserInfo() @@ -277,6 +297,7 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { } }, []) + useImperativeHandle(onRef, () => ({ selectRowDetail })); @@ -284,7 +305,7 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { return
{ isComponent ? '' : - + }
{ if (currentRow?.REALESTATE_ID) { + handleGetSERVERPARTREGION(currentRow?.SERVERPART_ID) return { ...currentRow, SERVERPART_ID: currentRow?.SERVERPART_ID.toString(), LEASEDATE: [moment(currentRow?.START_LEASEDATE), moment(currentRow?.END_LEASEDATE)] } } else { - return {} + console.log('selectedIdselectedIdselectedId', selectedId); + if (selectedId) { + let defaultSeverPartId: any = selectedId.split(',') && selectedId.split(',').length > 0 ? selectedId.split(',')[0] : "" + console.log('defaultSeverPartIddefaultSeverPartIddefaultSeverPartId', defaultSeverPartId); + let detailObj: any = {} + if (defaultSeverPartId) { + detailObj = await handleGetSERVERPARTREGION(defaultSeverPartId) + } + console.log('detailObjdetailObjdetailObj', detailObj); + + return { + SERVERPART_ID: defaultSeverPartId, + SERVERPART_NAME: detailObj.SERVERPART_NAME + } + } + return { + + } } }} onFinish={() => { @@ -453,7 +492,8 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { filterOption: (input, option) => (option?.label ?? '').toLowerCase().includes(input.toLowerCase()), optionFilterProp: 'label', - onChange: async (value, option: any) => { + onChange: async (value: any, option: any) => { + handleGetSERVERPARTREGION(value) modalFormRef.current?.setFieldsValue({ SERVERPART_NAME: option.title }) // 顺便拿个 服务区详情 let detail: any = await handleGetSERVERPARTDetail({ SERVERPARTId: value }) @@ -477,6 +517,18 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: { readonly={isComponent} /> + + +