1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
import React, { Component } from 'react';
import PageHeaderWrapper from '@/components/PageHeaderWrapper';
import Shell from '@/baseComponent/Shell';
import ButtonDiy from '@/baseComponent/ButtonDiy';
import router from 'umi/router';
import { getToken } from '@/utils/authority';
import config from '@/config/config';
import { message, Modal, notification, Popconfirm } from 'antd';
import DetailOneStop from '@/webPublic/one_stop_public/DetailForAudit/IframeForDetail';
import { getIsBei_Dian, getIsGui_Jian } from '@/webPublic/zyd_public/utils/utils';
window.iframeParentComponent = {
Modal,
message,
notification,
Popconfirm,
};
const getUrlInfo = (param) => {
let url = window.document.location.href.toString();
let u = url.split('?');
if (typeof u[1] == 'string') {
u = u[1].split('&');
let get = {};
for (let i in u) {
let j = u[i].split('=');
get[j[0]] = decodeURIComponent(j[1]);
}
return get;
} else {
return {};
}
};
export default class Detail extends Component {
constructor(props) {
super(props);
const { state } = this.props.location;
let id = '';
if (state && state.record && state.record.id) {
const { record } = state;
id = record.id;
}
if (!id) {
id = getUrlInfo()?.id;
}
console.log(id);
this.state = {
id,
showAll: props.from !== 'onestopApp2.0'
};
}
componentDidMount() {
window.addEventListener(
'message',
(event) => {
if (event.data && event.data.indexOf && event.data.indexOf('iframeDetailHeight') > -1) {
const height = Number(event.data.split('-')[1]);
const dom = document.getElementById('detailIframeId');
if(dom){
document.getElementById('detailIframeId').height = height + 50;
}
}
},
false,
);
}
showAll = () => {
this.setState({
showAll: true,
});
};
render() {
const { from } = this.props;
const { id, showAll } = this.state;
const url = config.onestopPC.split('/#/');
let showPrint = this.props.location?.state?.showPrint;
if(getIsGui_Jian() && !showPrint){
// 27590 寝室调整管理-寝室调整申请,详情的打印预览按钮不见了210301080119-122617
// 贵建把打印预览显示出来
showPrint = true;
}
console.log(showPrint);
let iframeUrl = `${url[0]}/#/IframeForDetail?id=${id}&token=${getToken()}`;
if (showPrint) {
iframeUrl = iframeUrl + '&showPrint=true';
}
if (from === 'onestopApp2.0') {
iframeUrl = config.gateWayPort + `/portal/#/showAuditIframe?id=${id}&hasSingle=false&token=${getToken()}&isPrint=false`;
}
// iframeUrl = `http://localhost:8000/onestop/IframeForDetail?id=${id}&token=${getToken()}`;
return (
<PageHeaderWrapper title=''>
<Shell>
<div
style={{
height: '54px',
padding: '12px 0 12px 12px',
}}>
{showAll ? (
<ButtonDiy
name='返回'
className='defaultBlue'
handleClick={() => {
router.goBack();
}}
icon='arrow-left'
/>
) : null}
<ButtonDiy
name={'全屏查看'}
className='defaultBlue'
handleClick={() => {
document.getElementById('detailIframeId').requestFullscreen();
}} />
</div>
</Shell>
<Shell>
{
from === 'onestopApp2.0' ?
<iframe
src={iframeUrl}
frameBorder={0}
id='detailIframeId'
name='applyIframe'
marginWidth='0'
marginHeight='0'
onLoad={this.showAll}
allowtransparency='yes'
seamless
scrolling={'no'}
style={{
width: '100%',
overflowY: 'hidden',
minHeight: '80vh',
}}
/> :
<div id={'detailIframeId'}>
<DetailOneStop id={id} {...this.props} showPrint={showPrint || false}/>
</div>
}
</Shell>
<Shell>
<div
style={{
height: '54px',
padding: '12px 0 12px 12px',
}}>
{showAll ? (
<ButtonDiy
name='返回'
className='defaultBlue'
handleClick={() => {
router.goBack();
}}
icon='arrow-left'
/>
) : null}
<ButtonDiy
name={'全屏查看'}
type={'primary'}
// className='primaryBlue'
handleClick={() => {
document.getElementById('detailIframeId').requestFullscreen();
}} />
</div>
</Shell>
</PageHeaderWrapper>
);
}
}