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

北电科删除部分字段

上级 018d04be
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* */ * */
import { message } from 'antd'; import { message } from 'antd';
import React from 'react'; import React, { useEffect, useState, } from 'react';
import * as service from '../publicApiService'; import * as service from '../publicApiService';
import * as destructionFunc from '../destruction'; import * as destructionFunc from '../destruction';
import { Link } from 'dva/router'; import { Link } from 'dva/router';
...@@ -23,65 +23,90 @@ import ApplyForZyd from '@/webPublic/one_stop_public/ForZydApply/index'; ...@@ -23,65 +23,90 @@ import ApplyForZyd from '@/webPublic/one_stop_public/ForZydApply/index';
export default function index(props) { export default function index(props) {
const { state = {} } = props.location; const { state = {} } = props.location;
if (state.justApply) { const [show, setShow] = useState(false);
return <JustApply {...props} />; useEffect(() => {
} else { setShow(false);
return <AffairPage {...props} />; 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 { class AffairPage extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
let pathname = this.props.location.pathname; let pathname = this.props.location.pathname;
const { dataBaseId, workId } = this.props; const {
this.state = { dataBaseId,
showIframe: false, workId
columns: [], } = this.props;
pathname, this.state = {
workId: workId || '', showIframe: false,
searchCondition: [], columns: [],
dataBaseId: '', pathname,
addFields: [], // 新增时填写的字段。 workId: workId || '',
renderIframe: false, searchCondition: [],
allConfigSetInfo: null, dataBaseId: '',
}; addFields: [], // 新增时填写的字段。
} renderIframe: false,
allConfigSetInfo: null,
};
}
getFormDetail = (workId) => { getFormDetail = (workId) => {
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 } = x; destructionFunc.destructionGetDetail(response)
this.setState( .then((x) => {
{ const {
addFields, addFields,
tableInfo, tableInfo,
allConfigSetInfo, allConfigSetInfo
}, } = x;
() => { this.setState(
this.giveDetailColumns(); {
}, addFields,
); tableInfo,
}); allConfigSetInfo,
}); },
}; () => {
this.giveDetailColumns();
},
);
});
});
};
giveDetailColumns = () => { giveDetailColumns = () => {
const { columns, workId, dataBaseId, addFields } = this.state; const {
const process_status = columns.find((x) => { columns,
return x.name === 'process_status'; workId,
}); dataBaseId,
if (process_status && process_status.dataIndex) { addFields
process_status.render = (text, record) => { } = this.state;
return record.statusName || record[process_status.dataIndex]; const process_status = columns.find((x) => {
}; return x.name === 'process_status';
} });
let findCz = columns.find((g) => g.dataIndex === 'operation'); if (process_status && process_status.dataIndex) {
if(!findCz){ process_status.render = (text, record) => {
return record.statusName || record[process_status.dataIndex];
};
}
let findCz = columns.find((g) => g.dataIndex === 'operation');
if (!findCz) {
columns.push({ columns.push({
dataIndex: 'operation', dataIndex: 'operation',
title: '操作', title: '操作',
...@@ -107,97 +132,113 @@ class AffairPage extends React.Component { ...@@ -107,97 +132,113 @@ class AffairPage extends React.Component {
} }
this.setState({
columns,
});
};
handleButtonSet = () => {
const {
canApply,
otherButtons = []
} = this.props;
const { allConfigSetInfo } = this.state;
if (!allConfigSetInfo) {
return [];
}
const isCloseStart = allConfigSetInfo?.isCloseStart;
this.setState({ if (canApply === false || isCloseStart) {
columns, return [...otherButtons];
}); }
};
handleButtonSet = () => {
const { canApply, otherButtons = [] } = this.props;
const { allConfigSetInfo } = this.state;
if (!allConfigSetInfo) {
return [];
}
const isCloseStart = allConfigSetInfo?.isCloseStart;
if (canApply === false || isCloseStart) {
return [...otherButtons];
}
return [ return [
{ {
type: 'add', type: 'add',
name: '申请', name: '申请',
component: 'Normal', component: 'Normal',
handleClick: () => { handleClick: () => {
this.setState( this.setState(
{ {
showIframe: true, showIframe: true,
renderIframe: true, renderIframe: true,
}, },
() => {}, () => {
); },
}, );
}, },
...otherButtons, },
]; ...otherButtons,
}; ];
};
handleSearchSet = () => { handleSearchSet = () => {
const { columns, searchCondition } = this.state; const {
const { onResponse } = this.props; columns,
const pageSearch = { searchCondition
search: { } = this.state;
field: {}, const { onResponse } = this.props;
getPageService: getApplyPage, const pageSearch = {
responseCallBack: (response) => { search: {
if (onResponse) { field: {},
onResponse(response); getPageService: getApplyPage,
} responseCallBack: (response) => {
return response; if (onResponse) {
}, onResponse(response);
condition: searchCondition, }
nameSpan: { big: 8, small: 9 }, return response;
fileSpan: { big: 4, small: 4 }, },
}, condition: searchCondition,
tableRowKey: 'id', nameSpan: {
columns, big: 8,
}; small: 9
return pageSearch; },
}; fileSpan: {
big: 4,
small: 4
},
},
tableRowKey: 'id',
columns,
};
return pageSearch;
};
getColumns = () => { getColumns = () => {
const { workId } = this.state; const { workId } = this.state;
service.getColumns(workId).then((response) => { service.getColumns(workId)
if(response && Array.isArray(response)){ .then((response) => {
response = response.filter((x) => { if (response && Array.isArray(response)) {
return x.title !== '流程进度'; response = response.filter((x) => {
}); return x.title !== '流程进度';
} });
}
if (response) { if (response) {
this.setState( this.setState(
{ {
columns: response, columns: response,
}, },
() => { () => {
this.getFormDetail(workId); this.getFormDetail(workId);
}, },
); );
} }
}); });
}; };
initData = () => { initData = () => {
if (!getToken()) { if (!getToken()) {
message.error('您的数据未同步,请联系管理员!'); message.error('您的数据未同步,请联系管理员!');
return false; return false;
} }
const { pathname } = this.state; const { pathname } = this.state;
const { dataBaseId, workId, iframeHeight } = this.props; const {
dataBaseId,
workId,
iframeHeight
} = this.props;
if (dataBaseId || workId) { if (dataBaseId || workId) {
this.setState( this.setState(
{ {
...@@ -209,17 +250,18 @@ class AffairPage extends React.Component { ...@@ -209,17 +250,18 @@ class AffairPage extends React.Component {
}, },
); );
} 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.getColumns(); () => {
}, this.getColumns();
); },
}); );
});
} }
window.addEventListener( window.addEventListener(
...@@ -241,102 +283,102 @@ class AffairPage extends React.Component { ...@@ -241,102 +283,102 @@ class AffairPage extends React.Component {
); );
return true; return true;
} };
componentDidMount() { componentDidMount() {
this.initData(); this.initData();
} }
componentDidUpdate(prevProps, prevState) { componentDidUpdate(prevProps, prevState) {
if(prevProps.workId !== this.props.workId){ if (prevProps.workId !== this.props.workId) {
// console.log('123123', prevProps, this.props); // console.log('123123', prevProps, this.props);
this.initData(); this.initData();
} }
} }
returnList = (needSearchList = false) => { returnList = (needSearchList = false) => {
console.log(needSearchList); console.log(needSearchList);
const { workId } = this.state; const { workId } = this.state;
this.setState( this.setState(
{ {
renderIframe: false, renderIframe: false,
}, },
() => { () => {
if (needSearchList) { if (needSearchList) {
this.ListComponent.getPage(); this.ListComponent.getPage();
setTimeout(() => { setTimeout(() => {
this.getFormDetail(workId); this.getFormDetail(workId);
}, 2000); }, 2000);
} }
this.setState({ this.setState({
showIframe: false, showIframe: false,
}); });
}, },
); );
}; };
render() { render() {
const { iframeUrlDiy } = this.props; const { iframeUrlDiy } = this.props;
const { const {
workId, workId,
dataBaseId, dataBaseId,
addFields, addFields,
showIframe, showIframe,
renderIframe, renderIframe,
allConfigSetInfo, allConfigSetInfo,
} = this.state; } = this.state;
if (!workId || !allConfigSetInfo) { if (!workId || !allConfigSetInfo) {
return null; return null;
} }
// console.log(allConfigSetInfo.isCloseStart); // console.log(allConfigSetInfo.isCloseStart);
// const url = config.onestopPC.split('/#/'); // const url = config.onestopPC.split('/#/');
// let iframeUrl = iframeUrlDiy || `${url[0]}/#/IFrameForApply?id=${workId}&token=${getToken()}`; // let iframeUrl = iframeUrlDiy || `${url[0]}/#/IFrameForApply?id=${workId}&token=${getToken()}`;
let buttons = this.handleButtonSet({}); let buttons = this.handleButtonSet({});
let listConfig = pageSetting.listConfig; let listConfig = pageSetting.listConfig;
if (!buttons.length) { if (!buttons.length) {
listConfig = deepCopy(listConfig); listConfig = deepCopy(listConfig);
listConfig.buttonArea = false; listConfig.buttonArea = false;
} }
return ( return (
<PageHeaderWrapper title=""> <PageHeaderWrapper title="">
<div <div
style={{ style={{
display: showIframe ? 'none' : 'block', display: showIframe ? 'none' : 'block',
}}> }}>
<List <List
listConfig={listConfig} listConfig={listConfig}
pageButton={buttons} pageButton={buttons}
pageSearch={this.handleSearchSet({})} pageSearch={this.handleSearchSet({})}
addFields={addFields} addFields={addFields}
ref={(ListComponent) => (this.ListComponent = ListComponent)} ref={(ListComponent) => (this.ListComponent = ListComponent)}
workId={workId} workId={workId}
dataBaseId={dataBaseId} dataBaseId={dataBaseId}
/> />
</div> </div>
<div <div
style={{ style={{
visibility: showIframe ? 'visible' : 'hidden', visibility: showIframe ? 'visible' : 'hidden',
height: showIframe ? 'auto' : '0px', height: showIframe ? 'auto' : '0px',
width: '100%', width: '100%',
backgroundColor: '#fff', backgroundColor: '#fff',
paddingLeft: '24px', paddingLeft: '24px',
}}> }}>
<Shell> <Shell>
<div <div
style={{ style={{
height: '54px', height: '54px',
padding: '12px 0 12px 12px', padding: '12px 0 12px 12px',
display: showIframe ? 'block' : 'none', display: showIframe ? 'block' : 'none',
}}> }}>
<ButtonDiy <ButtonDiy
name="返回" name="返回"
className="defaultBlue" className="defaultBlue"
handleClick={this.returnList} handleClick={this.returnList}
icon="arrow-left" icon="arrow-left"
/> />
</div> </div>
</Shell> </Shell>
{renderIframe ? ( {renderIframe ? (
iframeUrlDiy ? iframeUrlDiy ?
<iframe <iframe
src={iframeUrlDiy} src={iframeUrlDiy}
...@@ -355,14 +397,14 @@ class AffairPage extends React.Component { ...@@ -355,14 +397,14 @@ class AffairPage extends React.Component {
backgroundColor: '#fff', backgroundColor: '#fff',
}} }}
/> : /> :
<ApplyForZyd <ApplyForZyd
{...this.props} {...this.props}
returnList={this.returnList} returnList={this.returnList}
id={workId} id={workId}
/> />
) : null} ) : null}
</div> </div>
</PageHeaderWrapper> </PageHeaderWrapper>
); );
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论