diff --git a/.api/safetyEval-institution-eval-sign-task-save-post/spec.json b/.api/safetyEval-institution-eval-sign-task-save-post/spec.json new file mode 100644 index 0000000..b7c8d52 --- /dev/null +++ b/.api/safetyEval-institution-eval-sign-task-save-post/spec.json @@ -0,0 +1,84 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "新增签字任务", + "version": "1.0.0" + }, + "paths": { + "/safetyEval/institution/eval-sign-task/save": { + "post": { + "summary": "新增签字任务", + "tags": ["机构端-签字任务"], + "requestBody": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/EvalSignTaskSaveCmd" } + } + } + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/SingleResponseEvalSignTaskCO" } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "EvalSignTaskSaveCmd": { + "type": "object", + "properties": { + "projectId": { "type": "string", "description": "项目ID" }, + "nodeCode": { + "type": "string", + "description": "所属节点编码:NODE_01风险分析 NODE_02业务合同 NODE_03项目组成立 NODE_04现场踏勘 NODE_05报告编制 NODE_06内部审核 NODE_07技术审核 NODE_08过程控制" + }, + "bizRefId": { "type": "string", "description": "业务关联ID" }, + "signerPersonnelId": { "type": "string", "description": "签字人员ID" }, + "taskTitle": { "type": "string", "description": "任务标题" }, + "taskStatusCode": { "type": "integer", "description": "任务状态编码:1待签 2已签 3已作废" }, + "issueTime": { "type": "string", "description": "下发时间" }, + "signerUrl": { "type": "string", "description": "签字图片" }, + "remarks": { "type": "string", "description": "备注" } + }, + "required": ["projectId"] + }, + "SingleResponseEvalSignTaskCO": { + "type": "object", + "properties": { + "success": { "type": "boolean", "description": "是否成功" }, + "code": { "type": "string", "description": "响应码" }, + "message": { "type": "string", "description": "响应消息" }, + "errMessage": { "type": "string", "description": "错误响应消息" }, + "data": { "$ref": "#/components/schemas/EvalSignTaskCO" } + } + }, + "EvalSignTaskCO": { + "type": "object", + "properties": { + "id": { "type": "string", "description": "签字任务ID" }, + "orgId": { "type": "string", "description": "机构ID" }, + "projectId": { "type": "string", "description": "项目ID" }, + "nodeCode": { "type": "string", "description": "所属节点编码" }, + "bizRefId": { "type": "string", "description": "业务关联ID" }, + "signerPersonnelId": { "type": "string", "description": "签字人员ID" }, + "taskTitle": { "type": "string", "description": "任务标题" }, + "taskStatusCode": { "type": "integer", "description": "任务状态编码:1待签 2已签 3已作废" }, + "taskStatusName": { "type": "string", "description": "任务状态名称" }, + "issueTime": { "type": "string", "description": "下发时间" }, + "signerUrl": { "type": "string", "description": "签字图片" }, + "remarks": { "type": "string", "description": "备注" }, + "createName": { "type": "string", "description": "创建人" }, + "createTime": { "type": "string", "description": "创建时间" }, + "updateTime": { "type": "string", "description": "更新时间" } + } + } + } + } +} diff --git a/.api/safetyEval-institution-eval-sign-task-save-post/type.d.ts b/.api/safetyEval-institution-eval-sign-task-save-post/type.d.ts new file mode 100644 index 0000000..993c3ed --- /dev/null +++ b/.api/safetyEval-institution-eval-sign-task-save-post/type.d.ts @@ -0,0 +1,49 @@ +// POST /safetyEval/institution/eval-sign-task/save +// See ./spec.json + +export interface EvalSignTaskSaveCmd { + /** 项目ID */ + projectId: string; + /** 所属节点编码:NODE_01风险分析 NODE_02业务合同 NODE_03项目组成立 NODE_04现场踏勘 NODE_05报告编制 NODE_06内部审核 NODE_07技术审核 NODE_08过程控制 */ + nodeCode?: string; + /** 业务关联ID */ + bizRefId?: string; + /** 签字人员ID */ + signerPersonnelId?: string; + /** 任务标题 */ + taskTitle?: string; + /** 任务状态编码:1待签 2已签 3已作废 */ + taskStatusCode?: 1 | 2 | 3; + /** 下发时间 */ + issueTime?: string; + /** 签字图片 */ + signerUrl?: string; + /** 备注 */ + remarks?: string; +} + +export interface EvalSignTaskCO { + id: string; + orgId: string; + projectId: string; + nodeCode: string; + bizRefId: string; + signerPersonnelId: string; + taskTitle: string; + taskStatusCode: 1 | 2 | 3; + taskStatusName: string; + issueTime: string; + signerUrl: string; + remarks: string; + createName: string; + createTime: string; + updateTime: string; +} + +export interface SingleResponseEvalSignTaskCO { + success: boolean; + code: string; + message: string; + errMessage: string; + data: EvalSignTaskCO; +} diff --git a/jjb.config.js b/jjb.config.js index 956c00a..1df0572 100644 --- a/jjb.config.js +++ b/jjb.config.js @@ -13,8 +13,8 @@ module.exports = { //API_HOST: "https://gbs-gateway.qhdsafety.com", //API_HOST: "http://192.168.0.152", - API_HOST: "http://192.168.0.150", //太浅 - // API_HOST: "http://192.168.0.152", + //API_HOST: "http://192.168.0.150", //太浅 + API_HOST: "http://192.168.0.152", //API_HOST: "http://192.168.0.103", //huwei }, production: { diff --git a/src/api/safetyEvalBusiness/index.js b/src/api/safetyEvalBusiness/index.js index ffb007e..0df7ad6 100644 --- a/src/api/safetyEvalBusiness/index.js +++ b/src/api/safetyEvalBusiness/index.js @@ -130,6 +130,11 @@ export const evalRiskAnalysisPeopleSave = declareRequest( "Post > @/safetyEval/institution/eval-risk-analysis/participant/save", ); +export const evalSignTaskSave = declareRequest( + "evalSignTaskSaveLoading", + "Post > @/safetyEval/institution/eval-sign-task/save", +); + export const evalProjectMemberPage = declareRequest( "memberLoading", "Get > /safetyEval/institution/eval-project-member/page", diff --git a/src/pages/Container/SafetyEvalBusiness/ProjectFlow/RiskAnalysisContent.js b/src/pages/Container/SafetyEvalBusiness/ProjectFlow/RiskAnalysisContent.js index afe29f9..58d9acd 100644 --- a/src/pages/Container/SafetyEvalBusiness/ProjectFlow/RiskAnalysisContent.js +++ b/src/pages/Container/SafetyEvalBusiness/ProjectFlow/RiskAnalysisContent.js @@ -41,17 +41,20 @@ const RiskAnalysisContent = (props) => { evalRiskAnalysisGet, evalRiskAnalysisSave, evalRiskAnalysisPeopleSave, + evalSignTaskSave, } = props; const { riskAnalysisLoading, evalProjectDetailLoading, riskAnalysisSaveLoading, + evalSignTaskSaveLoading, evalProjectDetailData, } = safetyEvalBusiness || {}; // 查询风险分析数据回显 const [participantModalOpen, setParticipantModalOpen] = useState(false); const [selectedParticipantIds, setSelectedParticipantIds] = useState([]); + const [signingIndex, setSigningIndex] = useState(null); const addParticipantRef = useRef(null); const fetchData = async () => { @@ -108,11 +111,37 @@ const RiskAnalysisContent = (props) => { ); if (result.success) { message.success(statusCode === 2 ? "风险分析已完成" : "已暂存"); - props.getDetail() + props.getDetail(); } } }; + // 发起APP签字 + const handleSignApp = async (fieldName) => { + const participant = form.getFieldValue(["participants", fieldName]); + if (!participant?.personnelId) { + message.warning("该人员信息不完整,请先保存后再发起签字"); + return; + } + setSigningIndex(fieldName); + try { + const res = await evalSignTaskSave({ + projectId, + nodeCode: "RISK_ANALYSIS", + bizRefId: form.getFieldValue("id") || undefined, + signerPersonnelId: participant.personnelId, + taskTitle: "风险分析签字", + taskStatusCode: 1, + }); + if (res?.success) { + message.success("已发起APP签字"); + form.setFieldValue(["participants", fieldName, "signStatusCode"], 1); + } + } finally { + setSigningIndex(null); + } + }; + return (
@@ -301,82 +330,108 @@ const RiskAnalysisContent = (props) => { {(fields, { add, remove }) => { addParticipantRef.current = add; return ( - <> - { - const { key, ...fieldProps } = field; - return ( - - - - ); + <> +
{ + const { key, ...fieldProps } = field; + return ( + + + + ); + }, }, - }, - { - title: "部门/岗位", - dataIndex: "deptName", - render: (_, field) => { - const { key, ...fieldProps } = field; - return ( - - - - ); + { + title: "部门/岗位", + dataIndex: "deptName", + render: (_, field) => { + const { key, ...fieldProps } = field; + return ( + + + + ); + }, }, - }, - { - title: "分析意见", - dataIndex: "opinion", - render: (_, field) => { - const { key, ...fieldProps } = field; - return ( - - - - ); + { + title: "分析意见", + dataIndex: "opinion", + render: (_, field) => { + const { key, ...fieldProps } = field; + return ( + + + + ); + }, }, - }, - { - title: "签字状态", - render: (_, field) => ( - - ), - }, - { - title: "操作", - render: (_, field) => - fields.length > 1 ? ( + { + title: "签字状态", + render: (_, field) => { + const value = form.getFieldValue([ + "participants", + field.name, + "signStatusCode", + ]); + let text = "发起APP签字"; + + if (value === 1) { + text = "待APP签字"; + } + if (value === 2) { + text = "已手写签字"; + } + + return ( + + ); + }, + }, + { + title: "操作", + render: (_, field) => ( - ) : null, - }, - ]} - rowKey={(_, index) => index} - pagination={false} - /> - - - ); - }} + ), + }, + ]} + rowKey={(_, index) => index} + pagination={false} + /> + + + ); + }} @@ -413,14 +468,16 @@ const RiskAnalysisContent = (props) => { open={participantModalOpen} onCancel={() => setParticipantModalOpen(false)} onOk={() => { - const selected = (evalProjectDetailData?.participants || []).filter( - (p) => selectedParticipantIds.includes(p.id), - ); + const selected = ( + evalProjectDetailData?.participants || [] + ).filter((p) => selectedParticipantIds.includes(p.id)); selected.forEach((p) => { addParticipantRef.current?.({ + personnelId: p.id, personnelName: p.name, deptName: p.deptName, opinion: "", + projectId, }); }); setParticipantModalOpen(false); @@ -428,9 +485,9 @@ const RiskAnalysisContent = (props) => { >
{ - const existing = (form.getFieldValue("participants") || []).map( - (p) => p.personnelName, - ); + const existing = ( + form.getFieldValue("participants") || [] + ).map((p) => p.personnelName); return (evalProjectDetailData?.participants || []).filter( (p) => !existing.includes(p.name), );