审批流查看 添加 公共方法 给每个页面调用 使支持总部查看子页的审批流数据正常
This commit is contained in:
parent
08f404d8f9
commit
6bb8aa83c9
@ -1,5 +1,5 @@
|
||||
import { message } from "antd/lib/index";
|
||||
import { Layout,Descriptions, Tabs, Steps, Button, Popconfirm, Row, Col, Form, Input, Select, Table, Drawer ,Icon} from 'antd';
|
||||
import { Layout, Descriptions, Tabs, Steps, Button, Popconfirm, Row, Col, Form, Input, Select, Table, Drawer, Icon } from 'antd';
|
||||
import React from 'react';
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
import ReactToPrint from "react-to-print";
|
||||
@ -34,17 +34,16 @@ class PFCommonApproveView extends React.Component {
|
||||
visible: false,
|
||||
userData: [],
|
||||
selectUserId: '',
|
||||
appVisible:false,
|
||||
BtnAgreeDisplay:'none'
|
||||
appVisible: false,
|
||||
BtnAgreeDisplay: 'none'
|
||||
}
|
||||
};
|
||||
componentDidMount() {
|
||||
if (this.props.data?.id)
|
||||
{
|
||||
this.loadData(this.props.data?.id,false);
|
||||
if (this.props.data?.id) {
|
||||
this.loadData(this.props.data?.id, false);
|
||||
this.setState({
|
||||
appVisible: this.props.data.appVisible?this.props.data.appVisible:false,
|
||||
BtnAgreeDisplay:this.props.data.BtnAgreeDisplay?this.props.data.BtnAgreeDisplay:'none',
|
||||
appVisible: this.props.data.appVisible ? this.props.data.appVisible : false,
|
||||
BtnAgreeDisplay: this.props.data.BtnAgreeDisplay ? this.props.data.BtnAgreeDisplay : 'none',
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -53,13 +52,12 @@ class PFCommonApproveView extends React.Component {
|
||||
// if (NextProps.data?.id && this.props.data?.id != NextProps.data?.id) {
|
||||
// this.loadData(NextProps.data?.id);
|
||||
// }
|
||||
if(NextProps.data?.key && this.props.data?.key != NextProps.data?.key)
|
||||
{
|
||||
if (NextProps.data?.key && this.props.data?.key != NextProps.data?.key) {
|
||||
if (NextProps.data?.id) {
|
||||
this.loadData(NextProps.data?.id,true);
|
||||
this.loadData(NextProps.data?.id, true);
|
||||
this.setState({
|
||||
appVisible: NextProps.data.appVisible?NextProps.data.appVisible:false,
|
||||
BtnAgreeDisplay:NextProps.data.BtnAgreeDisplay?NextProps.data.BtnAgreeDisplay:'none',
|
||||
appVisible: NextProps.data.appVisible ? NextProps.data.appVisible : false,
|
||||
BtnAgreeDisplay: NextProps.data.BtnAgreeDisplay ? NextProps.data.BtnAgreeDisplay : 'none',
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -145,11 +143,11 @@ class PFCommonApproveView extends React.Component {
|
||||
});
|
||||
|
||||
}
|
||||
loadDataOld(dataid,appVisibleTemp) {
|
||||
loadDataOld(dataid, appVisibleTemp) {
|
||||
const json = initFilter(this.props.login.OrgId, this.props.data.id, '', 0, 1, this.props.data.PARAM ?? null, this.props.data.PARAM2);
|
||||
this.setState({
|
||||
appVisible:appVisibleTemp,
|
||||
BtnAgreeDisplay:this.props.data.BtnAgreeDisplay?this.props.data.BtnAgreeDisplay:'inline'
|
||||
appVisible: appVisibleTemp,
|
||||
BtnAgreeDisplay: this.props.data.BtnAgreeDisplay ? this.props.data.BtnAgreeDisplay : 'inline'
|
||||
});
|
||||
this.props.dispatch({
|
||||
type: 'app/getDataByPost',
|
||||
@ -167,7 +165,7 @@ class PFCommonApproveView extends React.Component {
|
||||
payload: jsonApp,
|
||||
onlyData: false,
|
||||
onComplete: (re) => {
|
||||
|
||||
|
||||
if (re && re.IsSuccessful && re.Data && re.Data.Nav_ApproveDetails.length > 0) {
|
||||
const newtmpData = {
|
||||
data: {
|
||||
@ -232,13 +230,17 @@ class PFCommonApproveView extends React.Component {
|
||||
}
|
||||
});
|
||||
}
|
||||
loadData(dataid,appVisibleTemp) {
|
||||
loadData(dataid, appVisibleTemp) {
|
||||
const json = initFilter(this.props.login.OrgId, this.props.data.id, '', 0, 1, this.props.data.PARAM ?? null, this.props.data.PARAM2);
|
||||
this.setState({
|
||||
appVisible:appVisibleTemp,
|
||||
BtnAgreeDisplay:this.props.data.BtnAgreeDisplay?this.props.data.BtnAgreeDisplay:'inline'
|
||||
appVisible: appVisibleTemp,
|
||||
BtnAgreeDisplay: this.props.data.BtnAgreeDisplay ? this.props.data.BtnAgreeDisplay : 'inline'
|
||||
});
|
||||
json.Parameter22=this.props.data?.TASK_ORGID
|
||||
if (this.props.data.ORG_ID_HV) {
|
||||
json.Parameter22 = this.props.data.ORG_ID_HV;
|
||||
} else {
|
||||
json.Parameter22 = this.props.data?.TASK_ORGID
|
||||
}
|
||||
this.props.dispatch({
|
||||
type: 'app/getDataByPost',
|
||||
payload: json,
|
||||
@ -309,14 +311,14 @@ class PFCommonApproveView extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
showAppDrawer= () => {
|
||||
showAppDrawer = () => {
|
||||
this.setState({
|
||||
appVisible: true,
|
||||
});
|
||||
}
|
||||
onClose = () => {
|
||||
this.setState({
|
||||
appVisible:false,
|
||||
appVisible: false,
|
||||
});
|
||||
};
|
||||
render() {
|
||||
@ -338,13 +340,13 @@ class PFCommonApproveView extends React.Component {
|
||||
// <FormPage {...this.state.tmpData} />
|
||||
|
||||
<Layout>
|
||||
<Drawer
|
||||
<Drawer
|
||||
title="审批详情"
|
||||
width={320}
|
||||
onClose={this.onClose}
|
||||
visible={this.state.appVisible}
|
||||
bodyStyle={{ paddingBottom: 80 }}
|
||||
placement ="left"
|
||||
placement="left"
|
||||
>
|
||||
{/* <Sider style={{
|
||||
overflow: 'auto',
|
||||
@ -353,7 +355,7 @@ class PFCommonApproveView extends React.Component {
|
||||
left: 20,
|
||||
background: '#FFF'
|
||||
}}> */}
|
||||
{/* {
|
||||
{/* {
|
||||
this.state.data && this.state.data.Nav_ApproveDetails? <Steps icon="user" current={0} direction="vertical" type="navigation">
|
||||
{this.state.data?.Nav_ApproveDetails?.map((n) => {
|
||||
let status = 'wait'; let result = '';
|
||||
@ -373,34 +375,34 @@ class PFCommonApproveView extends React.Component {
|
||||
})}
|
||||
</Steps> :"暂无审批详情"
|
||||
} */}
|
||||
{
|
||||
this.state.data && this.state.data[0] ?
|
||||
this.state.data.map((m,i)=>{
|
||||
|
||||
return <Steps icon="user" current={0} direction="vertical" type="navigation">
|
||||
{
|
||||
m.Nav_ApproveDetails?.sort(this.compare).map((n) => {
|
||||
let status = 'wait'; let result = '';
|
||||
if (n.NODE_APPROVE_STATUS == 10) {
|
||||
status = 'finish';result='同意';
|
||||
} else if (n.NODE_APPROVE_STATUS == 20) {
|
||||
status = 'error';result='驳回';
|
||||
}
|
||||
if (n.IS_CURRENT) {
|
||||
status = 'process';
|
||||
}
|
||||
return <Step title={n.NAME} description={<span> {"审批人:"+n.Nav_ApproveUser?.NAME}<br/>{"审批时间:"+(n.NODE_APPROVE_TIME == "0001-01-01 00:00:00" ? '' : n.NODE_APPROVE_TIME)}
|
||||
<br/>{"审批结论:"+result}
|
||||
<br/>{"审批意见:"+(n.CONTEXT ==undefined?'': n.CONTEXT)}
|
||||
</span>} status={status} icon={status=='process'?<Icon type="user" />:null} />
|
||||
// description={n.Nav_ApproveUser?.NAME + (n.NODE_APPROVE_TIME == "0001-01-01 00:00:00" ? '' : n.NODE_APPROVE_TIME)}
|
||||
})}
|
||||
<hr style={{border:'1px dashed #ccc',marginBottom:"15px",display:this.state.data.length-1 == i?'none':'block'}}></hr>
|
||||
</Steps>
|
||||
}) :"暂无审批详情"
|
||||
|
||||
}
|
||||
{/* </Sider> */}
|
||||
{
|
||||
this.state.data && this.state.data[0] ?
|
||||
this.state.data.map((m, i) => {
|
||||
|
||||
return <Steps icon="user" current={0} direction="vertical" type="navigation">
|
||||
{
|
||||
m.Nav_ApproveDetails?.sort(this.compare).map((n) => {
|
||||
let status = 'wait'; let result = '';
|
||||
if (n.NODE_APPROVE_STATUS == 10) {
|
||||
status = 'finish'; result = '同意';
|
||||
} else if (n.NODE_APPROVE_STATUS == 20) {
|
||||
status = 'error'; result = '驳回';
|
||||
}
|
||||
if (n.IS_CURRENT) {
|
||||
status = 'process';
|
||||
}
|
||||
return <Step title={n.NAME} description={<span> {"审批人:" + n.Nav_ApproveUser?.NAME}<br />{"审批时间:" + (n.NODE_APPROVE_TIME == "0001-01-01 00:00:00" ? '' : n.NODE_APPROVE_TIME)}
|
||||
<br />{"审批结论:" + result}
|
||||
<br />{"审批意见:" + (n.CONTEXT == undefined ? '' : n.CONTEXT)}
|
||||
</span>} status={status} icon={status == 'process' ? <Icon type="user" /> : null} />
|
||||
// description={n.Nav_ApproveUser?.NAME + (n.NODE_APPROVE_TIME == "0001-01-01 00:00:00" ? '' : n.NODE_APPROVE_TIME)}
|
||||
})}
|
||||
<hr style={{ border: '1px dashed #ccc', marginBottom: "15px", display: this.state.data.length - 1 == i ? 'none' : 'block' }}></hr>
|
||||
</Steps>
|
||||
}) : "暂无审批详情"
|
||||
|
||||
}
|
||||
{/* </Sider> */}
|
||||
</Drawer>
|
||||
{/* <Layout style={{ marginLeft: 0 }}>
|
||||
<Col span={2}>
|
||||
@ -429,7 +431,7 @@ class PFCommonApproveView extends React.Component {
|
||||
})}
|
||||
</Steps>
|
||||
</Footer> */}
|
||||
{/* {
|
||||
{/* {
|
||||
this.state.data && this.state.data[0]?
|
||||
<div style={{display: this.state.BtnAgreeDisplay,backgroundColor:"#fff"}}>
|
||||
<Descriptions size="middle" bordered className={styles.description}>
|
||||
@ -463,54 +465,51 @@ class PFCommonApproveView extends React.Component {
|
||||
</Descriptions>
|
||||
</div>:null
|
||||
} */}
|
||||
{
|
||||
this.state.data && this.state.data[0]?
|
||||
<div style={{display: this.state.BtnAgreeDisplay,backgroundColor:"#fff"}}>
|
||||
<table style={{ width: '100%', textAlign: 'center', borderTop: '1px solid #333', borderLeft: '1px solid #333' }} className={styles.PrintForm}>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colSpan={2} rowSpan={1} className={styles.fontBold}>审批详情</td>
|
||||
<td colSpan={8} rowSpan={1}>{
|
||||
this.state.data[0].Nav_ApproveDetails && this.state.data[0].Nav_ApproveDetails.sort(this.compare).map((item, i) => {
|
||||
if(item.NODE_APPROVE_STATUS == 20)
|
||||
{
|
||||
return <table style={{border:"0",width:'100%', textAlign: 'left'}}><tr><td style={{border:"0",color:"red"}}><b>{(item.NAME? item.NAME: "")}</b><br/>
|
||||
{("审批结论:"+(item.CONTEXT===undefined?"驳回":item.CONTEXT ))}<br/>
|
||||
{("审核时间:"+item.NODE_APPROVE_TIME)}</td>
|
||||
<td style={{border:"0",color:"red"}}><br/><img style={{ margin: "0 0 0 15px",width:'150px' }} title={item.Nav_ApproveUser.NAME} />
|
||||
</td></tr>
|
||||
<tr><td colSpan={2} style={{border:"0"}}><hr style={{border:'1px dashed #ccc'}}></hr></td></tr>
|
||||
</table>
|
||||
}
|
||||
else if (item.NODE_APPROVE_STATUS != 0) {
|
||||
if (item.Nav_ApproveUser != null && item.Nav_ApproveUser.FILE_PATH != null)
|
||||
{
|
||||
return <table style={{border:"0",width:'100%', textAlign: 'left'}}><tr><td style={{border:"0"}}><b>{(item.NAME? item.NAME: "")}</b><br/>
|
||||
{("审批结论:"+(item.CONTEXT===undefined?"同意":item.CONTEXT ))}<br/>
|
||||
{("审核时间:"+item.NODE_APPROVE_TIME)}</td>
|
||||
<td style={{border:"0"}}><br/><img style={{ margin: "0 0 0 15px",width:'150px' }} alt={item.Nav_ApproveUser.NAME} src={config.picServerHost + item.Nav_ApproveUser.FILE_PATH} />
|
||||
</td></tr>
|
||||
<tr><td colSpan={2} style={{border:"0"}}><hr style={{border:'1px dashed #ccc'}}></hr></td></tr>
|
||||
</table>
|
||||
}
|
||||
else
|
||||
{
|
||||
return <table style={{border:"0",width:'100%', textAlign: 'left'}}><tr><td style={{border:"0"}}><b>{(item.NAME? item.NAME: "")}</b><br/>
|
||||
{("审批结论:"+(item.CONTEXT===undefined?"同意":item.CONTEXT ))}<br/>
|
||||
{("审核时间:"+item.NODE_APPROVE_TIME)}</td>
|
||||
<td style={{border:"0"}}><br/><img style={{ margin: "0 0 0 15px",width:'150px' }} title={item.Nav_ApproveUser.NAME} />
|
||||
</td></tr>
|
||||
<tr><td colSpan={2} style={{border:"0"}}><hr style={{border:'1px dashed #ccc'}}></hr></td></tr>
|
||||
</table>
|
||||
}
|
||||
}
|
||||
})
|
||||
}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>:null
|
||||
}
|
||||
{
|
||||
this.state.data && this.state.data[0] ?
|
||||
<div style={{ display: this.state.BtnAgreeDisplay, backgroundColor: "#fff" }}>
|
||||
<table style={{ width: '100%', textAlign: 'center', borderTop: '1px solid #333', borderLeft: '1px solid #333' }} className={styles.PrintForm}>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colSpan={2} rowSpan={1} className={styles.fontBold}>审批详情</td>
|
||||
<td colSpan={8} rowSpan={1}>{
|
||||
this.state.data[0].Nav_ApproveDetails && this.state.data[0].Nav_ApproveDetails.sort(this.compare).map((item, i) => {
|
||||
if (item.NODE_APPROVE_STATUS == 20) {
|
||||
return <table style={{ border: "0", width: '100%', textAlign: 'left' }}><tr><td style={{ border: "0", color: "red" }}><b>{(item.NAME ? item.NAME : "")}</b><br />
|
||||
{("审批结论:" + (item.CONTEXT === undefined ? "驳回" : item.CONTEXT))}<br />
|
||||
{("审核时间:" + item.NODE_APPROVE_TIME)}</td>
|
||||
<td style={{ border: "0", color: "red" }}><br /><img style={{ margin: "0 0 0 15px", width: '150px' }} title={item.Nav_ApproveUser.NAME} />
|
||||
</td></tr>
|
||||
<tr><td colSpan={2} style={{ border: "0" }}><hr style={{ border: '1px dashed #ccc' }}></hr></td></tr>
|
||||
</table>
|
||||
}
|
||||
else if (item.NODE_APPROVE_STATUS != 0) {
|
||||
if (item.Nav_ApproveUser != null && item.Nav_ApproveUser.FILE_PATH != null) {
|
||||
return <table style={{ border: "0", width: '100%', textAlign: 'left' }}><tr><td style={{ border: "0" }}><b>{(item.NAME ? item.NAME : "")}</b><br />
|
||||
{("审批结论:" + (item.CONTEXT === undefined ? "同意" : item.CONTEXT))}<br />
|
||||
{("审核时间:" + item.NODE_APPROVE_TIME)}</td>
|
||||
<td style={{ border: "0" }}><br /><img style={{ margin: "0 0 0 15px", width: '150px' }} alt={item.Nav_ApproveUser.NAME} src={config.picServerHost + item.Nav_ApproveUser.FILE_PATH} />
|
||||
</td></tr>
|
||||
<tr><td colSpan={2} style={{ border: "0" }}><hr style={{ border: '1px dashed #ccc' }}></hr></td></tr>
|
||||
</table>
|
||||
}
|
||||
else {
|
||||
return <table style={{ border: "0", width: '100%', textAlign: 'left' }}><tr><td style={{ border: "0" }}><b>{(item.NAME ? item.NAME : "")}</b><br />
|
||||
{("审批结论:" + (item.CONTEXT === undefined ? "同意" : item.CONTEXT))}<br />
|
||||
{("审核时间:" + item.NODE_APPROVE_TIME)}</td>
|
||||
<td style={{ border: "0" }}><br /><img style={{ margin: "0 0 0 15px", width: '150px' }} title={item.Nav_ApproveUser.NAME} />
|
||||
</td></tr>
|
||||
<tr><td colSpan={2} style={{ border: "0" }}><hr style={{ border: '1px dashed #ccc' }}></hr></td></tr>
|
||||
</table>
|
||||
}
|
||||
}
|
||||
})
|
||||
}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div> : null
|
||||
}
|
||||
</Layout >
|
||||
|
||||
)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Button, Descriptions, Modal, Badge, Popconfirm, Row, Col, Form, Input, Select, Table } from 'antd';
|
||||
import React from 'react';
|
||||
import { initFilter, extendRule, extendInclude, setDataFieldValue, showApprove, guid, initQueryFilter, ShowDateTime, ShowPrintClose, GetFileModel, showFiles } from '../../../utils/common';
|
||||
import { initFilter, extendRule, extendInclude, setDataFieldValue, showApprove, guid, initQueryFilter, ShowDateTime, ShowPrintClose, GetFileModel, showFiles, approveView } from '../../../utils/common';
|
||||
import ReactToPrint from 'react-to-print';
|
||||
import { ExportToExcel } from '@woowalker/feui'
|
||||
import XLSX from 'xlsx';
|
||||
@ -40,18 +40,8 @@ class SE071ShowPrint extends React.Component {
|
||||
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 : '';
|
||||
@ -86,7 +76,7 @@ class SE071ShowPrint extends React.Component {
|
||||
<div style={{ padding: '10px' }}>
|
||||
<table>
|
||||
<tr>
|
||||
<td><Button onClick={() => this.onClickApprove(true)} style={{ marginRight: '8px' }} icon='export'>审批详情</Button></td>
|
||||
<td><Button onClick={() => approveView(this)} style={{ marginRight: '8px' }} icon='export'>审批详情</Button></td>
|
||||
<td><ReactToPrint trigger={() => <Button type={'default'} icon={'printer'} >打印</Button>} content={() => this.componentRef} /></td>
|
||||
<td><ExportToExcel fileName='年度培训计划' tableId={'tableId' + this.props.data.id} /></td>
|
||||
</tr>
|
||||
|
||||
@ -1537,19 +1537,19 @@ function fileOnClick(file, callBack) {
|
||||
|
||||
//适应 组件 对附件的显示
|
||||
export function getFileShow(FILE_PATH, FILE_NAME) {
|
||||
const result = []
|
||||
if (!FILE_NAME) {
|
||||
var listPath = FILE_PATH.split('/')
|
||||
FILE_NAME = listPath[listPath.length - 1]
|
||||
}
|
||||
result.push({
|
||||
Nav_ImgFile: {
|
||||
FILE_PATH: FILE_PATH,
|
||||
FILE_NAME: FILE_NAME,
|
||||
FILE_TYPE:''
|
||||
}
|
||||
})
|
||||
return result;
|
||||
const result = []
|
||||
if (!FILE_NAME) {
|
||||
var listPath = FILE_PATH.split('/')
|
||||
FILE_NAME = listPath[listPath.length - 1]
|
||||
}
|
||||
result.push({
|
||||
Nav_ImgFile: {
|
||||
FILE_PATH: FILE_PATH,
|
||||
FILE_NAME: FILE_NAME,
|
||||
FILE_TYPE: ''
|
||||
}
|
||||
})
|
||||
return result;
|
||||
|
||||
}
|
||||
//显示附件
|
||||
@ -1969,4 +1969,18 @@ export function getArryPropShow(arry, propPath) {
|
||||
});
|
||||
}
|
||||
return arryShow;
|
||||
}
|
||||
|
||||
/****** 审批查看公共能方法 ******/
|
||||
export function approveView(that, appVisible) {
|
||||
if (appVisible == null || appVisible == undefined) {
|
||||
appVisible = true
|
||||
}
|
||||
const newtmpData = {
|
||||
data: { id: that.props.data.id, isShow: true, key: guid(), param: that.props.data.param, appVisible: appVisible, BtnAgreeDisplay: 'none', ORG_ID_HV: that.props.data.ORG_ID_HV },
|
||||
formCode: 'PF123',
|
||||
}
|
||||
that.setState({
|
||||
tmpData: newtmpData
|
||||
});
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user