import { observable, action, autorun,toJS } from 'mobx'; import {WeaTableNew,WeaForm} from 'comsMobx' const {TableStore} = WeaTableNew; import { ListStore } from './listStore'; import {WeaTools,WeaLocaleProvider} from "ecCom" import * as Apis from '../apis/project'; import * as Apis_common from '../apis/'; import {ShareStore} from './shareStore' import {ExchangeStore } from "./exchangeStore" import { ProjectInfoStore } from './projectInfoStore'; const getLabel = WeaLocaleProvider.getLabel; class ProjectExecuteStore extends ListStore{ @observable topTabCount =[]; @observable searchParams = { tabkey: "all", } @observable showLeft = true; @observable rightMenu =[]; conditiontype = {conditiontype:"prjexecute"}; @observable shareStore = new ShareStore(); @observable exchangeStore = new ExchangeStore(); @observable projectInfoStore = new ProjectInfoStore(); /** 左侧树store */ @observable leftTree = []; @observable leftTreeCount = {}; @observable leftTreeCountType = []; @observable selectedTreeKey = ""; @observable verified = false; @observable hasRight = false; //权限 treeType = {}; initDatas=(params = {})=> { let newParams = {...this.conditiontype,...params}; this.topTabCount = this.topTabCount; Apis.getPrjCondition(newParams).then(data=>{ this.condition = data.condition; //根据高级搜索条件初始化form this.form && !this.form.isFormInit && this.form.initFormFields(data.condition); }).then(()=>{ Apis.getPrjTypeTreePageList({treetype:'prjexecute'}).then(data=>{ this.leftTree =data.treedata; this.leftTreeCount = data.treecount; this.leftTreeCountType = data.treecountcfg; this.selectedTreeKey = data.selectedKeys; this.doSearch({prjtype:data.selectedKeys}); }) }); } doSearch=(params={})=>{ this.loading = true; //获取表单的参数值 if(params.prjtype){ this.appendFormFields({prjtype:{value:params.prjtype}}); this.selectedTreeKey = params.prjtype; } const searchParamsAd = this.form.getFormParams(); if(searchParamsAd.prjtype){ this.selectedTreeKey = searchParamsAd.prjtype; } const newParams = {...this.searchParams,...params,...searchParamsAd }; Apis.getPrjTypeList(newParams).then(data=>{ this.tableStore = new TableStore(); this.tableStore.getDatas(data.sessionkey, params.current || 1); this.searchParams = { ...this.searchParams, ...params }; this.topTabCount = data.tabnum; this.dataKey = data.sessionkey; this.rightMenu = data.rightMenus; this.loading = false; }) } reLoad=()=>{ this.doSearch(); } onShowColumn=()=>{ this.tableStore.setColSetVisible(true); this.tableStore.tableColSet(true) } setSelectedTreeKey=(key) =>{ this.selectedTreeKey = key; } @action setLeftShow=(bool) =>{ this.showLeft = bool; } clearStatus=()=>{ this.searchParams = {tabkey: "all",}; this.showSearchAd = false; this.selectedTreeKey = ""; this.clearFormFields(); this.resetForm(); this.condition = []; this.resetTable(true); } //项目执行操作 @action doPlanOpt=(params={})=>{ Apis.doPlanOpt(params).then(data=>{ this.doSearch(); }); } } const projectExecuteStore = new ProjectExecuteStore(); export default projectExecuteStore;