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 ?
- this.doOptionChange(it, idx, 1, evt)} />
- 正确
+ this.doOptionChange(it, idx, 1, evt)} >正确
+ {/* */}
|
:
{
it.Nav_Test.TYPE === 1 ?
- this.doOptionChange(it, idx, 1, evt)} />
+ this.doOptionChange(it, idx, 1, evt)} >A.{it.Nav_Test.OPTION_A}
:
- this.doOptionChange(it, idx, 1, evt)} />
+ this.doOptionChange(it, idx, 1, evt)} >A.{it.Nav_Test.OPTION_A}
}
- A.
- {it.Nav_Test.OPTION_A}
+ {/* A.
+ {it.Nav_Test.OPTION_A} */}
|
}
@@ -414,19 +468,19 @@ class SE061PaperPage extends React.Component {
{
it.Nav_Test.TYPE === 0 ?
- this.doOptionChange(it, idx, 2, evt)} />
- 错误
+ this.doOptionChange(it, idx, 2, evt)} >错误
+ {/* 错误 */}
|
:
{
it.Nav_Test.TYPE === 1 ?
- this.doOptionChange(it, idx, 2, evt)} />
+ this.doOptionChange(it, idx, 2, evt)} >B.{it.Nav_Test.OPTION_B}
:
- this.doOptionChange(it, idx, 2, evt)} />
+ this.doOptionChange(it, idx, 2, evt)} >B.{it.Nav_Test.OPTION_B}
}
- B.
- {it.Nav_Test.OPTION_B}
+ {/* B.
+ {it.Nav_Test.OPTION_B} */}
|
}
@@ -436,12 +490,12 @@ class SE061PaperPage extends React.Component {
{
it.Nav_Test.TYPE === 1 ?
- this.doOptionChange(it, idx, 4, evt)} />
+ this.doOptionChange(it, idx, 4, evt)} >C.{it.Nav_Test.OPTION_C}
:
- this.doOptionChange(it, idx, 4, evt)} />
+ this.doOptionChange(it, idx, 4, evt)} >C.{it.Nav_Test.OPTION_C}
}
- C.
- {it.Nav_Test.OPTION_C}
+ {/* C.
+ {it.Nav_Test.OPTION_C} */}
|
}
@@ -451,12 +505,12 @@ class SE061PaperPage extends React.Component {
{
it.Nav_Test.TYPE === 1 ?
- this.doOptionChange(it, idx, 8, evt)} />
+ this.doOptionChange(it, idx, 8, evt)} >D.{it.Nav_Test.OPTION_D}
:
- this.doOptionChange(it, idx, 8, evt)} />
+ this.doOptionChange(it, idx, 8, evt)} >D.{it.Nav_Test.OPTION_D}
}
- D.
- {it.Nav_Test.OPTION_D}
+ {/* D.
+ {it.Nav_Test.OPTION_D} */}
|
}
@@ -466,12 +520,12 @@ class SE061PaperPage extends React.Component {
{
it.Nav_Test.TYPE === 1 ?
- this.doOptionChange(it, idx, 16, evt)} />
+ this.doOptionChange(it, idx, 16, evt)} >E.{it.Nav_Test.OPTION_E}
:
- this.doOptionChange(it, idx, 16, evt)} />
+ this.doOptionChange(it, idx, 16, evt)} >E.{it.Nav_Test.OPTION_E}
}
- E.
- {it.Nav_Test.OPTION_E}
+ {/* E.
+ {it.Nav_Test.OPTION_E} */}
|
}
diff --git a/src/components/CustomPages/SE/SE062ShowPrint.js b/src/components/CustomPages/SE/SE062ShowPrint.js
index 734349b..5230fbe 100644
--- a/src/components/CustomPages/SE/SE062ShowPrint.js
+++ b/src/components/CustomPages/SE/SE062ShowPrint.js
@@ -1,7 +1,7 @@
import { message } from "antd/lib/index";
import { Button, Descriptions, Modal, Row, Col, Checkbox, Radio, Form, Input, Select, Table, Upload, Icon, PageHeader } from 'antd';
import React from 'react';
-import { initFilter, extendRule, extendInclude, GetFileModel, guid, initQueryFilter, showFiles } from "../../../utils/common";
+import { initFilter, extendRule, extendInclude, GetFileModel, guid, getArryPropShow, showFiles } from "../../../utils/common";
import ReactToPrint from "react-to-print";
import styles from '../../CustomPages/HI/StepForm.css';
import XLSX from 'xlsx';
@@ -48,6 +48,7 @@ class SE062ShowPrint extends React.Component {
extendInclude(json, 'Nav_NewUser.Nav_User');
extendInclude(json, 'Nav_NewUser.Nav_Content');
extendInclude(json, 'Nav_NewUser.Nav_Files.Nav_ImgFile');
+ extendInclude(json, 'Nav_NewUser.Nav_Teachers.Nav_User');
extendInclude(json, 'Nav_User');
extendInclude(json, 'Nav_Department');
@@ -120,6 +121,7 @@ class SE062ShowPrint extends React.Component {
}
})
}
+
render() {
const { data } = this.state;
const enums = this.props.data.enums ? this.props.data.enums : this.props.app.enums;
@@ -144,8 +146,10 @@ class SE062ShowPrint extends React.Component {
{data ? data.Nav_NewUser.END_TIME : null}
{data ? data.Nav_NewUser.TRAINNING_TIME : null}
{data ? data.Nav_NewUser.TAINNING_ADDR : null}
- {data ? data.Nav_NewUser.TEACHER : null}
- {data ? this.returnModel(data.Nav_NewUser.TRAIN_MODEL) : null}
+ {/* {data ? data.Nav_NewUser.TEACHER : null} */}
+ {getArryPropShow(data.Nav_NewUser.Nav_Teachers, "Nav_User.NAME")}
+ {/* {data ? this.returnModel(data.Nav_NewUser.TRAIN_MODEL) : null} */}
+ {enums.TrainType.enums[data.Nav_NewUser?.TRAINTYPE]}
{data && data.Nav_NewUser.Nav_Content ? data.Nav_NewUser.Nav_Content.NAME : ''}
{showFiles(data.Nav_NewUser.Nav_Files, config.picServerHost, this)}
@@ -163,7 +167,7 @@ class SE062ShowPrint extends React.Component {
{data ? data.SCORE : null}
{/* {data ? data.EXAMINATION_RESULTS == 1 ? "合格" : "不合格" : null} */}
{(data && data.EXAMINATION_RESULTS && data.SCORE) ? enums.SEExaminationResultsEnum.enums[data.EXAMINATION_RESULTS] : ""}
- {data ? this.returnModel(data.Nav_NewUser.TRAIN_MODEL) : null}
+ {/* {data ? this.returnModel(data.Nav_NewUser.TRAIN_MODEL) : null} */}
{showFiles(data.Nav_Files, config.picServerHost, this)}
: null
diff --git a/src/files/edit/SE061.js b/src/files/edit/SE061.js
index c03b436..4715626 100644
--- a/src/files/edit/SE061.js
+++ b/src/files/edit/SE061.js
@@ -10,7 +10,7 @@ export default {
params.record.TaskID = params.data.TaskID //TaskID传递消息表ID
params.record.PUBLISH = params.customParams;
},
- onBeforeEdit: ({ isNew, stateData, setFieldVisible, setFieldValue, setRowFieldVisible }) => {
+ onBeforeEdit: ({ isNew, stateData, setFieldVisible, setRowFieldLabel, setRowFieldVisible }) => {
if (stateData.IS_CREATETEST == 0) {
setRowFieldVisible("T_SE_NEW_USER_DETAIL", { "SCORE": true, "EXAMINATION_RESULTS": true, "Nav_Files": true })
} else if (stateData.IS_CREATETEST == 1) {
@@ -20,6 +20,21 @@ export default {
if (stateData.TRAIN_STATUS == 3) {
setRowFieldVisible("T_SE_NEW_USER_DETAIL", { "Nav_DepartmentNext.NAME": false })
}
+ // TRAIN_STATUS 公司级 = 0, 部门级 = 1, 车间级 = 2, 班组级 = 3,
+ // Nav_DepartmentNext.NAME
+ if (stateData.TRAIN_STATUS == 0) {
+ setRowFieldLabel(
+ "T_SE_NEW_USER_DETAIL", {
+ 'Nav_DepartmentNext.NAME': '部门/车间级培训组织'
+ })
+ } else if (stateData.TRAIN_STATUS == 1) {
+ setRowFieldLabel(
+ "T_SE_NEW_USER_DETAIL", {
+ 'Nav_DepartmentNext.NAME': '班组级培训组织'
+ })
+ } else if (stateData.TRAIN_STATUS == 2 || stateData.TRAIN_STATUS == 3) {
+ // 列不可见
+ }
},
onChange: ({ isNew, stateData, setFieldVisible, setFieldValue, setRowFieldVisible }) => {
if (stateData.IS_CREATETEST == 0) {
diff --git a/src/utils/common.js b/src/utils/common.js
index d074608..77dd3a8 100644
--- a/src/utils/common.js
+++ b/src/utils/common.js
@@ -1937,4 +1937,19 @@ export function showEnum(enums, TRAIN_TYPE) {
}
}
return result
+}
+
+
+/****** 附件ListModel的某个二级属性 getArryPropShow(data.Nav_Teachers, "Nav_User.NAME") ******/
+export function getArryPropShow(arry, propPath) {
+ var arryShow = ''
+ const [prop1, prop2] = propPath.split('.');
+ if (arry && arry.length > 0 && propPath) {
+ arry.map(function (item, index) {
+ var itemProp = item[prop1]?.[prop2]
+ if (itemProp && itemProp.length > 0)
+ arryShow += (index > 0 ? ',' : '') + itemProp;
+ });
+ }
+ return arryShow;
}
\ No newline at end of file