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

组件修改

上级 d5bb11f0
......@@ -50,7 +50,7 @@ export default class List extends Component {
};
giveGetPageFields = () => {
const { listConfig, pageSearch, beforeGetPage } = this.props;
const { listConfig, pageSearch } = this.props;
const { pagination, formValues } = this.state;
const search = pageSearch.search;
let data = deepCopy(formValues);
......@@ -76,7 +76,7 @@ export default class List extends Component {
};
getPage = () => {
const { listConfig, pageSearch, dataBaseId, workId, addFields } = this.props;
const { listConfig, pageSearch, workId } = this.props;
const { pagination, sortGetPageFields } = this.state;
const { search } = pageSearch;
let data = this.giveGetPageFields();
......
......@@ -22,321 +22,333 @@ import config from '@/config/config';
import { deepCopy } from '@/webPublic/zyd_public/utils/utils';
export default function index(props) {
const { state = {} } = props.location;
if (state.justApply) {
return <JustApply {...props} />;
} else {
return <AffairPage {...props} />;
}
const { state = {} } = props.location;
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: true,
allConfigSetInfo: null,
};
}
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: true,
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();
},
);
});
});
};
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];
};
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>
);
},
});
}
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>
);
},
});
this.setState({
columns,
});
};
handleButtonSet = () => {
const { canApply, otherButtons = [] } = this.props;
const { allConfigSetInfo } = this.state;
if (!allConfigSetInfo) {
return [];
}
const isCloseStart = allConfigSetInfo?.isCloseStart;
// if(isCloseStart){
// setTimeout(()=>{
// this.setState({
// allConfigSetInfo: {
// ...allConfigSetInfo,
// isCloseStart: false,
// },
// });
// }, 3000);
// }
if (canApply === false || isCloseStart) {
return [...otherButtons];
}
return [
{
type: 'add',
name: '申请',
component: 'Normal',
handleClick: () => {
this.setState(
{
showIframe: true,
},
() => {
},
);
},
},
...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;
};
this.setState({
columns,
});
};
getColumns = () => {
const { workId } = this.state;
service.getColumns(workId).then((response) => {
response = response.filter((x) => {
return x.title !== '流程进度';
});
if (response) {
this.setState(
{
columns: response,
},
() => {
this.getFormDetail(workId);
},
);
}
});
};
handleButtonSet = () => {
const { canApply, otherButtons = [] } = this.props;
const { allConfigSetInfo } = this.state;
if (!allConfigSetInfo) {
return [];
}
const isCloseStart = allConfigSetInfo?.isCloseStart;
// if(isCloseStart){
// setTimeout(()=>{
// this.setState({
// allConfigSetInfo: {
// ...allConfigSetInfo,
// isCloseStart: false,
// },
// });
// }, 3000);
// }
if (canApply === false || isCloseStart) {
return [...otherButtons];
}
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();
},
);
});
}
return [
{
type: 'add',
name: '申请',
component: 'Normal',
handleClick: () => {
this.setState(
{
showIframe: true,
},
() => {},
);
},
},
...otherButtons,
];
};
window.addEventListener(
'message',
(event) => {
if (event.data === 'returnList') {
this.returnList(true);
}
if (event && event.data && event.data.indexOf && event.data.indexOf('iframeHeight') > -1) {
let height = Number(event.data.split('-')[1]);
const iframe = document.getElementById('applyIframeId');
if (iframe) {
iframe.height = height + 50;
}
}
},
false,
);
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 true;
}
getColumns = () => {
const { workId } = this.state;
service.getColumns(workId).then((response) => {
response = response.filter((x) => {
return x.title !== '流程进度';
});
if (response) {
this.setState(
{
columns: response,
},
() => {
this.getFormDetail(workId);
},
);
}
});
};
returnList = (needSearchList = false) => {
console.log(needSearchList);
const { workId } = this.state;
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();
},
);
});
}
this.setState(
{
renderIframe: false,
},
() => {
if (needSearchList) {
this.ListComponent.getPage();
setTimeout(() => {
this.getFormDetail(workId);
}, 2000);
}
this.setState({
showIframe: false,
renderIframe: true, // 重新挂载IFrame 保证申请数据不会再次显示出来
});
},
);
};
window.addEventListener(
'message',
(event) => {
if (event.data === 'returnList') {
this.returnList(true);
}
if (event && event.data && event.data.indexOf && event.data.indexOf('iframeHeight') > -1) {
let height = Number(event.data.split('-')[1]);
const iframe = document.getElementById('applyIframeId');
if (iframe) {
iframe.height = height + 50;
}
}
},
false,
);
render() {
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 = `${url[0]}/#/IFrameForApply?id=${workId}&token=${getToken()}`;
console.log(iframeUrl);
// iframeUrl = `http://localhost:8000/onestop/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',
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 ? (
<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>
);
}
return true;
}
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,
renderIframe: true, // 重新挂载IFrame 保证申请数据不会再次显示出来
});
},
);
};
render() {
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 = `${url[0]}/#/IFrameForApply?id=${workId}&token=${getToken()}`;
console.log(iframeUrl);
// iframeUrl = `http://localhost:8000/onestop/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',
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 ? (
<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>
);
}
}
......@@ -4,4 +4,4 @@
color:gray
}
}
}
\ No newline at end of file
}
......@@ -343,7 +343,7 @@ export default class DraftEditorCom extends React.Component {
const { modalVisible } = this.state;
return (
<div>
<div style={{border: '1px solid gray'}}>
<StyleControls
btns={btns}
editorState={this.state.editorState}
......@@ -361,6 +361,7 @@ export default class DraftEditorCom extends React.Component {
<Editor
ref={this.setEditor}
blockStyleFn={getBlockStyle}
readOnly={this.props.disabled}
customStyleMap={this.state.styleMap}
blockRendererFn={MyBlockRender.bind(
this,
......
......@@ -1853,7 +1853,6 @@ export default class tableCom extends Component {
// cm = <img src={queryApiActionPath()+obj[dataColumn.base52]} />
// break;
case 'RichText':
// console.log(obj[dataColumn.base52]);
cm = (
<Editor
key={dataColumn.base52}
......@@ -3066,13 +3065,14 @@ export default class tableCom extends Component {
}
break;
case 'RichText':
console.log(initValue, '22222222222222', dataColumn.base52, json);
cm = getFieldDecorator(dataColumn.base52, {
initialValue: initValue,
rules:
json.vlds && json.vlds.length > 0
? json.vlds
: [{ required: required, message: '请输入' }],
})(<DraftEditorCom placeholder={json.placeholder} />);
})(<DraftEditorCom placeholder={json.placeholder} disabled={json.disabled}/>);
if (
get === 'mobile' &&
((json.isMobileLabel != null && json.isMobileLabel) ||
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论