| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- /*
- * @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 = {
- imgMsgData: [
- {
- total: 4500,
- totalName: "累计运输锂辉石",
- styles: { left: "0%", top: "19%" },
- cumulativeProduction: null,
- inventory: 0,
- },
- {
- total: 3233,
- totalName: "锂辉石库存量",
- styles: { left: "11%", top: "45%" },
- cumulativeProduction: null,
- inventory: 0,
- },
- {
- total: 3578,
- totalName: "锂辉石库存量",
- styles: { left: "34%", top: "27%" },
- cumulativeProduction: null,
- inventory: 0,
- },
- {
- total: 0,
- totalName: "",
- styles: { left: "11%", top: "88%" },
- cumulativeProduction: 1222,
- inventory: 1000,
- day:222,
- mood:333,
- year:444,
- rawMaterial:[
- {
- prodCatgory:"原料-鲤辉石",
- indexValue:22,
- },
- {
- prodCatgory:"产品-碳酸锂",
- indexValue:33,
- },
- {
- prodCatgory:"原料-氯化锂",
- indexValue:44,
- },
- {
- prodCatgory:"产品-氢氧化锂",
- indexValue:66,
- },
- {
- prodCatgory:"产品-金属锂",
- indexValue:88,
- },
- {
- prodCatgory:"产品-98K",
- indexValue:1000,
- },
- ]
- },
- {
- total: 0,
- totalName: "",
- styles: { left: "30%", top: "73%" },
- cumulativeProduction: 1222,
- inventory: 1000,
- day:222,
- mood:333,
- year:444,
- rawMaterial:[
- {
- prodCatgory:"原料-鲤辉石",
- indexValue:22,
- },
- {
- prodCatgory:"产品-碳酸锂",
- indexValue:33,
- },
- {
- prodCatgory:"原料-氯化锂",
- indexValue:44,
- },
- {
- prodCatgory:"产品-氢氧化锂",
- indexValue:66,
- },
- {
- prodCatgory:"产品-金属锂",
- indexValue:88,
- },
- {
- prodCatgory:"产品-98K",
- indexValue:1000,
- },
- ]
- },
- {
- total: 0,
- totalName: "",
- styles: { left: "52%", top: "56%" },
- cumulativeProduction: 1222,
- inventory: 1000,
- day:222,
- mood:333,
- year:444,
- rawMaterial:[
- {
- prodCatgory:"原料-鲤辉石",
- indexValue:22,
- },
- {
- prodCatgory:"产品-碳酸锂",
- indexValue:33,
- },
- {
- prodCatgory:"原料-氯化锂",
- indexValue:44,
- },
- {
- prodCatgory:"产品-氢氧化锂",
- indexValue:66,
- },
- {
- prodCatgory:"产品-金属锂",
- indexValue:88,
- },
- {
- prodCatgory:"产品-98K",
- indexValue:1000,
- },
- ]
- },
- {
- total: 0,
- totalName: "",
- styles: { left: "70%", top: "42%" },
- cumulativeProduction: 1222,
- inventory: 1000,
- day:222,
- mood:333,
- year:444,
- rawMaterial:[
- {
- prodCatgory:"原料-鲤辉石",
- indexValue:22,
- },
- {
- prodCatgory:"产品-碳酸锂",
- indexValue:33,
- },
- {
- prodCatgory:"原料-氯化锂",
- indexValue:44,
- },
- {
- prodCatgory:"产品-氢氧化锂",
- indexValue:66,
- },
- {
- prodCatgory:"产品-金属锂",
- indexValue:88,
- },
- {
- prodCatgory:"产品-98K",
- indexValue:1000,
- },
- ]
- },
- {
- total: 0,
- totalName: "",
- styles: { left: "88%", top: "28%" },
- cumulativeProduction: 1222,
- inventory: 1000,
- day:222,
- mood:333,
- year:444,
- rawMaterial:[
- {
- prodCatgory:"原料-鲤辉石",
- indexValue:22,
- },
- {
- prodCatgory:"产品-碳酸锂",
- indexValue:33,
- },
- {
- prodCatgory:"原料-氯化锂",
- indexValue:44,
- },
- {
- prodCatgory:"产品-氢氧化锂",
- indexValue:66,
- },
- {
- prodCatgory:"产品-金属锂",
- indexValue:88,
- },
- {
- prodCatgory:"产品-98K",
- indexValue:1000,
- },
- ]
- },
- ],
- }
- // 严格模式
- 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;
|