trunk/pc4mobx/organization/stores/snapshot.js

97 lines
2.0 KiB
JavaScript

import {
observable,
action
} from 'mobx';
import * as mobx from 'mobx';
import * as Api from '../apis/snapshot';
import {
WeaForm
} from 'comsMobx';
import {
WeaTableNew
} from 'comsMobx';
import {
Modal,
message,
} from 'antd'
import {
i18n
} from '../public/i18n';
import moment from 'moment';
const toJS = mobx.toJS;
const {
TableStore
} = WeaTableNew;
export class SnapshotStore {
/***************************buttons**************/
topMenu = [
{
"isBatch": "0",
"isTop": "1",
"menuFun": "custom",
"menuIcon": "icon-coms-task-list",
"menuName": "显示列定制",
"type": "BTN_COLUMN"
}
]
rightMenu = [
{
"isBatch": "0",
"isTop": "0",
"menuFun": "custom",
"menuIcon": "icon-coms-task-list",
"menuName": "显示列定制",
"type": "BTN_COLUMN"
}
]
@observable tableStore = new TableStore();
@observable datas = {
subcompany:0,
department:0,
person:0
};
@observable date = moment(new Date()).format('YYYY-MM-DD');
@observable hasRight = true;
@action("获取table接口") getTableInfo() {
Api.getSearchList(this.date).then(res => {
if (res.code === 200) {
this.tableStore.getDatas(res.data.datas,1)
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
@action("数据统计") getDatas() {
Api.getDatas(this.date).then(res => {
if (res.code === 200) {
this.datas = {
...res.data
}
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
changeDate = (value) => {
this.date = value;
this.getDatas();
this.getTableInfo();
}
}