dev_1.2
tangjie 2026-07-27 16:47:58 +08:00
parent bbfb21730c
commit a42e658686
3 changed files with 42 additions and 26 deletions

View File

@ -8,6 +8,7 @@ import {
Spin, Spin,
Empty, Empty,
Typography, Typography,
Image,
} from "antd"; } from "antd";
import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout"; import PageLayout from "@cqsjjb/jjb-react-admin-component/PageLayout";
import { AntdTableFuncControl } from "@cqsjjb/jjb-common-decorator/antd"; import { AntdTableFuncControl } from "@cqsjjb/jjb-common-decorator/antd";
@ -42,6 +43,35 @@ const parseFileList = (raw) => {
} }
}; };
/** 判断 URL 是否为图片 */
const isImageUrl = (url) =>
/\.(jpg|jpeg|png|gif|webp|bmp)(\?.*)?$/i.test(url || "");
/** 渲染单个文件:图片用 Image 预览,其他用链接 */
const renderFile = (file, idx) => {
if (isImageUrl(file.url)) {
return (
<Image
key={file.uid || idx}
src={file.url}
width={80}
height={80}
className="epm-detail-file"
/>
);
}
return (
<Typography.Link
key={file.uid || idx}
href={file.url}
target="_blank"
className="epm-detail-file"
>
{file.name || `附件${idx + 1}`}
</Typography.Link>
);
};
// ===== 合同面板 ===== // ===== 合同面板 =====
const ContractPanel = ({ data, loading }) => { const ContractPanel = ({ data, loading }) => {
if (!data?.id) return <Spin><Empty description="暂无合同数据" /></Spin>; if (!data?.id) return <Spin><Empty description="暂无合同数据" /></Spin>;
@ -115,16 +145,7 @@ const ContractPanel = ({ data, loading }) => {
title="合同扫描件" title="合同扫描件"
className="epm-detail-section" className="epm-detail-section"
> >
{scanFiles.map((file, idx) => ( {scanFiles.map((file, idx) => renderFile(file, idx))}
<Typography.Link
key={file.uid || idx}
href={file.url}
target="_blank"
className="epm-detail-file"
>
{file.name || `附件${idx + 1}`}
</Typography.Link>
))}
</Card> </Card>
)} )}
</div> </div>
@ -297,16 +318,7 @@ const SurveyPanel = ({ personnel, attachments, loading, detailData }) => {
title={ATTACH_TYPE_LABELS[typeCode]} title={ATTACH_TYPE_LABELS[typeCode]}
className="epm-detail-section" className="epm-detail-section"
> >
{files.map((file, idx) => ( {files.map((file, idx) => renderFile(file, idx))}
<Typography.Link
key={file.uid || idx}
href={file.url}
target="_blank"
className="epm-detail-file"
>
{file.name || `附件${idx + 1}`}
</Typography.Link>
))}
</Card> </Card>
); );
})} })}

View File

@ -1,4 +1,5 @@
import React, { useState, useEffect } from "react"; import React, { useState, useEffect } from "react";
import dayjs from "dayjs";
import { import {
Row, Row,
Col, Col,
@ -95,7 +96,7 @@ const SurveyMonitor = (props) => {
...router.query, ...router.query,
dateRange: dateRange:
router.query.startTime && router.query.endTime router.query.startTime && router.query.endTime
? [router.query.startTime, router.query.endTime] ? [dayjs(router.query.startTime), dayjs(router.query.endTime)]
: undefined, : undefined,
}); });
getStat(); getStat();
@ -116,7 +117,7 @@ const SurveyMonitor = (props) => {
const handleReset = (values) => { const handleReset = (values) => {
searchForm.resetFields(); searchForm.resetFields();
router.query = { ...values, current: 1, size: 10 }; router.query = { ...values, current: 1, size: 10, startTime: undefined, endTime: undefined };
getData(); getData();
}; };
@ -218,14 +219,14 @@ const SurveyMonitor = (props) => {
}, },
}, },
{ {
title: "应到/实到", title: "实到/应到",
width: 100, width: 100,
render: (_, r) => `${r.expectedCount} / ${r.actualCount}`, render: (_, r) => `${r.actualCount || 0} / ${r.expectedCount || 0}`,
}, },
{ {
title: "签到/签退", title: "签到/签退",
width: 100, width: 100,
render: (_, r) => `${r.signInCount} / ${r.signOutCount}`, render: (_, r) => `${r.signInCount || 0} / ${r.signOutCount || 0}`,
}, },
{ {
title: "现场照片", title: "现场照片",

View File

@ -13,10 +13,13 @@ import {
import { ArrowLeftOutlined } from "@ant-design/icons"; import { ArrowLeftOutlined } from "@ant-design/icons";
import WebOfficeSDK from "~/web-office-sdk-solution-v2.0.7/web-office-sdk-solution-v2.0.7.es.js"; import WebOfficeSDK from "~/web-office-sdk-solution-v2.0.7/web-office-sdk-solution-v2.0.7.es.js";
import { createPortal } from "react-dom"; import { createPortal } from "react-dom";
import { tools } from "@cqsjjb/jjb-common-lib";
import { Connect } from "@cqsjjb/jjb-dva-runtime"; import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { NS_SAFETY_EVAL_BUSINESS } from "~/enumerate/namespace"; import { NS_SAFETY_EVAL_BUSINESS } from "~/enumerate/namespace";
import "./index.less"; import "./index.less";
const { router } = tools;
const App = (props) => { const App = (props) => {
const { onCancel, safetyEvalBusiness } = props; const { onCancel, safetyEvalBusiness } = props;
const { createDocLoading } = safetyEvalBusiness; const { createDocLoading } = safetyEvalBusiness;
@ -247,7 +250,7 @@ const App = (props) => {
size="small" size="small"
onClick={() => { onClick={() => {
props props
.createWpsDoc({ docxUrl: url }) .createWpsDoc({ docxUrl: url, projectId: router.query.id})
.then((res) => { .then((res) => {
const fileId = res?.data?.fileId; const fileId = res?.data?.fileId;
if (!fileId) { if (!fileId) {