全栈: Task模型+remark字段 + 前端任务卡片初始说明展示区
This commit is contained in:
23
backend/alembic/versions/f6a7b8c9d0e1_add_task_remark.py
Normal file
23
backend/alembic/versions/f6a7b8c9d0e1_add_task_remark.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
"""add_task_remark
|
||||||
|
|
||||||
|
Revision ID: f6a7b8c9d0e1
|
||||||
|
Revises: e5f6a7b8c9d0
|
||||||
|
Create Date: 2026-08-05
|
||||||
|
|
||||||
|
"""
|
||||||
|
from typing import Sequence, Union
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
revision: str = "f6a7b8c9d0e1"
|
||||||
|
down_revision: Union[str, None] = "e5f6a7b8c9d0"
|
||||||
|
branch_labels: Union[str, Sequence[str], None] = None
|
||||||
|
depends_on: Union[str, Sequence[str], None] = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
op.add_column("tasks", sa.Column("remark", sa.String(2000), nullable=True, comment="任务初始描述/交接备注"))
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
op.drop_column("tasks", "remark")
|
||||||
@ -69,6 +69,9 @@ class Task(Base):
|
|||||||
is_rework: Mapped[bool] = mapped_column(
|
is_rework: Mapped[bool] = mapped_column(
|
||||||
Boolean, default=False, comment="是否为返工任务",
|
Boolean, default=False, comment="是否为返工任务",
|
||||||
)
|
)
|
||||||
|
remark: Mapped[str | None] = mapped_column(
|
||||||
|
String(2000), nullable=True, comment="任务初始描述/交接备注",
|
||||||
|
)
|
||||||
|
|
||||||
# ---- 关系 ----
|
# ---- 关系 ----
|
||||||
product: Mapped["Product"] = relationship("Product", lazy="selectin")
|
product: Mapped["Product"] = relationship("Product", lazy="selectin")
|
||||||
|
|||||||
@ -102,6 +102,7 @@ class TaskSummaryResponse(BaseModel):
|
|||||||
status: str
|
status: str
|
||||||
notify_parent_on_complete: bool
|
notify_parent_on_complete: bool
|
||||||
is_rework: bool = False
|
is_rework: bool = False
|
||||||
|
remark: str | None = None
|
||||||
reject_reason: str | None = None
|
reject_reason: str | None = None
|
||||||
received_at: datetime | None = None
|
received_at: datetime | None = None
|
||||||
completed_at: datetime | None = None
|
completed_at: datetime | None = None
|
||||||
|
|||||||
@ -15,6 +15,12 @@
|
|||||||
<text v-if="task.assignee_id">负责人: {{ task.assignee_id }}</text>
|
<text v-if="task.assignee_id">负责人: {{ task.assignee_id }}</text>
|
||||||
<text v-if="task.reject_reason" class="reject-reason">驳回: {{ task.reject_reason }}</text>
|
<text v-if="task.reject_reason" class="reject-reason">驳回: {{ task.reject_reason }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 任务初始描述 / 交接备注(常驻显示,区别于动态日志 records) -->
|
||||||
|
<view v-if="task.remark || task.description" class="task-initial-remark">
|
||||||
|
<text class="remark-label">📌 初始说明:</text>
|
||||||
|
<text class="remark-text">{{ task.remark || task.description }}</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 状态标签 -->
|
<!-- 状态标签 -->
|
||||||
<text :class="['badge', statusColor(task.status)]">{{ statusLabel(task.status) }}</text>
|
<text :class="['badge', statusColor(task.status)]">{{ statusLabel(task.status) }}</text>
|
||||||
@ -172,6 +178,15 @@ export default {
|
|||||||
.tnode-meta { margin-top: 2px; font-size: 11px; color: #9ca3af; display: flex; gap: 8px; flex-wrap: wrap; }
|
.tnode-meta { margin-top: 2px; font-size: 11px; color: #9ca3af; display: flex; gap: 8px; flex-wrap: wrap; }
|
||||||
.reject-reason { color: #ef4444; }
|
.reject-reason { color: #ef4444; }
|
||||||
|
|
||||||
|
/* 任务初始描述(常驻,区别于动态记录) */
|
||||||
|
.task-initial-remark {
|
||||||
|
margin-top: 10rpx; padding: 12rpx 16rpx;
|
||||||
|
background: linear-gradient(135deg, #fefce8, #fef9c3);
|
||||||
|
border-left: 6rpx solid #eab308; border-radius: 8rpx;
|
||||||
|
}
|
||||||
|
.remark-label { font-size: 22rpx; font-weight: 700; color: #a16207; }
|
||||||
|
.remark-text { font-size: 26rpx; color: #713f12; line-height: 1.5; word-break: break-all; }
|
||||||
|
|
||||||
/* 进度记录 */
|
/* 进度记录 */
|
||||||
.records-area { background-color: #f9f9f9; padding: 0; border-radius: 10rpx; margin-top: 16rpx; margin-bottom: 6rpx; overflow: hidden; }
|
.records-area { background-color: #f9f9f9; padding: 0; border-radius: 10rpx; margin-top: 16rpx; margin-bottom: 6rpx; overflow: hidden; }
|
||||||
.records-bar {
|
.records-bar {
|
||||||
|
|||||||
Reference in New Issue
Block a user