feat:优化项目信息,增加用户器材信息管理
This commit is contained in:
@ -20,6 +20,14 @@ type (
|
||||
Papers []string `json:"papers" form:"papers"`
|
||||
Patents []string `json:"patents" form:"patents"`
|
||||
}
|
||||
// equipmentForm 设备信息
|
||||
equipmentForm struct {
|
||||
Kind int `json:"kind" form:"kind" binding:"required"`
|
||||
Code string `json:"code" form:"code" binding:"required"`
|
||||
Title string `json:"title" form:"title" binding:"required"`
|
||||
Params string `json:"params" form:"params"`
|
||||
Description string `json:"description" form:"description"`
|
||||
}
|
||||
)
|
||||
|
||||
func (a *enterpriseForm) paperInfo() []uint64 {
|
||||
@ -100,3 +108,59 @@ func (*Manage) EnterpriseDelete(c *gin.Context) {
|
||||
Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*Manage) Equipment(c *gin.Context) {
|
||||
form := &struct {
|
||||
Kind int `json:"kind" form:"kind"`
|
||||
Code string `json:"code" form:"code"`
|
||||
Title string `json:"title" form:"title"`
|
||||
api.PageForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewEquipment()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
List(form.Kind, form.Code, form.Title, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Manage) EquipmentAdd(c *gin.Context) {
|
||||
form := new(equipmentForm)
|
||||
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := manage.NewEquipment()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Form(&manage.EquipmentParams{Kind: form.Kind, Code: form.Code, Title: form.Title, Params: form.Params, Description: form.Description})
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*Manage) EquipmentEdit(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.IDStringForm
|
||||
equipmentForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := manage.NewEquipment()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Form(&manage.EquipmentParams{ID: form.Convert(), Kind: form.Kind, Code: form.Code, Title: form.Title,
|
||||
Params: form.Params, Description: form.Description})
|
||||
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*Manage) EquipmentDelete(c *gin.Context) {
|
||||
form := new(api.IDStringForm)
|
||||
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := manage.NewEquipment()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
@ -88,12 +88,6 @@ type (
|
||||
Kind int `json:"kind" form:"kind" binding:"required"`
|
||||
Keywords []string `json:"keywords" form:"keywords"`
|
||||
}
|
||||
// equipmentForm 设备参数
|
||||
equipmentForm struct {
|
||||
Title string `json:"title" form:"title" binding:"required"`
|
||||
Research string `json:"research" form:"research" binding:"required"`
|
||||
Describe string `json:"describe" form:"describe"`
|
||||
}
|
||||
// productForm 产品参数
|
||||
productForm struct {
|
||||
Title string `json:"title" form:"title" binding:"required"`
|
||||
@ -494,58 +488,6 @@ func (a *Technology) TopicDelete(c *gin.Context) {
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (a *Technology) Equipment(c *gin.Context) {
|
||||
form := &struct {
|
||||
Title string `json:"title" form:"title"`
|
||||
api.PageForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := technology2.NewEquipment()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
List(form.Title, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (a *Technology) EquipmentAdd(c *gin.Context) {
|
||||
form := new(equipmentForm)
|
||||
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewEquipment()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Form(&technology2.EquipmentParams{Title: form.Title, Research: form.Research, Describe: form.Describe})
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (a *Technology) EquipmentEdit(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.IDStringForm
|
||||
equipmentForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewEquipment()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Form(&technology2.EquipmentParams{ID: form.Convert(), Title: form.Title, Research: form.Research, Describe: form.Describe})
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (a *Technology) EquipmentDelete(c *gin.Context) {
|
||||
form := new(api.IDStringForm)
|
||||
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewEquipment()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*Technology) Product(c *gin.Context) {
|
||||
form := &struct {
|
||||
Title string `json:"title" form:"title"`
|
||||
|
Reference in New Issue
Block a user