Browse Source

优化

master
陈裕财 4 years ago
parent
commit
0d59523d69
  1. 3
      src/api/xm/core/xmTask.js
  2. 2
      src/views/xm/core/xmTask/XmTaskEdit.vue
  3. 161
      src/views/xm/core/xmTask/XmTaskList.vue
  4. 64
      src/views/xm/core/xmTask/XmTaskMng.vue

3
src/api/xm/core/xmTask.js

@ -51,6 +51,9 @@ export const setTaskCreateUser = params => { return axios.post(`${base}/xm/core/
export const editTime = params => { return axios.post(`${base}/xm/core/xmTask/editTime`, params); };
export const batchChangeParentTask = params => { return axios.post(`${base}/xm/core/xmTask/batchChangeParentTask`, params); };

2
src/views/xm/core/xmTask/XmTaskEdit.vue

@ -380,6 +380,8 @@
this.$notify({showClose: true, message: tips.msg, type: tips.isOk?'success':'error' });
}).catch( err => this.load.edit=false);
});
}else{
this.$notify({showClose: true, message: "表单验证不通过,请修改后提交", type: 'error' });
}
});
},

161
src/views/xm/core/xmTask/XmTaskList.vue

@ -22,8 +22,9 @@
</el-row>
<el-row class="page-main">
<el-table
ref="taskTable"
show-summary
ref="taskTable"
lazy
:load="loadXmTaskLazy"
:data="tasksTreeData"
@sort-change="sortChange"
v-loading="load.list"
@ -74,7 +75,7 @@
<el-table-column v-if="!isMultiSelect" header-align="center" label="操作" fixed="right" width="100">
<template slot-scope="scope">
<el-button :disabled="checkScope!='plan' && scope.row.ntype=='1'" type="primary" @click.stop="selectedTask(scope.row)" >选择</el-button>
<el-button :disabled="(checkScope=='plan' && scope.row.ntype!='1')||(checkScope=='task' && scope.row.ntype=='1')" type="primary" @click.stop="selectedTask(scope.row)" >选择</el-button>
</template>
</el-table-column>
</el-table>
@ -109,7 +110,7 @@
},
},
props: ["selProject",'isMultiSelect','xmProduct','xmIteration','check-scope'/**task/plan */],
props: ["selProject",'isMultiSelect','xmProduct','xmIteration','checkScope'/**task/all/plan */,'queryScope'/**task/all/plan */,],
watch: {
"selkey": function(val) {
// console.log("");
@ -172,6 +173,7 @@
tableHeight:300,
dateRanger: [ ],
pickerOptions: util.pickerOptions('datarange'),
maps:new Map(),
/**end 自定义属性请在上面加 请加备注**/
}
},//end data
@ -234,45 +236,21 @@
params.orderBy= orderBys.join(",")
}
if(this.dateRanger&&this.dateRanger.length==2){
params.createTimeStart=this.dateRanger[0]
params.createTimeEnd=this.dateRanger[1]
}
if(this.filters.key){
params.key='%'+this.filters.key+'%'
}
if(this.filters.taskType!="all" && this.filters.taskType!="" && this.filters.taskType!=null){
params.taskType=this.filters.taskType
}
params.withParents="1"
this.load.list = true;
if(this.selProject){
params.projectId = this.selProject.id;
}
if(!params.projectId){
if(this.filters.selProject){
params.projectId=this.filters.selProject.id
}
}
if(this.xmProduct && this.xmProduct.id){
params.productId = this.xmProduct.id;
}
if(this.xmIteration && this.xmIteration.id){
params.iterationId=this.xmIteration.id
}
if(!params.projectId){
this.$notify({showClose: true, message: "请选择项目", type: 'error' });
this.load.list=false;
return;
}
params.workexec="true";
if(this.isMy=='1'){
params.userid=this.userInfo.userid
params.isMy="1"
params=this.getParams(params)
if(this.queryScope=='all'){
params.isTop="1"
params.withParents="1"
}else if(this.queryScope=='plan'){
params.isTop="1"
params.withParents="1"
params.ntype="1"
}else if(this.queryScope=='task'){
params.ntype="0"
}else{
params.isTop="1"
params.withParents="1"
}
params.ntype="0"
getTask(params).then((res) => {
var tips=res.data.tips;
if(tips.isOk){
@ -286,6 +264,107 @@
this.load.list = false;
}).catch( err => this.load.list = false );
},
getParams(params) {
if (this.dateRanger && this.dateRanger.length == 2) {
params.createTimeStart = this.dateRanger[0];
params.createTimeEnd = this.dateRanger[1];
}
if (
this.filters.taskType != "all" &&
this.filters.taskType != "" &&
this.filters.taskType != null
) {
params.taskType = this.filters.taskType;
}
if (this.selkey == "work") {
params.work = "work";
} else if (this.selkey == "finish") {
params.rate = 100;
} else if (this.selkey == "myFocus") {
params.myFocus = "1";
params.userid = this.userInfo.userid;
} else if (this.selkey == "myCreate") {
params.createUserid = this.userInfo.userid;
params.userid = this.userInfo.userid;
} else if (this.selkey.indexOf("myExecuserStatus") >= 0) {
params.userid = this.userInfo.userid;
params.myExecuserStatus = this.selkey.substring(
"myExecuserStatus".length
);
}
if(this.filters.taskState){
params.taskState=this.filters.taskState
}
if (this.filters.selProject) {
params.projectId = this.filters.selProject.id;
}
params.workexec = "true";
if (this.projectPhase) {
{
params.phaseId = this.projectPhase.id;
}
}
if (this.isMy == "1") {
params.userid = this.userInfo.userid;
params.isMy = "1";
}
if (this.menuId) {
params.menuId = this.menuId;
}
if (this.filters.menus && this.filters.menus.length == 1) {
params.menuId = this.filters.menus[0].menuId;
} else if (this.filters.menus && this.filters.menus.length > 1) {
params.menuIds = this.filters.menus.map((i) => i.menuId);
}
if (this.filters.skillTags && this.filters.skillTags.length > 0) {
params.skillIds = this.filters.skillTags.map((i) => i.skillId);
}
if (this.filters.key) {
params.key = "%" + this.filters.key + "%";
}
if (this.filters.taskOut) {
params.taskOut = this.filters.taskOut;
}
if (this.filters.createUser) {
params.createUserid = this.filters.createUser.userid;
}
if (this.filters.executor) {
params.executorUserid = this.filters.executor.userid;
}
if (this.filters.product) {
params.productId = this.filters.product.id;
}
if (this.xmIteration) {
params.iterationId = this.xmIteration.id;
}
if (this.filters.tags && this.filters.tags.length>0) {
params.tagIdList = this.filters.tags.map(i=>i.tagId);
}
return params;
},
loadXmTaskLazy(tree, treeNode, resolve) {
this.maps.set(tree.id, { tree, treeNode, resolve }) //
var params={parentTaskid:tree.id}
params=this.getParams(params);
params.isTop=""
this.load.list = true;
var func=listXmTask
func(params).then(res=>{
this.load.list = false
var tips = res.data.tips;
if(tips.isOk){
var xmTasks=this.xmTasks.filter(i=>i.parentTaskid!=tree.id)
xmTasks.push(...res.data.data)
this.xmTasks=xmTasks;
resolve(res.data.data)
}else{
resolve([])
}
}).catch( err => this.load.list = false );
},
calcTaskStateByTime(startTime,endTime,row){
var obj={
type:'',

64
src/views/xm/core/xmTask/XmTaskMng.vue

@ -119,7 +119,7 @@
}})</el-tag
>
<el-input
style="width: 200px"
style="width: 150px"
v-model="filters.key"
placeholder="计划/任务名称"
>
@ -130,6 +130,13 @@
icon="el-icon-search"
v-loading="load.list"
></el-button>
<el-button
@click="showParentTaskList"
type="primary"
icon="el-icon-edit"
v-loading="load.edit"
>更换上级</el-button>
<el-button
v-if="isTaskCenter != '1' && isMy != '1'"
@click="showBatchEdit"
@ -984,6 +991,9 @@
>
</tag-mng>
</el-drawer>
<el-drawer title="选中上级" :visible.sync="selectParentTaskVisible" size="60%" append-to-body :close-on-click-modal="false">
<xm-task-list check-scope="plan" :sel-project="filters.selProject" @task-selected="onSelectedParentTask"></xm-task-list>
</el-drawer>
</section>
</template>
@ -1005,6 +1015,7 @@ import {
batchSaveBudget,
setTaskCreateUser,
batchRelTasksWithMenu,
batchChangeParentTask,
} from "@/api/xm/core/xmTask";
import XmTaskAdd from "./XmTaskAdd"; //
import XmTaskEdit from "./XmTaskEdit"; //
@ -1031,6 +1042,7 @@ import TagMng from "@/views/mdp/arc/tag/TagMng";
import XmGantt from "../components/xm-gantt";
import XmGroupSelect from "../xmGroup/XmGroupSelect.vue";
import XmTaskList from '../xmTask/XmTaskList';
export default {
computed: {
@ -1285,6 +1297,7 @@ export default {
actDateRanger: [],
tagSelectVisible: false,
batchRelTasksWithMenuVisible:false,
selectParentTaskVisible:false,
maps:new Map(),
};
}, //end data
@ -1656,11 +1669,9 @@ export default {
this.load.del = false;
var tips = res.data.tips;
if (tips.isOk) {
this.pageInfo.count = true;
var parents=this.sels.filter(i=>!this.sels.some(k=>k.id==i.parentTaskid));
var needLoadChlidList=parents.filter(i=>i.lvl>1)
this.pageInfo.count = true;
this.searchXmTasks()
treeTool.reloadAllChildren(this.$refs.table,this.maps,this.sles,'parentTaskid',this.loadXmTaskLazy)
treeTool.reloadAllChildren(this.$refs.table,this.maps,this.sels,'parentTaskid',this.loadXmTaskLazy)
}
this.$notify({
showClose: true,
@ -2389,6 +2400,48 @@ export default {
}).catch( err => this.load.list = false );
},
showParentTaskList(){
if(this.filters.selProject && this.filters.selProject.id){
if(this.sels.length==0){
this.$notify({showClose:true,message:"请先选择一个或者多个需要更换上级的计划/任务",type:'warning'})
return;
}
this.selectParentTaskVisible=true
}else{
this.$notify({showClose:true,message:"请先选择项目",type:'warning'})
}
},
onSelectedParentTask(task){
if(this.sels.length==0){
this.$notify({showClose:true,message:"请先选择一个或者多个需要更换上级的计划/任务",type:'warning'})
this.selectParentTaskVisible=true
return;
}else if(task==null || !task.id){
this.$notify({showClose:true,message:"请选择上级计划/任务",type:'warning'})
return;
}
var params={taskIds:this.sels.map(i=>i.id),parentTaskid:task.id}
this.$confirm("确认批量更新以下"+this.sels.length+"个任务的上级为【"+task.name+"】吗?", "提示", {
type: "warning",
}).then(() => {
batchChangeParentTask(params).then(res=>{
var tips = res.data.tips;
if(tips.isOk){
this.searchXmTasks();
debugger;
var rows=[...this.sels,{id:'xxxxx',parentTaskid:task.id}]
treeTool.reloadAllChildren(this.$refs.table,this.maps,rows,'parentTaskid',this.loadXmTaskLazy)
}
this.$notify({
showClose: true,
message: tips.msg,
type: tips.isOk ? "success" : "error",
});
});
})
}
/**end 自定义函数请在上面加**/
}, //end methods
components: {
@ -2410,6 +2463,7 @@ export default {
XmProductSelect,
XmTaskAgileKanban,
TagMng,
XmTaskList,
//
},
mounted() {

Loading…
Cancel
Save