Browse Source

优化

master
陈裕财 4 years ago
parent
commit
9abe242f73
  1. 7
      src/common/js/treeTool.js
  2. 3
      src/views/xm/core/xmProjectPhase/XmProjectPhaseMng.vue
  3. 7
      src/views/xm/core/xmTask/XmTaskAdd.vue
  4. 42
      src/views/xm/core/xmTask/XmTaskEdit.vue
  5. 546
      src/views/xm/core/xmTask/XmTaskMng.vue
  6. 20
      src/views/xm/core/xmTask/XmTaskMngBatch.vue

7
src/common/js/treeTool.js

@ -4,12 +4,15 @@ export default {
reloadChildren: function(table,maps, parentId,parentIdName,loadChildren) { reloadChildren: function(table,maps, parentId,parentIdName,loadChildren) {
var lazyTreeNodeMap=table.store.states.lazyTreeNodeMap var lazyTreeNodeMap=table.store.states.lazyTreeNodeMap
if (maps.get(parentId)) { if (maps.get(parentId)) {
const { tree, treeNode, resolve } = maps.get(parentId)
const { tree, treeNode, resolve } = maps.get(parentId)
lazyTreeNodeMap[parentId]=[]
if (tree) { // 重新执行父节点加载子级操作 if (tree) { // 重新执行父节点加载子级操作
loadChildren(tree, treeNode, resolve) loadChildren(tree, treeNode, resolve)
if (tree[parentIdName]) { // 若存在爷爷结点,则执行爷爷节点加载子级操作,防止最后一个子节点被删除后父节点不显示删除按钮 if (tree[parentIdName]) { // 若存在爷爷结点,则执行爷爷节点加载子级操作,防止最后一个子节点被删除后父节点不显示删除按钮
const a = maps.get(tree[parentIdName]) const a = maps.get(tree[parentIdName])
loadChildren(a.tree, a.treeNode, a.resolve)
if(a && a.tree){
this.reloadChildren(table,maps,tree[parentIdName],parentIdName,loadChildren)
}
} }
} }
} }

3
src/views/xm/core/xmProjectPhase/XmProjectPhaseMng.vue

@ -640,8 +640,7 @@ import XmProjectGroupSelect from '../xmProjectGroup/XmProjectGroupSelect.vue';
batchDelXmProjectPhase(phases).then((res) => { batchDelXmProjectPhase(phases).then((res) => {
this.load.del=false; this.load.del=false;
var tips=res.data.tips; var tips=res.data.tips;
if( tips.isOk ){
debugger;
if( tips.isOk ){
this.pageInfo.count=true; this.pageInfo.count=true;
var parents=phases.filter(i=>!phases.some(k=>k.id==i.parentPhaseId)); var parents=phases.filter(i=>!phases.some(k=>k.id==i.parentPhaseId));
var isLoadAll=parents.some(i=>i.lvl<=1||!this.maps.get(i.parentPhaseId)); var isLoadAll=parents.some(i=>i.lvl<=1||!this.maps.get(i.parentPhaseId));

7
src/views/xm/core/xmTask/XmTaskAdd.vue

@ -26,7 +26,10 @@
<el-card class="box-card" header="基础信息" id="baseInfoAdd" shadow="hover"> <el-card class="box-card" header="基础信息" id="baseInfoAdd" shadow="hover">
<el-form-item label="" prop="ntype"> <el-form-item label="" prop="ntype">
<el-radio v-model="addForm.ntype" label="1">任务集</el-radio> <el-radio v-model="addForm.ntype" label="1">任务集</el-radio>
<el-radio v-model="addForm.ntype" label="0">任务</el-radio>
<el-radio v-model="addForm.ntype" label="0">任务</el-radio>
<font color="red">
<br>任务集只负责汇总数据类似文件夹功能任务集下可建立子任务集子任务,但不能关联需求;<br>任务下不能建立子任务集也不能建立子任务但可以关联需求
</font>
</el-form-item> </el-form-item>
<el-form-item label="名称" prop="name"> <el-form-item label="名称" prop="name">
<el-row> <el-row>
@ -351,7 +354,7 @@
var tips=res.data.tips; var tips=res.data.tips;
if(tips.isOk){ if(tips.isOk){
//this.$refs['addForm'].resetFields(); //this.$refs['addForm'].resetFields();
this.$emit('submit');// @submit="afterAddSubmit"
this.$emit('submit',res.data.data);// @submit="afterAddSubmit"
} }
this.$message({showClose: true, message: tips.msg, type: tips.isOk?'success':'error' }); this.$message({showClose: true, message: tips.msg, type: tips.isOk?'success':'error' });
}).catch( err => this.load.add=false); }).catch( err => this.load.add=false);

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

@ -28,6 +28,9 @@
<el-form-item label="" prop="ntype"> <el-form-item label="" prop="ntype">
<el-radio v-model="editForm.ntype" label="1">任务集</el-radio> <el-radio v-model="editForm.ntype" label="1">任务集</el-radio>
<el-radio v-model="editForm.ntype" label="0">任务</el-radio> <el-radio v-model="editForm.ntype" label="0">任务</el-radio>
<font color="red">
<br>任务集只负责汇总数据类似文件夹功能任务集下可建立子任务集子任务,但不能关联需求;<br>任务下不能建立子任务集也不能建立子任务但可以关联需求
</font>
</el-form-item> </el-form-item>
<el-form-item label="名称" prop="name"> <el-form-item label="名称" prop="name">
<el-row> <el-row>
@ -131,6 +134,7 @@
<el-card class="box-card" header="工作量、成本" id="costInfo"> <el-card class="box-card" header="工作量、成本" id="costInfo">
<el-form-item label="预估工作量" prop="budgetWorkload"> <el-form-item label="预估工作量" prop="budgetWorkload">
<el-input-number v-model="editForm.budgetWorkload" @change="onBudgetWorkloadChange" :precision="2" :step="8" :min="0" placeholder="预计总工作量(人时,不包括下一级)"></el-input-number> <el-tag>人时{{this.toFixed(editForm.budgetWorkload/8/20)}}人月</el-tag> <el-input-number v-model="editForm.budgetWorkload" @change="onBudgetWorkloadChange" :precision="2" :step="8" :min="0" placeholder="预计总工作量(人时,不包括下一级)"></el-input-number> <el-tag>人时{{this.toFixed(editForm.budgetWorkload/8/20)}}人月</el-tag>
<font color="red">人月单价内购: {{projectPhase.phaseBudgetInnerUserPrice}} &nbsp;&nbsp; 外购: {{projectPhase.phaseBudgetOutUserPrice}}</font>
</el-form-item> </el-form-item>
<el-form-item label="预估金额" prop="taskOut"> <el-form-item label="预估金额" prop="taskOut">
<el-checkbox v-model="editForm.taskOut" @change="onTaskOutChange" true-label="1" false-label="0">是否为众包任务</el-checkbox> <el-checkbox v-model="editForm.taskOut" @change="onTaskOutChange" true-label="1" false-label="0">是否为众包任务</el-checkbox>
@ -237,16 +241,19 @@
calcTaskStep(){ calcTaskStep(){
if(!this.editForm.executorUserid){ if(!this.editForm.executorUserid){
return 1 return 1
}else if(this.editForm.exeUsernames.indexOf('执行中')>=0){
return 2
}else if(this.editForm.exeUsernames.indexOf('已验收')>=0){
return 3
}else if(this.editForm.exeUsernames.indexOf('已验收')>=0){
return 3
}else if(this.editForm.exeUsernames.indexOf('已验收')>=0){
return 3
} if(this.editForm.exeUsernames.indexOf('已结算')>=0){
return 4
}else if(this.editForm.exeUsernames) {
if(this.editForm.exeUsernames.indexOf('执行中')>=0){
return 3
}else if(this.editForm.exeUsernames.indexOf('已验收')>=0){
return 4
}else if(this.editForm.exeUsernames.indexOf('已验收')>=0){
return 4
}else if(this.editForm.exeUsernames.indexOf('已验收')>=0){
return 4
} if(this.editForm.exeUsernames.indexOf('已结算')>=0){
return 5
}
} }
} }
}, },
@ -343,11 +350,7 @@
this.$emit('cancel'); this.$emit('cancel');
}, },
//XmTask xm_task @submit="afterAddSubmit" //XmTask xm_task @submit="afterAddSubmit"
editSubmit: function () {
if( !this.roles.some(i=>i.roleid=='projectAdmin') && !this.roles.some(i=>i.roleid=='teamAdmin')){
this.$message.error("只有项目经理、小组长可以操作");
return;
}
editSubmit: function () {
this.$refs.editForm.validate((valid) => { this.$refs.editForm.validate((valid) => {
if (valid) { if (valid) {
this.$confirm('确认提交吗?', '提示', {}).then(() => { this.$confirm('确认提交吗?', '提示', {}).then(() => {
@ -365,7 +368,7 @@
var tips=res.data.tips; var tips=res.data.tips;
if(tips.isOk){ if(tips.isOk){
//this.$refs['editForm'].resetFields(); //this.$refs['editForm'].resetFields();
this.$emit('submit');// @submit="aftereditSubmit"
this.$emit('submit',res.data.data);// @submit="aftereditSubmit"
} }
this.$message({showClose: true, message: tips.msg, type: tips.isOk?'success':'error' }); this.$message({showClose: true, message: tips.msg, type: tips.isOk?'success':'error' });
}).catch( err => this.load.edit=false); }).catch( err => this.load.edit=false);
@ -410,6 +413,7 @@
if(tips.isOk){ if(tips.isOk){
this.skillVisible = false; this.skillVisible = false;
// this.getXmTasks(); // this.getXmTasks();
this.$emit("submit",this.editForm)
} }
this.$message({showClose: true, message: tips.msg, type: tips.isOk?'success':'error' }); this.$message({showClose: true, message: tips.msg, type: tips.isOk?'success':'error' });
}).catch( err => this.load.add=false); }).catch( err => this.load.add=false);
@ -536,6 +540,7 @@
if(tips.isOk){ if(tips.isOk){
this.$message.success("设置成功"); this.$message.success("设置成功");
this.groupUserSelectVisible=false; this.groupUserSelectVisible=false;
this.$emit("submit",this.editForm)
}else{ }else{
this.$message.error(tips.msg); this.$message.error(tips.msg);
} }
@ -547,9 +552,12 @@
}, },
afterAddExecSubmit(execForm){ afterAddExecSubmit(execForm){
this.$emit("submit",this.editForm)
this.$emit("after-add-submit",execForm); this.$emit("after-add-submit",execForm);
}, },
afterEditExecSubmit(execForm){
afterEditExecSubmit(execForm){
debugger;
this.$emit("submit",this.editForm)
this.$emit("after-edit-submit",execForm); this.$emit("after-edit-submit",execForm);
}, },
onTagSelected(tags) { onTagSelected(tags) {

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

@ -364,6 +364,8 @@
<el-table <el-table
v-else v-else
show-summary show-summary
lazy
:load="loadXmTaskLazy"
:data="tasksTreeData" :data="tasksTreeData"
@sort-change="sortChange" @sort-change="sortChange"
v-loading="load.list" v-loading="load.list"
@ -374,10 +376,9 @@
stripe stripe
fit fit
border border
tooltip-effect="light"
default-expand-all
tooltip-effect="light"
:max-height="tableHeight" :max-height="tableHeight"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
:tree-props="{ children: 'children', hasChildren: 'childrenCnt' }"
row-key="id" row-key="id"
ref="table" ref="table"
> >
@ -736,6 +737,8 @@
:project-phase="currentProjectPhase" :project-phase="currentProjectPhase"
:visible="editFormVisible" :visible="editFormVisible"
@cancel="editFormVisible = false" @cancel="editFormVisible = false"
@after-add-submit="afterEditSubmit"
@after-edit-submit="afterEditSubmit"
@submit="afterEditSubmit" @submit="afterEditSubmit"
></xm-task-edit> ></xm-task-edit>
</el-drawer> </el-drawer>
@ -972,6 +975,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 { import {
@ -1078,19 +1082,8 @@ export default {
} }
}, },
tasksTreeData() { tasksTreeData() {
let xmTasks = JSON.parse(JSON.stringify(this.xmTasks || []));
if (this.valueChangeRows && this.valueChangeRows.length) {
this.valueChangeRows.forEach((c) => {
var index = xmTasks.findIndex((i) => i.id == c.id);
const oldRow = JSON.parse(JSON.stringify(xmTasks[index]));
xmTasks.splice(index, 1);
c.parentTaskid = oldRow.parentTaskid;
xmTasks.push(c);
});
}
const tasksTreeData = this.translateDataToTree(xmTasks);
let xmTasks = JSON.parse(JSON.stringify(this.xmTasks || []));
const tasksTreeData = treeTool.translateDataToTree(xmTasks,"parentTaskid","id");
return tasksTreeData; return tasksTreeData;
}, },
@ -1348,6 +1341,7 @@ export default {
budgetDateRanger: [], budgetDateRanger: [],
actDateRanger: [], actDateRanger: [],
tagSelectVisible: false, tagSelectVisible: false,
maps:new Map(),
}; };
}, //end data }, //end data
methods: { methods: {
@ -1431,79 +1425,8 @@ export default {
} }
params.orderBy = orderBys.join(","); params.orderBy = orderBys.join(",");
} }
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
);
}
this.load.list = true;
if (this.filters.selProject) {
params.projectId = this.filters.selProject.id;
}
params.workexec = "true";
if (this.projectPhase) {
{
params.projectPhaseId = 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);
}
params=this.getParams(params)
params.isTop="1"
params.withParents="1" params.withParents="1"
getTask(params) getTask(params)
@ -1603,26 +1526,14 @@ export default {
}, },
editProgress(rate) { editProgress(rate) {
var isCreate = this.userInfo.userid == this.editForm.createUserid;
var isExec = this.userInfo.userid == this.editForm.executorUserid;
if (!isCreate && !isExec) {
this.$message({
showClose: true,
message: "你不是该任务的执行人、主负责人,不能更新进度",
type: "error",
});
return;
}
if (rate) {
this.editForm.rate = rate;
}
let params = { let params = {
id: this.editForm.id, id: this.editForm.id,
rate: this.editForm.rate,
rate: rate,
projectId: this.editForm.projectId, projectId: this.editForm.projectId,
parentTaskid: this.editForm.parentTaskid, parentTaskid: this.editForm.parentTaskid,
}; };
if (this.editForm.rate == 0) {
if (rate == 0) {
this.$message({ this.$message({
showClose: true, showClose: true,
message: "不允许更新为0", message: "不允许更新为0",
@ -1634,12 +1545,16 @@ export default {
editRate(params) editRate(params)
.then((res) => { .then((res) => {
var tips = res.data.tips; var tips = res.data.tips;
if(tips.isOk){
var row=this.editForm
this.getXmTasks()
treeTool.reloadChildren(this.$refs.table,this.maps,row.parentTaskid,'parentTaskid',this.loadXmTaskLazy)
}
this.$message({ this.$message({
showClose: true, showClose: true,
message: tips.msg, message: tips.msg,
type: tips.isOk ? "success" : "error", type: tips.isOk ? "success" : "error",
});
this.getXmTasks();
});
this.load.edit = false; this.load.edit = false;
}) })
.catch((err) => { .catch((err) => {
@ -1702,28 +1617,24 @@ export default {
} }
this.addFormVisible = true; this.addFormVisible = true;
}, },
afterAddSubmit() {
afterAddSubmit(row) {
this.addFormVisible = false; this.addFormVisible = false;
this.pageInfo.count = true;
this.getXmTasks();
this.pageInfo.count = true;
this.getXmTasks()
treeTool.reloadChildren(this.$refs.table,this.maps,row.parentTaskid,'parentTaskid',this.loadXmTaskLazy)
}, },
afterEditSubmit() { afterEditSubmit() {
this.editFormVisible = false; this.editFormVisible = false;
this.getXmTasks();
var row=this.editForm
this.getXmTasks()
treeTool.reloadChildren(this.$refs.table,this.maps,row.parentTaskid,'parentTaskid',this.loadXmTaskLazy)
}, },
//xmTask //xmTask
selsChange: function (sels) { selsChange: function (sels) {
this.sels = sels; this.sels = sels;
}, },
//xmTask //xmTask
handleDel: function (row, index) {
if (
!this.roles.some((i) => i.roleid == "projectAdmin") &&
!this.roles.some((i) => i.roleid == "teamAdmin")
) {
this.$message.error("只有项目经理、小组长可以操作");
return;
}
handleDel: function (row, index) {
this.$confirm("确认删除该记录吗?", "提示", { this.$confirm("确认删除该记录吗?", "提示", {
type: "warning", type: "warning",
}).then(() => { }).then(() => {
@ -1734,8 +1645,9 @@ export default {
this.load.del = false; this.load.del = false;
var tips = res.data.tips; var tips = res.data.tips;
if (tips.isOk) { if (tips.isOk) {
this.pageInfo.count = true;
this.getXmTasks();
this.pageInfo.count = true;
this.getXmTasks()
treeTool.reloadChildren(this.$refs.table,this.maps,row.parentTaskid,'parentTaskid',this.loadXmTaskLazy)
} }
this.$message({ this.$message({
showClose: true, showClose: true,
@ -1765,7 +1677,14 @@ export default {
var tips = res.data.tips; var tips = res.data.tips;
if (tips.isOk) { if (tips.isOk) {
this.pageInfo.count = true; this.pageInfo.count = true;
this.getXmTasks();
var parents=this.sels.filter(i=>!this.sels.some(k=>k.id==i.parentTaskid));
var needLoadChlidList=parents.filter(i=>i.lvl>1)
this.searchXmTasks()
if(needLoadChlidList.length>0){
needLoadChlidList.forEach(i=>{
treeTool.reloadChildren(this.$refs.table,this.maps,i.parentTaskid,'parentTaskid',this.loadXmTaskLazy)
})
}
} }
this.$message({ this.$message({
showClose: true, showClose: true,
@ -1793,6 +1712,7 @@ export default {
showDrawer: function (row) { showDrawer: function (row) {
this.editFormVisible = true; this.editFormVisible = true;
debugger;
this.editForm = row; this.editForm = row;
// this.$emit('row-click',row,);// @row-click="rowClick" // this.$emit('row-click',row,);// @row-click="rowClick"
@ -1965,7 +1885,11 @@ export default {
.then((res) => { .then((res) => {
var tips = res.data.tips; var tips = res.data.tips;
if (tips.isOk) { if (tips.isOk) {
this.getXmTasks();
this.getXmTasks();
if(this.parentTask && this.parentTask.id){
treeTool.reloadChildren(this.$refs.table,this.maps,this.parentTask.id,'parentTaskid',this.loadXmTaskLazy)
}
} }
this.taskTemplateVisible = false; this.taskTemplateVisible = false;
this.$message({ this.$message({
@ -2011,62 +1935,7 @@ export default {
handleSelect(key, keyPath) { handleSelect(key, keyPath) {
this.drawerkey = key; this.drawerkey = key;
}, },
translateDataToTree(data2) {
var data = JSON.parse(JSON.stringify(data2));
let parents = data.filter((value) => {
value.startDate = value.startTime
? value.startTime.substr(0, 10)
: null;
value.endDate = value.endTime ? value.endTime.substr(0, 10) : null;
value.realStartDate = value.actStartTime
? value.actStartTime.substr(0, 10)
: null;
value.realEndDate = value.actEndTime
? value.actEndTime.substr(0, 10)
: null;
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;
if(projectPhase.ntype=='1'){ if(projectPhase.ntype=='1'){
@ -2198,78 +2067,13 @@ export default {
if (this.projectPhase == null) { if (this.projectPhase == null) {
this.$message({ this.$message({
showClose: true, showClose: true,
message: "请选择计划再编辑",
message: "请在左边选择计划再编辑",
type: "error", type: "error",
}); });
return; return;
} }
this.batchEditVisible = true; this.batchEditVisible = true;
},
fieldChange: function (row, fieldName, nextReplace) {
if (nextReplace) {
row.nextReplace = nextReplace;
}
console.log("fieldChange--row.opType==", row.opType);
if (fieldName == "startTime" || fieldName == "endTime") {
if (row.startTime && row.endTime) {
var start = new Date(row.startTime);
var end = new Date(row.endTime);
var days = this.getDaysBetween(end, start);
if (
row.taskOut == "1" &&
this.projectPhase.phaseBudgetOutUserPrice &&
!row.budgetWorkload
) {
row.budgetWorkload = parseFloat((days * 8).toFixed(2));
row.budgetCost =
row.budgetWorkload * this.projectPhase.phaseBudgetOutUserPrice;
} else if (
row.taskOut != "1" &&
this.projectPhase.phaseBudgetInnerUserPrice &&
!row.budgetWorkload
) {
row.budgetWorkload = parseFloat((days * 8).toFixed(2));
row.budgetCost =
row.budgetWorkload * this.projectPhase.phaseBudgetInnerUserPrice;
}
}
}
if (fieldName == "budgetWorkload" || fieldName == "taskOut") {
if (row.taskOut == "1" && this.projectPhase.phaseBudgetOutUserPrice) {
row.budgetCost =
row.budgetWorkload * this.projectPhase.phaseBudgetOutUserPrice;
} else if (
row.taskOut != "1" &&
this.projectPhase.phaseBudgetInnerUserPrice
) {
row.budgetCost =
row.budgetWorkload * this.projectPhase.phaseBudgetInnerUserPrice;
}
}
if (row.opType) {
var index = this.valueChangeRows.findIndex((i) => i.id == row.id);
if (index >= 0) {
this.valueChangeRows.splice(index, 1);
this.valueChangeRows.push(row);
} else {
this.valueChangeRows.push(row);
}
} else {
var oneRow = this.valueChangeRows.find((i) => i.id == row.id);
if (oneRow) {
if (oneRow.nextReplace) {
var index = this.valueChangeRows.findIndex((i) => i.id == row.id);
this.valueChangeRows.splice(index, 1);
this.valueChangeRows.push(row);
} else {
return;
}
} else {
this.valueChangeRows.push(row);
}
}
},
},
getRowSum(row) { getRowSum(row) {
var budgetCost = this.getFloatValue(row.budgetCost); var budgetCost = this.getFloatValue(row.budgetCost);
if (row.taskOut == "1") { if (row.taskOut == "1") {
@ -2343,117 +2147,12 @@ export default {
} else { } else {
this.showEdit(task); this.showEdit(task);
} }
},
handlePopover: function (row, opType) {
if (
!this.roles.some((i) => i.roleid == "projectAdmin") &&
!this.roles.some((i) => i.roleid == "teamAdmin")
) {
this.$message.error("只有项目经理、小组长可以操作");
return;
}
if ("add" == opType) {
var subRow = JSON.parse(JSON.stringify(this.addForm));
subRow.parentTaskid = null;
subRow.id = sn();
subRow.sortLevel = "1";
subRow.opType = opType;
subRow.branchId = this.selProject.branchId;
subRow.projectId = this.selProject.id;
subRow.projectName = this.selProject.name;
if (this.projectPhase == null) {
subRow.projectPhaseId = this.parentTask.projectPhaseId;
subRow.projectPhaseName = this.parentTask.projectPhaseName;
subRow.sortLevel = subRow.sortLevel
? subRow.sortLevel
: this.parentTask.sortLevel;
subRow.taskType = subRow.taskType
? subRow.taskType
: this.parentTask.taskType;
subRow.taskClass = subRow.taskClass
? subRow.taskClass
: this.parentTask.taskClass;
} else {
subRow.projectPhaseId = this.projectPhase.id;
subRow.projectPhaseName = this.projectPhase.phaseName;
subRow.sortLevel = subRow.sortLevel
? subRow.sortLevel
: this.projectPhase.seqNo;
subRow.taskType = subRow.taskType
? subRow.taskType
: this.projectPhase.taskType;
}
subRow.budgetCost = 0;
subRow.budgetWorkload = 80;
subRow.level = subRow.level ? subRow.level : "3";
subRow.planType = subRow.planType ? subRow.planType : "w2";
subRow.actCost = 0;
subRow.actWorkload = 0;
subRow.taskState = "0";
subRow.rate = 0;
subRow.taskOut = subRow.taskOut ? subRow.taskOut : "0";
subRow.taskClass = subRow.taskClass ? subRow.taskClass : "1";
subRow.toTaskCenter = subRow.toTaskCenter ? subRow.toTaskCenter : "1";
subRow.settleSchemel = subRow.settleSchemel
? subRow.settleSchemel
: "quotePrice";
subRow.createUserid = this.userInfo.userid;
subRow.createUsername = this.userInfo.username;
const createTime = new Date();
var startTime = new Date();
const endTime = new Date();
endTime.setTime(startTime.getTime() + 3600 * 1000 * 24 * 7 * 2); //
subRow.createTime = util.formatDate.format(
createTime,
"yyyy-MM-dd HH:mm:ss"
);
subRow.startTime = util.formatDate.format(
startTime,
"yyyy-MM-dd HH:mm:ss"
);
subRow.endTime = util.formatDate.format(endTime, "yyyy-MM-dd HH:mm:ss");
this.fieldChange(subRow, "sortLevel");
this.xmTasks.unshift(subRow);
} else if ("addSub" == opType) {
var subRow = JSON.parse(JSON.stringify(row));
subRow.children = [];
subRow.parentTaskid = row.id;
subRow.id = sn();
subRow.sortLevel = row.sortLevel + ".1";
subRow.opType = opType;
this.fieldChange(subRow, "sortLevel");
this.xmTasks.unshift(subRow);
} else if ("delete" == opType) {
if (row.opType && (row.opType == "addSub" || row.opType == "add")) {
if (row.children && row.children.length > 0) {
this.$message.error("请先删除子元素");
return;
} else {
var index = this.xmTasks.findIndex((i) => i.id == row.id);
var indexValueChanges = this.valueChangeRows.findIndex(
(i) => i.id == row.id
);
this.valueChangeRows.splice(indexValueChanges, 1);
this.xmTasks.splice(index, 1);
}
} else {
this.$message.error("只能删除未保存的行");
return;
}
} else if ("highestPmenuId" === opType) {
if (row.id) {
this.xmTasks.find((d) => {
if (d.id === row.id) {
d.parentTaskid = "";
this.fieldChange(d, "seqNo");
}
});
}
}
},
},
afterExecuserSubmit() { afterExecuserSubmit() {
this.getXmTasks();
var row=this.editForm
this.getXmTasks()
treeTool.reloadChildren(this.$refs.table,this.maps,row.parentTaskid,'parentTaskid',this.loadXmTaskLazy)
}, },
toJoin() { toJoin() {
if ( if (
@ -2511,46 +2210,8 @@ export default {
} }
this.searchXmTasks(); this.searchXmTasks();
this.menuExecutor = false; this.menuExecutor = false;
},
//
// dict sIdmenuId; ePmeuId menuId;
judgePmenuId(dict, sId, ePmeuId) {
if (sId === ePmeuId) {
return true;
} else if (dict[ePmeuId]) {
return this.judgePmenuId(dict, sId, dict[ePmeuId]);
} else {
return false;
}
},
changePmenuId(sId, eId) {
let dict = {};
this.xmTasks.forEach((d) => {
dict[d.id] = d.parentTaskid || "";
});
if (!dict[eId]) {
this.xmTasks.find((d) => {
if (d.id === sId) {
d.parentTaskid = eId;
console.log("更新关系1");
this.fieldChange(d, "pmenuId", true);
}
});
} else {
const isSynezesis = this.judgePmenuId(dict, sId, dict[eId]);
if (!isSynezesis) {
this.xmTasks.find((d) => {
if (d.id === sId) {
d.parentTaskid = eId;
console.log("更新关系2");
this.fieldChange(d, "pmenuId", true);
}
});
} else {
console.log("形成闭合回路--拖拽不更新");
}
}
},
},
batchEditBack: function (needReload) { batchEditBack: function (needReload) {
if (needReload == true) { if (needReload == true) {
this.searchXmTasks(); this.searchXmTasks();
@ -2653,7 +2314,100 @@ export default {
this.filters.tags=tags this.filters.tags=tags
} }
this.searchXmTasks(); this.searchXmTasks();
}
},
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.selProject) {
params.projectId = this.filters.selProject.id;
}
params.workexec = "true";
if (this.projectPhase) {
{
params.projectPhaseId = 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){
resolve(res.data.data)
}else{
resolve([])
}
}).catch( err => this.load.list = false );
},
/**end 自定义函数请在上面加**/ /**end 自定义函数请在上面加**/
}, //end methods }, //end methods
components: { components: {

20
src/views/xm/core/xmTask/XmTaskMngBatch.vue

@ -136,6 +136,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';
@ -163,20 +164,9 @@
} }
}, },
tasksTreeData() { tasksTreeData() {
let xmTasks = JSON.parse(JSON.stringify(this.xmTasks || []));
if (this.valueChangeRows && this.valueChangeRows.length) {
this.valueChangeRows.forEach(c => {
var index = xmTasks.findIndex(i=>i.id==c.id);
const oldRow = JSON.parse(JSON.stringify(xmTasks[index]));
xmTasks.splice(index,1);
c.parentTaskid = oldRow.parentTaskid;
xmTasks.push(c);
})
}
const tasksTreeData = this.translateDataToTree(xmTasks);
this.rowDrop();
let xmTasks = JSON.parse(JSON.stringify(this.xmTasks || []));
const tasksTreeData = treeTool.translateDataToTree(xmTasks);
//this.rowDrop();
return tasksTreeData; return tasksTreeData;
}, },
@ -388,7 +378,7 @@
if(this.projectPhase){{ if(this.projectPhase){{
params.projectPhaseId=this.projectPhase.id params.projectPhaseId=this.projectPhase.id
}} }}
params.isTop="1"
params.withParents="1" params.withParents="1"
getTask(params).then((res) => { getTask(params).then((res) => {
var tips=res.data.tips; var tips=res.data.tips;

Loading…
Cancel
Save