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

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

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