import { Button, Descriptions, Modal, Popconfirm, Row, Col, Form, Input, Select, Table } from 'antd';
import React from 'react';
import { initFilter, extendRule, extendInclude, extendIgnoreDataRule, setDataFieldValue, GetFileModel, guid, showFiles, initQueryFilter, ShowDateTime, ShowPrintClose } from '../../../utils/common';
import ReactToPrint from 'react-to-print';
import { ExportToExcel } from '@woowalker/feui'
import XLSX from 'xlsx';
import { connect } from 'dva';
import moment from 'moment';
import { message } from 'antd/lib/index';
import styles from '../HI/StepForm.css';
import config from '../../../config.js';
import FormPage from '../../FormPage'
class CM032ShowPrint extends React.Component {
constructor(props) {
super(props);
this.state = {
data: null,
btndisplay: 'none',
isCheck: false, //是否待办 审批
fileData: [],
fileForm: {
title: "",
visible: false,
},
}
}
componentDidMount() {
if (this.props.data?.id)
this.loadData(this.props.data?.id);
}
componentWillReceiveProps(NextProps) {
if (NextProps.data?.id && this.props.data?.id != NextProps.data?.id) {
this.loadData(NextProps.data?.id);
}
}
onTableBtnExport() {
let TableWrap = document.getElementById('table1');
let Table = TableWrap.getElementsByTagName('table1')[0];
const wb = XLSX.utils.table_to_book(Table);
XLSX.writeFile(wb, this.props.record.Nav_Department.NAME + '.xlsx')
}
onClickApprove = (appVisible) => {
const newtmpData = {
data: { id: this.props.data.id, isShow: true, key: guid(), param: this.props.data.param, appVisible: appVisible, BtnAgreeDisplay: 'none' },
formCode: 'PF123',
}
this.setState({
tmpData: newtmpData,
});
}
loadData = (id) => {
var isCheck = (this.props.data.tableKey != undefined && this.props.data.tableKey == '1') ? true : false
var orgId = this.props.login ? this.props.login.OrgId : '';
let json = initFilter(orgId);
extendRule(json, 'ID', 1, id);
extendInclude(json, 'Nav_Files.Nav_ImgFile')
extendInclude(json, 'Nav_ListDetail.Nav_MaterialType')
extendInclude(json, 'Nav_ListDetail.Nav_EQDSurvey.Nav_Department')
extendIgnoreDataRule(json)
this.props.dispatch({
type: 'app/getDataByPost',
payload: json,
url: 'CM/CMEquipmentDemandSurveyMaster/GetOrder',
onComplete: (ret) => {
if (ret) {
this.setState({
data: ret,
isCheck: false
})
}
}
});
}
sign = () => {
let json = initFilter(this.props.login.OrgId, this.props.data.id, null, null, null, this.props.data.TaskID);
extendRule(json, 'ID', 1, this.props.data.id);
extendRule(json, 'Parameter1', 1, this.props.data.TaskID)
extendIgnoreDataRule(json)
this.props.dispatch({
type: 'app/getDataByPost',
payload: json,
url: 'CM/CMEquipmentDemandSurvey/Sign',
onComplete: (ret) => {
ShowPrintClose(this.props)
}
});
}
render() {
const { data, isCheck } = this.state;
return
|
} content={() => this.componentRef} pageStyle={"#tableId" + this.props.data.id + " { padding:0 40px;} img{width :120px}"} /> |
|
{isCheck ? | : null}
(this.componentRef = el)} style={{ padding: '20px', paddingTop: '20px' }} id={'tableId' + this.props.data.id}>
应急装备需求调查汇总表
{
data ?
{data.START_TIME}
{data.YEAR}
{showFiles(data.Nav_Files, config.picServerHost, this)}
: null
}
{
(data?.Nav_ListDetail && data?.Nav_ListDetail.length > 0) ?
| 需求部门 |
类型 |
装备名称 |
规格/型号 |
应急物资库名称 |
库内现有数量 |
需求数量 |
单位 |
{data?.Nav_ListDetail?.map((item, i) => {
return
| {item.Nav_EQDSurvey?.Nav_Department?.NAME} |
{item.Nav_MaterialType.NAME} |
{item.MATERIAL_NAME} |
{item.SPECIFICATION} |
{item.MATERIAL_LOCATION} |
{item.AVAILABLE_COUNT} |
{item.NEED_COUNT} |
{item.UNIT} |
})}
: null
}
{
GetFileModel(Modal, FormPage, this, this.state.fileForm.visible)
}
}
}
export default connect(({ login }) => ({ login }))(CM032ShowPrint)