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'"
>新增任务</el-button
>
<el-button
type="primary"
@click="utaskBreak"
v-loading="isBreakLoading"
v-auth="'utask.assgin'"
:disabled="!canBreak"
>任务分解</el-button
>
<el-button
type="primary"
@click="utaskDepuse"
v-loading="isLoading"
v-auth="'utask.assgin'"
>任务分解并下达</el-button
:disabled="!canDepuse"
>任务下达</el-button
>
</div>
<div class="'right-panel'">
@ -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;

View File

@ -14,8 +14,9 @@
<el-button
type="primary"
@click="utaskDepuse"
v-loading="isLoading"
v-loading="isBreakLoading"
v-auth="'utask.schedule'"
:disabled="!canBreak"
>任务分解</el-button
>
<el-button
@ -23,6 +24,7 @@
@click="utaskAssgin"
v-loading="isLoading"
v-auth="'utask.assgin'"
:disabled="!canDepuse"
>任务下达</el-button
>
</div>
@ -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;

View File

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