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

@ -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{}
}