审批流查看 添加 公共方法 给每个页面调用 使支持总部查看子页的审批流数据正常

This commit is contained in:
wyw 2026-05-13 14:16:00 +08:00
parent 08f404d8f9
commit 6bb8aa83c9
3 changed files with 131 additions and 128 deletions

View File

@ -1,5 +1,5 @@
import { message } from "antd/lib/index"; 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 React from 'react';
import { PlusOutlined } from '@ant-design/icons'; import { PlusOutlined } from '@ant-design/icons';
import ReactToPrint from "react-to-print"; import ReactToPrint from "react-to-print";
@ -34,17 +34,16 @@ class PFCommonApproveView extends React.Component {
visible: false, visible: false,
userData: [], userData: [],
selectUserId: '', selectUserId: '',
appVisible:false, appVisible: false,
BtnAgreeDisplay:'none' BtnAgreeDisplay: 'none'
} }
}; };
componentDidMount() { componentDidMount() {
if (this.props.data?.id) if (this.props.data?.id) {
{ this.loadData(this.props.data?.id, false);
this.loadData(this.props.data?.id,false);
this.setState({ this.setState({
appVisible: this.props.data.appVisible?this.props.data.appVisible:false, appVisible: this.props.data.appVisible ? this.props.data.appVisible : false,
BtnAgreeDisplay:this.props.data.BtnAgreeDisplay?this.props.data.BtnAgreeDisplay:'none', 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) { // if (NextProps.data?.id && this.props.data?.id != NextProps.data?.id) {
// this.loadData(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) { if (NextProps.data?.id) {
this.loadData(NextProps.data?.id,true); this.loadData(NextProps.data?.id, true);
this.setState({ this.setState({
appVisible: NextProps.data.appVisible?NextProps.data.appVisible:false, appVisible: NextProps.data.appVisible ? NextProps.data.appVisible : false,
BtnAgreeDisplay:NextProps.data.BtnAgreeDisplay?NextProps.data.BtnAgreeDisplay:'none', 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); const json = initFilter(this.props.login.OrgId, this.props.data.id, '', 0, 1, this.props.data.PARAM ?? null, this.props.data.PARAM2);
this.setState({ this.setState({
appVisible:appVisibleTemp, appVisible: appVisibleTemp,
BtnAgreeDisplay:this.props.data.BtnAgreeDisplay?this.props.data.BtnAgreeDisplay:'inline' BtnAgreeDisplay: this.props.data.BtnAgreeDisplay ? this.props.data.BtnAgreeDisplay : 'inline'
}); });
this.props.dispatch({ this.props.dispatch({
type: 'app/getDataByPost', type: 'app/getDataByPost',
@ -167,7 +165,7 @@ class PFCommonApproveView extends React.Component {
payload: jsonApp, payload: jsonApp,
onlyData: false, onlyData: false,
onComplete: (re) => { onComplete: (re) => {
if (re && re.IsSuccessful && re.Data && re.Data.Nav_ApproveDetails.length > 0) { if (re && re.IsSuccessful && re.Data && re.Data.Nav_ApproveDetails.length > 0) {
const newtmpData = { const newtmpData = {
data: { 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); const json = initFilter(this.props.login.OrgId, this.props.data.id, '', 0, 1, this.props.data.PARAM ?? null, this.props.data.PARAM2);
this.setState({ this.setState({
appVisible:appVisibleTemp, appVisible: appVisibleTemp,
BtnAgreeDisplay:this.props.data.BtnAgreeDisplay?this.props.data.BtnAgreeDisplay:'inline' 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({ this.props.dispatch({
type: 'app/getDataByPost', type: 'app/getDataByPost',
payload: json, payload: json,
@ -309,14 +311,14 @@ class PFCommonApproveView extends React.Component {
}); });
} }
showAppDrawer= () => { showAppDrawer = () => {
this.setState({ this.setState({
appVisible: true, appVisible: true,
}); });
} }
onClose = () => { onClose = () => {
this.setState({ this.setState({
appVisible:false, appVisible: false,
}); });
}; };
render() { render() {
@ -338,13 +340,13 @@ class PFCommonApproveView extends React.Component {
// <FormPage {...this.state.tmpData} /> // <FormPage {...this.state.tmpData} />
<Layout> <Layout>
<Drawer <Drawer
title="审批详情" title="审批详情"
width={320} width={320}
onClose={this.onClose} onClose={this.onClose}
visible={this.state.appVisible} visible={this.state.appVisible}
bodyStyle={{ paddingBottom: 80 }} bodyStyle={{ paddingBottom: 80 }}
placement ="left" placement="left"
> >
{/* <Sider style={{ {/* <Sider style={{
overflow: 'auto', overflow: 'auto',
@ -353,7 +355,7 @@ class PFCommonApproveView extends React.Component {
left: 20, left: 20,
background: '#FFF' background: '#FFF'
}}> */} }}> */}
{/* { {/* {
this.state.data && this.state.data.Nav_ApproveDetails? <Steps icon="user" current={0} direction="vertical" type="navigation"> this.state.data && this.state.data.Nav_ApproveDetails? <Steps icon="user" current={0} direction="vertical" type="navigation">
{this.state.data?.Nav_ApproveDetails?.map((n) => { {this.state.data?.Nav_ApproveDetails?.map((n) => {
let status = 'wait'; let result = ''; let status = 'wait'; let result = '';
@ -373,34 +375,34 @@ class PFCommonApproveView extends React.Component {
})} })}
</Steps> :"" </Steps> :""
} */} } */}
{ {
this.state.data && this.state.data[0] ? this.state.data && this.state.data[0] ?
this.state.data.map((m,i)=>{ this.state.data.map((m, i) => {
return <Steps icon="user" current={0} direction="vertical" type="navigation"> return <Steps icon="user" current={0} direction="vertical" type="navigation">
{ {
m.Nav_ApproveDetails?.sort(this.compare).map((n) => { m.Nav_ApproveDetails?.sort(this.compare).map((n) => {
let status = 'wait'; let result = ''; let status = 'wait'; let result = '';
if (n.NODE_APPROVE_STATUS == 10) { if (n.NODE_APPROVE_STATUS == 10) {
status = 'finish';result='同意'; status = 'finish'; result = '同意';
} else if (n.NODE_APPROVE_STATUS == 20) { } else if (n.NODE_APPROVE_STATUS == 20) {
status = 'error';result='驳回'; status = 'error'; result = '驳回';
} }
if (n.IS_CURRENT) { if (n.IS_CURRENT) {
status = 'process'; 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)} 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 />{"审批结论:" + result}
<br/>{"审批意见:"+(n.CONTEXT ==undefined?'': n.CONTEXT)} <br />{"审批意见:" + (n.CONTEXT == undefined ? '' : n.CONTEXT)}
</span>} status={status} icon={status=='process'?<Icon type="user" />:null} /> </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)} // 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> <hr style={{ border: '1px dashed #ccc', marginBottom: "15px", display: this.state.data.length - 1 == i ? 'none' : 'block' }}></hr>
</Steps> </Steps>
}) :"暂无审批详情" }) : "暂无审批详情"
} }
{/* </Sider> */} {/* </Sider> */}
</Drawer> </Drawer>
{/* <Layout style={{ marginLeft: 0 }}> {/* <Layout style={{ marginLeft: 0 }}>
<Col span={2}> <Col span={2}>
@ -429,7 +431,7 @@ class PFCommonApproveView extends React.Component {
})} })}
</Steps> </Steps>
</Footer> */} </Footer> */}
{/* { {/* {
this.state.data && this.state.data[0]? this.state.data && this.state.data[0]?
<div style={{display: this.state.BtnAgreeDisplay,backgroundColor:"#fff"}}> <div style={{display: this.state.BtnAgreeDisplay,backgroundColor:"#fff"}}>
<Descriptions size="middle" bordered className={styles.description}> <Descriptions size="middle" bordered className={styles.description}>
@ -463,54 +465,51 @@ class PFCommonApproveView extends React.Component {
</Descriptions> </Descriptions>
</div>:null </div>:null
} */} } */}
{ {
this.state.data && this.state.data[0]? this.state.data && this.state.data[0] ?
<div style={{display: this.state.BtnAgreeDisplay,backgroundColor:"#fff"}}> <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}> <table style={{ width: '100%', textAlign: 'center', borderTop: '1px solid #333', borderLeft: '1px solid #333' }} className={styles.PrintForm}>
<tbody> <tbody>
<tr> <tr>
<td colSpan={2} rowSpan={1} className={styles.fontBold}>审批详情</td> <td colSpan={2} rowSpan={1} className={styles.fontBold}>审批详情</td>
<td colSpan={8} rowSpan={1}>{ <td colSpan={8} rowSpan={1}>{
this.state.data[0].Nav_ApproveDetails && this.state.data[0].Nav_ApproveDetails.sort(this.compare).map((item, i) => { this.state.data[0].Nav_ApproveDetails && this.state.data[0].Nav_ApproveDetails.sort(this.compare).map((item, i) => {
if(item.NODE_APPROVE_STATUS == 20) 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 />
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.CONTEXT===undefined?"驳回":item.CONTEXT ))}<br/> {("审核时间:" + item.NODE_APPROVE_TIME)}</td>
{("审核时间:"+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 style={{border:"0",color:"red"}}><br/><img style={{ margin: "0 0 0 15px",width:'150px' }} title={item.Nav_ApproveUser.NAME} /> </td></tr>
</td></tr> <tr><td colSpan={2} style={{ border: "0" }}><hr style={{ border: '1px dashed #ccc' }}></hr></td></tr>
<tr><td colSpan={2} style={{border:"0"}}><hr style={{border:'1px dashed #ccc'}}></hr></td></tr> </table>
</table> }
} else if (item.NODE_APPROVE_STATUS != 0) {
else if (item.NODE_APPROVE_STATUS != 0) { if (item.Nav_ApproveUser != null && item.Nav_ApproveUser.FILE_PATH != null) {
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 />
return <table style={{border:"0",width:'100%', textAlign: 'left'}}><tr><td style={{border:"0"}}><b>{(item.NAME? item.NAME: "")}</b><br/> {("审核时间:" + item.NODE_APPROVE_TIME)}</td>
{("审批结论:"+(item.CONTEXT===undefined?"同意":item.CONTEXT ))}<br/> <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} />
{("审核时间:"+item.NODE_APPROVE_TIME)}</td> </td></tr>
<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} /> <tr><td colSpan={2} style={{ border: "0" }}><hr style={{ border: '1px dashed #ccc' }}></hr></td></tr>
</td></tr> </table>
<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 />
else {("审批结论:" + (item.CONTEXT === undefined ? "同意" : item.CONTEXT))}<br />
{ {("审核时间:" + item.NODE_APPROVE_TIME)}</td>
return <table style={{border:"0",width:'100%', textAlign: 'left'}}><tr><td style={{border:"0"}}><b>{(item.NAME? item.NAME: "")}</b><br/> <td style={{ border: "0" }}><br /><img style={{ margin: "0 0 0 15px", width: '150px' }} title={item.Nav_ApproveUser.NAME} />
{("审批结论:"+(item.CONTEXT===undefined?"同意":item.CONTEXT ))}<br/> </td></tr>
{("审核时间:"+item.NODE_APPROVE_TIME)}</td> <tr><td colSpan={2} style={{ border: "0" }}><hr style={{ border: '1px dashed #ccc' }}></hr></td></tr>
<td style={{border:"0"}}><br/><img style={{ margin: "0 0 0 15px",width:'150px' }} title={item.Nav_ApproveUser.NAME} /> </table>
</td></tr> }
<tr><td colSpan={2} style={{border:"0"}}><hr style={{border:'1px dashed #ccc'}}></hr></td></tr> }
</table> })
} }</td>
} </tr>
}) </tbody>
}</td> </table>
</tr> </div> : null
</tbody> }
</table>
</div>:null
}
</Layout > </Layout >
) )

View File

@ -1,6 +1,6 @@
import { Button, Descriptions, Modal, Badge, Popconfirm, Row, Col, Form, Input, Select, Table } from 'antd'; import { Button, Descriptions, Modal, Badge, Popconfirm, Row, Col, Form, Input, Select, Table } from 'antd';
import React from 'react'; 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 ReactToPrint from 'react-to-print';
import { ExportToExcel } from '@woowalker/feui' import { ExportToExcel } from '@woowalker/feui'
import XLSX from 'xlsx'; import XLSX from 'xlsx';
@ -40,18 +40,8 @@ class SE071ShowPrint extends React.Component {
let Table = TableWrap.getElementsByTagName('table1')[0]; let Table = TableWrap.getElementsByTagName('table1')[0];
const wb = XLSX.utils.table_to_book(Table); const wb = XLSX.utils.table_to_book(Table);
XLSX.writeFile(wb, this.props.record.Nav_Department.NAME + '.xlsx') 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) => { loadData = (id) => {
var isCheck = (this.props.data.tableKey != undefined && this.props.data.tableKey == '1') ? true : false var isCheck = (this.props.data.tableKey != undefined && this.props.data.tableKey == '1') ? true : false
var orgId = this.props.login ? this.props.login.OrgId : ''; var orgId = this.props.login ? this.props.login.OrgId : '';
@ -86,7 +76,7 @@ class SE071ShowPrint extends React.Component {
<div style={{ padding: '10px' }}> <div style={{ padding: '10px' }}>
<table> <table>
<tr> <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><ReactToPrint trigger={() => <Button type={'default'} icon={'printer'} >打印</Button>} content={() => this.componentRef} /></td>
<td><ExportToExcel fileName='年度培训计划' tableId={'tableId' + this.props.data.id} /></td> <td><ExportToExcel fileName='年度培训计划' tableId={'tableId' + this.props.data.id} /></td>
</tr> </tr>

View File

@ -1537,19 +1537,19 @@ function fileOnClick(file, callBack) {
//适应 组件 对附件的显示 //适应 组件 对附件的显示
export function getFileShow(FILE_PATH, FILE_NAME) { export function getFileShow(FILE_PATH, FILE_NAME) {
const result = [] const result = []
if (!FILE_NAME) { if (!FILE_NAME) {
var listPath = FILE_PATH.split('/') var listPath = FILE_PATH.split('/')
FILE_NAME = listPath[listPath.length - 1] FILE_NAME = listPath[listPath.length - 1]
} }
result.push({ result.push({
Nav_ImgFile: { Nav_ImgFile: {
FILE_PATH: FILE_PATH, FILE_PATH: FILE_PATH,
FILE_NAME: FILE_NAME, FILE_NAME: FILE_NAME,
FILE_TYPE:'' FILE_TYPE: ''
} }
}) })
return result; return result;
} }
//显示附件 //显示附件
@ -1969,4 +1969,18 @@ export function getArryPropShow(arry, propPath) {
}); });
} }
return arryShow; 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
});
} }