| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- /*
- * @Author: dayan_hjm
- * @Date: 2022-10-27 11:11:30
- * @Last modified by: dayan_hjm
- * @Last modified time: 2022-10-27 11:11:30
- */
- // 状态管理方法
- import { observable, action, configure, makeObservable, runInAction } from 'mobx';
- // 工具方法
- import { cloneDeep, get, groupBy, isEmpty, orderBy, pick, values } from "lodash";
- import { message } from 'antd';
- // 默认状态
- const defaultState = {
- totalValue:0,
- yearDecline:0,
- yearSend:0,
- productInventory:0,
- list:[{name:'营运数据大屏'},{name:'经营大盘'},{name:'到家专题'},{name:'门店大盘'},{name:'自助跑数SQL平台'},{name:'月度包材预警跑数模板'}],
- rightlist:[],
- bumen:'数字化中心/数据工程部',
- gw:'数据产品经理',
- }
- // 严格模式
- configure({
- enforceActions: 'observed'
- });
- /**
- * mod层 - 业务逻辑,数据逻辑应该存储于此
- */
- class Mod {
- constructor() {
- makeObservable(this);
- }
- // 监视状态
- @observable state = cloneDeep(defaultState);
- @action saveState = async (payload) => {
- runInAction(() => {
- this.state = {
- ...this.state,
- ...payload
- };
- });
- };
- // 新增/编辑运营商
- // @action customerOperatorsmod = async (par, type) => {
- // try {
- // const { data, resultCode, resultMsg } = await Serv.customerOperatorsServ(par, type);
- // if (resultCode + '' === '0') {
- // runInAction(() => {
- // message.success('操作成功!')
- // this.state.addEditVisiable = false;
- // this.state.version = Math.random()
- // });
- // }
- // } catch (e) {
- // console.log('e: ', e);
- // }
- // }
- }
- // 将组件实例化,这意味着组件将不能从别处实例化
- const mod = new Mod();
- export default mod;
|