fix:光子任务分解下达拆开

This commit is contained in:
shijing 2025-04-25 10:42:04 +08:00
parent 9c73b60a7b
commit 220b5a6818
3 changed files with 144 additions and 57 deletions

View File

@ -11,12 +11,21 @@
v-auth="'utask.create'" v-auth="'utask.create'"
>新增任务</el-button >新增任务</el-button
> >
<el-button
type="primary"
@click="utaskBreak"
v-loading="isBreakLoading"
v-auth="'utask.assgin'"
:disabled="!canBreak"
>任务分解</el-button
>
<el-button <el-button
type="primary" type="primary"
@click="utaskDepuse" @click="utaskDepuse"
v-loading="isLoading" v-loading="isLoading"
v-auth="'utask.assgin'" v-auth="'utask.assgin'"
>任务分解并下达</el-button :disabled="!canDepuse"
>任务下达</el-button
> >
</div> </div>
<div class="'right-panel'"> <div class="'right-panel'">
@ -167,6 +176,7 @@
@confirm.stop="table_del(scope.row)" @confirm.stop="table_del(scope.row)"
v-if=" v-if="
scope.row.state == 10 || scope.row.state == 10 ||
scope.row.state == 14 ||
scope.row.state == 20 scope.row.state == 20
" "
v-auth="'utask.delete'" v-auth="'utask.delete'"
@ -235,6 +245,9 @@ export default {
data() { data() {
return { return {
utaskId: "", utaskId: "",
canBreak:true,
canDepuse:true,
isBreakLoading: false,
visibleDrawer: false, visibleDrawer: false,
isLoading: false, isLoading: false,
selectedIds: [], selectedIds: [],
@ -254,6 +267,7 @@ export default {
paramsUtask: {}, paramsUtask: {},
paramsObj: {}, paramsObj: {},
utaskList: [], utaskList: [],
selection:[],
state_: { state_: {
10: "创建中", 10: "创建中",
14: "已分解", 14: "已分解",
@ -378,37 +392,60 @@ export default {
gantt.refreshData(); 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() { utaskDepuse() {
let that = this; let that = this;
if (that.selectedIds.length > 0) { if (that.selectedIds.length > 0) {
let ids = that.selectedIds; let ids = that.selectedIds;
that.isLoading = true; that.isLoading = true;
that.$API.pm.utask.scheduemtasks that.$API.pm.utask.assgin.req({ ids: ids }).then((res) => {
.req({ ids: ids }) that.$message.success("下达任务成功");
.then((res) => { that.isLoading = false;
that.$API.pm.utask.assgin that.$refs.table.refresh();
.req({ ids: ids }) }).catch(() => {
.then((res) => { that.isLoading = false;
that.$message.success("下达任务成功"); });
that.isLoading = false;
that.$refs.table.refresh();
})
.catch(() => {
that.isLoading = false;
});
})
.catch(() => {
that.isLoading = false;
});
} else { } else {
this.$message.error("未选择任何任务"); this.$message.error("未选择任何任务");
} }
}, },
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.selectedIds = []; this.selectedIds = [];
selection.forEach((item) => { this.selection= selection;
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() { utaskCreate() {
this.dialog.save = true; this.dialog.save = true;

View File

@ -14,8 +14,9 @@
<el-button <el-button
type="primary" type="primary"
@click="utaskDepuse" @click="utaskDepuse"
v-loading="isLoading" v-loading="isBreakLoading"
v-auth="'utask.schedule'" v-auth="'utask.schedule'"
:disabled="!canBreak"
>任务分解</el-button >任务分解</el-button
> >
<el-button <el-button
@ -23,6 +24,7 @@
@click="utaskAssgin" @click="utaskAssgin"
v-loading="isLoading" v-loading="isLoading"
v-auth="'utask.assgin'" v-auth="'utask.assgin'"
:disabled="!canDepuse"
>任务下达</el-button >任务下达</el-button
> >
</div> </div>
@ -251,6 +253,8 @@ export default {
data() { data() {
return { return {
utaskId: "", utaskId: "",
canBreak:true,
canDepuse:true,
visibleDrawer: false, visibleDrawer: false,
isLoading: false, isLoading: false,
selectedIds: [], selectedIds: [],
@ -400,16 +404,16 @@ export default {
let that = this; let that = this;
if (that.selectedIds.length > 0) { if (that.selectedIds.length > 0) {
let ids = that.selectedIds; let ids = that.selectedIds;
that.isLoading = true; that.isBreakLoading = true;
that.$API.pm.utask.scheduemtasks that.$API.pm.utask.scheduemtasks
.req({ ids: ids }) .req({ ids: ids })
.then((res) => { .then((res) => {
that.$message.success("分解任务成功"); that.$message.success("分解任务成功");
that.isLoading = false; that.isBreakLoading = false;
that.$refs.table.refresh(); that.$refs.table.refresh();
}) })
.catch(() => { .catch(() => {
that.isLoading = false; that.isBreakLoading = false;
}); });
} else { } else {
this.$message.error("未选择任何任务"); this.$message.error("未选择任何任务");
@ -436,9 +440,24 @@ export default {
}, },
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.selectedIds = []; this.selectedIds = [];
selection.forEach((item) => { if(selection.length>0){
this.selectedIds.push(item.id); 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() { utaskCreate() {
this.dialog.save = true; this.dialog.save = true;

View File

@ -11,12 +11,21 @@
v-auth="'utask.create'" v-auth="'utask.create'"
>新增任务</el-button >新增任务</el-button
> >
<el-button
type="primary"
@click="utaskBreak"
v-loading="isBreakLoading"
v-auth="'utask.assgin'"
:disabled="!canBreak"
>任务分解</el-button
>
<el-button <el-button
type="primary" type="primary"
@click="utaskDepuse" @click="utaskDepuse"
v-loading="isLoading" v-loading="isLoading"
v-auth="'utask.assgin'" v-auth="'utask.assgin'"
>任务分解并下达</el-button :disabled="!canDepuse"
>任务下达</el-button
> >
</div> </div>
<div class="'right-panel'"> <div class="'right-panel'">
@ -165,16 +174,11 @@
<el-popconfirm <el-popconfirm
title="确定删除吗?" title="确定删除吗?"
@confirm.stop="table_del(scope.row)" @confirm.stop="table_del(scope.row)"
v-if=" v-if="scope.row.state == 10 ||scope.row.state == 14 ||scope.row.state == 20"
scope.row.state == 10 ||
scope.row.state == 20
"
v-auth="'utask.delete'" v-auth="'utask.delete'"
> >
<template #reference> <template #reference>
<el-button link type="danger" <el-button link type="danger">删除</el-button>
>删除</el-button
>
</template> </template>
</el-popconfirm> </el-popconfirm>
<el-popconfirm <el-popconfirm
@ -270,8 +274,11 @@ export default {
data() { data() {
return { return {
utaskId: "", utaskId: "",
canBreak:true,
canDepuse:true,
visibleDrawer: false, visibleDrawer: false,
isLoading: false, isLoading: false,
isBreakLoading:false,
selectedIds: [], selectedIds: [],
dialog: { dialog: {
save: false, save: false,
@ -289,6 +296,7 @@ export default {
paramsUtask: {}, paramsUtask: {},
queryUtask: {}, queryUtask: {},
utaskList: [], utaskList: [],
selection: [],
state_: { state_: {
10: "创建中", 10: "创建中",
14: "已分解", 14: "已分解",
@ -369,37 +377,60 @@ export default {
that.ganntVisit = true; that.ganntVisit = true;
gantt.refreshData(); gantt.refreshData();
}, },
utaskDepuse() { utaskBreak(){
let that = this; let that = this;
if (that.selectedIds.length > 0) { if (that.selectedIds.length > 0) {
let ids = that.selectedIds; 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.isLoading = true;
that.$API.pm.utask.scheduemtasks let ids = that.selectedIds;
.req({ ids: ids }) that.$API.pm.utask.assgin.req({ ids: ids }).then((res) => {
.then((res) => { that.$message.success("任务下达成功");
that.$API.pm.utask.assgin that.isLoading = false;
.req({ ids: ids }) that.$refs.table.refresh();
.then((res) => { }).catch(() => {
that.$message.success("下达任务成功"); that.isLoading = false;
that.isLoading = false; });
that.$refs.table.refresh();
})
.catch(() => {
that.isLoading = false;
});
})
.catch(() => {
that.isLoading = false;
});
} else { } else {
this.$message.error("未选择任何任务"); this.$message.error("未选择任何任务");
} }
}, },
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.selectedIds = []; this.selectedIds = [];
selection.forEach((item) => { this.selection= selection;
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() { utaskCreate() {
this.dialog.save = true; this.dialog.save = true;