feat: 增加真实采购任务安全模式 (#98)
This commit is contained in:
+42
-28
@@ -58,6 +58,16 @@ func taskTypeText(t model.TaskType) string {
|
||||
return string(t)
|
||||
}
|
||||
|
||||
func taskExecutionModeText(taskType model.TaskType, mode model.TaskExecutionMode) string {
|
||||
if taskType != model.TaskPurchase {
|
||||
return "采集"
|
||||
}
|
||||
if mode == model.TaskExecutionLive {
|
||||
return "真实下单(不支付)"
|
||||
}
|
||||
return "采购演练"
|
||||
}
|
||||
|
||||
// ---------- 界面文字:状态 ----------
|
||||
|
||||
// taskStatusOrder 定下状态在筛选框和底部状态条里的显示顺序,
|
||||
@@ -222,13 +232,14 @@ func priceLimitText(cent int64) string {
|
||||
|
||||
// TaskView 是列表页一行要显示的全部内容,全部已经是字符串。
|
||||
type TaskView struct {
|
||||
TaskID string
|
||||
TypeText string
|
||||
Target string
|
||||
StatusText string
|
||||
IsWarn bool // 失败 / 需人工,标黄提醒
|
||||
ClientText string
|
||||
UpdatedAt string
|
||||
TaskID string
|
||||
TypeText string
|
||||
ExecutionModeText string
|
||||
Target string
|
||||
StatusText string
|
||||
IsWarn bool // 失败 / 需人工,标黄提醒
|
||||
ClientText string
|
||||
UpdatedAt string
|
||||
}
|
||||
|
||||
// TaskListResult 是列表页要的全部数据。
|
||||
@@ -274,13 +285,14 @@ func ListTasksView(db *sql.DB, filter repository.TaskFilter, requestedPage int)
|
||||
}
|
||||
for _, r := range rows {
|
||||
result.Rows = append(result.Rows, TaskView{
|
||||
TaskID: r.TaskID,
|
||||
TypeText: taskTypeText(r.TaskType),
|
||||
Target: buildTarget(r),
|
||||
StatusText: taskStatusText(r.Status),
|
||||
IsWarn: isTaskWarn(r.Status),
|
||||
ClientText: clientText(r.AssignedClient),
|
||||
UpdatedAt: formatLocalTime(r.UpdatedAt),
|
||||
TaskID: r.TaskID,
|
||||
TypeText: taskTypeText(r.TaskType),
|
||||
ExecutionModeText: taskExecutionModeText(r.TaskType, r.ExecutionMode),
|
||||
Target: buildTarget(r),
|
||||
StatusText: taskStatusText(r.Status),
|
||||
IsWarn: isTaskWarn(r.Status),
|
||||
ClientText: clientText(r.AssignedClient),
|
||||
UpdatedAt: formatLocalTime(r.UpdatedAt),
|
||||
})
|
||||
}
|
||||
return result, nil
|
||||
@@ -316,12 +328,13 @@ const resultDataLimit = 4000
|
||||
//
|
||||
// `[必须]` 只读——本工单不做改派、重试、取消,弹窗里不应该有对应的表单。
|
||||
type TaskDetailView struct {
|
||||
TaskID string
|
||||
TypeText string
|
||||
StatusText string
|
||||
ClientText string
|
||||
ClaimedAt string
|
||||
FinishedAt string
|
||||
TaskID string
|
||||
TypeText string
|
||||
ExecutionModeText string
|
||||
StatusText string
|
||||
ClientText string
|
||||
ClaimedAt string
|
||||
FinishedAt string
|
||||
|
||||
PddGoodsURL string
|
||||
|
||||
@@ -350,14 +363,15 @@ func GetTaskDetail(db *sql.DB, taskID string) (*TaskDetailView, error) {
|
||||
}
|
||||
|
||||
v := &TaskDetailView{
|
||||
TaskID: t.TaskID,
|
||||
TypeText: taskTypeText(t.TaskType),
|
||||
StatusText: taskStatusText(t.Status),
|
||||
ClientText: clientText(t.AssignedClient),
|
||||
ClaimedAt: formatLocalTime(t.ClaimedAt),
|
||||
FinishedAt: formatLocalTime(t.FinishedAt),
|
||||
PddGoodsURL: t.PddGoodsURL,
|
||||
IsPurchase: t.TaskType == model.TaskPurchase,
|
||||
TaskID: t.TaskID,
|
||||
TypeText: taskTypeText(t.TaskType),
|
||||
ExecutionModeText: taskExecutionModeText(t.TaskType, t.ExecutionMode),
|
||||
StatusText: taskStatusText(t.Status),
|
||||
ClientText: clientText(t.AssignedClient),
|
||||
ClaimedAt: formatLocalTime(t.ClaimedAt),
|
||||
FinishedAt: formatLocalTime(t.FinishedAt),
|
||||
PddGoodsURL: t.PddGoodsURL,
|
||||
IsPurchase: t.TaskType == model.TaskPurchase,
|
||||
}
|
||||
if v.IsPurchase {
|
||||
v.SpecText = specText(t.PddOptions)
|
||||
|
||||
Reference in New Issue
Block a user