This commit is contained in:
ylj20011123 2026-02-06 09:47:13 +08:00
parent 9a63d91801
commit 3357d03316
7 changed files with 498 additions and 192 deletions

View File

@ -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",

BIN
src/21/~$打印表单.docx Normal file

Binary file not shown.

View File

@ -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<any>({})
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 || ""

View File

@ -1142,7 +1142,7 @@ const InvoiceInquiry: React.FC<{ currentUser: any }> = (props) => {
</Modal>
<InvoiceDetial showDetail={showDetailModal} setShowDetail={setShowDetailModal} parentRow={currentRow} setParentRow={setCurrentRow} />
<InvoiceDetial showDetail={showDetailModal} setShowDetail={setShowDetailModal} parentRow={currentRow} setParentRow={setCurrentRow} showType="search" />
</div>
)

View File

@ -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<ActionType>();
const formRef = useRef<FormInstance>();
const modalFormRef = useRef<FormInstance>();
const { RangePicker } = DatePicker;
// 树相关的属性和方法
const [selectedId, setSelectedId] = useState<string>()
const [collapsible, setCollapsible] = useState<boolean>(false)
@ -36,9 +50,12 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: {
// 悬浮框点击确认的按钮加载效果
const [confirmLoading, setConfirmLoading] = useState<boolean>(false)
// 选中的行数据详情
const [selectRowKey, setSelectRowKey] = useState<any>()
const [selectRowDetail, setSelectRowDetail] = useState<any>()
// 当前服务区下的方位
const [SERVERPARTREGION, setSERVERPARTREGION] = useState<any>()
// 表格数据
const [tableData, setTableData] = useState<any>()
// 服务区列表
const [searchServerPartList, setSearchServerPartList] = useState<any>()
const [columnsState, setColumnsState] = useState<any>({
@ -46,6 +63,8 @@ const RealEstate = ({ serverPartId, isComponent, onRef, selectRealEstateId }: {
CITY_NAME: { show: false },
SPECIALINDUSTRY_NUMBER: { show: false },
})
// 当前组件的可以选择的全部服务区
const [currentServerPartList, setCurrentServerPartList] = useState<any>()
// 列表配置
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 ?
<ConfigProvider locale={zhCN}>
<RangePicker
value={[record?.START_LEASEDATE ? dayjs(record.START_LEASEDATE) : null, record?.END_LEASEDATE ? dayjs(record.END_LEASEDATE) : null]}
onChange={(e: any) => {
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)
}}
/>
</ConfigProvider>
// <ProForm
// submitter={false}
// initialValues={{ LEASEDATE: [moment(record?.START_LEASEDATE).format('YYYY-MM-DD'), moment(record?.END_LEASEDATE).format('YYYY-MM-DD')] }}
// >
// <ProFormDateRangePicker name="LEASEDATE" fieldProps={{
// format: 'YYYY-MM-DD',
// onChange: (e: any) => {
// 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]);
// }
// }} />
// </ProForm>
: `${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 <div style={{ height: isComponent ? '600px' : 'calc(100vh - 100px)', backgroundColor: '#fff', display: 'flex' }}>
@ -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={{

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, 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<any>();
const formRef = useRef<FormInstance<any>>();
const detailActionRef = useRef<ActionType>();
const { RangePicker } = DatePicker;
// 保存的加载效果
const [saveLoading, setSaveLoading] = useState<boolean>(false)
// 明细表格默认隐藏的内容
@ -65,7 +81,8 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow, par
const [currentRow, setCurrentRow] = useState<any>();
// 解析不动产的枚举
const [realEstateEnum, setRealEstateEnum] = useState<any>();
// 判断当前的发票明细里面 有没有不动产
const [haveRealEstate, setHaveRealEstate] = useState<boolean>(false)
const detailColumns: any = [
{
@ -107,10 +124,43 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow, par
}} /> : currentItem.TABLE_NAME
}
},
{
title: <div style={{ textAlign: 'center' }}></div>,
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 ?
<ConfigProvider locale={zhCN}>
<RangePicker
defaultValue={[currentItem?.START_LEASEDATE ? dayjs(currentItem.START_LEASEDATE) : null, currentItem?.END_LEASEDATE ? dayjs(currentItem.END_LEASEDATE) : null]}
onChange={(e: any) => {
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)
}}
/>
</ConfigProvider>
:
`${record?.START_LEASEDATE || ""}${record?.END_LEASEDATE ? `-${record?.END_LEASEDATE}` : ''}`
}
},
{
title: <div style={{ textAlign: 'center' }}></div>,
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: <div style={{ textAlign: 'center' }}></div>,
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: <div style={{ textAlign: 'center' }}></div>,
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: <div style={{ textAlign: 'center' }}></div>,
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: <div style={{ textAlign: 'center' }}></div>,
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 ?
<a onClick={() => {
@ -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}
</a> :
<Tooltip title={"选择不动产"}>
<Button type={'primary'} onClick={async () => {
console.log('选择不动产', record);
console.log('票据信息', parentRow);
</a> : showType === 'search' ? '' :
<Tooltip title={"选择不动产"}>
<Button type={'primary'} onClick={async () => {
console.log('选择不动产', record);
console.log('票据信息', parentRow);
setCurrentRow(record)
setSelectRealEstateModal(true)
}}>+</Button>
</Tooltip>
setCurrentRow(record)
setSelectRealEstateModal(true)
}}>+</Button>
</Tooltip>
}
}
@ -455,11 +506,12 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow, par
})
}
setRealEstateEnum(obj)
return data
}
return (
<Drawer
width="80%"
width="90%"
open={showDetail}
title="票据详情"
onClose={() => {
@ -497,14 +549,14 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow, par
<Col span={8}>
<ProFormText name="BILL_NO" label="票据编号" readonly />
<ProFormText name="SERVERPARTSHOP_NAME" label="门店" readonly />
<ProFormText name="SERIAL_NO" label="流水号" readonly />
<ProFormText name="BILL_AMOUNT" label="除税开票金额" readonly />
<ProFormText name="BILL_DATE" label="申请日期" readonly />
</Col>
<Col span={8}>
<ProFormText name="SERIAL_NO" label="流水号" readonly />
<ProFormText name="ORIBILL_NO" label="原单据号" readonly />
<ProFormSelect name="BILL_STATE" label="票据状态" readonly fieldProps={{
options: [
{ label: "填写中", value: 1000 },
@ -576,87 +628,136 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow, par
</Col>
</Row>
{/* 发票明细 */}
<div style={{ marginTop: 24 }}>
<Space direction="vertical" style={{ width: '100%' }}>
<Text strong></Text>
<ProTable
actionRef={detailActionRef}
search={false}
columns={detailColumns}
bordered
scroll={{ x: "100%", y: '500px' }}
// pagination={false}
pagination={{
defaultPageSize: 100,
pageSizeOptions: ['100', '200', '500', '1000'],
}}
request={async () => {
// 调用一次 获取这个服务区里面的全部 不动产信息
handleGetThisServerpartRealEstateData()
// 拿到发票明细
const billDetail = await handleGetBILLDETAILList({
SearchParameter: {
BILL_ID: parentRow?.BILL_ID
},
PageIndex: 1,
PageSize: 999999,
SortStr: "BILLDETAIL_ID"
})
{
selectRealEstateModal ? '' :
<ProTable
actionRef={detailActionRef}
search={false}
columns={detailColumns}
bordered
scroll={{ x: "100%", y: '500px' }}
// pagination={false}
pagination={{
defaultPageSize: 100,
pageSizeOptions: ['100', '200', '500', '1000'],
}}
request={async () => {
// 调用一次 获取这个服务区里面的全部 不动产信息
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 ?
<>
<Button type="primary" loading={saveLoading} style={{ marginRight: '4px' }} onClick={() => {
handleSaveTaxCode()
}}></Button>
<Button onClick={() => {
setIsEdit(false)
}}></Button>
</> :
<Button type="primary" onClick={() => {
setIsEdit(true)
}}></Button>
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}`
}
</> : ""
}
</>,
<Button type={'primary'} onClick={async () => {
exportXlsxFromProColumnsExcelJS(detailColumns,
reqDetailList,
`${parentRow?.BILL_NO}发票明细`,
{
// topTitle: `历史销售单品报表`, // 顶部大标题
// footerMaker: currentUser?.Name,
// footerMakerTime: moment().format('YYYY-MM-DD HH:mm:ss'),
// footerStatsTime: `${searchParams?.StartDate}-${searchParams?.EndDate}`
}
})
console.log('allREALESTATE_IDallREALESTATE_ID', allREALESTATE_ID);
// 看看有没有不动产信息
if (allREALESTATE_ID) {
setHaveRealEstate(true)
} else {
setHaveRealEstate(false)
}
)
}}>excel</Button>
]
}}
/>
// 请求到的当前的全部不动产信息
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 ?
<>
<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,
reqDetailList,
`${parentRow?.BILL_NO}发票明细`,
{
// topTitle: `历史销售单品报表`, // 顶部大标题
// footerMaker: currentUser?.Name,
// footerMakerTime: moment().format('YYYY-MM-DD HH:mm:ss'),
// footerStatsTime: `${searchParams?.StartDate}-${searchParams?.EndDate}`
}
)
}}>excel</Button>
]
}}
/>
}
</Space>
</div>
@ -776,54 +877,93 @@ const InvoiceDetail = ({ showDetail, setShowDetail, parentRow, setParentRow, par
setSelectRealEstateModal(false)
}}
confirmLoading={realEstateLoading}
bodyStyle={{
height: '700px', // 你可以根据需要调整高度
overflowY: 'auto',
}}
footer={showType === 'search' ? '' : <div>
<Button onClick={() => {
setSelectRealEstateModal(false)
}}></Button>
<Button loading={realEstateLoading} style={{ marginLeft: '8px' }} type={'primary'} onClick={async () => {
// 已经开票申请了的 就不能改变不动产数据了
// if (parentRow?.BILL_STATE > 2000) {
// setCurrentRow(undefined)
// setSelectRealEstateModal(false)
// setRealEstateLoading(false)
// return
// }
onOk={async () => {
// 已经开票申请了的 就不能改变不动产数据了
if (parentRow?.BILL_STATE > 2000) {
setCurrentRow(undefined)
// let data = realEstateRef?.current?.selectRowDetail
let data: any = []
let nowSelectKey: any = realEstateRef?.current?.selectRowKey
let nowTableData: any = realEstateRef?.current?.tableData
if (nowTableData && nowTableData.length > 0) {
nowTableData.forEach((item: any) => {
if (item.REALESTATE_ID === nowSelectKey[0]) {
data = [item]
}
})
}
console.log('datadasds', data);
// 开始保存内容
handleGetSelectRealEstate(data)
if (tableEditData && tableEditData.length > 0) {
setRealEstateLoading(true)
let list: any = JSON.parse(JSON.stringify(tableEditData))
let idList: any = []
// 因为 我们选择的 租赁开始结束时间在 data 中
// 但是实际的list 是来自tableEditData 所以得根据id拼进去 造一个对应id 对应的 租赁时间的对象
let leaseObj: any = {}
if (data && data.length > 0) {
idList = data.map((item: any) => Number(item.REALESTATE_ID))
data.forEach((item: any) => {
leaseObj[item.REALESTATE_ID] = {
START_LEASEDATE: item.START_LEASEDATE,
END_LEASEDATE: item.END_LEASEDATE
}
})
}
console.log('leaseObjleaseObj', leaseObj);
list.forEach((item: any) => {
if (item.REALESTATE_ID === currentRow?.REALESTATE_ID) {
item.REALESTATE_ID = idList && idList.length > 0 ? Number(idList.toString()) : ""
item.START_LEASEDATE = leaseObj[item.REALESTATE_ID]?.START_LEASEDATE
item.END_LEASEDATE = leaseObj[item.REALESTATE_ID]?.END_LEASEDATE
}
})
setSelectRealEstateId(idList)
console.log('listlistlist', list);
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)
return
}
}}></Button>
</div>}
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)
}}
>
<RealEstate serverPartId={parentRow?.SERVERPART_ID} isComponent={true} onRef={realEstateRef} selectRealEstateId={selectRealEstateId} />
<RealEstate serverPartId={parentRow?.SERVERPART_ID} isComponent={true} onRef={realEstateRef} selectRealEstateId={selectRealEstateId} parentRow={currentRow} showType={'search'} />
</Modal>
</Drawer>
);

View File

@ -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==