培训 分数显示修改
This commit is contained in:
parent
5b0b309aab
commit
4a8f302ed8
@ -1,9 +1,9 @@
|
|||||||
import { message } from "antd/lib/index";
|
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 { Button, Popconfirm, Row, Col, Checkbox, Radio, Form, Input, Select, Table, Upload, Icon, PageHeader, Modal, Spin } from 'antd';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { initFilter, extendRule, extendInclude, setDataFieldValue, guid, initQueryFilter } from "../../../utils/common";
|
import { initFilter, extendRule, extendInclude, setDataFieldValue, guid, initQueryFilter } from "../../../utils/common";
|
||||||
import ReactToPrint from "react-to-print";
|
import ReactToPrint from "react-to-print";
|
||||||
import styles from '../../CustomPages/HI/StepForm.css';
|
import styles from '../../CustomPages/HI/StepForm.css';
|
||||||
import XLSX from 'xlsx';
|
import XLSX from 'xlsx';
|
||||||
import { connect } from 'dva';
|
import { connect } from 'dva';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
@ -32,9 +32,9 @@ class SE005ReportEdit extends React.Component {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
if (this.state.ALL){
|
if (this.state.ALL) {
|
||||||
this.loadList();
|
this.loadList();
|
||||||
}else{
|
} else {
|
||||||
this.loadData();
|
this.loadData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -45,21 +45,21 @@ class SE005ReportEdit extends React.Component {
|
|||||||
loadList = () => {
|
loadList = () => {
|
||||||
let json = initFilter(this.props.login.OrgId);
|
let json = initFilter(this.props.login.OrgId);
|
||||||
json.OrgType = 2;
|
json.OrgType = 2;
|
||||||
this.setState({loading: true})
|
this.setState({ loading: true })
|
||||||
this.props.dispatch({
|
this.props.dispatch({
|
||||||
type: 'app/getDataByPost',
|
type: 'app/getDataByPost',
|
||||||
payload: json,
|
payload: json,
|
||||||
url: 'SE/SESafeSurvey/GetReportList',
|
url: 'SE/SESafeSurvey/GetReportList',
|
||||||
onComplete: (ret) => {
|
onComplete: (ret) => {
|
||||||
this.setState({loading: false})
|
this.setState({ loading: false })
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return;
|
return;
|
||||||
if (ret.length == 0){
|
if (ret.length == 0) {
|
||||||
message.warn("当年未查到有效的公司调查问卷报表");
|
message.warn("当年未查到有效的公司调查问卷报表");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let taskid = this.props.data.id;
|
let taskid = this.props.data.id;
|
||||||
if (!ret.find(it => it.Key === taskid)){
|
if (!ret.find(it => it.Key === taskid)) {
|
||||||
taskid = ret[0].Key;
|
taskid = ret[0].Key;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,16 +76,16 @@ class SE005ReportEdit extends React.Component {
|
|||||||
let json = initFilter(this.props.login.OrgId);
|
let json = initFilter(this.props.login.OrgId);
|
||||||
json.OrgType = 2;
|
json.OrgType = 2;
|
||||||
json.Parameter3 = this.state.type;
|
json.Parameter3 = this.state.type;
|
||||||
if (this.state.ALL){
|
if (this.state.ALL) {
|
||||||
if (!this.state.taskid)
|
if (!this.state.taskid)
|
||||||
return;
|
return;
|
||||||
json.Parameter2 = this.state.taskid;
|
json.Parameter2 = this.state.taskid;
|
||||||
}else{
|
} else {
|
||||||
if (!this.state.surveyid)
|
if (!this.state.surveyid)
|
||||||
return;
|
return;
|
||||||
json.Parameter1 = this.state.surveyid;
|
json.Parameter1 = this.state.surveyid;
|
||||||
}
|
}
|
||||||
this.setState( {
|
this.setState({
|
||||||
data: null,
|
data: null,
|
||||||
loading: true
|
loading: true
|
||||||
});
|
});
|
||||||
@ -94,16 +94,16 @@ class SE005ReportEdit extends React.Component {
|
|||||||
payload: json,
|
payload: json,
|
||||||
url: 'SE/SESafeSurvey/GetReport',
|
url: 'SE/SESafeSurvey/GetReport',
|
||||||
onComplete: (ret) => {
|
onComplete: (ret) => {
|
||||||
this.setState({loading: false})
|
this.setState({ loading: false })
|
||||||
if (!ret){
|
if (!ret) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.setState({data: ret})
|
this.setState({ data: ret })
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
onApprove = ()=>{
|
onApprove = () => {
|
||||||
const { ALL,data } = this.state;
|
const { ALL, data } = this.state;
|
||||||
let json = {
|
let json = {
|
||||||
Parameter1: data.SURVEY[0].ID,
|
Parameter1: data.SURVEY[0].ID,
|
||||||
Parameter2: this.props.data.TaskID,
|
Parameter2: this.props.data.TaskID,
|
||||||
@ -118,7 +118,7 @@ class SE005ReportEdit extends React.Component {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
fmtEnum(name,value){
|
fmtEnum(name, value) {
|
||||||
const enums = this.props.app.enums;
|
const enums = this.props.app.enums;
|
||||||
if (!enums || !enums[name]) return '';
|
if (!enums || !enums[name]) return '';
|
||||||
return enums[name].enums[value] || '';
|
return enums[name].enums[value] || '';
|
||||||
@ -131,13 +131,13 @@ class SE005ReportEdit extends React.Component {
|
|||||||
name += '.xlsx';
|
name += '.xlsx';
|
||||||
XLSX.writeFile(wb, name)
|
XLSX.writeFile(wb, name)
|
||||||
}
|
}
|
||||||
getJoinDepartment(depart){
|
getJoinDepartment(depart) {
|
||||||
let arr = [];
|
let arr = [];
|
||||||
for(let it of depart){
|
for (let it of depart) {
|
||||||
if (it.Nav_Department){
|
if (it.Nav_Department) {
|
||||||
if (it.Nav_Department.NAME == "宁化行洛坑钨矿有限公司"){
|
if (it.Nav_Department.NAME == "宁化行洛坑钨矿有限公司") {
|
||||||
arr.push("公司领导")
|
arr.push("公司领导")
|
||||||
}else{
|
} else {
|
||||||
arr.push(it.Nav_Department.NAME)
|
arr.push(it.Nav_Department.NAME)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -145,10 +145,10 @@ class SE005ReportEdit extends React.Component {
|
|||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
const { ALL,data,list,loading } = this.state;
|
const { ALL, data, list, loading } = this.state;
|
||||||
const count = data && data.ROWS && data.ROWS.length > 0 && data.ROWS[0].length || 1;
|
const count = data && data.ROWS && data.ROWS.length > 0 && data.ROWS[0].length || 1;
|
||||||
const SPAN = Math.floor(24 / count) || 1;
|
const SPAN = Math.floor(24 / count) || 1;
|
||||||
const TITLE_SPAN = Math.max(24 - count * SPAN,0) + SPAN;
|
const TITLE_SPAN = Math.max(24 - count * SPAN, 0) + SPAN;
|
||||||
const canApprove = this.props.data.tableKey == "1"
|
const canApprove = this.props.data.tableKey == "1"
|
||||||
return <div>
|
return <div>
|
||||||
<div style={{ padding: '10px' }}>
|
<div style={{ padding: '10px' }}>
|
||||||
@ -160,29 +160,29 @@ class SE005ReportEdit extends React.Component {
|
|||||||
<Button style={{ marginLeft: '8px' }} onClick={() => this.onTableBtnExport()} icon="export" >导出</Button>
|
<Button style={{ marginLeft: '8px' }} onClick={() => this.onTableBtnExport()} icon="export" >导出</Button>
|
||||||
{
|
{
|
||||||
ALL &&
|
ALL &&
|
||||||
<Select style={{ fontSize: 14, width: "100px",marginLeft: '8px' }}
|
<Select style={{ fontSize: 14, width: "100px", marginLeft: '8px' }}
|
||||||
showSearch
|
showSearch
|
||||||
value={this.state.taskid}
|
value={this.state.taskid}
|
||||||
onChange={val => {
|
onChange={val => {
|
||||||
this.setState({taskid: val})
|
this.setState({ taskid: val })
|
||||||
this.loadData();
|
this.loadData();
|
||||||
} }
|
}}
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
list && list.map( it => {
|
list && list.map(it => {
|
||||||
return <Option key={it.Key} value={it.Key}>{it.Value}</Option>
|
return <Option key={it.Key} value={it.Key}>{it.Value}</Option>
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
</Select>
|
</Select>
|
||||||
}
|
}
|
||||||
|
|
||||||
<Select style={{ fontSize: 14, width: "100px", marginLeft: '8px' }}
|
<Select style={{ fontSize: 14, width: "100px", marginLeft: '8px' }}
|
||||||
value={this.state.type}
|
value={this.state.type}
|
||||||
onChange={val => {
|
onChange={val => {
|
||||||
this.state.type = val;
|
this.state.type = val;
|
||||||
this.loadData();
|
this.loadData();
|
||||||
} }
|
}}
|
||||||
>
|
>
|
||||||
<Option value={"部门"}>{"部门"}</Option>
|
<Option value={"部门"}>{"部门"}</Option>
|
||||||
<Option value={"人员"}>{"人员"}</Option>
|
<Option value={"人员"}>{"人员"}</Option>
|
||||||
@ -193,18 +193,18 @@ class SE005ReportEdit extends React.Component {
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<div ref={el => (this.componentRef = el)} id={'tableId' + this.props.data.id} style={{ padding: '20px' }}>
|
<div ref={el => (this.componentRef = el)} id={'tableId' + this.props.data.id} style={{ padding: '20px' }}>
|
||||||
<h1 style={{ textAlign: 'center'}}>{this.state.ALL ? '安全意识调查问卷公司报表' : '安全意识调查问卷部门报表'}</h1>
|
<h1 style={{ textAlign: 'center' }}>{this.state.ALL ? '安全意识调查问卷公司报表' : '安全意识调查问卷部门报表'}</h1>
|
||||||
<Spin spinning={this.state.loading}>
|
<Spin spinning={this.state.loading}>
|
||||||
{
|
{
|
||||||
data && <>
|
data && <>
|
||||||
<table style={{ width: '100%', textAlign: 'center', borderTop: '1px solid #333', borderLeft: '1px solid #333' }} className={styles.PrintForm}>
|
<table style={{ width: '100%', textAlign: 'center', borderTop: '1px solid #333', borderLeft: '1px solid #333' }} className={styles.PrintForm}>
|
||||||
<tbody>
|
<tbody>
|
||||||
{
|
{
|
||||||
data.SURVEY && data.SURVEY.map(SURVEY =>{
|
data.SURVEY && data.SURVEY.map(SURVEY => {
|
||||||
return <>
|
return <>
|
||||||
<tr>
|
<tr>
|
||||||
<td colSpan={4} rowSpan={1} className={styles.fontBold}>调查名称</td>
|
<td colSpan={4} rowSpan={1} className={styles.fontBold}>调查名称</td>
|
||||||
<td colSpan={20} rowSpan={1}>{SURVEY.NAME }</td>
|
<td colSpan={20} rowSpan={1}>{SURVEY.NAME}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colSpan={3} rowSpan={1} className={styles.fontBold}>发起时间</td>
|
<td colSpan={3} rowSpan={1} className={styles.fontBold}>发起时间</td>
|
||||||
@ -222,7 +222,7 @@ class SE005ReportEdit extends React.Component {
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colSpan={4} rowSpan={1} className={styles.fontBold}>调查内容</td>
|
<td colSpan={4} rowSpan={1} className={styles.fontBold}>调查内容</td>
|
||||||
<td colSpan={20} rowSpan={1}>{ SURVEY.Nav_Points && SURVEY.Nav_Points.map(it => it.Nav_Point.NAME).join('、')}</td>
|
<td colSpan={20} rowSpan={1}>{SURVEY.Nav_Points && SURVEY.Nav_Points.map(it => it.Nav_Point.NAME).join('、')}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</>
|
</>
|
||||||
})
|
})
|
||||||
@ -231,10 +231,10 @@ class SE005ReportEdit extends React.Component {
|
|||||||
<td colSpan={24} rowSpan={1} className={styles.fontBold}>答案正确率(百分比)</td>
|
<td colSpan={24} rowSpan={1} className={styles.fontBold}>答案正确率(百分比)</td>
|
||||||
</tr>
|
</tr>
|
||||||
{
|
{
|
||||||
data.ROWS && data.ROWS.map((row,ridx) =>{
|
data.ROWS && data.ROWS.map((row, ridx) => {
|
||||||
return <tr>
|
return <tr>
|
||||||
{
|
{
|
||||||
row.map((col,cidx) =>{
|
row.map((col, cidx) => {
|
||||||
return <td colSpan={cidx == 0 ? TITLE_SPAN : SPAN} rowSpan={1} className={ridx == 0 || cidx == 0 ? styles.fontBold : null}>{col}{ridx == 0 || cidx == 0 ? null : "%"}</td>
|
return <td colSpan={cidx == 0 ? TITLE_SPAN : SPAN} rowSpan={1} className={ridx == 0 || cidx == 0 ? styles.fontBold : null}>{col}{ridx == 0 || cidx == 0 ? null : "%"}</td>
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -246,7 +246,7 @@ class SE005ReportEdit extends React.Component {
|
|||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
!data && !loading && <div style={{ width: '100%', textAlign: 'center'}}> 暂未查到有效数据 </div>
|
!data && !loading && <div style={{ width: '100%', textAlign: 'center' }}> 暂未查到有效数据 </div>
|
||||||
}
|
}
|
||||||
</Spin>
|
</Spin>
|
||||||
|
|
||||||
|
|||||||
@ -159,7 +159,8 @@ class SE062ShowPrint extends React.Component {
|
|||||||
<Descriptions.Item label="部门">{data && data.Nav_Department ? data.Nav_Department.NAME : ''}</Descriptions.Item>
|
<Descriptions.Item label="部门">{data && data.Nav_Department ? data.Nav_Department.NAME : ''}</Descriptions.Item>
|
||||||
<Descriptions.Item label="岗位">{data && data.Nav_Post ? data.Nav_Post.NAME : ''}</Descriptions.Item>
|
<Descriptions.Item label="岗位">{data && data.Nav_Post ? data.Nav_Post.NAME : ''}</Descriptions.Item>
|
||||||
<Descriptions.Item label="分数">{data ? data.SCORE : null}</Descriptions.Item>
|
<Descriptions.Item label="分数">{data ? data.SCORE : null}</Descriptions.Item>
|
||||||
<Descriptions.Item label="考核结果">{data ? data.EXAMINATION_RESULTS == 1 ? "合格" : "不合格" : null}</Descriptions.Item>
|
{/* <Descriptions.Item label="考核结果">{data ? data.EXAMINATION_RESULTS == 1 ? "合格" : "不合格" : null}</Descriptions.Item> */}
|
||||||
|
<Descriptions.Item label="考核结果">{(data && data.EXAMINATION_RESULTS && data.SCORE) ? enums.SEExaminationResultsEnum.enums[data.EXAMINATION_RESULTS] : ""}</Descriptions.Item>
|
||||||
<Descriptions.Item label="培训形式">{data ? this.returnModel(data.Nav_NewUser.TRAIN_MODEL) : null}</Descriptions.Item>
|
<Descriptions.Item label="培训形式">{data ? this.returnModel(data.Nav_NewUser.TRAIN_MODEL) : null}</Descriptions.Item>
|
||||||
<Descriptions.Item label="附件">{showFiles(data.Nav_Files, config.picServerHost, this)}</Descriptions.Item>
|
<Descriptions.Item label="附件">{showFiles(data.Nav_Files, config.picServerHost, this)}</Descriptions.Item>
|
||||||
</Descriptions>
|
</Descriptions>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user