diff --git a/src/views/pm/utask_dept10.vue b/src/views/pm/utask_dept10.vue index edfbff95..b7241f08 100644 --- a/src/views/pm/utask_dept10.vue +++ b/src/views/pm/utask_dept10.vue @@ -11,12 +11,21 @@ v-auth="'utask.create'" >新增任务 + 任务分解 任务分解并下达任务下达
@@ -167,6 +176,7 @@ @confirm.stop="table_del(scope.row)" v-if=" scope.row.state == 10 || + scope.row.state == 14 || scope.row.state == 20 " v-auth="'utask.delete'" @@ -235,6 +245,9 @@ export default { data() { return { utaskId: "", + canBreak:true, + canDepuse:true, + isBreakLoading: false, visibleDrawer: false, isLoading: false, selectedIds: [], @@ -254,6 +267,7 @@ export default { paramsUtask: {}, paramsObj: {}, utaskList: [], + selection:[], state_: { 10: "创建中", 14: "已分解", @@ -378,37 +392,60 @@ export default { gantt.refreshData(); }); }, + utaskBreak() { + let that = this; + if (that.selectedIds.length > 0) { + let ids = that.selectedIds; + that.isBreakLoading = true; + that.$API.pm.utask.scheduemtasks.req({ ids: ids }).then((res) => { + that.$message.success("任务分解成功"); + that.isBreakLoading = false; + that.$refs.table.refresh(); + }).catch(() => { + that.isBreakLoading = false; + }); + } else { + this.$message.error("未选择任何任务"); + } + }, utaskDepuse() { let that = this; if (that.selectedIds.length > 0) { let ids = that.selectedIds; that.isLoading = true; - that.$API.pm.utask.scheduemtasks - .req({ ids: ids }) - .then((res) => { - that.$API.pm.utask.assgin - .req({ ids: ids }) - .then((res) => { - that.$message.success("下达任务成功"); - that.isLoading = false; - that.$refs.table.refresh(); - }) - .catch(() => { - that.isLoading = false; - }); - }) - .catch(() => { - that.isLoading = false; - }); + that.$API.pm.utask.assgin.req({ ids: ids }).then((res) => { + that.$message.success("下达任务成功"); + that.isLoading = false; + that.$refs.table.refresh(); + }).catch(() => { + that.isLoading = false; + }); } else { this.$message.error("未选择任何任务"); } }, handleSelectionChange(selection) { this.selectedIds = []; - selection.forEach((item) => { - this.selectedIds.push(item.id); - }); + this.selection= selection; + if(selection.length>0){ + selection.forEach((item) => { + this.selectedIds.push(item.id); + if(item.state == 10){//创建中 + this.canBreak = true; + this.canDepuse = false; + }else if(item.state == 14){//已分解 + this.canDepuse = true; + this.canBreak = false; + }else{ + this.canBreak = false; + this.canDepuse = false; + } + }); + }else{ + this.canBreak = true; + this.canDepuse = true; + } + }, utaskCreate() { this.dialog.save = true; diff --git a/src/views/pm/utask_dept6.vue b/src/views/pm/utask_dept6.vue index 0d4a79eb..8d3bc050 100644 --- a/src/views/pm/utask_dept6.vue +++ b/src/views/pm/utask_dept6.vue @@ -14,8 +14,9 @@ 任务分解 任务下达
@@ -251,6 +253,8 @@ export default { data() { return { utaskId: "", + canBreak:true, + canDepuse:true, visibleDrawer: false, isLoading: false, selectedIds: [], @@ -400,16 +404,16 @@ export default { let that = this; if (that.selectedIds.length > 0) { let ids = that.selectedIds; - that.isLoading = true; + that.isBreakLoading = true; that.$API.pm.utask.scheduemtasks .req({ ids: ids }) .then((res) => { that.$message.success("分解任务成功"); - that.isLoading = false; + that.isBreakLoading = false; that.$refs.table.refresh(); }) .catch(() => { - that.isLoading = false; + that.isBreakLoading = false; }); } else { this.$message.error("未选择任何任务"); @@ -436,9 +440,24 @@ export default { }, handleSelectionChange(selection) { this.selectedIds = []; - selection.forEach((item) => { - this.selectedIds.push(item.id); - }); + if(selection.length>0){ + selection.forEach((item) => { + this.selectedIds.push(item.id); + if(item.state == 10){//创建中 + this.canBreak = true; + this.canDepuse = false; + }else if(item.state == 14){//已分解 + this.canDepuse = true; + this.canBreak = false; + }else{ + this.canBreak = false; + this.canDepuse = false; + } + }); + }else{ + this.canBreak = true; + this.canDepuse = true; + } }, utaskCreate() { this.dialog.save = true; diff --git a/src/views/pm/utask_dept7.vue b/src/views/pm/utask_dept7.vue index fa617c4e..fd8c4269 100644 --- a/src/views/pm/utask_dept7.vue +++ b/src/views/pm/utask_dept7.vue @@ -11,12 +11,21 @@ v-auth="'utask.create'" >新增任务 + 任务分解 任务分解并下达任务下达
@@ -165,16 +174,11 @@ 0) { let ids = that.selectedIds; + that.isBreakLoading = true; + that.$API.pm.utask.scheduemtasks.req({ ids: ids }).then((res) => { + that.isBreakLoading = false; + that.$refs.table.refresh(); + that.$message.success("任务分解成功"); + }).catch(() => { + that.isBreakLoading = false; + }); + } else { + this.$message.error("未选择任何任务"); + } + }, + utaskDepuse() { + let that = this; + if (that.selectedIds.length > 0) { that.isLoading = true; - that.$API.pm.utask.scheduemtasks - .req({ ids: ids }) - .then((res) => { - that.$API.pm.utask.assgin - .req({ ids: ids }) - .then((res) => { - that.$message.success("下达任务成功"); - that.isLoading = false; - that.$refs.table.refresh(); - }) - .catch(() => { - that.isLoading = false; - }); - }) - .catch(() => { - that.isLoading = false; - }); + let ids = that.selectedIds; + that.$API.pm.utask.assgin.req({ ids: ids }).then((res) => { + that.$message.success("任务下达成功"); + that.isLoading = false; + that.$refs.table.refresh(); + }).catch(() => { + that.isLoading = false; + }); } else { this.$message.error("未选择任何任务"); } }, handleSelectionChange(selection) { this.selectedIds = []; - selection.forEach((item) => { - this.selectedIds.push(item.id); - }); + this.selection= selection; + if(selection.length>0){ + selection.forEach((item) => { + this.selectedIds.push(item.id); + if(item.state == 10){//创建中 + this.canBreak = true; + this.canDepuse = false; + }else if(item.state == 14){//已分解 + this.canDepuse = true; + this.canBreak = false; + }else{ + this.canBreak = false; + this.canDepuse = false; + } + }); + }else{ + this.canBreak = true; + this.canDepuse = true; + } + }, utaskCreate() { this.dialog.save = true;