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

30305 所有申请应用--学生填错后,在审核前可以撤回一次

上级 5fbdea9d
......@@ -2,9 +2,9 @@ import { getIsBei_Dian } from '@/webPublic/zyd_public/utils/getSchoolType';
import { message, Modal } from 'antd';
import { uaaRequest } from '@/webPublic/one_stop_public/utils/request';
export default function rebackButton(){
export default function rebackButton(serviceInfo){
let reBack = [];
if (getIsBei_Dian()) {
if (getIsBei_Dian() && serviceInfo.isCanRecall) {
reBack.push({
type: 'chehui',
name: '撤回',
......
......@@ -6,7 +6,7 @@
* */
import { message, Modal } from 'antd';
import React, { useEffect, useState, } from 'react';
import React, { useEffect, useState } from 'react';
import * as service from '../publicApiService';
import * as destructionFunc from '../destruction';
import { Link } from 'dva/router';
......@@ -23,392 +23,373 @@ import ApplyForZyd from '@/webPublic/one_stop_public/ForZydApply/index';
import { uaaRequest } from '@/webPublic/one_stop_public/utils/request';
import rebackButton from '@/webPublic/FormInsertDiy/AffairPage/ApplyPage/ReBackButton';
export default function index(props) {
const { state = {} } = props.location;
const [show, setShow] = useState(false);
useEffect(() => {
setShow(false);
setTimeout(() => {
setShow(true);
}, 100);
}, [props.location.pathname]);
if (!show) {
return null;
}
if (state.justApply) {
return <JustApply {...props} />;
} else {
return <AffairPage {...props} />;
}
const { state = {} } = props.location;
const [show, setShow] = useState(false);
useEffect(
() => {
setShow(false);
setTimeout(() => {
setShow(true);
}, 100);
},
[props.location.pathname],
);
if (!show) {
return null;
}
if (state.justApply) {
return <JustApply {...props} />;
} else {
return <AffairPage {...props} />;
}
}
class AffairPage extends React.Component {
constructor(props) {
super(props);
let pathname = this.props.location.pathname;
const {
dataBaseId,
workId
} = this.props;
this.state = {
showIframe: false,
columns: [],
pathname,
workId: workId || '',
searchCondition: [],
dataBaseId: '',
addFields: [], // 新增时填写的字段。
renderIframe: false,
allConfigSetInfo: null,
};
}
getFormDetail = (workId) => {
service.getFormDetail(workId)
.then((response) => {
if (typeof response.unifiedServicePatternModel === 'undefined') {
return false;
}
destructionFunc.destructionGetDetail(response)
.then((x) => {
const {
addFields,
tableInfo,
allConfigSetInfo
} = x;
this.setState(
{
addFields,
tableInfo,
allConfigSetInfo,
},
() => {
this.giveDetailColumns();
},
);
});
});
};
giveDetailColumns = () => {
const {
columns,
workId,
dataBaseId,
addFields
} = this.state;
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];
};
}
let findCz = columns.find((g) => g.dataIndex === 'operation');
if (!findCz) {
columns.push({
dataIndex: 'operation',
title: '操作',
fixed: columns.length > 12 ? 'right' : false,
render: (text, record) => {
return (
<Link
to={{
pathname: './Detail',
state: {
workId,
dataBaseId,
record,
addFields,
},
}}>
详情
</Link>
);
},
});
}
constructor(props) {
super(props);
let pathname = this.props.location.pathname;
const { dataBaseId, workId } = this.props;
this.state = {
showIframe: false,
columns: [],
pathname,
workId: workId || '',
searchCondition: [],
dataBaseId: '',
addFields: [], // 新增时填写的字段。
renderIframe: false,
allConfigSetInfo: null,
serviceInfo: null,
};
}
getServiceDetail = (serviceId) => {
service.getServiceDetail(serviceId).then((res) => {
this.setState({
serviceInfo: res,
});
});
};
this.setState({
columns,
});
};
getFormDetail = (workId) => {
service.getFormDetail(workId).then((response) => {
console.log(response);
if (typeof response.unifiedServicePatternModel === 'undefined') {
return false;
}
if(response.serviceId){
this.getServiceDetail(response.serviceId);
}
destructionFunc.destructionGetDetail(response).then((x) => {
const { addFields, tableInfo, allConfigSetInfo } = x;
this.setState(
{
addFields,
tableInfo,
allConfigSetInfo,
},
() => {
this.giveDetailColumns();
},
);
});
});
};
handleButtonSet = () => {
const {
canApply,
otherButtons = [],
} = this.props;
const { allConfigSetInfo } = this.state;
if (!allConfigSetInfo) {
return [];
}
const isCloseStart = allConfigSetInfo?.isCloseStart;
giveDetailColumns = () => {
const { columns, workId, dataBaseId, addFields } = this.state;
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];
};
}
let findCz = columns.find((g) => g.dataIndex === 'operation');
if (!findCz) {
columns.push({
dataIndex: 'operation',
title: '操作',
fixed: columns.length > 12 ? 'right' : false,
render: (text, record) => {
return (
<Link
to={{
pathname: './Detail',
state: {
workId,
dataBaseId,
record,
addFields,
},
}}>
详情
</Link>
);
},
});
}
if (canApply === false || isCloseStart) {
return [...otherButtons];
}
this.setState({
columns,
});
};
handleButtonSet = () => {
const { canApply, otherButtons = [] } = this.props;
const { allConfigSetInfo, serviceInfo } = this.state;
if (!allConfigSetInfo) {
return [];
}
const isCloseStart = allConfigSetInfo?.isCloseStart;
return [
{
type: 'add',
name: '申请',
component: 'Normal',
handleClick: () => {
this.setState(
{
showIframe: true,
renderIframe: true,
},
() => {
},
);
},
},
...rebackButton(),
...otherButtons,
];
};
if (canApply === false || isCloseStart) {
return [...otherButtons];
}
handleSearchSet = () => {
const {
columns,
searchCondition
} = this.state;
const { onResponse } = this.props;
const pageSearch = {
search: {
field: {},
getPageService: getApplyPage,
responseCallBack: (response) => {
if (onResponse) {
onResponse(response);
}
return response;
},
condition: searchCondition,
nameSpan: {
big: 8,
small: 9
},
fileSpan: {
big: 4,
small: 4
},
},
tableRowKey: 'id',
columns,
};
return pageSearch;
};
return [
{
type: 'add',
name: '申请',
component: 'Normal',
handleClick: () => {
this.setState(
{
showIframe: true,
renderIframe: true,
},
() => {},
);
},
},
...rebackButton(serviceInfo),
...otherButtons,
];
};
getColumns = () => {
const { workId } = this.state;
service.getColumns(workId)
.then((response) => {
if (response && Array.isArray(response)) {
response = response.filter((x) => {
return x.title !== '流程进度';
});
}
handleSearchSet = () => {
const { columns, searchCondition } = this.state;
const { onResponse } = this.props;
const pageSearch = {
search: {
field: {},
getPageService: getApplyPage,
responseCallBack: (response) => {
if (onResponse) {
onResponse(response);
}
return response;
},
condition: searchCondition,
nameSpan: {
big: 8,
small: 9,
},
fileSpan: {
big: 4,
small: 4,
},
},
tableRowKey: 'id',
columns,
};
return pageSearch;
};
if (response) {
this.setState(
{
columns: response,
},
() => {
this.getFormDetail(workId);
},
);
}
});
};
getColumns = () => {
const { workId } = this.state;
service.getColumns(workId).then((response) => {
if (response && Array.isArray(response)) {
response = response.filter((x) => {
return x.title !== '流程进度';
});
}
if (response) {
this.setState(
{
columns: response,
},
() => {
this.getFormDetail(workId);
},
);
}
});
};
initData = () => {
if (!getToken()) {
message.error('您的数据未同步,请联系管理员!');
return false;
}
const { pathname } = this.state;
const {
dataBaseId,
workId,
iframeHeight
} = this.props;
if (dataBaseId || workId) {
this.setState(
{
workId,
dataBaseId,
},
() => {
this.getColumns();
},
);
} else {
service.getId(pathname)
.then((x) => {
this.setState(
{
workId: x.workId,
dataBaseId: x.dataBaseId,
},
() => {
this.getColumns();
},
);
});
}
initData = () => {
if (!getToken()) {
message.error('您的数据未同步,请联系管理员!');
return false;
}
const { pathname } = this.state;
const { dataBaseId, workId, iframeHeight } = this.props;
if (dataBaseId || workId) {
this.setState(
{
workId,
dataBaseId,
},
() => {
this.getColumns();
},
);
} else {
service.getId(pathname).then((x) => {
this.setState(
{
workId: x.workId,
dataBaseId: x.dataBaseId,
},
() => {
this.getColumns();
},
);
});
}
window.addEventListener(
'message',
(event) => {
if (event.data === 'returnList') {
this.returnList(true);
}
if (event && event.data && event.data.indexOf && event.data.indexOf('iframeHeight') > -1) {
console.log(event.data);
let height = Number(event.data.split('-')[1]);
const iframe = document.getElementById('applyIframeId');
if (iframe) {
iframe.height = height + (iframeHeight || 50);
}
}
},
false,
);
window.addEventListener(
'message',
(event) => {
if (event.data === 'returnList') {
this.returnList(true);
}
if (event && event.data && event.data.indexOf && event.data.indexOf('iframeHeight') > -1) {
console.log(event.data);
let height = Number(event.data.split('-')[1]);
const iframe = document.getElementById('applyIframeId');
if (iframe) {
iframe.height = height + (iframeHeight || 50);
}
}
},
false,
);
return true;
};
return true;
};
componentDidMount() {
this.initData();
}
componentDidMount() {
this.initData();
}
componentDidUpdate(prevProps, prevState) {
if (prevProps.workId !== this.props.workId) {
// console.log('123123', prevProps, this.props);
this.initData();
}
}
componentDidUpdate(prevProps, prevState) {
if (prevProps.workId !== this.props.workId) {
// console.log('123123', prevProps, this.props);
this.initData();
}
}
returnList = (needSearchList = false) => {
console.log(needSearchList);
const { workId } = this.state;
this.setState(
{
renderIframe: false,
},
() => {
if (needSearchList) {
this.ListComponent.getPage();
setTimeout(() => {
this.getFormDetail(workId);
}, 2000);
}
this.setState({
showIframe: false,
});
},
);
};
returnList = (needSearchList = false) => {
console.log(needSearchList);
const { workId } = this.state;
this.setState(
{
renderIframe: false,
},
() => {
if (needSearchList) {
this.ListComponent.getPage();
setTimeout(() => {
this.getFormDetail(workId);
}, 2000);
}
this.setState({
showIframe: false,
});
},
);
};
render() {
const { iframeUrlDiy } = this.props;
const {
workId,
dataBaseId,
addFields,
showIframe,
renderIframe,
allConfigSetInfo,
} = this.state;
if (!workId || !allConfigSetInfo) {
return null;
}
// console.log(allConfigSetInfo.isCloseStart);
// const url = config.onestopPC.split('/#/');
// let iframeUrl = iframeUrlDiy || `${url[0]}/#/IFrameForApply?id=${workId}&token=${getToken()}`;
let buttons = this.handleButtonSet({});
let listConfig = pageSetting.listConfig;
if (!buttons.length) {
listConfig = deepCopy(listConfig);
listConfig.buttonArea = false;
}
return (
<PageHeaderWrapper title="">
<div
style={{
display: showIframe ? 'none' : 'block',
}}>
<List
listConfig={listConfig}
pageButton={buttons}
pageSearch={this.handleSearchSet({})}
addFields={addFields}
ref={(ListComponent) => (this.ListComponent = ListComponent)}
workId={workId}
dataBaseId={dataBaseId}
/>
</div>
<div
style={{
visibility: showIframe ? 'visible' : 'hidden',
height: showIframe ? 'auto' : '0px',
width: '100%',
backgroundColor: '#fff',
paddingLeft: '24px',
}}>
<Shell>
<div
style={{
height: '54px',
padding: '12px 0 12px 12px',
display: showIframe ? 'block' : 'none',
}}>
<ButtonDiy
name="返回"
className="defaultBlue"
handleClick={this.returnList}
icon="arrow-left"
/>
</div>
</Shell>
{renderIframe ? (
iframeUrlDiy ?
<iframe
src={iframeUrlDiy}
frameBorder={0}
id="applyIframeId"
name="applyIframe"
marginWidth="0"
marginHeight="0"
allowTransparency="yes"
seamless
scrolling={'auto'}
style={{
width: '100%',
minHeight: '800px',
overflowY: 'hidden',
backgroundColor: '#fff',
}}
/> :
<ApplyForZyd
{...this.props}
returnList={this.returnList}
id={workId}
/>
) : null}
</div>
</PageHeaderWrapper>
);
}
render() {
const { iframeUrlDiy } = this.props;
const {
workId,
dataBaseId,
addFields,
showIframe,
renderIframe,
allConfigSetInfo,
} = this.state;
if (!workId || !allConfigSetInfo) {
return null;
}
// console.log(allConfigSetInfo.isCloseStart);
// const url = config.onestopPC.split('/#/');
// let iframeUrl = iframeUrlDiy || `${url[0]}/#/IFrameForApply?id=${workId}&token=${getToken()}`;
let buttons = this.handleButtonSet({});
let listConfig = pageSetting.listConfig;
if (!buttons.length) {
listConfig = deepCopy(listConfig);
listConfig.buttonArea = false;
}
return (
<PageHeaderWrapper title="">
<div
style={{
display: showIframe ? 'none' : 'block',
}}>
<List
listConfig={listConfig}
pageButton={buttons}
pageSearch={this.handleSearchSet({})}
addFields={addFields}
ref={(ListComponent) => (this.ListComponent = ListComponent)}
workId={workId}
dataBaseId={dataBaseId}
/>
</div>
<div
style={{
visibility: showIframe ? 'visible' : 'hidden',
height: showIframe ? 'auto' : '0px',
width: '100%',
backgroundColor: '#fff',
paddingLeft: '24px',
}}>
<Shell>
<div
style={{
height: '54px',
padding: '12px 0 12px 12px',
display: showIframe ? 'block' : 'none',
}}>
<ButtonDiy
name="返回"
className="defaultBlue"
handleClick={this.returnList}
icon="arrow-left"
/>
</div>
</Shell>
{renderIframe ? (
iframeUrlDiy ? (
<iframe
src={iframeUrlDiy}
frameBorder={0}
id="applyIframeId"
name="applyIframe"
marginWidth="0"
marginHeight="0"
allowTransparency="yes"
seamless
scrolling={'auto'}
style={{
width: '100%',
minHeight: '800px',
overflowY: 'hidden',
backgroundColor: '#fff',
}}
/>
) : (
<ApplyForZyd {...this.props} returnList={this.returnList} id={workId} />
)
) : null}
</div>
</PageHeaderWrapper>
);
}
}
......@@ -144,6 +144,19 @@ const getFormDetail = (id) => {
});
};
/**
*
* */
const getServiceDetail = (id) => {
return apiRequest('/UnifiedServiceApi/getDetail', { id }).then((x) => {
if (x) {
return x;
} else {
return {};
}
});
};
/**
* 发起流程
* */
......@@ -248,6 +261,7 @@ export {
getColumns,
getPages,
getFormDetail,
getServiceDetail,
getOptions,
getBatchOptions,
startProcess,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论