重构: 删除卡片中间冗余按钮 + 转交弹窗接入真实用户/工序API

This commit is contained in:
2026-08-05 15:25:19 +08:00
parent 22f7bb2f79
commit e5b201a040
2 changed files with 22 additions and 32 deletions

View File

@ -26,18 +26,6 @@
<text :class="['badge', statusColor(task.status)]">{{ statusLabel(task.status) }}</text>
</view>
<!-- 操作栏 -->
<view v-if="task.status === 'PENDING' || task.status === 'WIP'" class="action-bar">
<button v-if="task.status === 'PENDING'" class="act-btn act-receive" size="mini"
@tap.stop="$emit('action', { task, type: 'receive' })">接收</button>
<button v-if="task.status === 'PENDING'" class="act-btn act-reject" size="mini"
@tap.stop="$emit('action', { task, type: 'reject' })">驳回</button>
<button v-if="task.status === 'WIP'" class="act-btn act-transfer" size="mini"
@tap.stop="$emit('action', { task, type: 'transfer' })">转交</button>
<button v-if="task.status === 'WIP'" class="act-btn act-record" size="mini"
@tap.stop="$emit('action', { task, type: 'record' })">📝 记录/拍照</button>
</view>
<!-- 第二层递归子任务树 -->
<view v-if="task.child_tasks && task.child_tasks.length" class="tnode-children">
<TaskTreeNode
@ -219,17 +207,5 @@ export default {
.s-green .badge { background: #dcfce7; color: #15803d; }
.s-red .badge { background: #fce4ec; color: #be123c; }
.action-bar {
display: flex; justify-content: flex-end; gap: 20rpx;
padding: 10px 12px; border-top: 1px solid #f3f4f6;
border-radius: 0 0 10px 10px; background: #fafafa;
}
.act-btn { height: 56rpx; line-height: 56rpx; padding: 0 28rpx; font-size: 26rpx; font-weight: 600; border-radius: 10rpx; border: none; margin: 0; }
.act-btn::after { border: none; }
.act-receive { background: #dbeafe; color: #2563eb; }
.act-reject { background: #fce4ec; color: #dc2626; }
.act-transfer { background: #dcfce7; color: #16a34a; }
.act-record { background: #fef3c7; color: #b45309; }
.tnode-children { position: relative; }
</style>

View File

@ -326,13 +326,8 @@ export default {
currentUserId: "",
currentUsername: "",
// Picker 数据源
processOptions: ["备货", "生产", "测试", "维修", "质检", "打包"],
userOptions: [
{ id: "duxingchen", name: "杜邢宸" },
{ id: "zhangsan", name: "张三" },
{ id: "lisi", name: "李四" },
{ id: "wangwu", name: "王五" },
],
processOptions: [],
userOptions: [],
// 任务操作
actionPopup: { visible: false, type: "", task: null },
actionLoading: false,
@ -429,6 +424,11 @@ export default {
async loadUsers() {
try {
this.users = await get("/users/", { limit: 200 });
// 同步填充 Picker 使用的 userOptions接口返回 id/username/full_name
this.userOptions = (this.users || []).map(u => ({
id: u.username || u.id,
name: u.full_name || u.username,
}));
} catch { /* 静默 */ }
},
loadCurrentUser() {
@ -634,9 +634,23 @@ export default {
},
// ---- 任务操作 ----
handleTaskAction({ task, type, record }) {
async handleTaskAction({ task, type, record }) {
if (type === "record") { this.openRecordPopup(task); return; }
if (type === "deleteRecord") { this.doDeleteRecord(record); return; }
// 转交时异步拉取真实工序和用户数据
if (type === "transfer") {
uni.showLoading({ title: "加载数据..." });
try {
if (!this.userOptions.length) await this.loadUsers();
if (!this.processOptions.length) {
this.processOptions = [...TASK_NAME_OPTIONS];
}
} finally {
uni.hideLoading();
}
}
this.actionPopup = { visible: true, type, task };
this.rejectReason = "";
this.transferForm = { next_task_name: "", assignees: [], selectedUserId: "", warehouse: false, note: "" };