From 33c72f66c28aed3a797a44c37c5098f3fb08c389 Mon Sep 17 00:00:00 2001
From: luotaiqian <1147642922@qq.com>
Date: Fri, 21 Aug 2026 14:43:11 +0800
Subject: [PATCH 1/2] paper
---
jjb.config.js | 4 +--
src/api/safetyEvalBusiness/index.js | 21 ++++++++++++++
src/pages/Container/WpsEditor/index.js | 38 +++++++++++++++++++++++++-
3 files changed, 60 insertions(+), 3 deletions(-)
diff --git a/jjb.config.js b/jjb.config.js
index 5157f2e..1f205b6 100644
--- a/jjb.config.js
+++ b/jjb.config.js
@@ -12,8 +12,8 @@ module.exports = {
// 可通过环境变量覆盖: SAFETY_EVAL_API_HOST=http://192.168.x.x:8095
//API_HOST: "http://localhost:80",
- API_HOST: "http://192.168.0.134",
- // API_HOST: "http://192.168.0.150", //太浅
+ // API_HOST: "http://192.168.0.134",
+ API_HOST: "http://192.168.0.150", //太浅
// API_HOST: "https://gbs-gateway.qhdsafety.com",
// API_HOST: "http://192.168.0.103", //huwei
},
diff --git a/src/api/safetyEvalBusiness/index.js b/src/api/safetyEvalBusiness/index.js
index a259c2e..bdab6bc 100644
--- a/src/api/safetyEvalBusiness/index.js
+++ b/src/api/safetyEvalBusiness/index.js
@@ -24,6 +24,27 @@ export const getDocByProjectId = declareRequest(
'wpsDoc: {} | res.data || {}',
);
+/**
+ * 上传已有 Word 文件并创建 WPS 文档,返回可打开的 WPS 文档信息
+ * multipart/form-data,declareRequest 仅支持 json,故手动 fetch
+ * @param {File} file Word 文件(.doc/.docx)
+ * @param {String} projectId 项目 ID
+ */
+export async function uploadWpsDoc(file, projectId) {
+ const formData = new FormData();
+ formData.append("file", file);
+ formData.append("projectId", projectId);
+ const res = await fetch(
+ `${window.process.env.app.API_HOST}/safetyEval-h5/wsp/doc/upload`,
+ {
+ method: "POST",
+ headers: { token: sessionStorage.getItem("token") },
+ body: formData,
+ },
+ );
+ return res.json();
+}
+
export const downloadWpsDoc = declareRequest(
"downloadDocLoading",
"Get > /safetyEval-h5/wsp/v3/3rd/files/{fileId}/download",
diff --git a/src/pages/Container/WpsEditor/index.js b/src/pages/Container/WpsEditor/index.js
index 0120afe..9ed047a 100644
--- a/src/pages/Container/WpsEditor/index.js
+++ b/src/pages/Container/WpsEditor/index.js
@@ -8,9 +8,11 @@ import {
Tag,
Progress,
Typography,
+ Upload,
message,
} from "antd";
import { ArrowLeftOutlined } from "@ant-design/icons";
+import { uploadWpsDoc } from "~/api/safetyEvalBusiness";
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 { tools } from "@cqsjjb/jjb-common-lib";
@@ -27,6 +29,7 @@ const App = (props) => {
const [expandedMap, setExpandedMap] = useState({});
const [fileId, setFileId] = useState(props.fileId);
const [templateMap, setTemplateMap] = useState([]);
+ const [uploading, setUploading] = useState(false);
const sdkRef = useRef(null);
useEffect(() => {
@@ -51,6 +54,29 @@ const App = (props) => {
message.success("保存成功");
};
+ const beforeUploadWord = (file) => {
+ if (!/\.(docx?)$/i.test(file.name)) {
+ message.error("仅支持上传 Word 文件(.doc / .docx)");
+ return Upload.LIST_IGNORE;
+ }
+ setUploading(true);
+ uploadWpsDoc(file, router.query.id)
+ .then((res) => {
+ const newFileId = res?.data?.fileId;
+ if (!newFileId) {
+ throw new Error(res?.errMessage || res?.message || "上传失败");
+ }
+ setFileId(newFileId);
+ message.success("Word 文件上传成功,已在编辑器中打开");
+ })
+ .catch((e) => {
+ message.error(e?.message || "上传失败,请重试");
+ })
+ .finally(() => setUploading(false));
+ // 阻止 antd 自动上传,由手动 fetch 提交
+ return false;
+ };
+
const handleDownload = async () => {
if (!sdkRef.current) {
message.warning("文档尚未加载完成");
@@ -162,9 +188,19 @@ const App = (props) => {
}
extra={
+ {!readOnly && (
+
+
+
+ )}
{!readOnly && }
-
+
}
>
From 6bfb3c9fd090443674e54e20eff8a2119cc030ba Mon Sep 17 00:00:00 2001
From: luotaiqian <1147642922@qq.com>
Date: Fri, 21 Aug 2026 15:39:13 +0800
Subject: [PATCH 2/2] paper
---
src/api/safetyEvalBusiness/index.js | 5 +++++
src/pages/Container/WpsEditor/index.js | 28 +++++++++++++++++++-------
2 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/src/api/safetyEvalBusiness/index.js b/src/api/safetyEvalBusiness/index.js
index bdab6bc..c6cb027 100644
--- a/src/api/safetyEvalBusiness/index.js
+++ b/src/api/safetyEvalBusiness/index.js
@@ -360,6 +360,11 @@ export const evalReportSubmit = declareRequest(
"Post > @/safetyEval/institution/eval-report/submit",
);
+export const evalReportCompletePreparation = declareRequest(
+ "evalReportCompletePreparationLoading",
+ "Post > @/safetyEval/institution/eval-report/preparation/complete",
+);
+
/**
* 机构端报告库-批量报送监管端
*
diff --git a/src/pages/Container/WpsEditor/index.js b/src/pages/Container/WpsEditor/index.js
index 9ed047a..e67ae74 100644
--- a/src/pages/Container/WpsEditor/index.js
+++ b/src/pages/Container/WpsEditor/index.js
@@ -25,7 +25,8 @@ const { router } = tools;
const App = (props) => {
const { onCancel, safetyEvalBusiness, readOnly } = props;
- const { createDocLoading } = safetyEvalBusiness;
+ const { createDocLoading, evalReportCompletePreparationLoading } =
+ safetyEvalBusiness;
const [expandedMap, setExpandedMap] = useState({});
const [fileId, setFileId] = useState(props.fileId);
const [templateMap, setTemplateMap] = useState([]);
@@ -51,12 +52,18 @@ const App = (props) => {
}
await sdkRef.current.save();
- message.success("保存成功");
+ // 完成报告编制:将 REPORT_PREPARATION 节点置为已完成,提交内审
+ const res = await props.evalReportCompletePreparation({
+ data: { projectId: router.query.id },
+ });
+ if (res?.success !== false) {
+ message.success("报告编制已完成,已提交内审");
+ }
};
const beforeUploadWord = (file) => {
- if (!/\.(docx?)$/i.test(file.name)) {
- message.error("仅支持上传 Word 文件(.doc / .docx)");
+ if (!/\.(docx?|pdf)$/i.test(file.name)) {
+ message.error("仅支持上传 Word / PDF 文件(.doc / .docx / .pdf)");
return Upload.LIST_IGNORE;
}
setUploading(true);
@@ -190,15 +197,22 @@ const App = (props) => {
{!readOnly && (
-
+
)}
- {!readOnly && }
+ {!readOnly && (
+
+ )}