import * as React from 'react'; import Header from '&/components/common/componentHeader' import Loading from '@beisen/loading'; import INfoContent from './infoContent'; import NodataView from '&/components/common/noDataView'; import ScrollWrap from '&/components/common/scrollWrap'; import widthProvider from '@beisen/react-width-provider'; import { getBSGlobal,getToUserId,getUserInfo,getApiUrl,taker,encodeURIFn} from '&/helper'; import './index.scss'; interface Props{ type:number, width?:number, title:string } interface Data { isFeching:boolean, infoList:any[] editLink:string, resetList:any[] } interface CoverProps{ width:number } // const exampleData = { // infoList:[ // { // keyName:'你你你你妮妮', // valueText:'我我我我我我我我我' // }, // { // keyName:'你你你你妮妮', // valueText:'我我我我我我我我我' // }, // { // keyName:'你你你你妮妮', // valueText:'我我我我我我我我我' // }, // { // keyName:'你你你你妮妮', // valueText:'我我我我我我我我我' // }, // { // keyName:'你你你你妮妮', // valueText:'我我我我我我我我我' // }, // ], // editLink:'www.baidu.com' // } @widthProvider('width') export default class UserInfoCom extends React.Component{ constructor(props:Props){ super(props) this.state = { isFeching:true, infoList:[], editLink:'', resetList:[] } } static defaultProps: CoverProps = { width:155 } async componentDidMount(){ const {type} = this.props; const toUserId = getToUserId(); const url = type === 1 ? `${getApiUrl('proxy/GetUPaaSCoreGateway')}?metaname=BaseInfoComponent&funname=GetAccountBaseInfo&toUserId=${toUserId}` : `${getApiUrl('proxy/GetUPaaSCoreGateway')}?metaname=BaseInfoComponent&funname=GetCoreHrBaseInfo&toUserId=${toUserId}`; const resData = await taker(url); this.setState({ infoList:resData.OperationObject&&resData.OperationObject.infoList?[resData.OperationObject.infoList]:[], isFeching:false, editLink:resData.OperationObject&&resData.OperationObject.editLink ? resData.OperationObject.editLink : '', resetList:resData.OperationObject&&resData.OperationObject.infoList?resData.OperationObject.infoList:[] }) } resetInfoList = (row:number,colum:number,changeIndex:number) => { let infoList = []; const {resetList } = this.state; if(changeIndex > -1){ for(let i=0,len =resetList.length;i { return
} contentRender = () => { const {infoList} = this.state; const {width} = this.props as Props & CoverProps; return
{ // width <= 230 ? // // // // : // }
} openEditInfo = () => { const {type} = this.props; const {editLink} = this.state; const me = getUserInfo().Id; const applist = getBSGlobal('apps'); const apiServer = getBSGlobal('apiPath'); const coreHr = applist.filter((item:any)=>item.appId == 908); if(type == 1 ){ window.open(encodeURIFn(`${apiServer}/${me}/UIBuilder#/ChangePersonalInfoSetting`)) }else{ if(coreHr.length != 0){ window.open(encodeURIFn(`${editLink}`)) }else{ window.open(encodeURIFn(`${apiServer}/${me}/UIBuilder#/ChangePersonalInfoSetting`)) } } } renderEdit = () => { const toUserId = getToUserId(); const me = getUserInfo().Id; const isMe = toUserId == me; const {type} = this.props; const applist = getBSGlobal('apps'); const coreHr = applist.filter((item:any)=>item.appId == 908); if(isMe){ if(type == 2){ if(coreHr.length != 0){ return
}else{ return '' } }else{ return
} }else{ return '' } } render(){ const {width,title} = this.props as Props & CoverProps; const {infoList,isFeching} = this.state; const comTitle = !title ? '基本信息':title const settings = { color: '#F28D48', icon: 'font-nine-grid-default', title: comTitle, } if(isFeching) return return
{ this.renderEdit()} { infoList.length === 0 ? this.contentNullRender():this.contentRender() }
} }