import { observable, action } from 'mobx'; import * as mobx from 'mobx'; import * as Api from '../apis/logview'; import { WeaForm } from 'comsMobx'; import { WeaTableNew } from 'comsMobx'; import { Modal, message, } from 'antd' import { i18n } from '../public/i18n'; const toJS = mobx.toJS; const { TableStore } = WeaTableNew; export class LogViewStore { @observable tableStore = new TableStore(); @observable searchCondition = []; @observable form = new WeaForm(); @observable conditionNum = 20; @observable searchConditionLoading = false; @observable visible = false; @observable dialogLoading = false; @observable moduleType = ""; //模块类型 init(logMoudleType) { this.setModuleType(logMoudleType); this.getTableInfo(); this.getSearchCondition(); } @action getTableInfo() { let params = { ...this.form.getFormParams(), moduleType: this.moduleType } this.tableStore = new TableStore(); Api.getLogList(params).then(res => { if (res.code === 200) { res.data.datas && this.tableStore.getDatas(res.data.datas, 1); } else { message.warning(res.msg); } }, error => { message.warning(error.msg); }) } @action getSearchCondition() { this.setSearchConditionLoading(true); Api.getAdvanceSearchCondition().then(res => { if (res.code === 200) { this.setSearchConditionLoading(false); res.data.conditions && this.setSearchCondition(res.data.conditions); res.data.conditions && this.form.initFormFields(res.data.conditions); } else { message.warning(res.msg); } }, error => { message.warning(error.msg); }) } setDialogLoading(bool) { this.dialogLoading = bool; } isEmptyObject(obj) { for (let key in obj) { return false; } return true; } setSearchCondition(searchCondition) { this.searchCondition = searchCondition; } setSearchConditionLoading(bool) { this.searchConditionLoading = bool; } scLoadingReset() { this.searchConditionLoading = true; } setVisable(bool) { this.visible = bool; } setModuleType(moduleType) { this.moduleType = moduleType; } }