This commit is contained in:
wjn 2024-05-27 16:17:28 +08:00
parent 87fdb931c6
commit f1c08e1a61
3 changed files with 79 additions and 5 deletions

1
.gitignore vendored
View File

@ -12,6 +12,5 @@
.DS_Store .DS_Store
npm-debug.log* npm-debug.log*
/src/components/Custom/CustomPage.js
npminstall-debug.log npminstall-debug.log
/src/utils/customConfigwjn.js /src/utils/customConfigwjn.js

View File

@ -0,0 +1,74 @@
import React from 'react'
import { connect } from 'dva'
import { initFilter, getCustomParams } from "../../utils/common"
//import loadPage from '../../utils/customConfigwjn'//便捷开发 请勿提交
// import loadPage from '../../utils/customConfig1'
import loadPage from '../../utils/customConfig'
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)

View File

@ -374,12 +374,12 @@ function Header(props) {
return ( return (
<div className={`header ${props.matchLogin ? "login" : "nologin"}`}> <div className={`header ${props.matchLogin ? "login" : "nologin"}`}>
<div className="header__left"> <div className="header__left">
<PictureThumb {/* <PictureThumb
thumbCodes={thumbCode ? [thumbCode] : []} thumbCodes={thumbCode ? [thumbCode] : []}
thumbConfigs={[{ target: thumbCode }]} thumbConfigs={[{ target: thumbCode }]}
defaultThumb={require("../assets/layout/header-logo.png")} defaultThumb={require("../assets/layout/header-logo.png")}
className="header__left-logo" className="header__left-logo"
/> /> */}
{isMobile ? ( {isMobile ? (
<span className="header__left-slogan-mobile"> </span> <span className="header__left-slogan-mobile"> </span>
) : ( ) : (
@ -390,8 +390,9 @@ function Header(props) {
: "header__left-slogan" : "header__left-slogan"
}`} }`}
> >
安全管理系统 双重预防管控系统
<span style={{ color: "#c99d03" }}>SMS</span> {/*
<span style={{ color: "#c99d03" }}>SMS</span> */}
{baseConfig.SYS_NAME}{" "} {baseConfig.SYS_NAME}{" "}
</span> </span>
)} )}