feat:完善项目

This commit is contained in:
henry
2021-11-09 14:08:02 +08:00
parent 08083d26d3
commit d544b7f80c
14 changed files with 338 additions and 61 deletions

View File

@ -17,7 +17,7 @@ type WorkInstance struct {
Breakdown string `gorm:"column:breakdown;type:varchar(150);default:null;comment:故障" json:"breakdown"`
Priority WorkInstancePriority `gorm:"column:priority;type:tinyint(1);default:1;comment:工单优先级" json:"priority"`
Schedule uint64 `gorm:"column:schedule;type:int(11);default:1;comment:工单进度" json:"schedule"`
IsAssist WorkInstanceAssist `orm:"column:is_assist;type:tinyint(1);default:0;comment:协助状态" json:"is_assist"` // 当前阶段协助状态,确认是否需要下一阶段协助
IsAssist WorkInstanceAssist `gorm:"column:is_assist;type:tinyint(1);default:0;comment:协助状态" json:"is_assist"` // 当前阶段协助状态,确认是否需要下一阶段协助
Status WorkInstanceStatus `gorm:"column:status;type:tinyint(1);default:0;comment:工单状态" json:"status"`
Remark string `gorm:"column:remark;type:varchar(255);default:null;comment:备注信息" json:"remark"`
Distribution string `gorm:"column:distribution;type:varchar(255);default:null;comment:配送信息" json:"-"`

View File

@ -5,16 +5,25 @@ import "strings"
// WorkSchedule 工单流程数据模型
type WorkSchedule struct {
Model
Kind WorkScheduleKind `gorm:"column:kind;type:tinyint(1);default:1;comment:工单类型" json:"-"`
Title string `gorm:"column:title;type:varchar(30);default:null;comment:标题" json:"title"`
Stage int `orm:"column:stage;type:tinyint(1);default:1;comment:阶段" json:"stage"`
Step int `orm:"column:step;type:tinyint(1);default:1;comment:步骤1阶段-1步骤" json:"step"`
Target WorkScheduleTarget `orm:"column:target;type:tinyint(1);default:1;comment:对象类型" json:"target"`
TargetValue string `orm:"column:target_value;type:tinyint(1);default:1;comment:对象信息" json:"target_value"`
IsCountersign WorkScheduleCountersign `orm:"column:is_countersign;type:tinyint(1);default:0;comment:是否会签" json:"is_countersign"`
Stage int `gorm:"column:stage;type:tinyint(1);default:1;comment:阶段" json:"stage"`
Step int `gorm:"column:step;type:tinyint(1);default:1;comment:步骤1阶段-1步骤" json:"step"`
Target WorkScheduleTarget `gorm:"column:target;type:tinyint(1);default:1;comment:对象类型" json:"target"`
TargetValue string `gorm:"column:target_value;type:tinyint(1);default:1;comment:对象信息" json:"target_value"`
IsCountersign WorkScheduleCountersign `gorm:"column:is_countersign;type:tinyint(1);default:0;comment:是否会签" json:"is_countersign"`
ModelDeleted
ModelAt
}
// WorkScheduleKind 工单流程类型
type WorkScheduleKind int
const (
// WorkScheduleKindForRepair 维修工单
WorkScheduleKindForRepair WorkScheduleKind = iota + 1
)
// WorkScheduleTarget 工单对象类型
type WorkScheduleTarget int
@ -51,6 +60,13 @@ func (m *WorkSchedule) SetTargetValueAttribute(value []string) {
m.TargetValue = strings.Join(value, ",")
}
func (m *WorkSchedule) KindTitle() string {
if m.Kind == WorkScheduleKindForRepair {
return "维修工单"
}
return ""
}
func NewWorkSchedule() *WorkSchedule {
return &WorkSchedule{}
}