|
@@ -122,15 +122,16 @@ func AddReportAndChapter(reportInfo *models.Report, inheritReportId int, grantAd
|
|
|
|
|
|
func EditReport(reportInfo *models.Report, req models.EditReq, sysUser *system.Admin) (err error, errMsg string) {
|
|
|
errMsg = `保存失败`
|
|
|
- var stage int
|
|
|
- if reportInfo.ClassifyNameFirst != req.ClassifyNameFirst || reportInfo.ClassifyNameSecond != req.ClassifyNameSecond {
|
|
|
-
|
|
|
- maxStage, _ := models.GetReportStageEdit(req.ClassifyIdFirst, req.ClassifyIdSecond, req.ClassifyIdThird, int(req.ReportId))
|
|
|
- maxStage = maxStage + 1
|
|
|
- stage = maxStage
|
|
|
- } else {
|
|
|
- stage = reportInfo.Stage
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -146,18 +147,18 @@ func EditReport(reportInfo *models.Report, req models.EditReq, sysUser *system.A
|
|
|
|
|
|
|
|
|
|
|
|
- reportInfo.ClassifyIdFirst = req.ClassifyIdFirst
|
|
|
- reportInfo.ClassifyNameFirst = req.ClassifyNameFirst
|
|
|
- reportInfo.ClassifyIdSecond = req.ClassifyIdSecond
|
|
|
- reportInfo.ClassifyNameSecond = req.ClassifyNameSecond
|
|
|
- reportInfo.ClassifyIdThird = req.ClassifyIdThird
|
|
|
- reportInfo.ClassifyNameThird = req.ClassifyNameThird
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
reportInfo.Title = req.Title
|
|
|
reportInfo.Abstract = req.Abstract
|
|
|
reportInfo.Author = req.Author
|
|
|
reportInfo.Frequency = req.Frequency
|
|
|
|
|
|
- reportInfo.Stage = stage
|
|
|
+
|
|
|
|
|
|
|
|
|
reportInfo.CreateTime = req.CreateTime
|
|
@@ -171,7 +172,8 @@ func EditReport(reportInfo *models.Report, req models.EditReq, sysUser *system.A
|
|
|
reportInfo.LastModifyAdminName = sysUser.RealName
|
|
|
reportInfo.ModifyTime = time.Now()
|
|
|
|
|
|
- updateCols := []string{"ClassifyIdFirst", "ClassifyNameFirst", "ClassifyIdSecond", "ClassifyNameSecond", "ClassifyIdThird", "ClassifyNameThird", "Title", "Abstract", "Author", "Frequency", "Stage", "CreateTime", "IsPublicPublish", "LastModifyAdminId", "LastModifyAdminName", "ModifyTime"}
|
|
|
+
|
|
|
+ updateCols := []string{"Title", "Abstract", "Author", "Frequency", "CreateTime", "IsPublicPublish", "LastModifyAdminId", "LastModifyAdminName", "ModifyTime"}
|
|
|
|
|
|
if req.HeadResourceId > 0 {
|
|
|
reportInfo.HeadResourceId = req.HeadResourceId
|
|
@@ -889,3 +891,41 @@ func CheckReportAuthByReportChapterInfo(adminId, createAdminId int, reportInfoId
|
|
|
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func EditReportLayoutImg(reportInfo *models.Report, req models.EditLayoutImgReq, sysUser *system.Admin) (err error, errMsg string) {
|
|
|
+ errMsg = `保存失败`
|
|
|
+
|
|
|
+ reportInfo.CanvasColor = req.CanvasColor
|
|
|
+ reportInfo.LastModifyAdminId = sysUser.AdminId
|
|
|
+ reportInfo.LastModifyAdminName = sysUser.RealName
|
|
|
+ reportInfo.ModifyTime = time.Now()
|
|
|
+
|
|
|
+ updateCols := []string{"CanvasColor", "LastModifyAdminId", "LastModifyAdminName", "ModifyTime"}
|
|
|
+
|
|
|
+ if req.HeadResourceId > 0 {
|
|
|
+ reportInfo.HeadResourceId = req.HeadResourceId
|
|
|
+ reportInfo.HeadImg = req.HeadImg
|
|
|
+ updateCols = append(updateCols, "HeadResourceId", "HeadImg")
|
|
|
+ }
|
|
|
+ if req.EndResourceId > 0 {
|
|
|
+ reportInfo.EndResourceId = req.EndResourceId
|
|
|
+ reportInfo.EndImg = req.EndImg
|
|
|
+ updateCols = append(updateCols, "EndResourceId", "EndImg")
|
|
|
+ }
|
|
|
+
|
|
|
+ err = reportInfo.UpdateReport(updateCols)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ return
|
|
|
+}
|