123 lines
4.1 KiB
JavaScript
123 lines
4.1 KiB
JavaScript
import { observable, action, autorun,toJS } from 'mobx';
|
|
import {WeaTableNew,WeaForm} from 'comsMobx'
|
|
const {TableStore} = WeaTableNew;
|
|
import { ListStore } from './listStore';
|
|
import {ShareStore } from './shareStore'
|
|
import {ExchangeStore } from "./exchangeStore"
|
|
import {TaskInfoStore} from './task/taskInfoStore'
|
|
|
|
import {WeaTools,WeaLocaleProvider} from "ecCom"
|
|
import * as Apis from '../apis/queryTask';
|
|
import * as Apis_common from "../apis/index"
|
|
const getLabel = WeaLocaleProvider.getLabel;
|
|
|
|
class QueryTaskStore extends ListStore{
|
|
@observable rightMenu =[];
|
|
conditiontype = {conditiontype:"search"};
|
|
@observable isreloadWorkPlan = false;
|
|
@observable searchfrom = '';
|
|
|
|
@observable shareStore = new ShareStore();
|
|
@observable exchangeStore = new ExchangeStore();
|
|
@observable taskInfoStore = new TaskInfoStore();
|
|
|
|
@action
|
|
getQueryCondition=(params={},needReset=false)=>{
|
|
this.loading = true;
|
|
const newParams = {...this.conditiontype,...params}
|
|
if(needReset){
|
|
this.resetForm();
|
|
}
|
|
Apis_common.getTaskCondition(newParams).then(data=>{
|
|
this.loading = false;
|
|
this.condition = data.condition;
|
|
this.form && !this.form.isFormInit && this.form.initFormFields(data.condition);
|
|
})
|
|
}
|
|
initDatas=(params = {})=> {
|
|
|
|
}
|
|
initTreeDatas=(params={})=>{
|
|
// Apis.getPrjTypeTreePageList({treetype:'mymanagerprj',...params}).then(data=>{
|
|
// this.leftTree =data.treedata;
|
|
// this.leftTreeCount = data.treecount;
|
|
// this.leftTreeCountType = data.treecountcfg;
|
|
// this.selectedTreeKey = data.selectedKeys;
|
|
// })
|
|
}
|
|
|
|
doSearch=(params={})=>{
|
|
this.loading = true;
|
|
const type = this.searchfrom;
|
|
//获取表单的参数值
|
|
const searchParamsAd = this.form.getFormParams();
|
|
const newParams = { searchfrom:type, ...searchParamsAd, ...params };
|
|
Apis.getTaskSearchList(newParams).then(data=>{
|
|
this.tableStore.getDatas(data.sessionkey, params.current || 1);
|
|
this.searchParams = { ...this.searchParams, ...params };
|
|
this.dataKey = data.sessionkey;
|
|
this.rightMenu = data.rightMenus;
|
|
this.loading = false;
|
|
})
|
|
}
|
|
reLoad=()=>{
|
|
this.doSearch();
|
|
}
|
|
onShowColumn=()=>{
|
|
this.tableStore.setColSetVisible(true);
|
|
this.tableStore.tableColSet(true)
|
|
}
|
|
|
|
@action
|
|
setLoaded=()=>{
|
|
this.isreloadWorkPlan= true;
|
|
}
|
|
|
|
setSearchfrom=()=>{
|
|
this.searchfrom = 'portal';
|
|
}
|
|
|
|
clearStatus=()=>{
|
|
this.searchParams = "";
|
|
this.showSearchAd = false;
|
|
this.selectedTreeKey = "";
|
|
this.clearFormFields();
|
|
}
|
|
|
|
//导出任务
|
|
@action
|
|
doTaskExcelExp=(params={})=>{
|
|
this.loading = true;
|
|
//获取表单的参数值
|
|
const searchParamsAd = this.form.getFormParams();
|
|
const type = this.searchfrom;
|
|
const newParams = { searchfrom:type, ...searchParamsAd, ...params, 'from':'queryTask' };
|
|
if(window.setShare4ec){
|
|
window.setShare4ec({
|
|
mouldCode: 'PRJ',
|
|
itemCode: 'PRJ_EXPORT_2',
|
|
encrypt: '1',
|
|
targetid: ""
|
|
} ,
|
|
(datas)=>{
|
|
const {status,sharepassword = '',serialid = ''} = datas;
|
|
if(status === '1'){
|
|
newParams.sharepassword = sharepassword;
|
|
newParams.itemCode = 'PRJ_EXPORT_2';
|
|
WeaTools.callApi('/api/proj/pctask/doTaskExcelExp','GET',newParams).then(data => {
|
|
window.location=(window.ecologyContentPath || '')+"/weaver/weaver.file.ExcelOut";
|
|
this.loading = false;
|
|
}).catch(err=>message.error(err))
|
|
}
|
|
});
|
|
}else{
|
|
WeaTools.callApi('/api/proj/pctask/doTaskExcelExp','GET',newParams).then(data => {
|
|
window.location=(window.ecologyContentPath || '')+"/weaver/weaver.file.ExcelOut";
|
|
this.loading = false;
|
|
}).catch(err=>message.error(err))
|
|
}
|
|
}
|
|
}
|
|
|
|
const queryTaskStore = new QueryTaskStore();
|
|
export default queryTaskStore; |