trunk/pc4mobx/organization/stores/logview.js

109 lines
2.4 KiB
JavaScript
Raw Normal View History

2022-07-05 18:54:56 +08:00
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;
2022-07-07 18:06:02 +08:00
@observable searchConditionLoading = false;
2022-07-05 18:54:56 +08:00
@observable visible = false;
@observable dialogLoading = false;
@observable moduleType = ""; //模块类型
2022-07-07 18:06:02 +08:00
2022-07-05 18:54:56 +08:00
init(logMoudleType) {
this.setModuleType(logMoudleType);
this.getTableInfo();
this.getSearchCondition();
}
@action getTableInfo() {
let params = {
...this.form.getFormParams(),
2022-07-07 18:06:02 +08:00
moduleType: this.moduleType
2022-07-05 18:54:56 +08:00
}
2022-07-07 18:06:02 +08:00
this.tableStore = new TableStore();
2022-07-05 18:54:56 +08:00
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() {
2022-07-07 18:06:02 +08:00
this.setSearchConditionLoading(true);
2022-07-05 18:54:56 +08:00
Api.getAdvanceSearchCondition().then(res => {
if (res.code === 200) {
2022-07-07 18:06:02 +08:00
this.setSearchConditionLoading(false);
2022-07-05 18:54:56 +08:00
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);
})
}
2022-07-07 18:06:02 +08:00
2022-07-05 18:54:56 +08:00
setDialogLoading(bool) {
this.dialogLoading = bool;
}
isEmptyObject(obj) {
for (let key in obj) {
return false;
}
return true;
}
setSearchCondition(searchCondition) {
this.searchCondition = searchCondition;
}
2022-07-07 18:06:02 +08:00
setSearchConditionLoading(bool) {
this.searchConditionLoading = bool;
}
2022-07-05 18:54:56 +08:00
scLoadingReset() {
this.searchConditionLoading = true;
}
setVisable(bool) {
this.visible = bool;
}
setModuleType(moduleType) {
this.moduleType = moduleType;
}
}