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

流程发起按钮修改 显示条件 通过 isCloseStart 判断

上级 92a611a6
...@@ -19,291 +19,324 @@ import pageSetting from './pageSetting'; ...@@ -19,291 +19,324 @@ import pageSetting from './pageSetting';
import ButtonDiy from '@/baseComponent/ButtonDiy'; import ButtonDiy from '@/baseComponent/ButtonDiy';
import Shell from '@/baseComponent/Shell'; import Shell from '@/baseComponent/Shell';
import config from '@/config/config'; import config from '@/config/config';
import { deepCopy } from '@/webPublic/zyd_public/utils/utils';
export default function index(props) { export default function index(props) {
const { state = {} } = props.location; const { state = {} } = props.location;
if (state.justApply) { if (state.justApply) {
return <JustApply {...props} />; return <JustApply {...props} />;
} else { } else {
return <AffairPage {...props} />; 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 { dataBaseId, workId } = this.props;
this.state = { this.state = {
showIframe: false, showIframe: false,
columns: [], columns: [],
pathname, pathname,
workId: workId || '', workId: workId || '',
searchCondition: [], searchCondition: [],
dataBaseId: '', dataBaseId: '',
addFields: [], // 新增时填写的字段。 addFields: [], // 新增时填写的字段。
renderIframe: true, renderIframe: true,
}; allConfigSetInfo: null,
} };
}
getFormDetail = (workId) => { getFormDetail = (workId) => {
service.getFormDetail(workId).then((response) => { service.getFormDetail(workId).then((response) => {
if (typeof response.unifiedServicePatternModel === 'undefined') { if (typeof response.unifiedServicePatternModel === 'undefined') {
return false; return false;
} }
destructionFunc.destructionGetDetail(response).then((x) => { destructionFunc.destructionGetDetail(response).then((x) => {
const { addFields, tableInfo, allConfigSetInfo } = x; const { addFields, tableInfo, allConfigSetInfo } = x;
this.setState( this.setState(
{ {
addFields, addFields,
tableInfo, tableInfo,
allConfigSetInfo, allConfigSetInfo,
}, },
() => { () => {
this.giveDetailColumns(); this.giveDetailColumns();
}, },
); );
}); });
}); });
}; };
giveDetailColumns = () => { giveDetailColumns = () => {
const { columns, workId, dataBaseId, addFields } = this.state; const { columns, workId, dataBaseId, addFields } = this.state;
const process_status = columns.find((x) => { const process_status = columns.find((x) => {
return x.name === 'process_status'; return x.name === 'process_status';
}); });
if (process_status && process_status.dataIndex) { if (process_status && process_status.dataIndex) {
process_status.render = (text, record) => { process_status.render = (text, record) => {
return record.statusName || record[process_status.dataIndex]; return record.statusName || record[process_status.dataIndex];
}; };
} }
columns.push({ columns.push({
dataIndex: 'operation', dataIndex: 'operation',
title: '操作', title: '操作',
fixed: columns.length > 12 ? 'right' : false, fixed: columns.length > 12 ? 'right' : false,
render: (text, record) => { render: (text, record) => {
return ( return (
<Link <Link
to={{ to={{
pathname: './Detail', pathname: './Detail',
state: { state: {
workId, workId,
dataBaseId, dataBaseId,
record, record,
addFields, addFields,
}, },
}}> }}>
详情 详情
</Link> </Link>
); );
}, },
}); });
this.setState({ this.setState({
columns, columns,
}); });
}; };
handleButtonSet = () => { handleButtonSet = () => {
const { canApply, otherButtons = [] } = this.props; const { canApply, otherButtons = [] } = this.props;
if (canApply === false) { const { allConfigSetInfo } = this.state;
return [...otherButtons]; if (!allConfigSetInfo) {
} return [];
return [ }
{ const isCloseStart = allConfigSetInfo?.isCloseStart;
type: 'add', // if(isCloseStart){
name: '申请', // setTimeout(()=>{
component: 'Normal', // this.setState({
handleClick: () => { // allConfigSetInfo: {
this.setState( // ...allConfigSetInfo,
{ // isCloseStart: false,
showIframe: true, // },
}, // });
() => {}, // }, 3000);
); // }
}, if (canApply === false || isCloseStart) {
}, return [...otherButtons];
...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;
};
getColumns = () => { return [
const { workId } = this.state; {
service.getColumns(workId).then((response) => { type: 'add',
response = response.filter((x) => { name: '申请',
return x.title !== '流程进度'; component: 'Normal',
}); handleClick: () => {
if (response) { this.setState(
this.setState( {
{ showIframe: true,
columns: response, },
}, () => {
() => { },
this.getFormDetail(workId); );
}, },
); },
} ...otherButtons,
}); ];
}; };
componentDidMount() { handleSearchSet = () => {
if (!getToken()) { const { columns, searchCondition } = this.state;
message.error('您的数据未同步,请联系管理员!'); const { onResponse } = this.props;
return false; const pageSearch = {
} search: {
const { pathname } = this.state; field: {},
const { dataBaseId, workId } = this.props; getPageService: getApplyPage,
if (dataBaseId || workId) { responseCallBack: (response) => {
this.setState( if (onResponse) {
{ onResponse(response);
workId, }
dataBaseId, return response;
}, },
() => { condition: searchCondition,
this.getColumns(); nameSpan: { big: 8, small: 9 },
}, fileSpan: { big: 4, small: 4 },
); },
} else { tableRowKey: 'id',
service.getId(pathname).then((x) => { columns,
this.setState( };
{ return pageSearch;
workId: x.workId, };
dataBaseId: x.dataBaseId,
},
() => {
this.getColumns();
},
);
});
}
window.addEventListener( getColumns = () => {
'message', const { workId } = this.state;
(event) => { service.getColumns(workId).then((response) => {
if (event.data === 'returnList') { response = response.filter((x) => {
this.returnList(true); return x.title !== '流程进度';
} });
if (event && event.data && event.data.indexOf && event.data.indexOf('iframeHeight') > -1) { if (response) {
let height = Number(event.data.split('-')[1]); this.setState(
const iframe = document.getElementById('applyIframeId'); {
if (iframe) { columns: response,
iframe.height = height; },
} () => {
} this.getFormDetail(workId);
}, },
false, );
); }
});
};
return true; componentDidMount() {
} if (!getToken()) {
message.error('您的数据未同步,请联系管理员!');
return false;
}
const { pathname } = this.state;
const { dataBaseId, workId } = 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();
},
);
});
}
returnList = (needSearchList = false) => { window.addEventListener(
this.setState( 'message',
{ (event) => {
renderIframe: false, if (event.data === 'returnList') {
}, this.returnList(true);
() => { }
if (needSearchList) { if (event && event.data && event.data.indexOf && event.data.indexOf('iframeHeight') > -1) {
this.ListComponent.getPage(); let height = Number(event.data.split('-')[1]);
} const iframe = document.getElementById('applyIframeId');
this.setState({ if (iframe) {
showIframe: false, iframe.height = height;
renderIframe: true, // 重新挂载IFrame 保证申请数据不会再次显示出来 }
}); }
}, },
); false,
}; );
render() { return true;
const { workId, dataBaseId, addFields, showIframe, renderIframe } = this.state; }
if (!workId) {
return null; returnList = (needSearchList = false) => {
} console.log(needSearchList);
const url = config.onestopPC.split('/#/'); const { workId } = this.state;
let iframeUrl = `${url[0]}/#/IFrameForApply?id=${workId}&token=${getToken()}`;
console.log(iframeUrl); this.setState(
// iframeUrl = `http://localhost:8000/onestop/IFrameForApply?id=${workId}&token=${getToken()}`; {
return ( renderIframe: false,
<PageHeaderWrapper title=""> },
<div () => {
style={{ if (needSearchList) {
display: showIframe ? 'none' : 'block', this.ListComponent.getPage();
}}> setTimeout(() => {
<List this.getFormDetail(workId);
listConfig={pageSetting.listConfig} }, 2000);
pageButton={this.handleButtonSet({})} }
pageSearch={this.handleSearchSet({})} this.setState({
addFields={addFields} showIframe: false,
ref={(ListComponent) => (this.ListComponent = ListComponent)} renderIframe: true, // 重新挂载IFrame 保证申请数据不会再次显示出来
workId={workId} });
dataBaseId={dataBaseId} },
/> );
</div> };
<div
style={{ render() {
visibility: showIframe ? 'visible' : 'hidden', const { workId, dataBaseId, addFields, showIframe, renderIframe, allConfigSetInfo } = this.state;
width: '100%', if (!workId || !allConfigSetInfo) {
backgroundColor: '#fff', return null;
paddingLeft: '24px', }
}}> console.log(allConfigSetInfo.isCloseStart);
<Shell> const url = config.onestopPC.split('/#/');
<div let iframeUrl = `${url[0]}/#/IFrameForApply?id=${workId}&token=${getToken()}`;
style={{ console.log(iframeUrl);
height: '54px', // iframeUrl = `http://localhost:8000/onestop/IFrameForApply?id=${workId}&token=${getToken()}`;
padding: '12px 0 12px 12px', let buttons = this.handleButtonSet({});
display: showIframe ? 'block' : 'none', let listConfig = pageSetting.listConfig;
}}> if (!buttons.length) {
<ButtonDiy listConfig = deepCopy(listConfig);
name="返回" listConfig.buttonArea = false;
className="defaultBlue" }
handleClick={this.returnList} return (
icon="arrow-left" <PageHeaderWrapper title=''>
/> <div
</div> style={{
</Shell> display: showIframe ? 'none' : 'block',
{renderIframe ? ( }}>
<iframe <List
src={iframeUrl} listConfig={listConfig}
frameBorder={0} pageButton={buttons}
id="applyIframeId" pageSearch={this.handleSearchSet({})}
name="applyIframe" addFields={addFields}
marginWidth="0" ref={(ListComponent) => (this.ListComponent = ListComponent)}
marginHeight="0" workId={workId}
allowtransparency="yes" dataBaseId={dataBaseId}
seamless />
scrolling={'auto'} </div>
style={{ <div
width: '100%', style={{
minHeight: '800px', visibility: showIframe ? 'visible' : 'hidden',
overflowY: 'hidden', width: '100%',
backgroundColor: '#fff', backgroundColor: '#fff',
}} paddingLeft: '24px',
/> }}>
) : null} <Shell>
</div> <div
</PageHeaderWrapper> 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 ? (
<iframe
src={iframeUrl}
frameBorder={0}
id='applyIframeId'
name='applyIframe'
marginWidth='0'
marginHeight='0'
allowtransparency='yes'
seamless
scrolling={'auto'}
style={{
width: '100%',
minHeight: '800px',
overflowY: 'hidden',
backgroundColor: '#fff',
}}
/>
) : null}
</div>
</PageHeaderWrapper>
);
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论