import styled from 'styled-components' ;
const WrapperCard = styled ( Card) `
background: #fff;
padding: 24px;
.ant-form-item {
margin-bottom: 0px;
}
.ant-calendar-picker{
width:100%
}
` ;
const Placeholder = styled. span`
visibility: hidden;
` ;
SearchPanel 是一个自定义组件,组件内具有form
wrappedComponentRef :这个属性里边的函数,第一个参数代表这个自定义组件里的所有form的this
当前页面
< SearchPanel
FormGroup= { ( this . state. activeKey== 3 || this . state. activeKey== 4 ) ? ItemMap2: ItemMap1}
buttonProps= { buttonProps}
wrappedComponentRef= { ( form) => { return this . form = form} } / >
import { connect} from 'dva' ;
@connect ( ( { login} ) => ( { login} ) )
@connect ( ( { login} ) => ( { aaa: login} ) )
export default connect ( ( { setting } ) => ( {
contentWidth: setting. contentWidth,
} ) ) ( GridContent) ;
export default {
namespace: 'login' ,
state: {
status: undefined,
loginInfo: { } ,
loginAdmin: {
} ,
} ,
effects: {
* login ( { payload } , { call, put } ) {
const response = yield call ( login, payload) ;
if ( response. code === 200 ) {
setToken ( response. token)
yield put ( {
type: 'changeLoginStatus' ,
payload: {
currentAuthority: 'admin' ,
status: 'ok' ,
type: 'account' ,
} ,
} ) ;
}
return response;
} ,
* captchaImage ( { payload } , { call} ) {
const response = yield call ( captchaImage, payload) ;
return response;
} ,
* Userinfo ( { payload } , { call, put } ) {
const response = yield call ( profile, payload) ;
yield put ( {
type: 'changeLoginStatus' ,
payload: {
action: 'info' ,
loginInfo: response. data,
loginAdmin: response
}
} ) ;
return response;
} ,
* logout ( _, { put } ) {
yield put ( {
type: 'changeLoginStatus' ,
payload: {
status: false ,
currentAuthority: 'guest' ,
} ,
} )
}
} ,
reducers: {
save ( state, { payload} ) {
return {
... state,
... payload
} ;
} ,
}
{
path: '/contract/edit/:id' ,
icon: 'dashboard' ,
component: './Contract/AddOrEdit' ,
} ,
import router from 'umi/router' ;
router. push ( `/contract/edit/ ${ record. contractId} ` ) ;
this . props. match. params. id