zy-react-library 1.0.71 → 1.0.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,17 @@
1
1
  import { request } from "@cqsjjb/jjb-common-lib/http";
2
- import { Descriptions, Divider, Spin } from "antd";
2
+ import { Button, Descriptions, Divider, Spin } from "antd";
3
3
  import dayjs from "dayjs";
4
4
  import { useEffect, useState } from "react";
5
+ import { HIDDEN_SOURCE_ENUM, HIDDEN_STATE_ENUM } from "../../../enum/hidden/gwj";
6
+ import { UPLOAD_FILE_TYPE_ENUM } from "../../../enum/uploadFile/gwj";
7
+ import useDownloadFile from "../../../hooks/useDownloadFile";
8
+ import useGetFile from "../../../hooks/useGetFile";
9
+ import useGetUrlQuery from "../../../hooks/useGetUrlQuery";
10
+ import { getFileName, getFileSuffix, getLabelName } from "../../../utils";
5
11
  import HeaderBack from "../../HeaderBack";
6
12
  import VideoIcon from "../../Icon/VideoIcon";
7
13
  import PreviewImg from "../../PreviewImg";
8
14
  import PreviewPdf from "../../PreviewPdf";
9
- import { UPLOAD_FILE_TYPE_ENUM } from "../../../enum/uploadFile/gwj";
10
- import useGetFile from "../../../hooks/useGetFile";
11
- import { getLabelName } from "../../../utils";
12
- import { HIDDEN_SOURCE_ENUM, HIDDEN_STATE_ENUM } from "../../../enum/hidden/gwj";
13
- import useGetUrlQuery from "../../../hooks/useGetUrlQuery";
14
15
 
15
16
  /**
16
17
  * 隐患查看组件(港务局版本)
@@ -43,6 +44,7 @@ function HiddenInfo(props) {
43
44
  const [loading, setLoading] = useState(true);
44
45
  const { getFile } = useGetFile();
45
46
  const query = useGetUrlQuery();
47
+ const { loading: downloadFileLoading, downloadFile } = useDownloadFile();
46
48
 
47
49
  const getData = async () => {
48
50
  request(`/hidden/hidden/${id || query[idKey]}`, "get").then((res) => {
@@ -74,292 +76,306 @@ function HiddenInfo(props) {
74
76
  return (
75
77
  <div>
76
78
  {isShowHeaderBack && <HeaderBack title="查看" />}
77
- <Spin spinning={loading}>
79
+ <Spin spinning={loading || downloadFileLoading}>
78
80
  <div style={{ padding: 20 }}>
79
- <Divider orientation="left">隐患信息</Divider>
80
- <Descriptions
81
- bordered
82
- column={1}
83
- labelStyle={{ width: 200 }}
84
- items={[
85
- { label: "隐患来源", children: getLabelName({ list: HIDDEN_SOURCE_ENUM, status: info.source }) },
86
- { label: "隐患类型", children: info.hiddenTypeName },
87
- { label: "隐患级别", children: info.hiddenLevelName },
88
- { label: "隐患状态", children: getLabelName({ list: HIDDEN_STATE_ENUM, status: info.state }) },
89
- { label: "隐患描述", children: info.hiddenDesc },
90
- { label: "隐患部位", children: info.hiddenPart },
91
- ...(info.source === 2 || info.source === 3
92
- ? [
93
- { label: "风险点(单元)", children: "todo" },
94
- { label: "辨识部位", children: "todo" },
95
- { label: "存在风险", children: "todo" },
96
- { label: "风险分级", children: "todo" },
97
- { label: "隐患清单", children: "todo" },
98
- ]
99
- : []),
100
- {
101
- label: "隐患上报位置(经纬度)",
102
- children: [info.longitude && `经度:${info.longitude}`, info.latitude && `纬度:${info.latitude}`].filter(Boolean).join(" "),
103
- },
104
- { label: "隐患位置描述", children: info.positionDesc },
105
- { label: "隐患发现人", children: info.creatorName },
106
- { label: "隐患发现时间", children: dayjs(info.hiddenFindTime).format("YYYY-MM-DD hh:mm:ss") },
107
- {
108
- label: "整改类型",
109
- children: getLabelName({
110
- list: [{ bianma: "1", name: "立即整改" }, { bianma: "2", name: "延期整改" }],
111
- status: info.rectificationType,
112
- }),
113
- },
114
- {
115
- label: "是否相关方",
116
- children: getLabelName({
117
- list: [{ bianma: "1", name: "是" }, { bianma: "2", name: "否" }],
118
- status: info.isRelated,
119
- }),
120
- },
121
- { label: "隐患图片", children: <PreviewImg files={hiddenImageFiles} /> },
122
- ...(hiddenVideoFiles.length > 0 ? [{ label: "隐患视频", children: <VideoIcon /> }] : []),
123
- ]}
124
- />
125
- {
126
- (info.hiddenUserPresetsCO && Object.keys(info.hiddenUserPresetsCO).length > 0) && (
127
- <>
128
- <Divider orientation="left">整改信息(发现人预填)</Divider>
129
- <Descriptions
130
- bordered
131
- column={1}
132
- labelStyle={{ width: 200 }}
133
- items={[
134
- { label: "整改部门", children: info.hiddenUserPresetsCO.rectifyDeptName },
135
- { label: "整改人", children: info.hiddenUserPresetsCO.rectifyUserName },
136
- ...(info.rectificationType === 2
137
- ? [
138
- { label: "整改期限", children: dayjs(info.hiddenUserPresetsCO.rectifyDeadline).format("YYYY-MM-DD") },
139
- ]
140
- : []),
141
- ...(info.rectificationType === 1
142
- ? [
143
- { label: "验收部门", children: info.hiddenUserPresetsCO.checkDeptName },
144
- { label: "验收人", children: info.hiddenUserPresetsCO.checkUserName },
145
- ]
146
- : []),
147
- ]}
148
- />
149
- </>
150
- )
151
- }
152
- {
153
- (info.isConfirm === 1 && info.hiddenConfirmUserCO && Object.keys(info.hiddenConfirmUserCO).length > 0) && (
154
- <>
155
- <Divider orientation="left">隐患确认</Divider>
156
- <Descriptions
157
- bordered
158
- column={1}
159
- labelStyle={{ width: 200 }}
160
- items={[
161
- { label: "隐患级别", children: info.hiddenConfirmUserCO.hiddenLevelName },
162
- { label: "隐患确认人", children: info.hiddenConfirmUserCO.userName },
163
- { label: "隐患确认时间", children: info.hiddenConfirmUserCO.rectificationTime },
164
- { label: "整改负责人部门", children: info.hiddenConfirmUserCO.rectifyDeptName },
165
- { label: "整改负责人", children: info.hiddenConfirmUserCO.rectifyUserName },
166
- { label: "整改完成期限", children: info.hiddenConfirmUserCO.rectificationDeadline },
167
- { label: "验收部门", children: info.hiddenConfirmUserCO.checkDeptName },
168
- { label: "验收人", children: info.hiddenConfirmUserCO.checkUserName },
169
- ...(info.hiddenConfirmUserCO.repulseCause
170
- ? [
171
- { label: "打回意见", children: info.hiddenConfirmUserCO.repulseCause },
172
- { label: "打回时间", children: info.hiddenConfirmUserCO.rectificationTime },
173
- ]
174
- : []),
175
- ]}
176
- />
177
- </>
178
- )
179
- }
180
- {
181
- info.hiddenExtensionList && info.hiddenExtensionList.length > 0 && (
182
- <>
183
- <Divider orientation="left">延期信息</Divider>
81
+ <Divider orientation="left">隐患信息</Divider>
82
+ <Descriptions
83
+ bordered
84
+ column={1}
85
+ labelStyle={{ width: 200 }}
86
+ items={[
87
+ { label: "隐患来源", children: getLabelName({ list: HIDDEN_SOURCE_ENUM, status: info.source }) },
88
+ { label: "隐患类型", children: info.hiddenTypeName },
89
+ { label: "隐患级别", children: info.hiddenLevelName },
90
+ { label: "隐患状态", children: getLabelName({ list: HIDDEN_STATE_ENUM, status: info.state }) },
91
+ { label: "隐患描述", children: info.hiddenDesc },
92
+ { label: "隐患部位", children: info.hiddenPart },
93
+ ...(info.source === 2 || info.source === 3
94
+ ? [
95
+ { label: "风险点(单元)", children: "todo" },
96
+ { label: "辨识部位", children: "todo" },
97
+ { label: "存在风险", children: "todo" },
98
+ { label: "风险分级", children: "todo" },
99
+ { label: "隐患清单", children: "todo" },
100
+ ]
101
+ : []),
184
102
  {
185
- info.hiddenExtensionList.map(item => (
186
- <Descriptions
187
- key={item.id}
188
- bordered
189
- column={1}
190
- labelStyle={{ width: 200 }}
191
- items={[
192
- { label: "申请延期日期", children: item.createTime },
193
- { label: "延期日期", children: item.delayTime },
194
- { label: "审核人", children: item.updateName },
195
- ...(item.state === 3
196
- ? [
197
- { label: "处置方案", children: item.disposalPlan },
198
- { label: "处置方案附件", children: <PreviewPdf name={item.disposalPlan || "处置方案附件"} url={item.disposalFile} /> },
199
- ]
200
- : []),
201
- {
202
- label: "延期审核状态",
203
- children: (
204
- <>
205
- {item.state === 1 && <span>待审核</span>}
206
- {item.state === 2 && <span>审批中</span>}
207
- {item.state === 3 && <span>已通过</span>}
208
- {item.state === 4 && <span>已拒绝</span>}
209
- {item.state === 5 && <span>已撤回</span>}
210
- </>
211
- ),
212
- },
213
- ...((item.state === 3 || item.state === 4) ? [{ label: "延期审核时间", children: item.updateTime }] : []),
214
- ]}
215
- />
216
- ),
217
- )
218
- }
219
- </>
220
- )
221
- }
222
- {
223
- info.hiddenSpecialList && info.hiddenSpecialList.length > 0 && (
224
- <>
225
- <Divider orientation="left">特殊处置审核信息</Divider>
103
+ label: "隐患上报位置(经纬度)",
104
+ children: [info.longitude && `经度:${info.longitude}`, info.latitude && `纬度:${info.latitude}`].filter(Boolean).join(" "),
105
+ },
106
+ { label: "隐患位置描述", children: info.positionDesc },
107
+ { label: "隐患发现人", children: info.creatorName },
108
+ { label: "隐患发现时间", children: dayjs(info.hiddenFindTime).format("YYYY-MM-DD hh:mm:ss") },
109
+ {
110
+ label: "整改类型",
111
+ children: getLabelName({
112
+ list: [{ bianma: "1", name: "立即整改" }, { bianma: "2", name: "延期整改" }],
113
+ status: info.rectificationType,
114
+ }),
115
+ },
226
116
  {
227
- info.hiddenSpecialList.map(item => (
228
- <Descriptions
229
- key={item.id}
230
- bordered
231
- column={1}
232
- labelStyle={{ width: 200 }}
233
- items={[
234
- ...((item.state === 3 || item.state === 4)
235
- ? [
236
- { label: "审核人", children: item.updateName },
237
- { label: "审核时间", children: item.updateTime },
238
- ]
239
- : []),
240
- { label: "无法整改原因", children: item.examine },
241
- ...(item.state === 3
242
- ? [
243
- { label: "处置方案", children: item.disposalPlan },
244
- { label: "处置方案附件", children: <PreviewPdf name={item.disposalPlan || "处置方案附件"} url={item.disposalFile} /> },
245
- { label: "是否更换整改负责人", children: item.rectifyUserCO && Object.keys(item.rectifyUserCO).length > 0 ? "是" : "否" },
246
- ...(
247
- item.rectifyUserCO && Object.keys(item.rectifyUserCO).length > 0
248
- ? [{ label: "整改负责人", children: item.rectifyUserCO.userName }]
249
- : []),
250
- ]
251
- : []),
252
- {
253
- label: "特殊处置审核状态",
254
- children: (
255
- <>
256
- {item.state === 1 && <span>待审核</span>}
257
- {item.state === 2 && <span>审批中</span>}
258
- {item.state === 3 && <span>已通过</span>}
259
- {item.state === 4 && <span>已拒绝</span>}
260
- {item.state === 5 && <span>已撤回</span>}
261
- </>
262
- ),
263
- },
264
- ]}
265
- />
266
- ),
117
+ label: "是否相关方",
118
+ children: getLabelName({
119
+ list: [{ bianma: "1", name: "是" }, { bianma: "2", name: "否" }],
120
+ status: info.isRelated,
121
+ }),
122
+ },
123
+ { label: "隐患图片", children: <PreviewImg files={hiddenImageFiles} /> },
124
+ ...(hiddenVideoFiles.length > 0 ? [{ label: "隐患视频", children: <VideoIcon /> }] : []),
125
+ ]}
126
+ />
127
+ {
128
+ (info.hiddenUserPresetsCO && Object.keys(info.hiddenUserPresetsCO).length > 0) && (
129
+ <>
130
+ <Divider orientation="left">整改信息(发现人预填)</Divider>
131
+ <Descriptions
132
+ bordered
133
+ column={1}
134
+ labelStyle={{ width: 200 }}
135
+ items={[
136
+ { label: "整改部门", children: info.hiddenUserPresetsCO.rectifyDeptName },
137
+ { label: "整改人", children: info.hiddenUserPresetsCO.rectifyUserName },
138
+ ...(info.rectificationType === 2
139
+ ? [
140
+ { label: "整改期限", children: dayjs(info.hiddenUserPresetsCO.rectifyDeadline).format("YYYY-MM-DD") },
141
+ ]
142
+ : []),
143
+ ...(info.rectificationType === 1
144
+ ? [
145
+ { label: "验收部门", children: info.hiddenUserPresetsCO.checkDeptName },
146
+ { label: "验收人", children: info.hiddenUserPresetsCO.checkUserName },
147
+ ]
148
+ : []),
149
+ ]}
150
+ />
151
+ </>
152
+ )
153
+ }
154
+ {
155
+ (info.isConfirm === 1 && info.hiddenConfirmUserCO && Object.keys(info.hiddenConfirmUserCO).length > 0) && (
156
+ <>
157
+ <Divider orientation="left">隐患确认</Divider>
158
+ <Descriptions
159
+ bordered
160
+ column={1}
161
+ labelStyle={{ width: 200 }}
162
+ items={[
163
+ { label: "隐患级别", children: info.hiddenConfirmUserCO.hiddenLevelName },
164
+ { label: "隐患确认人", children: info.hiddenConfirmUserCO.userName },
165
+ { label: "隐患确认时间", children: info.hiddenConfirmUserCO.rectificationTime },
166
+ { label: "整改负责人部门", children: info.hiddenConfirmUserCO.rectifyDeptName },
167
+ { label: "整改负责人", children: info.hiddenConfirmUserCO.rectifyUserName },
168
+ { label: "整改完成期限", children: info.hiddenConfirmUserCO.rectificationDeadline },
169
+ { label: "验收部门", children: info.hiddenConfirmUserCO.checkDeptName },
170
+ { label: "验收人", children: info.hiddenConfirmUserCO.checkUserName },
171
+ ...(info.hiddenConfirmUserCO.repulseCause
172
+ ? [
173
+ { label: "打回意见", children: info.hiddenConfirmUserCO.repulseCause },
174
+ { label: "打回时间", children: info.hiddenConfirmUserCO.rectificationTime },
175
+ ]
176
+ : []),
177
+ ]}
178
+ />
179
+ </>
180
+ )
181
+ }
182
+ {
183
+ info.hiddenExtensionList && info.hiddenExtensionList.length > 0 && (
184
+ <>
185
+ <Divider orientation="left">延期信息</Divider>
186
+ {
187
+ info.hiddenExtensionList.map(item => (
188
+ <Descriptions
189
+ key={item.id}
190
+ bordered
191
+ column={1}
192
+ labelStyle={{ width: 200 }}
193
+ items={[
194
+ { label: "申请延期日期", children: item.createTime },
195
+ { label: "延期日期", children: item.delayTime },
196
+ { label: "审核人", children: item.updateName },
197
+ ...(item.state === 3
198
+ ? [
199
+ { label: "处置方案", children: item.disposalPlan },
200
+ {
201
+ label: "处置方案附件",
202
+ children: (
203
+ getFileSuffix(item.disposalFile) === "pdf"
204
+ ? <PreviewPdf name={getFileName(item.disposalFile)} url={item.disposalFile} />
205
+ : <Button type="primary" size="small" onClick={() => downloadFile(item.disposalFile)}>预览</Button>
206
+ ),
207
+ },
208
+ ]
209
+ : []),
210
+ {
211
+ label: "延期审核状态",
212
+ children: (
213
+ <>
214
+ {item.state === 1 && <span>待审核</span>}
215
+ {item.state === 2 && <span>审批中</span>}
216
+ {item.state === 3 && <span>已通过</span>}
217
+ {item.state === 4 && <span>已拒绝</span>}
218
+ {item.state === 5 && <span>已撤回</span>}
219
+ </>
220
+ ),
221
+ },
222
+ ...((item.state === 3 || item.state === 4) ? [{ label: "延期审核时间", children: item.updateTime }] : []),
223
+ ]}
224
+ />
225
+ ),
226
+ )
227
+ }
228
+ </>
229
+ )
230
+ }
231
+ {
232
+ info.hiddenSpecialList && info.hiddenSpecialList.length > 0 && (
233
+ <>
234
+ <Divider orientation="left">特殊处置审核信息</Divider>
235
+ {
236
+ info.hiddenSpecialList.map(item => (
237
+ <Descriptions
238
+ key={item.id}
239
+ bordered
240
+ column={1}
241
+ labelStyle={{ width: 200 }}
242
+ items={[
243
+ ...((item.state === 3 || item.state === 4)
244
+ ? [
245
+ { label: "审核人", children: item.updateName },
246
+ { label: "审核时间", children: item.updateTime },
247
+ ]
248
+ : []),
249
+ { label: "无法整改原因", children: item.examine },
250
+ ...(item.state === 3
251
+ ? [
252
+ { label: "处置方案", children: item.disposalPlan },
253
+ {
254
+ label: "处置方案附件",
255
+ children: (
256
+ getFileSuffix(item.disposalFile) === "pdf"
257
+ ? <PreviewPdf name={getFileName(item.disposalFile)} url={item.disposalFile} />
258
+ : <Button type="primary" size="small" onClick={() => downloadFile(item.disposalFile)}>预览</Button>
259
+ ),
260
+ },
261
+ { label: "是否更换整改负责人", children: item.rectifyUserCO && Object.keys(item.rectifyUserCO).length > 0 ? "是" : "否" },
262
+ ...(
263
+ item.rectifyUserCO && Object.keys(item.rectifyUserCO).length > 0
264
+ ? [{ label: "整改负责人", children: item.rectifyUserCO.userName }]
265
+ : []),
266
+ ]
267
+ : []),
268
+ {
269
+ label: "特殊处置审核状态",
270
+ children: (
271
+ <>
272
+ {item.state === 1 && <span>待审核</span>}
273
+ {item.state === 2 && <span>审批中</span>}
274
+ {item.state === 3 && <span>已通过</span>}
275
+ {item.state === 4 && <span>已拒绝</span>}
276
+ {item.state === 5 && <span>已撤回</span>}
277
+ </>
278
+ ),
279
+ },
280
+ ]}
281
+ />
282
+ ),
283
+ )
284
+ }
285
+ </>
286
+ )
287
+ }
288
+ {
289
+ (info.hiddenRectifyUserCO && Object.keys(info.hiddenRectifyUserCO).length > 0) && (
290
+ <>
291
+ <Divider orientation="left">整改信息</Divider>
292
+ <Descriptions
293
+ bordered
294
+ column={1}
295
+ labelStyle={{ width: 200 }}
296
+ items={[
297
+ { label: "整改部门", children: info.hiddenRectifyUserCO.deptName },
298
+ { label: "整改人", children: info.hiddenRectifyUserCO.userName },
299
+ { label: "整改时间", children: info.hiddenRectifyUserCO.rectificationTime },
300
+ { label: "整改描述", children: info.hiddenRectifyUserCO.descr },
301
+ { label: "投入资金", children: info.hiddenRectifyUserCO.investmentFunds },
302
+ { label: "临时安全措施", children: info.tempSafeMeasure },
303
+ { label: "整改后图片", children: <PreviewImg files={afterRectificationImageFiles} /> },
304
+ { label: "整改方案", children: info.hiddenRectifyUserCO.isRectificationScheme === 0 ? "无" : "有" },
305
+ ...((info.hiddenRectifyUserCO.isRectificationScheme === 1 && info.hiddenRectifyUserCO.hiddenSchemeCO && Object.keys(info.hiddenRectifyUserCO.hiddenSchemeCO).length > 0)
306
+ ? [
307
+ { label: "治理标准", children: info.hiddenRectifyUserCO.hiddenSchemeCO.governStanDards },
308
+ { label: "治理方法", children: info.hiddenRectifyUserCO.hiddenSchemeCO.governMethod },
309
+ { label: "经费落实", children: info.hiddenRectifyUserCO.hiddenSchemeCO.expenditure },
310
+ { label: "负责人员", children: info.hiddenRectifyUserCO.hiddenSchemeCO.principal },
311
+ { label: "工时安排", children: info.hiddenRectifyUserCO.hiddenSchemeCO.programming },
312
+ { label: "时限要求", children: info.hiddenRectifyUserCO.hiddenSchemeCO.timeLimitFor },
313
+ { label: "工作要求", children: info.hiddenRectifyUserCO.hiddenSchemeCO.jobRequireMent },
314
+ { label: "其他事项", children: info.hiddenRectifyUserCO.hiddenSchemeCO.otherBusiness },
315
+ { label: "方案图片", children: <PreviewImg files={rectificationPlanImageFiles} /> },
316
+ ]
317
+ : []),
318
+ ]}
319
+ />
320
+ </>
321
+ )
322
+ }
323
+ {
324
+ info.isQualified === 1
325
+ ? (
326
+ (info.hiddenAcceptUserCO && Object.keys(info.hiddenAcceptUserCO).length > 0)
327
+ ? (
328
+ <>
329
+ <Divider orientation="left">验收信息</Divider>
330
+ <Descriptions
331
+ bordered
332
+ column={1}
333
+ labelStyle={{ width: 200 }}
334
+ items={[
335
+ { label: "验收部门", children: info.hiddenAcceptUserCO.deptName },
336
+ { label: "验收人", children: info.hiddenAcceptUserCO.userName },
337
+ { label: "验收时间", children: info.hiddenAcceptUserCO.rectificationTime },
338
+ { label: "验收打回意见", children: info.hiddenAcceptUserCO.repulseCause },
339
+ { label: "是否合格", children: "合格" },
340
+ { label: "验收描述", children: info.hiddenAcceptUserCO.descr },
341
+ { label: "验收图片", children: <PreviewImg files={acceptImageFiles} /> },
342
+ ]}
343
+ />
344
+ </>
345
+ )
346
+ : (
347
+ <>
348
+ <Divider orientation="left">验收打回信息</Divider>
349
+ <Descriptions
350
+ bordered
351
+ column={1}
352
+ labelStyle={{ width: 200 }}
353
+ items={[
354
+ { label: "验收部门", children: info.hiddenAcceptUserCO.deptName },
355
+ { label: "验收人", children: info.hiddenAcceptUserCO.userName },
356
+ { label: "验收时间", children: info.hiddenAcceptUserCO.rectificationTime },
357
+ { label: "验收打回意见", children: info.hiddenAcceptUserCO.repulseCause },
358
+ ]}
359
+ />
360
+ </>
361
+ )
267
362
  )
268
- }
269
- </>
270
- )
271
- }
272
- {
273
- (info.hiddenRectifyUserCO && Object.keys(info.hiddenRectifyUserCO).length > 0) && (
274
- <>
275
- <Divider orientation="left">整改信息</Divider>
276
- <Descriptions
277
- bordered
278
- column={1}
279
- labelStyle={{ width: 200 }}
280
- items={[
281
- { label: "整改部门", children: info.hiddenRectifyUserCO.deptName },
282
- { label: "整改人", children: info.hiddenRectifyUserCO.userName },
283
- { label: "整改时间", children: info.hiddenRectifyUserCO.rectificationTime },
284
- { label: "整改描述", children: info.hiddenRectifyUserCO.descr },
285
- { label: "投入资金", children: info.hiddenRectifyUserCO.investmentFunds },
286
- { label: "临时安全措施", children: info.tempSafeMeasure },
287
- { label: "整改后图片", children: <PreviewImg files={afterRectificationImageFiles} /> },
288
- { label: "整改方案", children: info.hiddenRectifyUserCO.isRectificationScheme === 0 ? "无" : "有" },
289
- ...((info.hiddenRectifyUserCO.isRectificationScheme === 1 && info.hiddenRectifyUserCO.hiddenSchemeCO && Object.keys(info.hiddenRectifyUserCO.hiddenSchemeCO).length > 0)
290
- ? [
291
- { label: "治理标准", children: info.hiddenRectifyUserCO.hiddenSchemeCO.governStanDards },
292
- { label: "治理方法", children: info.hiddenRectifyUserCO.hiddenSchemeCO.governMethod },
293
- { label: "经费落实", children: info.hiddenRectifyUserCO.hiddenSchemeCO.expenditure },
294
- { label: "负责人员", children: info.hiddenRectifyUserCO.hiddenSchemeCO.principal },
295
- { label: "工时安排", children: info.hiddenRectifyUserCO.hiddenSchemeCO.programming },
296
- { label: "时限要求", children: info.hiddenRectifyUserCO.hiddenSchemeCO.timeLimitFor },
297
- { label: "工作要求", children: info.hiddenRectifyUserCO.hiddenSchemeCO.jobRequireMent },
298
- { label: "其他事项", children: info.hiddenRectifyUserCO.hiddenSchemeCO.otherBusiness },
299
- { label: "方案图片", children: <PreviewImg files={rectificationPlanImageFiles} /> },
300
- ]
301
- : []),
302
- ]}
303
- />
304
- </>
305
- )
306
- }
307
- {
308
- info.isQualified === 1
309
- ? (
310
- (info.hiddenAcceptUserCO && Object.keys(info.hiddenAcceptUserCO).length > 0)
311
- ? (
312
- <>
313
- <Divider orientation="left">验收信息</Divider>
314
- <Descriptions
315
- bordered
316
- column={1}
317
- labelStyle={{ width: 200 }}
318
- items={[
319
- { label: "验收部门", children: info.hiddenAcceptUserCO.deptName },
320
- { label: "验收人", children: info.hiddenAcceptUserCO.userName },
321
- { label: "验收时间", children: info.hiddenAcceptUserCO.rectificationTime },
322
- { label: "验收打回意见", children: info.hiddenAcceptUserCO.repulseCause },
323
- { label: "是否合格", children: "合格" },
324
- { label: "验收描述", children: info.hiddenAcceptUserCO.descr },
325
- { label: "验收图片", children: <PreviewImg files={acceptImageFiles} /> },
326
- ]}
327
- />
328
- </>
329
- )
330
- : (
331
- <>
332
- <Divider orientation="left">验收打回信息</Divider>
333
- <Descriptions
334
- bordered
335
- column={1}
336
- labelStyle={{ width: 200 }}
337
- items={[
338
- { label: "验收部门", children: info.hiddenAcceptUserCO.deptName },
339
- { label: "验收人", children: info.hiddenAcceptUserCO.userName },
340
- { label: "验收时间", children: info.hiddenAcceptUserCO.rectificationTime },
341
- { label: "验收打回意见", children: info.hiddenAcceptUserCO.repulseCause },
342
- ]}
343
- />
344
- </>
345
- )
346
- )
347
- : null
348
- }
349
- <Divider orientation="left">安全环保验收信息</Divider>
350
- <Descriptions
351
- bordered
352
- column={1}
353
- labelStyle={{ width: 200 }}
354
- items={[
355
- { label: "验收人", children: "todo" },
356
- { label: "验收时间", children: "todo" },
357
- { label: "是否合格", children: "todo" },
358
- { label: "验收描述", children: "todo" },
359
- { label: "验收图片", children: "todo" },
360
- ]}
361
- />
362
- </div>
363
+ : null
364
+ }
365
+ <Divider orientation="left">安全环保验收信息</Divider>
366
+ <Descriptions
367
+ bordered
368
+ column={1}
369
+ labelStyle={{ width: 200 }}
370
+ items={[
371
+ { label: "验收人", children: "todo" },
372
+ { label: "验收时间", children: "todo" },
373
+ { label: "是否合格", children: "todo" },
374
+ { label: "验收描述", children: "todo" },
375
+ { label: "验收图片", children: "todo" },
376
+ ]}
377
+ />
378
+ </div>
363
379
  </Spin>
364
380
  </div>
365
381
  );
@@ -3,6 +3,8 @@ import type { CSSProperties, FC } from "react";
3
3
  export interface PdfProps {
4
4
  /** pdf 文件地址 */
5
5
  file: string;
6
+ /** pdf 文件名 */
7
+ name?: string;
6
8
  /** 是否显示弹窗 */
7
9
  visible?: boolean;
8
10
  /** 关闭弹窗的方法 */
@@ -1,6 +1,7 @@
1
- import { Button, message, Modal, Spin } from "antd";
1
+ import { message, Modal, Spin } from "antd";
2
2
  import { useState } from "react";
3
3
  import { Document, Page, pdfjs } from "react-pdf";
4
+ import useDownloadFile from "../../hooks/useDownloadFile";
4
5
  import { getFileUrl } from "../../utils/index";
5
6
 
6
7
  /**
@@ -11,6 +12,7 @@ function Pdf(props) {
11
12
  visible = false,
12
13
  onCancel,
13
14
  file,
15
+ name,
14
16
  inline = false,
15
17
  style = {},
16
18
  } = props;
@@ -70,6 +72,21 @@ function Pdf(props) {
70
72
  return renderPdfContent();
71
73
  }
72
74
 
75
+ const { loading: downloadFileLoading, downloadFile } = useDownloadFile();
76
+
77
+ const onDownloadFile = () => {
78
+ Modal.confirm({
79
+ title: "提示",
80
+ content: "确定要下载此文件吗?",
81
+ onOk: () => {
82
+ downloadFile({
83
+ url: fileUrl,
84
+ name,
85
+ });
86
+ },
87
+ });
88
+ };
89
+
73
90
  // 默认弹窗模式
74
91
  return (
75
92
  <Modal
@@ -77,7 +94,10 @@ function Pdf(props) {
77
94
  width={pdfWidth + 100}
78
95
  title="PDF预览"
79
96
  onCancel={onCancel}
80
- footer={<Button onClick={onCancel}>关闭</Button>}
97
+ cancelText="关闭"
98
+ okText="下载"
99
+ onOk={onDownloadFile}
100
+ loading={downloadFileLoading}
81
101
  >
82
102
  {renderPdfContent()}
83
103
  </Modal>
@@ -15,16 +15,19 @@ const PreviewPdf = (props) => {
15
15
  } = props;
16
16
 
17
17
  const [visible, setVisible] = useState(false);
18
- const [src, setSrc] = useState("");
18
+ const [currentSrc, setCurrentSrc] = useState("");
19
+ const [currentName, setCurrentName] = useState("");
19
20
 
20
- const previewPdf = (src) => {
21
+ const previewPdf = (src, name) => {
21
22
  setVisible(true);
22
- setSrc(src);
23
+ setCurrentSrc(src);
24
+ setCurrentName(name);
23
25
  };
24
26
 
25
27
  const onCancel = () => {
26
28
  setVisible(false);
27
- setSrc("");
29
+ setCurrentSrc("");
30
+ setCurrentName("");
28
31
  };
29
32
 
30
33
  // 单个文件预览模式
@@ -33,13 +36,14 @@ const PreviewPdf = (props) => {
33
36
  <>
34
37
  <Space>
35
38
  <span>{name}</span>
36
- <Button type="primary" size="small" onClick={() => previewPdf(url)}>
39
+ <Button type="primary" size="small" onClick={() => previewPdf(url, name)}>
37
40
  预览
38
41
  </Button>
39
42
  </Space>
40
43
  <Pdf
41
44
  visible={visible}
42
- file={src}
45
+ file={currentSrc}
46
+ name={currentName}
43
47
  onCancel={onCancel}
44
48
  />
45
49
  </>
@@ -57,7 +61,7 @@ const PreviewPdf = (props) => {
57
61
  <Button
58
62
  type="primary"
59
63
  size="small"
60
- onClick={() => previewPdf(item.filePath || item[urlKey])}
64
+ onClick={() => previewPdf(item.filePath || item[urlKey], item.name || item.fileName || item[nameKey])}
61
65
  >
62
66
  预览
63
67
  </Button>
@@ -66,7 +70,8 @@ const PreviewPdf = (props) => {
66
70
  ))}
67
71
  <Pdf
68
72
  visible={visible}
69
- file={src}
73
+ file={currentSrc}
74
+ name={currentName}
70
75
  onCancel={onCancel}
71
76
  />
72
77
  </>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zy-react-library",
3
3
  "private": false,
4
- "version": "1.0.71",
4
+ "version": "1.0.72",
5
5
  "type": "module",
6
6
  "description": "",
7
7
  "author": "LiuJiaNan",