import { observable, action } from 'mobx'; import {WeaForm} from 'comsMobx'; import * as API from '../apis/online'; import {Modal} from 'antd' const confirm = Modal.confirm; import {WeaTableNew} from 'comsMobx' const {TableStore} = WeaTableNew; import {i18n} from '../public/i18n'; import {WeaLocaleProvider} from 'ecCom'; import { addContentPath } from '../util/index.js'; const getLabel = WeaLocaleProvider.getLabel; export class HrmOnline { title = () => getLabel('20536',"在线人员"); @observable form = new WeaForm(); @observable table = new TableStore(); @observable condition=[]; @observable showSearchAd=false; @observable searchParamsAd={}; @observable dataKey = ''; @action getData = (params = {}) => { this.form = new WeaForm(); this.table = new TableStore(); this.condition=[]; this.showSearchAd=false; this.searchParamsAd={}; this.dataKey = ''; this.getSearchCondition(); this.getSearchList(); } getSearchCondition = (params = {}) => { API.getSearchCondition(params).then((data) => { this.condition = data.condition; this.form.initFormFields(data.condition); }); } doSearch = () => { const formParams = this.form.getFormParams(); formParams.search="search"; this.getSearchList(formParams); } getSearchList = (params = {}) => { API.getSearchList(params).then((data) => { this.dataKey = data.sessionkey; this.table.getDatas(data.sessionkey,1); }); } //强制下线 forcedOffline = (id) => { let __this = this; confirm({ title: i18n.confirm.systemhints(), content: getLabel('81904',"确定要将该用户强制下线吗?"), onOk(){ jQuery.ajax({ url: addContentPath("/js/hrm/getdata.jsp?cmd=userOffline&uid="+id), type:"post", async:false, complete:function(xhr,status){ __this.update(); } }); }, onCancel(){}, }); } update = () => { this.table.getDatas(this.dataKey,1);//刷新table } setShowSearchAd = (bool) => { this.showSearchAd = bool; } getFormParams = () => { return this.form.getFormParams(); } }