From 053c4a678620a72d84dbbfe896fbfa05910d82dd Mon Sep 17 00:00:00 2001 From: wyw <571921741@qq.com> Date: Thu, 25 Dec 2025 10:46:30 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=B7=BB=E5=8A=A0=E5=85=AC=E5=85=B1?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E5=AF=B9=20listModel=20=E7=9A=84=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=20=20getArryPropShow=202=E3=80=81=E4=B8=8B=E7=BA=A7?= =?UTF-8?q?=E5=9F=B9=E8=AE=AD=E7=BB=84=E7=BB=87=20=E5=85=B7=E4=BD=93?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=90=8D=E7=A7=B0=20=20=E9=83=A8=E9=97=A8/?= =?UTF-8?q?=E8=BD=A6=E9=97=B4=E7=BA=A7=E5=9F=B9=E8=AE=AD=E7=BB=84=E7=BB=87?= =?UTF-8?q?=20=20=E7=8F=AD=E7=BB=84=E7=BA=A7=E5=9F=B9=E8=AE=AD=E7=BB=84?= =?UTF-8?q?=E7=BB=87=203=E3=80=81=E9=A1=B5=E9=9D=A2=E6=98=BE=E7=A4=BA=20?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E4=BF=AE=E6=94=B9=20=E8=80=81=E5=B8=88=20?= =?UTF-8?q?=E5=9F=B9=E8=AE=AD=E5=BD=A2=E5=BC=8F=204=E3=80=81=E8=80=83?= =?UTF-8?q?=E9=A2=98=20=E5=85=BC=E5=AE=B9=E6=80=A7=20=E4=BF=AE=E6=94=B9=20?= =?UTF-8?q?=E8=80=83=E8=AF=95=E4=BC=A0=20TEXT=5FID=20=E4=BD=86=E6=98=AF=20?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=9F=A5=E7=9C=8B=20=E4=BF=9D=E6=8C=81?= =?UTF-8?q?=E5=8E=9F=E6=9D=A5=E7=9A=84=20=20RECORD=5FID=20=20=EF=BC=88SE06?= =?UTF-8?q?1PaperPage=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CustomPages/SE/SE061PaperPage.js | 188 +++++++++++------- .../CustomPages/SE/SE062ShowPrint.js | 12 +- src/files/edit/SE061.js | 17 +- src/utils/common.js | 15 ++ 4 files changed, 160 insertions(+), 72 deletions(-) diff --git a/src/components/CustomPages/SE/SE061PaperPage.js b/src/components/CustomPages/SE/SE061PaperPage.js index 880da0b..348a2e4 100644 --- a/src/components/CustomPages/SE/SE061PaperPage.js +++ b/src/components/CustomPages/SE/SE061PaperPage.js @@ -1,7 +1,7 @@ import { message } from "antd/lib/index"; import { Button, Popconfirm, Row, Col, Checkbox, Radio, Form, Input, Select, Table, Upload, Icon, PageHeader, Modal, Spin } from 'antd'; import React from 'react'; -import { initFilter, extendRule, extendInclude, setDataFieldValue, guid, initQueryFilter } from "../../../utils/common"; +import { initFilter, extendRule, extendInclude, extendSelectField, guid, initQueryFilter } from "../../../utils/common"; import ReactToPrint from "react-to-print"; import styles from '../../CustomPages/HI/StepForm.css'; import SEstyles from './SE.css'; @@ -55,12 +55,19 @@ class SE061PaperPage extends React.Component { this.props.data.onCancel(); } getUsers = (dataid) => { - debugger let json = initFilter(this.props.login.OrgId); + json.Parameter22 = this.props.data.ORG_ID_HV; json.OrgType = 2; // extendRule(json, 'RECORD_ID', 1, this.props.data.id); - extendRule(json, 'RECORD_ID', 1, dataid); + if (this.props.data.TaskID) { + extendRule(json, 'TEXT_ID', 1, dataid);//RECORD_ID 这个是哪里的 考试 + } else { + extendRule(json, 'RECORD_ID', 1, dataid);// 标准化执行 > 安全教育与培训 > 新三级安全教育记录 小眼睛 查看 有数据 + } extendInclude(json, 'Nav_User'); + extendSelectField(json, 'Nav_User.ID'); + extendSelectField(json, 'Nav_User.NAME'); + extendSelectField(json, 'Nav_User.CODE'); this.state.loading = true; this.props.dispatch({ type: 'app/getDataByPost', @@ -107,15 +114,23 @@ class SE061PaperPage extends React.Component { return; } - let json = initFilter(this.props.login.OrgId, '', 'Nav_Test.TYPE', 1); + json.Parameter22 = this.props.data.ORG_ID_HV; json.OrgType = 2; - extendRule(json, 'RECORD_ID', 1, this.props.data.id); + // extendRule(json, 'TEXT_ID', 1, this.props.data.id);//RECORD_ID 这个是哪个页面 考试 + // extendRule(json, 'RECORD_ID', 1, this.props.data.id);// dataid 标准化执行 > 安全教育与培训 > 新三级安全教育记录 小眼睛 查看 有数据 + + if (this.props.data.TaskID) { + extendRule(json, 'TEXT_ID', 1, this.props.data.id);//RECORD_ID 这个是哪里的 考试 + } else { + extendRule(json, 'RECORD_ID', 1, this.props.data.id);// 标准化执行 > 安全教育与培训 > 新三级安全教育记录 小眼睛 查看 有数据 + } + extendRule(json, 'USER_ID', 1, SelUsrID); extendInclude(json, 'Nav_Record'); - extendInclude(json, 'Nav_Test'); extendInclude(json, 'Nav_User'); + extendInclude(json, 'Nav_Text'); this.state.loading = true; this.props.dispatch({ type: 'app/getDataByPost', @@ -130,11 +145,17 @@ class SE061PaperPage extends React.Component { let notify = record ? record.Nav_Notify : null; let NAME = record.NAME; let hasAnswered = false; - for (let i = 0; i < ret.Nav_Papers.length; i++) { - if (ret.Nav_Papers[i].ANSWER !== 0) { - hasAnswered = true; + if (!this.props.data.TaskID) { + hasAnswered = true; + } + if (!hasAnswered) { + for (let i = 0; i < ret.Nav_Papers.length; i++) { + if (ret.Nav_Papers[i].ANSWER !== 0) { + hasAnswered = true; + } } } + this.setState({ papers, config, @@ -153,7 +174,24 @@ class SE061PaperPage extends React.Component { loadData = (dataid) => { if (this.props.data.id == "") return; - this.getUsers(dataid); + // this.getUsers(dataid); + //如果是待办进来 不要 getUsers 直接获取登录者的试卷进行答题 + if (this.props.data.TaskID && (this.props.data.tableKey == '1' || this.props.data.tableKey == '2')) { + var UserList = [] + UserList.push({ + ID: this.props.login.user.ID, + CODE: this.props.login.user.CODE, + NAME: this.props.login.user.NAME, + }) + this.setState({ + SelUsrID: this.props.login.user.ID, + UserList: UserList + }, () => { + this.getPapers(); + }); + } else { + this.getUsers(dataid); + } } onSave = () => { if (this.state.readonly) { @@ -175,8 +213,10 @@ class SE061PaperPage extends React.Component { Nav_Config: JSON.parse(JSON.stringify(this.state.config)), Nav_Papers: JSON.parse(JSON.stringify(this.state.papers)), TaskID: this.props.data.TaskID, + TEXT_ID: this.props.data.id, ORG_ID: this.props.login.OrgId, } + this.props.dispatch({ type: 'app/getDataByPost', payload: data, @@ -185,6 +225,11 @@ class SE061PaperPage extends React.Component { if (ret) { message.success('提交成功'); this.BtnClose(); + } else if (ret === false) { + //请重新考试 + setTimeout(() => { + this.props.data.onCancel(); + }, 3000); } } }); @@ -269,44 +314,53 @@ class SE061PaperPage extends React.Component { } return str; } + + //分数计算 CalcScore = () => { if (!this.state.readonly) { return ""; - } - let score = 0; - let sscore = 1; - let mscore = 1; - let cscore = 1; - if (this.state.config) { - if (this.state.config.S_TEST_SCORE > 0) { - sscore = this.state.config.S_TEST_SCORE; - } - if (this.state.config.M_TEST_SCORE > 0) { - mscore = this.state.config.M_TEST_SCORE; - } - if (this.state.config.C_TEST_SCORE > 0) { - cscore = this.state.config.C_TEST_SCORE; - } - } - this.state.papers.map((it, idx) => { - if (it.ANSWER !== 0 && it.ANSWER == it.Nav_Test.ANSWER) { - switch (it.Nav_Test.TYPE) { - case 0: { - score += cscore; - break; - } - case 1: { - score += sscore; - break; - } - case 2: { - score += mscore; - break; - } + } else if (this.state.papers == null || this.state.papers.length < 1) { + return ""; + } else if (this.state.papers[0].Nav_Text != null) { + //新增表单 有存分数 后台排序 最后的显示在最前面 + return this.state.papers[0].Nav_Text.SCORE ? this.state.papers[0].Nav_Text.SCORE : ""; + } else { + //按理不能来这边 + let score = 0; + let sscore = 1; + let mscore = 1; + let cscore = 1; + if (this.state.config) { + if (this.state.config.S_TEST_SCORE > 0) { + sscore = this.state.config.S_TEST_SCORE; + } + if (this.state.config.M_TEST_SCORE > 0) { + mscore = this.state.config.M_TEST_SCORE; + } + if (this.state.config.C_TEST_SCORE > 0) { + cscore = this.state.config.C_TEST_SCORE; } } - }) - return score; + this.state.papers.map((it, idx) => { + if (it.ANSWER !== 0 && it.ANSWER == it.Nav_Test.ANSWER) { + switch (it.Nav_Test.TYPE) { + case 0: { + score += cscore; + break; + } + case 1: { + score += sscore; + break; + } + case 2: { + score += mscore; + break; + } + } + } + }) + return score; + } } getType(type) { let ret = ''; @@ -394,19 +448,19 @@ class SE061PaperPage extends React.Component { { it.Nav_Test.TYPE === 0 ?