Browse Source

优化

master
陈裕财 4 years ago
parent
commit
d9bca90101
  1. 40
      src/views/xm/core/xmMenu/XmMenuMng.vue
  2. 72
      src/views/xm/core/xmTask/XmTaskList.vue

40
src/views/xm/core/xmMenu/XmMenuMng.vue

@ -105,6 +105,8 @@
{{dicts.menuStatus.some(i=>i.id==scope.row.status)?dicts.menuStatus.find(i=>scope.row.status==i.id).name:''}} {{dicts.menuStatus.some(i=>i.id==scope.row.status)?dicts.menuStatus.find(i=>scope.row.status==i.id).name:''}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="iterationName" label="迭代" width="80" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="finishRate" label="进度" width="80" show-overflow-tooltip> <el-table-column prop="finishRate" label="进度" width="80" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.finishRate"><el-tag :type="scope.row.finishRate>=100?'success':'warning'">{{scope.row.finishRate}}%</el-tag></span> <span v-if="scope.row.finishRate"><el-tag :type="scope.row.finishRate>=100?'success':'warning'">{{scope.row.finishRate}}%</el-tag></span>
@ -142,11 +144,9 @@
<el-button type="text" slot="reference" icon="el-icon-plus">添加子需求</el-button> <el-button type="text" slot="reference" icon="el-icon-plus">添加子需求</el-button>
</el-popover> </el-popover>
<font v-else> <font v-else>
<el-button v-if="!selProject" type="text" @click="showTaskListForMenu(scope.row,scope.$index)" icon="el-icon-s-operation">任务</el-button>
<el-button v-if="selProject" type="text" @click="showTasks(scope.row,scope.$index)" icon="el-icon-s-operation">任务</el-button>
<el-button type="text" @click="toIterationList(scope.row,scope.$index)" icon="el-icon-document-copy">迭代</el-button>
<el-button type="text" @click="showTaskListForMenu(scope.row,scope.$index)" icon="el-icon-s-operation">查任务</el-button>
<el-button type="text" @click="showTaskList(scope.row,scope.$index)" icon="el-icon-s-operation">关联任务</el-button>
</font> </font>
<el-button type="text" :disabled="scope.row.childrenCnt>0" @click="handleDel(scope.row)" icon="el-icon-delete">删除</el-button>
</el-row> </el-row>
</template> </template>
</el-table-column> </el-table-column>
@ -676,11 +676,6 @@
this.$emit("selected",row) this.$emit("selected",row)
}, },
showImportFromMenuTemplate(row){ showImportFromMenuTemplate(row){
if(!this.roles.some(i=>i.roleid=='productAdmin') && !this.roles.some(i=>i.roleid=='productTeamAdmin')){
this.$notify({showClose: true, message: "只有产品经理、产品组长能够修改需求", type: 'error'});
return false;
}
if(!this.filters.product){ if(!this.filters.product){
this.$notify.error("请选择产品模板") this.$notify.error("请选择产品模板")
return; return;
@ -754,11 +749,6 @@
}).catch( err => this.load.add=false ); }).catch( err => this.load.add=false );
}, },
toBatchEdit(){ toBatchEdit(){
if(!this.roles.some(i=>i.roleid=='productAdmin') && !this.roles.some(i=>i.roleid=='productTeamAdmin')){
this.$notify({showClose: true, message: "只有产品经理、产品组长能够修改需求", type: 'error'});
return false;
}
this.batchEditVisible=true; this.batchEditVisible=true;
}, },
@ -768,11 +758,6 @@
}, },
showTaskList(row){ showTaskList(row){
if(!this.roles.some(i=>i.roleid=='productAdmin') && !this.roles.some(i=>i.roleid=='productTeamAdmin')){
this.$notify({showClose: true, message: "只有产品经理、产品组长能够修改需求", type: 'error'});
return false;
}
this.editForm=row this.editForm=row
this.selectTaskVisible=true; this.selectTaskVisible=true;
}, },
@ -784,19 +769,16 @@
this.$notify.error("请最少选择一个任务进行关联"); this.$notify.error("请最少选择一个任务进行关联");
return; return;
} }
var menu=this.editForm
xmTasks.forEach(i=>{
i.menuId=menu.menuId
i.menuName=menu.menuName
i.productId=menu.productId
i.productName=menu.productName
});
this.selectTaskVisible=false; this.selectTaskVisible=false;
batchRelTasksWithMenu(xmTasks).then(res=>{
var params={
menuId:this.editForm.menuId,
taskIds:xmTasks.map(i=>i.id)
}
batchRelTasksWithMenu(params).then(res=>{
var tips = res.data.tips var tips = res.data.tips
if(tips.isOk){ if(tips.isOk){
this.getXmMenus()
//this.getXmMenus()
} }
this.$notify({showClose: true, message: tips.msg, type: tips.isOk?'success':'error'}); this.$notify({showClose: true, message: tips.msg, type: tips.isOk?'success':'error'});
}); });

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

@ -43,15 +43,27 @@
stripe stripe
fit fit
border border
default-expand-all
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
:tree-props="{children: 'children', hasChildren: 'childrenCnt'}"
row-key="id" row-key="id"
:height="tableHeight" :height="tableHeight"
> >
<el-table-column v-show="isMultiSelect" reserve-selection sortable width="70" type="selection"></el-table-column>
<el-table-column v-show="isMultiSelect" sortable width="70" type="selection"></el-table-column>
<el-table-column prop="name" label="任务名称" min-width="260" show-overflow-tooltip> <el-table-column prop="name" label="任务名称" min-width="260" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.row.sortLevel}}&nbsp;{{scope.row.name}}
<el-link type="primary" :icon="scope.row.ntype=='1'?'el-icon-folder-opened':''">
{{ scope.row.sortLevel }}&nbsp;
<el-tag v-if="scope.row.level <= '2'" type="info"
>轻微</el-tag
>
<el-tag v-else-if="scope.row.level == '3'" type="warning"
>一般</el-tag
>
<el-tag v-else-if="scope.row.level == '4'" type="danger"
>紧急</el-tag
>
<el-tag v-else type="danger">特急</el-tag>
</el-link>
{{ scope.row.name }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="menuName" min-width="150" label="需求" show-overflow-tooltip></el-table-column> <el-table-column prop="menuName" min-width="150" label="需求" show-overflow-tooltip></el-table-column>
@ -91,6 +103,7 @@
<script> <script>
import Vue from 'vue' import Vue from 'vue'
import util from '@/common/js/util';// import util from '@/common/js/util';//
import treeTool from '@/common/js/treeTool';//
//import Sticky from '@/components/Sticky' // header //import Sticky from '@/components/Sticky' // header
import { listOption } from '@/api/mdp/meta/itemOption';// import { listOption } from '@/api/mdp/meta/itemOption';//
import { getTask ,listXmTask,editXmTask,editRate, delXmTask, batchDelXmTask,batchImportTaskFromTemplate,batchSaveBudget } from '@/api/xm/core/xmTask'; import { getTask ,listXmTask,editXmTask,editRate, delXmTask, batchDelXmTask,batchImportTaskFromTemplate,batchSaveBudget } from '@/api/xm/core/xmTask';
@ -104,7 +117,10 @@
'userInfo','roles' 'userInfo','roles'
]), ]),
tasksTreeData() { tasksTreeData() {
return this.translateDataToTree(this.xmTasks);
debugger;
var d=JSON.parse(JSON.stringify(this.xmTasks))
var data= treeTool.translateDataToTree(d,"parentTaskid","id");
return data;
}, },
}, },
@ -355,51 +371,7 @@
selectedTasks:function(){ selectedTasks:function(){
this.$emit("tasks-selected", this.sels); this.$emit("tasks-selected", this.sels);
},
translateDataToTree(data2) {
var data=JSON.parse(JSON.stringify(data2));
let parents = data.filter(value =>{
value.taskBudgetCostAt=this.getRowSum(value);
//
if(value.parentTaskid == 'undefined' || value.parentTaskid == null || value.parentTaskid == ''){
return true;
//
}else if(data.some(i=>value.parentTaskid==i.id)){
return false;
}else {
return true
}
})
let children = data.filter(value =>{
if(data.some(i=>value.parentTaskid==i.id)){
return true;
}else{
return false;
}
})
let translator = (parents, children) => {
parents.forEach((parent) => {
children.forEach((current, index) => {
if (current.parentTaskid === parent.id) {
let temp = JSON.parse(JSON.stringify(children))
temp.splice(index, 1)
translator([current], temp)
typeof parent.children !== 'undefined' ? parent.children.push(current) : parent.children = [current]
}
}
)
}
)
}
translator(parents, children)
return parents
},
},
projectPhaseRowClick:function(projectPhase){ projectPhaseRowClick:function(projectPhase){
this.projectPhase=projectPhase this.projectPhase=projectPhase
this.getXmTasks(); this.getXmTasks();

Loading…
Cancel
Save