feat:完善项目管理,增加技术成果数据

This commit is contained in:
henry
2021-12-14 13:34:42 +08:00
parent 3bb8f96d84
commit 3c55143278
11 changed files with 542 additions and 2 deletions

View File

@ -114,6 +114,21 @@ type (
Source string `json:"source" form:"source" binding:"required"`
Director string `json:"director" form:"director" binding:"required"`
}
// achievementForm 成果参数
achievementForm struct {
Mode int `json:"mode" form:"mode" binding:"required"`
Title string `json:"title" form:"title" binding:"required"`
api.ImageForm
File string `json:"file" form:"file" binding:"required"`
Industrys []string `json:"industrys" form:"industrys"`
Customers []string `json:"customers" form:"customers"`
Maturity int `json:"maturity" form:"maturity"`
LeadStandard int `json:"lead_standard" form:"lead_standard"`
CooperationMode int `json:"cooperation_mode" form:"cooperation_mode"`
Keywords []string `json:"keywords" form:"keywords"`
Introduce string `json:"introduce" form:"introduce"`
IsSubmit int `json:"is_submit" form:"is_submit"`
}
)
func (a *instanceForm) FilterProveImages() string {
@ -128,6 +143,10 @@ func (a *productForm) FilterMaterial() string {
return (&api.ImageForm{Image: a.Material}).FilterImageURL()
}
func (a *achievementForm) FilterFile() string {
return (&api.ImageForm{Image: a.File}).FilterImageURL()
}
func (a *Technology) Instance(c *gin.Context) {
form := &struct {
Status int `json:"status" form:"status"`
@ -650,3 +669,79 @@ func (a *Technology) ProjectDelete(c *gin.Context) {
Delete(form.Convert())
api.APIResponse(err)(c)
}
func (*Technology) Achievement(c *gin.Context) {
form := &struct {
Status int `json:"status" form:"status"`
api.PageForm
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
data, err := technology2.NewAchievement()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Instance(form.Status, form.Page, form.PageSize)
api.APIResponse(err, data)(c)
}
func (*Technology) AchievementAdd(c *gin.Context) {
form := new(achievementForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewAchievement()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Form(&technology2.AchievementParams{Mode: form.Mode,
Title: form.Title, Image: form.FilterImageURL(), File: form.FilterFile(),
Introduce: form.Introduce, Industrys: form.Industrys,
Maturity: form.Maturity, LeadStandard: form.LeadStandard, CooperationMode: form.CooperationMode,
Customers: form.Customers, Keywords: form.Keywords, IsSubmit: form.IsSubmit,
})
api.APIResponse(err)(c)
}
func (*Technology) AchievementEdit(c *gin.Context) {
form := &struct {
api.IDStringForm
achievementForm
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewAchievement()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Form(&technology2.AchievementParams{ID: form.Convert(), Mode: form.Mode,
Title: form.Title, Image: form.FilterImageURL(), File: form.FilterFile(),
Introduce: form.Introduce, Industrys: form.Industrys,
Maturity: form.Maturity, LeadStandard: form.LeadStandard, CooperationMode: form.CooperationMode,
Customers: form.Customers, Keywords: form.Keywords, IsSubmit: form.IsSubmit,
})
api.APIResponse(err)(c)
}
func (*Technology) AchievementShelf(c *gin.Context) {
form := &struct {
api.IDStringForm
Status int `json:"status" form:"status" binding:"required"`
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewAchievement()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Shelf(form.Convert(), form.Status)
api.APIResponse(err)(c)
}
func (*Technology) AchievementDelete(c *gin.Context) {
form := new(api.IDStringForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewAchievement()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Delete(form.Convert())
api.APIResponse(err)(c)
}