import { observable, action } from 'mobx'; import {WeaForm} from 'comsMobx'; import * as API from '../apis/birthdayinfo'; import * as Util from '../util/index'; import moment from 'moment'; import {WeaTableNew} from 'comsMobx' const {TableStore} = WeaTableNew; import {WeaLocaleProvider} from 'ecCom'; const getLabel = WeaLocaleProvider.getLabel; export class HrmBirthdayInfo { title = () => getLabel('22744',"人员生日"); @observable verified = false; @observable hasRight = false; @observable form = new WeaForm(); @observable table = new TableStore(); @observable condition=[]; @observable showSearchAd=false; @observable searchParamsAd={}; @action getHasRight = (params = {}) => { API.getHasRight(params).then((data) => { this.hasRight = data.hasRight; if(data.hasRight){ this.getSearchCondition(); this.getSearchList(); } this.verified = true; }); } getSearchCondition = (params = {}) => { this.form = new WeaForm(); API.getSearchCondition(params).then((data) => { this.condition = data.conditions; this.form.initFormFields(data.conditions); this.form.isFormInit && this.form.updateFields({ bMonth:{value: new moment().format('MM')}, }) }); } doSearch = () => { const formParams = this.form.getFormParams(); formParams.search="search"; this.getSearchList(formParams); } getSearchList = (params = {}) => { this.table = new TableStore(); API.getSearchList(params).then((data) => { this.table.getDatas(data.sessionkey,1); }); } setShowSearchAd = (bool) => { this.showSearchAd = bool; } getFormParams = () => { return this.form.getFormParams(); } getMonth = () => { let options = []; options.push( { key: "", showname: "" }); let tempMonth = ""; for(let i=1;i<=12;i++){ tempMonth = i<10?("0"+i):""+i; options.push( { key: tempMonth, showname: tempMonth, }); } return options; } getDay = () => { let options = []; options.push( { key: "", showname: "" }); let tempDay = ""; for(let i=1;i<=31;i++){ tempDay = i<10?("0"+i):""+i; options.push( { key: tempDay, showname: tempDay }); } return options; } @action doExport = () => { this.table.exportAll() } }