2025-08-26 17:46:36 +08:00
|
|
|
import React from 'react'
|
|
|
|
|
import { connect } from 'dva'
|
|
|
|
|
import { initFilter, getCustomParams } from "../../utils/common"
|
2026-04-14 14:26:36 +08:00
|
|
|
//import loadPage from '../../utils/customConfig1'//便捷开发 请勿提交
|
|
|
|
|
import loadPage from '../../utils/customConfig'
|
2025-08-26 17:46:36 +08:00
|
|
|
|
|
|
|
|
class CustomPage extends React.Component {
|
|
|
|
|
constructor(props) {
|
|
|
|
|
super(props)
|
|
|
|
|
this.state = {
|
|
|
|
|
pageCustom: {},
|
|
|
|
|
formData: {},
|
|
|
|
|
customParams: {},
|
|
|
|
|
CustomComponentDispatch: null
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
this.getCustomConfig(this.props.formCode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentWillReceiveProps(NextProps) {
|
|
|
|
|
if (NextProps.formCode && this.props.formCode != NextProps.formCode) {
|
|
|
|
|
this.getCustomConfig(NextProps.formCode)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getCustomConfig = (formCode) => {
|
|
|
|
|
const { login } = this.props
|
|
|
|
|
const { OrgId: ORG_ID } = login
|
|
|
|
|
const params = initFilter(ORG_ID, formCode)
|
|
|
|
|
this.props.dispatch({
|
|
|
|
|
type: 'customPage/getCustomPageConfigInfo',
|
|
|
|
|
payload: params,
|
|
|
|
|
onComplete: (ret) => {
|
|
|
|
|
if (ret) {
|
|
|
|
|
this.setCustomConfig(ret)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setCustomConfig = (ret) => {
|
|
|
|
|
if (ret) {
|
|
|
|
|
let customParams = "";
|
|
|
|
|
if (ret.Nav_PageCustom)
|
|
|
|
|
customParams = ret.Nav_PageCustom.CUSTOM_PARAMS;
|
|
|
|
|
this.setState({
|
|
|
|
|
pageCustom: ret.Nav_PageCustom,
|
|
|
|
|
formData: ret.Nav_Form,
|
|
|
|
|
customParams: getCustomParams(customParams)
|
|
|
|
|
}, () => {
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
const { formParam, data, formCode } = this.props
|
|
|
|
|
const { COMPONENT_NAME, PAGE_FORM_ID } = this.state.pageCustom ? this.state.pageCustom : {}
|
|
|
|
|
return (
|
|
|
|
|
<React.Fragment>
|
|
|
|
|
{
|
|
|
|
|
COMPONENT_NAME
|
|
|
|
|
? loadPage(COMPONENT_NAME, PAGE_FORM_ID, formParam, { ...data, ...this.state.customParams }, formCode, this.state.formData)
|
|
|
|
|
: null
|
|
|
|
|
}
|
|
|
|
|
</React.Fragment>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default connect(({ login, loading, customPage }) => ({ login, loading, customPage }))(CustomPage)
|