提交 ce543fef authored 作者: 钟是志's avatar 钟是志

28479 北电]免缓军训管理,流程详情开出打印预览-任翠林

上级 dcb629b9
...@@ -5,184 +5,207 @@ ...@@ -5,184 +5,207 @@
* *
* */ * */
import React from 'react'; import React, { useContext } from 'react';
import * as service from '../publicApiService'; import * as service from '../publicApiService';
import AuditPage from './AuditPage'; import AuditPage from './AuditPage';
import * as destructionFunc from '../destruction'; import * as destructionFunc from '../destruction';
import { Link } from 'dva/router'; import { Link } from 'dva/router';
import { CreateC } from '../../ExportComponent/ActiveMenuComponent';
export default class Index extends React.Component { class Index extends React.Component {
static defaultProps = { static defaultProps = {
hasBatchAudit: false, // 是否有批量审核按钮 默认关掉 如果有需要再在外面包一层 2020年5月6日 18:44:11 钟是志 hasBatchAudit: false, // 是否有批量审核按钮 默认关掉 如果有需要再在外面包一层 2020年5月6日 18:44:11 钟是志
batchAuditButtonName: '批量审核', // 如果需要批量审核 则直接用 BatchAudit.js 文件 batchAuditButtonName: '批量审核', // 如果需要批量审核 则直接用 BatchAudit.js 文件
}; };
constructor(props) { constructor(props) {
super(props); super(props);
let pathname = this.props.location.pathname;
let pathname = this.props.location.pathname; this.state = {
this.state = { columns: [],
columns: [], dataList: [],
dataList: [], headerInfo: [],
headerInfo: [], workId: this.props.workId || '',
workId: this.props.workId || '', searchCondition: [],
searchCondition: [], pathname,
pathname, dataBaseId: this.props.dataBaseId || '',
dataBaseId: this.props.dataBaseId || '', addCondition: [],
addCondition: [], addFields: [], // 新增时填写的字段。
addFields: [], // 新增时填写的字段。 tableInfo: {}, // 表格配置属性
tableInfo: {}, // 表格配置属性 allConfigSetInfo: {}, // 返回的数据
allConfigSetInfo: {}, // 返回的数据 };
};
window.callbackSubmitInfoZhiYong = undefined; window.callbackSubmitInfoZhiYong = undefined;
} }
getFormDetail = (workId) => { getFormDetail = (workId) => {
const { dataBaseId } = this.state; const { dataBaseId } = this.state;
service.getFormDetail(workId).then((response) => { service.getFormDetail(workId)
if (typeof response.unifiedServicePatternModel === 'undefined') { .then((response) => {
return false; if (typeof response.unifiedServicePatternModel === 'undefined') {
} return false;
destructionFunc.destructionGetDetail(response).then((x) => { }
const { addFields, tableInfo, allConfigSetInfo, searchCondition } = x; destructionFunc.destructionGetDetail(response)
this.setState( .then((x) => {
{ const {
addFields, addFields,
tableInfo, tableInfo,
searchCondition, allConfigSetInfo,
allConfigSetInfo, searchCondition
}, } = x;
() => { this.setState(
this.giveDetailColumns(); {
}, addFields,
); tableInfo,
}); searchCondition,
}); allConfigSetInfo,
}; },
() => {
this.giveDetailColumns();
},
);
});
});
};
giveDetailColumns = () => { giveDetailColumns = () => {
const { columns, workId, dataBaseId, addFields, tableInfo } = this.state; const {
const { showPrint } = this.props; columns,
const process_status = columns.find((x) => { workId,
return x.name === 'process_status'; dataBaseId,
}); addFields,
if (process_status && process_status.dataIndex) { tableInfo
process_status.render = (text, record) => { } = this.state;
return record.statusName || record[process_status.dataIndex]; const { showPrint, routerConfig } = this.props;
}; const process_status = columns.find((x) => {
} return x.name === 'process_status';
columns.push({ });
dataIndex: 'operation', if (process_status && process_status.dataIndex) {
title: '操作', process_status.render = (text, record) => {
fixed: columns.length > 12 ? 'right' : false, return record.statusName || record[process_status.dataIndex];
render: (text, record) => { };
return ( }
<Link columns.push({
to={{ dataIndex: 'operation',
pathname: './Detail', title: '操作',
state: { fixed: columns.length > 12 ? 'right' : false,
workId, render: (text, record) => {
dataBaseId, return (
record, <Link
addFields, to={{
tableInfo, pathname: './Detail',
showPrint, state: {
}, workId,
}}> dataBaseId,
详情 record,
</Link> addFields,
); tableInfo,
}, showPrint: showPrint || routerConfig.showPrint === '1',
}); },
this.setState({ }}>
columns, 详情
}); </Link>
}; );
},
});
this.setState({
columns,
});
};
getColumn = () => { getColumn = () => {
const { workId } = this.state; const { workId } = this.state;
service.getColumns(workId).then((response) => { service.getColumns(workId)
if(!response || !Array.isArray(response)){ .then((response) => {
response = []; if (!response || !Array.isArray(response)) {
} response = [];
for(let item of response){
if(item.dataIndex === 'taskName' && !item.width){
item.width = 200;
} }
if(item.dataIndex === 'createTime' && !item.width){ for (let item of response) {
item.width = 200; if (item.dataIndex === 'taskName' && !item.width) {
item.width = 200;
}
if (item.dataIndex === 'createTime' && !item.width) {
item.width = 200;
}
} }
} response = response.filter((x) => {
response = response.filter((x) => { return x.title !== '流程进度';
return x.title !== '流程进度'; });
}); if (response && response.length) {
// for(let item of response){ this.setState(
// if(!item.width){ {
// // item.width = 90; // 给一个默认宽度 columns: response, // 表头
// } },
// } () => {
if (response && response.length) { this.getFormDetail(workId);
this.setState( },
{ );
columns: response, // 表头 }
}, });
() => { };
this.getFormDetail(workId);
},
);
}
});
};
componentDidMount() { componentDidMount() {
const { pathname } = this.state; const { pathname } = this.state;
const { workId } = this.state; const { workId } = this.state;
if (workId) { if (workId) {
this.getColumn(); this.getColumn();
} else { } else {
service.getId(pathname).then((x) => { service.getId(pathname)
this.setState( .then((x) => {
{ this.setState(
workId: x.workId, {
dataBaseId: x.dataBaseId, workId: x.workId,
}, dataBaseId: x.dataBaseId,
() => { },
this.getColumn(); () => {
}, this.getColumn();
); },
}); );
} });
} }
}
render() { render() {
const { const {
workId, workId,
dataBaseId, dataBaseId,
columns, columns,
searchCondition, searchCondition,
addFields, addFields,
allConfigSetInfo, allConfigSetInfo,
tableInfo, tableInfo,
} = this.state; } = this.state;
const { hasBatchAudit, batchAuditButtonName, showPrint, noNeedForm, tab2Buttons = [] } = this.props; const {
if (!workId) { hasBatchAudit,
return null; batchAuditButtonName,
} showPrint,
return ( noNeedForm,
<AuditPage tab2Buttons = []
hasBatchAudit={hasBatchAudit} } = this.props;
workId={workId} if (!workId) {
dataBaseId={dataBaseId} return null;
columns={columns} }
addFields={addFields} return (
tableInfo={tableInfo} <AuditPage
allConfigSetInfo={allConfigSetInfo} hasBatchAudit={hasBatchAudit}
searchCondition={searchCondition} workId={workId}
batchAuditButtonName={batchAuditButtonName} dataBaseId={dataBaseId}
columns={columns}
addFields={addFields}
tableInfo={tableInfo}
allConfigSetInfo={allConfigSetInfo}
searchCondition={searchCondition}
batchAuditButtonName={batchAuditButtonName}
showPrint={showPrint} showPrint={showPrint}
noNeedForm={noNeedForm} noNeedForm={noNeedForm}
tab2Buttons={tab2Buttons} tab2Buttons={tab2Buttons}
/> />
); );
} }
}
export default function Pr(props) {
const { routerConfig } = useContext(CreateC);
return (
<Index {...props} routerConfig={routerConfig}/>
);
} }
...@@ -83,7 +83,6 @@ export default class Detail extends Component { ...@@ -83,7 +83,6 @@ export default class Detail extends Component {
// 贵建把打印预览显示出来 // 贵建把打印预览显示出来
showPrint = true; showPrint = true;
} }
console.log(showPrint);
let iframeUrl = `${url[0]}/#/IframeForDetail?id=${id}&token=${getToken()}`; let iframeUrl = `${url[0]}/#/IframeForDetail?id=${id}&token=${getToken()}`;
if (showPrint) { if (showPrint) {
iframeUrl = iframeUrl + '&showPrint=true'; iframeUrl = iframeUrl + '&showPrint=true';
...@@ -92,6 +91,7 @@ export default class Detail extends Component { ...@@ -92,6 +91,7 @@ export default class Detail extends Component {
iframeUrl = config.gateWayPort + `/portal/#/showAuditIframe?id=${id}&hasSingle=false&token=${getToken()}&isPrint=false`; iframeUrl = config.gateWayPort + `/portal/#/showAuditIframe?id=${id}&hasSingle=false&token=${getToken()}&isPrint=false`;
} }
// iframeUrl = `http://localhost:8000/onestop/IframeForDetail?id=${id}&token=${getToken()}`; // iframeUrl = `http://localhost:8000/onestop/IframeForDetail?id=${id}&token=${getToken()}`;
// console.log(showPrint);
return ( return (
<PageHeaderWrapper title=''> <PageHeaderWrapper title=''>
<Shell> <Shell>
......
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState, createContext } from 'react';
import CheckRecord from '@/webPublic/FormInsertDiy/ExportComponent/CheckRecord'; // 查询类 import CheckRecord from '@/webPublic/FormInsertDiy/ExportComponent/CheckRecord'; // 查询类
import Apply from '@/webPublic/FormInsertDiy/AffairPage/ApplyPage'; // 申请 import Apply from '@/webPublic/FormInsertDiy/AffairPage/ApplyPage'; // 申请
import BatchAudit from '@/webPublic/FormInsertDiy/AffairPage/AuditPage/BatchAudit'; // 批量审批 import BatchAudit from '@/webPublic/FormInsertDiy/AffairPage/AuditPage/BatchAudit'; // 批量审批
import Audit from '@/webPublic/FormInsertDiy/AffairPage/AuditPage/index.js'; // 审批 import Audit from '@/webPublic/FormInsertDiy/AffairPage/AuditPage/index.js'; // 审批
import Detail from '@/webPublic/FormInsertDiy/AffairPage/Detail'; //详情 import Detail from '@/webPublic/FormInsertDiy/AffairPage/Detail'; //详情
import { Modal, message, notification, Popconfirm } from 'antd'; import { Modal, message, notification, Popconfirm } from 'antd';
import { connect } from 'dva';
export const CreateC = createContext({
routerConfig: {},
});
window.iframeParentComponent = { window.iframeParentComponent = {
Modal, Modal,
message, message,
notification, notification,
Popconfirm, Popconfirm,
}; };
export default function ActiveMenuComponent({ routerConfig, ...otherProps }) { function ActiveMenuComponent({
const { component = '', appId } = routerConfig; routerConfig,
const { location } = otherProps; ...otherProps
const record = location?.state?.record; }) {
const [show, setShow] = useState(false); const {
useEffect( component = '',
() => { appId
if (appId || record.id) { } = routerConfig;
setShow(false); const { location } = otherProps;
setTimeout(() => { const record = location?.state?.record;
setShow(true); const [show, setShow] = useState(false);
}, 100); useEffect(
} () => {
}, if (appId || record.id) {
[appId, record], setShow(false);
); setTimeout(() => {
if (!show) { setShow(true);
return null; }, 100);
} }
},
[appId, record],
);
if (!show) {
return null;
}
switch (component) { let Res = <div>暂无此功能</div>;
case 'CheckRecord': // 查询类应用
return <CheckRecord workId={appId} />; switch (component) {
case 'Apply': // 申请类 详情是 iframe case 'CheckRecord': // 查询类应用
return <Apply workId={appId} {...otherProps} />; Res = <CheckRecord workId={appId}/>;
case 'Audit': // 审批类 详情是 iframe break;
return <Audit workId={appId} {...otherProps} />; case 'Apply': // 申请类
case 'BatchAudit': // 批量审批 详情是 iframe Res = <Apply workId={appId} {...otherProps} />;
return <BatchAudit workId={appId} {...otherProps} />; break;
case 'Detail': // 详情 iframe case 'Audit': // 审批类
return <Detail {...otherProps} />; Res = <Audit workId={appId} {...otherProps} />;
default: break;
console.log(component, '没有找到此组件'); case 'BatchAudit': // 批量审批
return <div>暂无此功能</div>; Res = <BatchAudit workId={appId}
} {...otherProps}
/>;
break;
case 'Detail': // 详情
Res = <Detail {...otherProps} />;
break;
default:
break;
}
return (
<CreateC.Provider value={{
routerConfig,
}}>
{Res}
</CreateC.Provider>
);
} }
export default connect(({}) => {
return {};
})(ActiveMenuComponent);
...@@ -17,6 +17,7 @@ export default function ActiveMenuComponent2({ ...@@ -17,6 +17,7 @@ export default function ActiveMenuComponent2({
if(appId){ if(appId){
setShow(false); setShow(false);
setTimeout(() => { setTimeout(() => {
setShow(true); setShow(true);
}, 1000); }, 1000);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论