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

组件修改

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