weaver_trunk_cli/pc4mobx/hrm/stores/rpsubsearch.js

57 lines
1.5 KiB
JavaScript

import { observable, action } from 'mobx';
import {WeaForm} from 'comsMobx';
import * as API from '../apis/rpsubsearch';
import * as Util from '../util/index';
import {WeaTableNew} from 'comsMobx'
const {TableStore} = WeaTableNew;
import {WeaLocaleProvider} from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;
export class HrmRpSubSearch {
title = () => getLabel('17088',"自定义信息");
@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);
});
}
doSearch = () => {
const formParams = this.form.getFormParams();
this.getSearchList(formParams);
}
getSearchList = (params = {}) => {
API.getSearchList(params).then((data) => {
this.table.getDatas(data.sessionkey,1);
});
}
setShowSearchAd = (bool) => {
this.showSearchAd = bool;
}
getFormParams = () => {
return this.form.getFormParams();
}
}