diff --git a/track-uniapp/src/pages/scan/components/TaskTreeNode.vue b/track-uniapp/src/pages/scan/components/TaskTreeNode.vue index fc1aae7..6e0ecfc 100644 --- a/track-uniapp/src/pages/scan/components/TaskTreeNode.vue +++ b/track-uniapp/src/pages/scan/components/TaskTreeNode.vue @@ -35,6 +35,7 @@ :currentUser="currentUser" :currentUserId="currentUserId" :currentUsername="currentUsername" + :readonly="readonly" :isLast="idx === task.child_tasks.length - 1" @action="(e) => $emit('action', e)" @editRecord="(e) => $emit('editRecord', e)" @@ -85,6 +86,7 @@ export default { currentUser: { type: Object, default: null }, currentUserId: { type: [String, Number], default: "" }, currentUsername: { type: String, default: "" }, + readonly: { type: Boolean, default: false }, }, emits: ["action", "editRecord", "viewRecords"], mounted() { @@ -94,6 +96,7 @@ export default { }, computed: { canEditRecord() { + if (this.readonly) return false; if (this.task.assignee_id == this.currentUserId) return true; if (this.task.assignee_id == this.currentUsername) return true; if (this.currentUser && this.currentUser.id == this.task.assignee_id) return true; diff --git a/track-uniapp/src/pages/scan/detail.vue b/track-uniapp/src/pages/scan/detail.vue index 8101e10..49dbc2e 100644 --- a/track-uniapp/src/pages/scan/detail.vue +++ b/track-uniapp/src/pages/scan/detail.vue @@ -24,6 +24,9 @@ 📦 产品信息 {{ statusLabel(product.status) }} + + {{ currentMode === 'workspace' ? '🌳 流转树' : '🛠️ 工作区' }} + ✏️ @@ -54,9 +57,9 @@ - + - + 📋 @@ -126,32 +129,51 @@ + + + + + + + + - + - - - - - - + + + 📋 + 该产品暂无流转任务 + + @@ -397,6 +419,7 @@ export default { currentUserId: "", currentUsername: "", swiperCurrent: 0, + currentMode: "tree", // Picker 数据源 processOptions: [], userOptions: [], @@ -453,6 +476,9 @@ export default { currentTask() { return this.focusTasks[this.swiperCurrent] || null; }, + hasMyActiveTask() { + return this.focusTasks.length > 0; + }, }, onLoad(options) { this.loadUsers(); @@ -479,9 +505,18 @@ export default { try { this.product = await get(`/products/scan/${sn}`); if (!this.product.overall_status) this.showStatusPicker = true; + // 智能分流:有本人活跃任务 → workspace,否则 → tree + this.$nextTick(() => { + this.currentMode = this.hasMyActiveTask ? 'workspace' : 'tree'; + this.swiperCurrent = 0; + }); } catch (e) { this.error = e?.data?.detail || "查询失败"; } finally { this.loading = false; } }, + toggleMode() { + this.currentMode = this.currentMode === 'workspace' ? 'tree' : 'workspace'; + if (this.currentMode === 'workspace') this.swiperCurrent = 0; + }, // ---- 状态定调 ---- async handleSetOverallStatus(status) { @@ -915,10 +950,14 @@ export default { .fc-records-bar { padding: 8px 12px; background: linear-gradient(135deg,#eff6ff,#dbeafe); border-radius: 8px; font-size: 13px; font-weight: 700; color: #2563eb; margin-bottom: 8px; } .fc-time { font-size: 11px; color: #9ca3af; margin-top: auto; padding-top: 8px; border-top: 1px solid #f3f4f6; } + +/* 流转树视图(只读) */ +.tree-area { flex: 1; overflow-y: auto; min-height: 0; padding: 4px 0; -webkit-overflow-scrolling: touch; } .card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; } .card-header-right { display: flex; align-items: center; gap: 8px; } .card-title { font-size: 15px; font-weight: 700; } .edit-btn { font-size: 18px; padding: 2px 6px; } +.mode-toggle { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 8px; background: #eff6ff; color: #2563eb; } .info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } .label { font-size: 12px; color: #9ca3af; } .value { font-size: 14px; color: #1f2937; font-weight: 600; word-break: break-all; }