import React from 'react'; import { inject, observer } from 'mobx-react'; import { WeaTop, WeaTab, WeaOrgTree, WeaEchart, WeaYear, WeaDialog, WeaPopoverHrm, WeaCheckbox, WeaRadioGroup, WeaRightMenu, WeaTools, WeaErrorPage, WeaAlertPage, WeaDatePicker, WeaBrowser, WeaNewScroll, WeaSearchGroup } from 'ecCom'; import { WeaTableNew } from 'comsMobx'; const WeaTable = WeaTableNew.WeaTable; import { Modal, Row, Col, Button, Spin, Icon, Calendar, Tooltip, Timeline } from 'antd'; import '../style/checking.less'; import '../style/outside.less'; import * as mobx from 'mobx'; import isEmpty from 'lodash/isEmpty'; import cloneDeep from 'lodash/cloneDeep'; import toString from 'lodash/toString'; import moment from 'moment'; import * as Util from '../util/index'; import Map from '../coms/Map'; import loadjs from 'loadjs'; import OutSideTabkey1 from './OutsideTabkey1.js'; import OutSideTabkey2 from './OutsideTabkey2.js'; import OutSideTabkey3 from './OutsideTabkey3.js'; import { i18n } from '../public/i18n'; import { WeaLocaleProvider } from 'ecCom'; import { carousel } from '../util/index' import {addContentPath} from '../util/index.js' const getLabel = WeaLocaleProvider.getLabel; const toJS = mobx.toJS; @inject('hrmOutside') @observer class main extends React.Component { constructor(props) { super(props); } componentDidMount() { const { hrmOutside } = this.props; hrmOutside.init(); this.getData(); //document.title = hrmOutside.title; } componentWillReceiveProps(nextProps) { if (this.props.location.key !== nextProps.location.key) { const { hrmOutside } = this.props; hrmOutside.init(); this.getData(); } } getData() { const { hrmOutside } = this.props; hrmOutside.getData(); } getRightMenu() { const { hrmOutside } = this.props; const { dataKey, tabkey, hasRight } = hrmOutside; let btns = []; if (tabkey == '3' && hasRight) { //分页控件导出有bug,先屏蔽 btns.push({ key: "exportExcel", icon: , content: i18n.button.export(), onClick: key => { hrmOutside.exportExcel(dataKey) } }); } return btns; } chooseUser(e) { const { hrmOutside } = this.props; let hrmId = '', hrmName = undefined; if (e.selected) { hrmId = e.node.props.id; hrmName = e.node.props.name; } if (hrmId) { hrmOutside.updateHrmId(hrmId); if (hrmName) hrmOutside.updateHrmName(hrmName); this.getData(); } } changeUserRoot(ids, names, datas) { const { hrmOutside } = this.props; hrmOutside.updateUserRoot(datas); } resetUserRoot() { const { hrmOutside } = this.props; hrmOutside.updateUserRoot(); hrmOutside.updateHrmId(); hrmOutside.updateHrmName(); this.getData(); } reFresh() { this.getData(); } changeTab(key) { const { hrmOutside } = this.props; hrmOutside.changeTab(key); //this.resetUserRoot(); if(key!="3"){ this.getData(); } } changeDateTab(key) { const { hrmOutside } = this.props; hrmOutside.changeDateTab(key); this.getData(); } changeDate(v1, v2) { const { hrmOutside } = this.props; hrmOutside.changeDate(v1, v2); this.getData(); } handlerCheckbox(v) { const { hrmOutside } = this.props; hrmOutside.handlerCheckbox(v); } handlerPosition(item) { const { hrmOutside } = this.props; hrmOutside.updatePosition(item); hrmOutside.updateVisible(true); } onTreeCheck(ids, datas) { const { hrmOutside } = this.props; let idds = []; datas.forEach((d) => { idds.push(d.id); }) hrmOutside.updateHrmId(idds.join(',')); hrmOutside.updateOrgTreeCheckedDatas(datas); this.getData(); } renderLeft() { const { hrmOutside } = this.props; let { leftTitle, userRoot, orgTreeIsMult, orgTreeCheckedDatas } = hrmOutside; userRoot = toJS(userRoot); return
{leftTitle()} { hrmOutside.updateOrgTreeIsMult(v); hrmOutside.updateOrgTreeCheckedDatas(); this.refs.orgTree && this.refs.orgTree.resetCheck() }} value={orgTreeIsMult}/>  {getLabel('386504',"开启选择")}
item.id} dataUrl="/api/hrm/base/getHrmResourceTree" rootKey="rootManager" treeNodeClick={this.chooseUser.bind(this)} params={Array.isArray(userRoot) && userRoot[0] ? {rootid: userRoot[0].id} : {}} />
} renderList() { const { hrmOutside } = this.props; let { timeData } = hrmOutside; timeData = toJS(timeData); return { timeData && timeData.map((item,index) => { return
{item.date}
{ isEmpty(item.items) &&
{getLabel('386505',"当天无外勤签到记录")}
} { !isEmpty(item.items) && item.items.map(i=> { return
{i.name} {i.time} {i.signTitle}
{i.information &&
} {i.pics &&
{ i.pics.map(pic=> { return
{ carousel(pic,index,'ant-timeline-item')}/> }
}) }
} { i.crm && i.crm.length > 0 &&
{ i.crm.map((d, i) => { return (
{d}
) }) }
} {i.title}
}) }
}) }
} renderDetail() { const { hrmOutside } = this.props; let { config, dataKey, table, onRadioGroupChange } = hrmOutside; config = toJS(config); return
{/* {console.debug(1);hrmOutside.radioGroupParams=params;hrmOutside.getData(params)}}/> */} {hrmOutside.radioGroupParams=params;hrmOutside.onRadioGroupChange(params)}}/> this.reRenderColumns(columns,hrmOutside)} />
} reRenderColumns = (columns, store) => { const { handleViewClick } = store; columns.map(c => { if (c.dataIndex === 'canViewSignImg') { c.render = function(text, record) { const { randomFieldId, canViewSignImgspan } = record; if (canViewSignImgspan === '1') { return handleViewClick(randomFieldId)}>{getLabel(33564,'查看')} } else { return } } } }); } renderMap() { const { hrmOutside } = this.props; let { mapData } = hrmOutside; mapData = toJS(mapData); if (!isEmpty(mapData)) { return } else { return
} >
{getLabel('386505',"当天无外勤签到记录")}
} } renderContent() { const { hrmOutside } = this.props; let { tabkey } = hrmOutside; if (tabkey == 1) return this.renderList(); if (tabkey == 2) return this.renderMap(); if (tabkey == 3) return this.renderDetail(); } getTabButtonsAd() { const { hrmOutside } = this.props; const { dataKey } = hrmOutside; return [ (), ] } showtabs(){ const { hrmOutside } = this.props; let { tabkey } = hrmOutside; return tabkey==3?:this.renderContent() } render() { const { hrmOutside } = this.props; let { title, tabkey, tabDatas, loading, hasRight, hrmName, dateTabkey, dateTabDatas, dateTabDatas1, pDate, showSignInfo, signTitle, visible, positionObj, getRadioGroupConfig } = hrmOutside; tabDatas = tabDatas(); dateTabDatas1 = dateTabDatas1(); dateTabDatas = dateTabDatas(); positionObj = toJS(positionObj); const errorMsg = getLabel('386507', "你无权查看{params}的外勤数据!").replace('{params}', hrmName); return (
{hrmOutside.updateVisible(false);}} closable style={{width: 700, height: 500}} title = {getLabel('386506',"位置详情")} icon="icon-coms-hrm" iconBgcolor='#008572' > {visible &&} } iconBgcolor='#217346' buttons={[]} buttonSpace={10} showDropIcon={true} dropMenuDatas={this.getRightMenu()} > {this.renderLeft()}
{ tabkey!=3 && {tabkey == 1 && dateTabDatas.map((item)=> { return {item.title} } )} {tabkey == 2 && dateTabDatas1.map((item)=> { return {item.title} } )} {signTitle()} }
{!hasRight ?
{errorMsg}
: this.showtabs() // this.renderContent() //
// { // tabkey == 1 &&this.renderContent() // // // } // { // tabkey == 2 &&this.renderContent() // // // } // { // tabkey == 3 && // // } //
}
) } } export default main