重构: 删除卡片中间冗余按钮 + 转交弹窗接入真实用户/工序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

@ -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: "" };