不动产的开票信息判断 修改
This commit is contained in:
parent
c6a5262222
commit
9a63d91801
9
src/pages/ComplaintForwardingProcess/index.less
Normal file
9
src/pages/ComplaintForwardingProcess/index.less
Normal file
@ -0,0 +1,9 @@
|
||||
/*
|
||||
由于现在使用 Iframe 隔离打印方案,
|
||||
样式已直接在 index.tsx 的 iframe 注入逻辑中定义。
|
||||
此文件目前仅保留页面基础样式(如有)。
|
||||
*/
|
||||
|
||||
.print-ignore {
|
||||
/* 页面按钮展示样式 */
|
||||
}
|
||||
@ -1,32 +1,206 @@
|
||||
import { Button } from "antd"
|
||||
|
||||
import { Button } from "antd";
|
||||
import ReactDOM from "react-dom";
|
||||
import "./index.less";
|
||||
|
||||
const ComplaintForwardingProcess = () => {
|
||||
|
||||
// 打印附件1
|
||||
const handlePrintAttachment1 = () => {
|
||||
}
|
||||
|
||||
// 打印附件2
|
||||
const handlePrintAttachment2 = () => {
|
||||
}
|
||||
|
||||
// 打印附件3
|
||||
const handlePrintAttachment3 = () => {
|
||||
}
|
||||
|
||||
return <div>
|
||||
<Button onClick={() => {
|
||||
handlePrintAttachment1()
|
||||
}}>打印附件1</Button>
|
||||
<Button onClick={() => {
|
||||
handlePrintAttachment2()
|
||||
}}>打印附件2</Button>
|
||||
<Button onClick={() => {
|
||||
handlePrintAttachment3()
|
||||
}}>打印附件3</Button>
|
||||
// 附件1 结构
|
||||
const Attachment1 = () => (
|
||||
<div className="printContainer">
|
||||
<div className="printTitle">附件1:受理工单</div>
|
||||
<table className="printTable">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td className="labelCell">投诉人</td>
|
||||
<td className="contentCell"></td>
|
||||
<td className="labelCell">联系电话</td>
|
||||
<td className="contentCell"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="labelCell">受理部门</td>
|
||||
<td className="contentCell"></td>
|
||||
<td className="labelCell">受理时间</td>
|
||||
<td className="contentCell"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="labelCell">转办部门</td>
|
||||
<td className="contentCell"></td>
|
||||
<td className="labelCell">来电类别</td>
|
||||
<td className="contentCell"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="labelCell">来电内容</td>
|
||||
<td colSpan={3} className="largeCell"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="labelCell">转办要求</td>
|
||||
<td colSpan={3} className="largeCell"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="labelCell">处理反馈结果(可附页)</td>
|
||||
<td colSpan={3} className="largeCell">
|
||||
<div style={{ marginTop: '100px', textAlign: 'right' }}>
|
||||
反馈人: 时间: 年 月 日 时 分
|
||||
</div>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
);
|
||||
|
||||
// 附件2 结构
|
||||
const Attachment2 = () => (
|
||||
<div className="printContainer">
|
||||
<div className="printTitle">“12328”交通运输服务监督电话话务转办单</div>
|
||||
<div style={{ textAlign: 'right', marginBottom: '5px' }}>编号:</div>
|
||||
<table className="printTable">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td className="labelCell">来电人</td>
|
||||
<td className="contentCell"></td>
|
||||
<td className="labelCell">联系电话</td>
|
||||
<td className="contentCell"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="labelCell">受理部门</td>
|
||||
<td className="contentCell"></td>
|
||||
<td className="labelCell">受理时间</td>
|
||||
<td className="contentCell"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="labelCell">转办单位</td>
|
||||
<td className="contentCell"></td>
|
||||
<td className="labelCell">来电类别</td>
|
||||
<td className="contentCell"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="labelCell">来电内容</td>
|
||||
<td colSpan={3} className="largeCell"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="labelCell">转办要求</td>
|
||||
<td colSpan={3} className="largeCell">
|
||||
<div style={{ marginTop: '50px', textAlign: 'right' }}>
|
||||
转办人: 时间:
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="labelCell">处理反馈结果(可附页)</td>
|
||||
<td colSpan={3} className="largeCell">
|
||||
<div style={{ marginTop: '50px', textAlign: 'right' }}>
|
||||
反馈人: 时间:
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
);
|
||||
|
||||
export default ComplaintForwardingProcess
|
||||
// 附件3 结构
|
||||
const Attachment3 = () => (
|
||||
<div className="printContainer">
|
||||
<div className="printTitle">网络舆情处置报告书</div>
|
||||
<div style={{ textAlign: 'right', marginBottom: '5px' }}>反馈时间: 年 月 日</div>
|
||||
<table className="printTable">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td className="labelCell">反馈单位(加盖公章)</td>
|
||||
<td colSpan={3} className="contentCell"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="labelCell">签发人</td>
|
||||
<td colSpan={3} className="contentCell"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="labelCell">联系人</td>
|
||||
<td className="contentCell"></td>
|
||||
<td className="labelCell">手机号码</td>
|
||||
<td className="contentCell"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="labelCell">舆情概况</td>
|
||||
<td colSpan={3} className="largeCell"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="labelCell">核实及处置情况(可另附页)</td>
|
||||
<td colSpan={3} className="largeCell"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
);
|
||||
|
||||
// 真正的打印函数,使用 Iframe 隔离
|
||||
const handlePrintByIframe = (AttachmentComponent: React.ComponentType) => {
|
||||
// 1. 创建隐藏的 iframe
|
||||
const iframe = document.createElement('iframe');
|
||||
iframe.style.position = 'fixed';
|
||||
iframe.style.right = '0';
|
||||
iframe.style.bottom = '0';
|
||||
iframe.style.width = '0';
|
||||
iframe.style.height = '0';
|
||||
iframe.style.border = '0';
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
const iframeDoc = iframe.contentWindow?.document;
|
||||
if (!iframeDoc) return;
|
||||
|
||||
// 2. 注入样式和容器
|
||||
iframeDoc.open();
|
||||
iframeDoc.write(`
|
||||
<html>
|
||||
<head>
|
||||
<title>打印预览</title>
|
||||
<style>
|
||||
body { margin: 0; padding: 20px; font-family: SimSun, STSong, serif; }
|
||||
.printContainer { width: 100%; box-sizing: border-box; }
|
||||
.printTitle { text-align: center; font-size: 24px; font-weight: bold; margin-bottom: 25px; }
|
||||
.printTable { width: 100%; border-collapse: collapse; border: 2px solid #000; table-layout: fixed; }
|
||||
.printTable td { border: 1px solid #000; padding: 12px; font-size: 15px; word-break: break-all; height: 45px; }
|
||||
.labelCell { background-color: #f2f2f2 !important; width: 110px; font-weight: bold; text-align: center; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
|
||||
.contentCell { text-align: left; }
|
||||
.largeCell { height: 180px; vertical-align: top; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="print-root"></div>
|
||||
</body>
|
||||
</html>
|
||||
`);
|
||||
iframeDoc.close();
|
||||
|
||||
// 3. 将 React 组件渲染到 iframe 中
|
||||
const printRoot = iframeDoc.getElementById('print-root');
|
||||
if (printRoot) {
|
||||
ReactDOM.render(<AttachmentComponent />, printRoot);
|
||||
}
|
||||
|
||||
// 4. 调用打印
|
||||
setTimeout(() => {
|
||||
iframe.contentWindow?.focus();
|
||||
iframe.contentWindow?.print();
|
||||
// 5. 打印完成后清理
|
||||
setTimeout(() => {
|
||||
document.body.removeChild(iframe);
|
||||
}, 1000);
|
||||
}, 300);
|
||||
};
|
||||
|
||||
return (
|
||||
<div style={{ padding: '24px' }}>
|
||||
<div style={{ display: 'flex', gap: '16px', marginBottom: '24px' }}>
|
||||
<Button type="primary" onClick={() => handlePrintByIframe(Attachment1)}>打印附件1</Button>
|
||||
<Button type="primary" onClick={() => handlePrintByIframe(Attachment2)}>打印附件2</Button>
|
||||
<Button type="primary" onClick={() => handlePrintByIframe(Attachment3)}>打印附件3</Button>
|
||||
</div>
|
||||
|
||||
<div style={{ color: '#999', fontSize: '14px' }}>
|
||||
提示:点击按钮将使用 Iframe 隔离技术打开打印预览。这能确保**只打印表格内容**,而不会包含页面上的其他元素。
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ComplaintForwardingProcess;
|
||||
|
||||
@ -564,9 +564,18 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
||||
PageSize: 999999,
|
||||
SortStr: "BILLDETAIL_ID"
|
||||
})
|
||||
console.log('billDetailbillDetail', billDetail);
|
||||
|
||||
let billDetailReq: any = []
|
||||
// 可能存在的不动产数据
|
||||
let estateLeaseItems: any = []
|
||||
// 判断 票据信息里面是否有税务代码
|
||||
// 2026-01-23 朱老师点头 判断是否有不动产号 有的话 不动产信息必填 不需要一一对应 即 有不动产编号的时候 不动产选择也必须要有
|
||||
// 判断是不是全部的 不动产商品 都已经选择了不动产
|
||||
let haveAllShopSelectRealEstate = true
|
||||
// 判断是否有不动产
|
||||
let haveRealEstate = false
|
||||
|
||||
if (billDetail && billDetail.length > 0) {
|
||||
// 从当前商品的详情里面取出 用的到的 不动产id
|
||||
let REALESTATE_IDList: Number[] = []
|
||||
@ -585,10 +594,16 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
||||
REALESTATE_ID: item.REALESTATE_ID,// 不动产id
|
||||
BILLDETAIL_DESC: item.BILLDETAIL_DESC // 备注
|
||||
})
|
||||
if (item.TABLE_NAME && item.TABLE_NAME.indexOf('30405020') !== -1) {
|
||||
haveRealEstate = true
|
||||
if (!item.REALESTATE_ID) {
|
||||
haveAllShopSelectRealEstate = false
|
||||
}
|
||||
}
|
||||
|
||||
REALESTATE_IDList.push(Number(item.REALESTATE_ID))
|
||||
})
|
||||
|
||||
console.log('dhaskdhaslhdasl', billDetail);
|
||||
// REALESTATE_ID 是,隔开的不动产id 这里去查询 记录 有多少条
|
||||
const req: any = {
|
||||
searchParameter: {
|
||||
@ -603,7 +618,6 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
||||
value: encryptAES(JSON.stringify(req))
|
||||
}
|
||||
const data: any = await handleGetREALESTATEList(newReq)
|
||||
console.log('dhaskdhaslhdasl', data);
|
||||
// 这个服务区的全部不动产的数据 都在data里面
|
||||
if (data && data.length > 0) {
|
||||
let unitObj: any = {
|
||||
@ -634,7 +648,15 @@ const DigitalElectronics: React.FC<{ currentUser: any }> = (props) => {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 判断不动产信息是否已经选择了
|
||||
// haveRealEstate true 说明票的商品明细里面有不动产 不然就是没有
|
||||
if (haveRealEstate) {
|
||||
if (haveAllShopSelectRealEstate && estateLeaseItems && estateLeaseItems.length > 0) {
|
||||
} else {
|
||||
message.error('请选择不动产信息')
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
let obj: any = {
|
||||
billNo: record?.BILL_NO, // 单据编号
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user