工艺节点树: 新增结束分支(终止)接口 + 前端🏁结束分支按钮 + WIP可无下游完结

This commit is contained in:
2026-08-05 16:37:05 +08:00
parent e2d9590c48
commit 21aa608db3
3 changed files with 71 additions and 0 deletions

View File

@ -140,6 +140,10 @@
@tap="handleTaskAction({ task: currentTask, type: 'record' })">
📝 记录/拍照
</button>
<button v-if="currentTask.status === 'WIP'" class="footer-btn footer-end"
@tap="handleTaskAction({ task: currentTask, type: 'end' })">
🏁 结束分支
</button>
<button v-if="currentTask.status === 'PENDING'" class="footer-btn footer-receive"
@tap="handleTaskAction({ task: currentTask, type: 'receive' })">
✅ 接收任务
@ -725,6 +729,7 @@ export default {
async handleTaskAction({ task, type, record }) {
if (type === "record") { this.openRecordPopup(task); return; }
if (type === "deleteRecord") { this.doDeleteRecord(record); return; }
if (type === "end") { this.confirmEndBranch(task); return; }
// 转交时异步拉取真实工序和用户数据
if (type === "transfer") {
@ -747,6 +752,23 @@ export default {
handleViewRecords(task) {
uni.navigateTo({ url: `/pages/scan/records?taskId=${task.id}` });
},
confirmEndBranch(task) {
uni.showModal({
title: "结束当前分支",
content: `确定结束「${task.task_name}」吗?\n此分支将标记为已完成,不会创建下游任务。`,
confirmText: "确定结束",
confirmColor: "#f59e0b",
success: (res) => { if (res.confirm) this.doEndBranch(task); },
});
},
async doEndBranch(task) {
try {
const opId = this.currentUsername || this.currentUserId;
await post(`/tasks/${task.id}/end?operator_id=${encodeURIComponent(opId)}`);
uni.showToast({ title: "分支已结束", icon: "success" });
this.doQuery(this.product.serial_number);
} catch {}
},
onSwiperChange(e) {
this.swiperCurrent = e.detail.current;
},
@ -996,6 +1018,7 @@ export default {
.footer-record { background: #eff6ff; color: #2563eb; }
.footer-receive { background: #dbeafe; color: #1d4ed8; }
.footer-reject { background: #fce4ec; color: #dc2626; }
.footer-end { background: #fef3c7; color: #b45309; }
/* Picker 选择器 */
.form-item { margin: 10px 0; }