feat:完善项目

This commit is contained in:
henry
2021-11-19 15:34:22 +08:00
parent 7efe403bf0
commit c5f4a5d281
10 changed files with 168 additions and 21 deletions

View File

@ -28,7 +28,9 @@ type (
InstanceDetailInfo struct {
basic.CommonIDString
*model.WorkInstanceInfo
Outside struct {
EquipmentID string `json:"equipment_id"`
ScheduleID string `json:"schedule_id"`
Outside struct {
SupplierName string `json:"supplier_name"`
} `json:"outside"`
Within struct {
@ -311,6 +313,8 @@ func (c *Instance) Detail(id uint64) (*InstanceDetailInfo, error) {
out.CommonIDString = basic.CommonIDString{
ID: mWorkInstance.GetEncodeID(),
}
out.EquipmentID = (&model2.Model{ID: out.WorkInstanceInfo.EquipmentID}).GetEncodeID()
out.ScheduleID = (&model2.Model{ID: out.WorkInstanceInfo.ScheduleID}).GetEncodeID()
// 位置信息
mWorkInstance.Distribution = out.WorkInstanceInfo.Distribution

View File

@ -20,6 +20,11 @@ type (
Title string `json:"title"`
Schedules []*ScheduleDetailInfo `json:"schedules"`
}
// ScheduleBasicInfo 流程基本信息
ScheduleBasicInfo struct {
basic.CommonIDString
*model.WorkSchedule
}
// ScheduleDetailInfo 流程详细信息
ScheduleDetailInfo struct {
basic.CommonIDString
@ -79,6 +84,21 @@ func (c *Schedule) List() ([]*ScheduleInfo, error) {
return list, nil
}
// Basic 基本信息
func (c *Schedule) Basic(id uint64) (*ScheduleBasicInfo, error) {
mWorkSchedule := model.NewWorkSchedule()
mWorkSchedule.ID = id
if isExist, err := model2.FirstField(mWorkSchedule.WorkSchedule, []string{"id", "kind", "title", "stage", "step"}); err != nil {
return nil, err
} else if !isExist {
return nil, errors.New("操作错误,流程信息不存在或已被删除")
}
return &ScheduleBasicInfo{
CommonIDString: basic.CommonIDString{ID: mWorkSchedule.GetEncodeID()},
WorkSchedule: mWorkSchedule,
}, nil
}
// Form 数据操作
func (c *Schedule) Form(params *ScheduleParams) error {
if params.ID > 0 {