418 lines
19 KiB
JavaScript
418 lines
19 KiB
JavaScript
import { Button, Descriptions,Popconfirm, Row, Col, Form,Modal, Input, Select, Table } from 'antd';
|
|
import React from 'react';
|
|
import { initFilter, extendRule, extendInclude,extendIgnoreDataRule, setDataFieldValue, guid, initQueryFilter } from "../../../utils/common";
|
|
import ReactToPrint from "react-to-print";
|
|
import stylesStep from '../HI/StepForm.css';
|
|
import config from "../../../config";
|
|
import XLSX from 'xlsx';
|
|
import { connect } from 'dva';
|
|
import moment from 'moment';
|
|
import { message } from "antd/lib/index";
|
|
import FormPage from '../../../components/FormPage'
|
|
|
|
class PE029ShowPrintNew extends React.Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {
|
|
data: null,
|
|
BtnAgreeDisplay: 'none',
|
|
tmpData: {},
|
|
searchTodayVisible: false, //弹窗显示
|
|
tmpData: [],
|
|
searchColumns :[
|
|
{
|
|
title: '序号',
|
|
dataIndex: 'ROW_NO',
|
|
key: 'ROW_NO',
|
|
},
|
|
{
|
|
title: '生产单元',
|
|
dataIndex: 'Nav_ProductionUnit.NAME',
|
|
key: 'Nav_ProductionUnit.NAME',
|
|
},
|
|
{
|
|
title: '一级类目',
|
|
dataIndex: 'Nav_Primary.NAME',
|
|
key: 'Nav_Primary.NAME'
|
|
},
|
|
{
|
|
title: '二级类目',
|
|
dataIndex: 'Nav_Second.NAME',
|
|
key: 'Nav_Second.NAME'
|
|
},
|
|
{
|
|
title: '三级类目',
|
|
dataIndex: 'Nav_Three.NAME',
|
|
key: 'Nav_Three.NAME',
|
|
},
|
|
{
|
|
title: '考评项目',
|
|
dataIndex: 'EVALUATION_ITEM',
|
|
key: 'EVALUATION_ITEM',
|
|
render: (text, record) => (
|
|
<span>{this.props.app.enums.PEEvaluationItemEnum.enums[record?.EVALUATION_ITEM]}</span>
|
|
)
|
|
},
|
|
{
|
|
width: "350px",
|
|
title: '考评内容',
|
|
dataIndex: 'CONTENTS',
|
|
key: 'CONTENTS',
|
|
},
|
|
{
|
|
title: '扣分分值',
|
|
dataIndex: 'NON_STANDARDIZED_SCORE',
|
|
key: 'NON_STANDARDIZED_SCORE',
|
|
},
|
|
{
|
|
title: '不符合说明',
|
|
dataIndex: 'NON_CONFORMANCE',
|
|
key: 'NON_CONFORMANCE',
|
|
},
|
|
// {
|
|
// title: '标准分',
|
|
// dataIndex: 'STANDARDIZED_SCORE',
|
|
// key: 'STANDARDIZED_SCORE',
|
|
// },
|
|
// {
|
|
// title: '实得分',
|
|
// dataIndex: 'RESULT_SCORE',
|
|
// key: 'RESULT_SCORE',
|
|
// },
|
|
// {
|
|
// title: '评价结论',
|
|
// dataIndex: 'EVALUATION_RESULT',
|
|
// key: 'EVALUATION_RESULT',
|
|
// render: (text, record) => (
|
|
// <span>{this.props.app.enums.PEEvaluationResultEnum.enums[record?.EVALUATION_RESULT]}</span>
|
|
// )
|
|
// },
|
|
{
|
|
title: '评价方法',
|
|
dataIndex: 'Nav_EvaluationMethod',
|
|
key: 'Nav_EvaluationMethod',
|
|
render: (text, record) => (
|
|
<span>{
|
|
record.Nav_EvaluationMethod && record.Nav_EvaluationMethod?.map((item, i) => {
|
|
return <tr><label> {item.Nav_Method?.NAME}</label></tr>
|
|
})
|
|
}</span>
|
|
)
|
|
},]
|
|
};
|
|
};
|
|
|
|
componentDidMount() {
|
|
if (this.props.data?.id)
|
|
this.loadData(this.props.data?.id);
|
|
else
|
|
this.loadData(null);
|
|
}
|
|
|
|
componentWillReceiveProps(NextProps) {
|
|
if (NextProps.data?.id && this.props.data?.id != NextProps.data?.id) {
|
|
this.loadData(NextProps.data?.id);
|
|
}
|
|
}
|
|
loadList = () => {
|
|
let that=this;
|
|
let json = initFilter(that.props.login.OrgId);
|
|
// extendRule(json, 'ID', 1, dataId);
|
|
extendIgnoreDataRule(json)
|
|
that.props.dispatch({
|
|
type: 'app/getDataByPost',
|
|
payload: json,
|
|
url: 'PE/PESafetyEvaluationRecord/FullGet',
|
|
onComplete: (ret) => {
|
|
if (ret) {
|
|
if(that.props.data && that.props.data.loadDataDeal)
|
|
{
|
|
that.props.data.loadDataDeal(1);
|
|
}
|
|
that.setState({ data: ret });
|
|
if (that.props.data.tableKey==="2" ||that.props.data.tableKey===undefined) {
|
|
that.setState({ BtnAgreeDisplay: 'none' })
|
|
}else{
|
|
that.setState({ BtnAgreeDisplay: 'inline' })
|
|
}
|
|
this.onClickApprove(false);
|
|
//归档才显示打印和导出按钮
|
|
// if(ret.PRE_MEETING_STATUS==5){
|
|
// this.setState({ isFinished: 'inline' })
|
|
// }
|
|
}
|
|
else
|
|
{ message.error('请先尝试刷新,若仍然加载失败,请联系管理员排查!');}
|
|
}
|
|
});
|
|
}
|
|
onTableBtnAgree() {
|
|
this.props.dispatch({
|
|
type: 'app/getDataByPost',
|
|
url: 'PE/PESafetyMonitorRecord/IdentityUpdateNew',
|
|
payload: {
|
|
ID: this.props.data.id,
|
|
TaskID: this.props.data.TaskID,
|
|
},
|
|
onComplete: (ret) => {
|
|
if (ret) {
|
|
message.success('确认成功!');
|
|
this.setState({ BtnAgreeDisplay: 'none' })
|
|
this.BtnClose();
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
BtnClose = () => {
|
|
if (typeof this.props.data.onCancel != "undefined"&&typeof this.props.data.onCancel == 'function')
|
|
this.props.data.onCancel();
|
|
}
|
|
|
|
loadData = (dataId) => {
|
|
let that=this;
|
|
let json = initFilter(that.props.login.OrgId);
|
|
extendRule(json, 'ID', 1, dataId);
|
|
extendIgnoreDataRule(json)
|
|
that.props.dispatch({
|
|
type: 'app/getDataByPost',
|
|
payload: json,
|
|
url: 'PE/PESafetyEvaluationRecord/FullGet',
|
|
onComplete: (ret) => {
|
|
if (ret) {
|
|
if(that.props.data && that.props.data.loadDataDeal)
|
|
{
|
|
that.props.data.loadDataDeal(1);
|
|
}
|
|
that.setState({ data: ret });
|
|
if (that.props.data.tableKey==="2" ||that.props.data.tableKey===undefined) {
|
|
that.setState({ BtnAgreeDisplay: 'none' })
|
|
}else{
|
|
that.setState({ BtnAgreeDisplay: 'inline' })
|
|
}
|
|
this.onClickApprove(false);
|
|
//归档才显示打印和导出按钮
|
|
// if(ret.PRE_MEETING_STATUS==5){
|
|
// this.setState({ isFinished: 'inline' })
|
|
// }
|
|
}
|
|
else
|
|
{ message.error('请先尝试刷新,若仍然加载失败,请联系管理员排查!');}
|
|
}
|
|
});
|
|
}
|
|
showModal = () => {
|
|
if(this.state.data && this.state.data?.Nav_Details)
|
|
{
|
|
let temp=this.state.data?.Nav_Details?.filter(t=>t.NON_CONFORMANCE != "" && t.NON_CONFORMANCE!=null);
|
|
let tmpData = temp.map((item, i) => {
|
|
item['ROW_NO'] = i + 1;
|
|
return item;
|
|
});
|
|
let aa={"CONTENTS":"合计扣分:","NON_STANDARDIZED_SCORE":this.state.data.NON_STANDARDIZED_SCORE}
|
|
tmpData.push(aa)
|
|
this.setState({
|
|
searchTodayVisible: true, //弹窗显示
|
|
tmpData:tmpData
|
|
});
|
|
}
|
|
else
|
|
{
|
|
message.error("请先等待数据加载");
|
|
}
|
|
}
|
|
closeModal = () => {
|
|
let newtmpData = { ...this.state.tmpData }
|
|
this.setState({
|
|
searchTodayVisible: false,
|
|
tmpData: [],//newtmpData
|
|
})
|
|
}
|
|
onTableBtnExport() {
|
|
// const enums=this.props.data.enums ? this.props.data.enums :this.props.app.enums ;
|
|
let TableWrap = document.getElementById('tableId' + this.props.data.id);
|
|
let Table = TableWrap.getElementsByTagName('table')[0];
|
|
const wb = XLSX.utils.table_to_book(Table);
|
|
XLSX.writeFile(wb, "安全标准化内部评价记录表.xlsx")
|
|
}
|
|
|
|
onClickApprove=(appVisible)=>{
|
|
const newtmpData = {
|
|
data: { id: this.props.data.id, isShow: true,key:guid(),param:this.props.data.param,appVisible:appVisible,BtnAgreeDisplay:'inline'},
|
|
formCode: "PF123",
|
|
}
|
|
this.setState({
|
|
tmpData: newtmpData,
|
|
});
|
|
}
|
|
render() {
|
|
const { data } = this.state;
|
|
const enums=this.props.data.enums ? this.props.data.enums :this.props.app.enums ;
|
|
// let aaa = Math.random();
|
|
return <div>
|
|
<div style={{ padding: '10px' }}>
|
|
<Button onClick={() => this.onClickApprove(true)} style={{ marginRight: '8px'}} icon="export">审批详情</Button>
|
|
<ReactToPrint
|
|
trigger={() => <Button style={{ marginLeft: '8px', display: data && data.IS_PUBLISH === 5?"inline":"none" }} type={'default'} icon={'printer'} >打印</Button>}
|
|
content={() => this.componentRef}
|
|
/>
|
|
<Button onClick={() => this.onTableBtnExport()} icon="export" style={{ marginLeft: '8px', display: data && data.IS_PUBLISH === 5?"inline":"none" }}>导出</Button>
|
|
{/* <Button type="primary" style={{marginLeft: '8px', display: this.state.BtnAgreeDisplay }} onClick={() => this.onTableBtnAgree()} icon="check" >确认</Button> */}
|
|
</div>
|
|
<div ref={el => (this.componentRef = el)} style={{ padding: '20px' }} id={'tableId' + this.props.data.id}>
|
|
<h1 style={{ textAlign: 'center', margin: '15px' }}>安全标准化内部评价记录表</h1>
|
|
<Button type="primary" style={{marginBottom:'8px' }} onClick={() => this.showModal()} icon="file" >不符合说明</Button>
|
|
<Modal
|
|
visible={this.state.searchTodayVisible}
|
|
title={"不符合项说明"}
|
|
onCancel={this.closeModal}
|
|
footer={null}
|
|
width={1000}
|
|
style={{ width: '100%', height: '100%' }}
|
|
>
|
|
<div>
|
|
{/* <FormPage {...this.state.tmpData} /> */}
|
|
<Table
|
|
dataSource={this.state.tmpData}
|
|
columns={this.state.searchColumns}
|
|
pagination={false}
|
|
loading={false}
|
|
size="small"
|
|
className={stylesStep.PrintForm1}
|
|
/>
|
|
</div>
|
|
</Modal>
|
|
|
|
{
|
|
data ?
|
|
<div>
|
|
<Descriptions size="middle" bordered className={stylesStep.description}>
|
|
<Descriptions.Item label="评价开始时间">{data.Nav_EvaluationPlan?.START_TIME}</Descriptions.Item>
|
|
<Descriptions.Item label="评价结束时间">{data.Nav_EvaluationPlan?.END_TIME}</Descriptions.Item>
|
|
<Descriptions.Item label="评价人员">{
|
|
data.Nav_IngoreUser && data.Nav_IngoreUser.map((item, i) => {
|
|
if (i == (data.Nav_IngoreUser.length - 1)) {
|
|
if (item.DEAL_STATUS == 0)
|
|
return <label style={{ color: 'red' }} title='未签到'> {item.Nav_User?.NAME}</label>
|
|
else
|
|
return item.Nav_User.NAME
|
|
} else {
|
|
if (item.DEAL_STATUS == 0)
|
|
return <label style={{ color: 'red' }} title='未签到'>{item.Nav_User?.NAME + ','}</label>
|
|
else
|
|
return item.Nav_User.NAME + ','
|
|
}
|
|
})
|
|
}</Descriptions.Item>
|
|
</Descriptions>
|
|
</div>:null
|
|
}
|
|
{
|
|
data ? <table style={{ width: '100%', textAlign: 'left'}} className={stylesStep.PrintForm1}>
|
|
<tr>
|
|
<td style={{width:"50px"}} className={stylesStep.fontBold}>序号</td>
|
|
<td style={{width:"100px"}} className={stylesStep.fontBold}>生产单元</td>
|
|
<td style={{width:"100px"}} className={stylesStep.fontBold}>一级类目</td>
|
|
<td style={{width:"100px"}} className={stylesStep.fontBold}>二级类目</td>
|
|
<td style={{width:"100px"}} className={stylesStep.fontBold}>三级类目</td>
|
|
<td style={{width:"50px"}}className={stylesStep.fontBold}>考评项目</td>
|
|
<td className={stylesStep.fontBold}>考评内容</td>
|
|
<td style={{width:"150px"}}className={stylesStep.fontBold}>评分办法</td>
|
|
<td style={{width:"50px"}}className={stylesStep.fontBold}>标准分</td>
|
|
<td style={{width:"50px"}}className={stylesStep.fontBold}>实得分</td>
|
|
<td style={{width:"50px"}}className={stylesStep.fontBold}>评价结论</td>
|
|
<td style={{width:"150px"}}className={stylesStep.fontBold}>不符合说明</td>
|
|
<td style={{width:"150px"}} className={stylesStep.fontBold}>评价方法</td>
|
|
</tr>
|
|
{
|
|
data.Nav_Details && data.Nav_Details.map((item,i)=>{
|
|
return <tr>
|
|
<td>
|
|
{i+1}
|
|
</td>
|
|
<td>
|
|
{item.Nav_ProductionUnit?.NAME}
|
|
</td>
|
|
<td>
|
|
{item.Nav_Primary?.NAME}
|
|
</td>
|
|
<td>
|
|
{item.Nav_Second?.NAME}
|
|
</td>
|
|
<td>
|
|
{item.Nav_Three?.NAME}
|
|
</td>
|
|
<td>
|
|
{enums.PEEvaluationItemEnum.enums[item?.EVALUATION_ITEM]}
|
|
</td>
|
|
<td>
|
|
{
|
|
item.CONTENTS
|
|
}
|
|
</td>
|
|
<td>
|
|
{item.DESCRIPTION}
|
|
</td>
|
|
<td>
|
|
{
|
|
item.STANDARDIZED_SCORE
|
|
}
|
|
</td>
|
|
<td>
|
|
{item.RESULT_SCORE}
|
|
</td>
|
|
<td>
|
|
{enums.PEEvaluationResultEnum.enums[item?.EVALUATION_RESULT]}
|
|
</td>
|
|
<td>
|
|
{
|
|
item.NON_CONFORMANCE
|
|
}
|
|
</td>
|
|
<td>
|
|
{
|
|
item.Nav_EvaluationMethod && item.Nav_EvaluationMethod.map((item2, i) => {
|
|
return <tr><label> {item2.Nav_Method?.NAME}</label></tr>
|
|
})
|
|
}
|
|
</td>
|
|
</tr>
|
|
})
|
|
}
|
|
</table>:null
|
|
}
|
|
{
|
|
data && data.STAND_TOTAL && data.RESULT_TOTAL ?
|
|
<div>
|
|
<Descriptions size="middle" bordered className={stylesStep.description}>
|
|
<Descriptions.Item label="标准分汇总">{data.STAND_TOTAL}</Descriptions.Item>
|
|
<Descriptions.Item label="实得分汇总">{data.RESULT_TOTAL}</Descriptions.Item>
|
|
<Descriptions.Item label="标准化得分">{data.STAND_TOTAL===0?0:(data.RESULT_TOTAL/data.STAND_TOTAL*100).toFixed(2)}</Descriptions.Item>
|
|
</Descriptions>
|
|
</div>:null
|
|
}
|
|
{
|
|
data ?
|
|
<div>
|
|
<Descriptions size="middle" bordered className={stylesStep.description}>
|
|
<Descriptions.Item label="评价人员签字">{
|
|
data.Nav_IngoreUser && data.Nav_IngoreUser.map((item, i) => {
|
|
if (item.DEAL_STATUS == 1) {
|
|
if (item.Nav_User != null && item.Nav_User.Nav_UserSignFiles[0] != null)
|
|
return <img style={{ margin: "0 0 0 15px",width:'200px' }} alt={item.Nav_User.NAME} src={config.picServerHost + item.Nav_User.Nav_UserSignFiles[0].Nav_ImgFile.Nav_File.FILE_PATH} />
|
|
else
|
|
return <img style={{ margin: "0 0 0 15px" ,width:'200px'}} title={item.Nav_User.NAME} />
|
|
}
|
|
})
|
|
}</Descriptions.Item>
|
|
</Descriptions>
|
|
</div>:null
|
|
}
|
|
<FormPage {...this.state.tmpData} />
|
|
</div>
|
|
</div>
|
|
}
|
|
|
|
}
|
|
|
|
export default connect(({ login,app }) => ({ login,app }))(PE029ShowPrintNew)
|