feat:完善项目

This commit is contained in:
henry
2021-11-10 15:09:31 +08:00
parent 095bdcfe4c
commit 863edee71c
6 changed files with 161 additions and 5 deletions

View File

@ -24,6 +24,47 @@ type (
}
)
/**
* @api {post} /api/v1/supplier/select 供应商Select
* @apiVersion 1.0.0
* @apiName SupplierSelect
* @apiGroup Supplier
*
* @apiHeader {string} x-token token
*
* @apiParam {Number} kind 类型101制造商102材料合作商103维修合作商
*
* @apiSuccess (200) {Object} data 数据信息
* @apiSuccess (200) {String} data.id ID
* @apiSuccess (200) {String} data.name 名称
* @apiSuccess (200) {Number} code 成功响应状态码!
* @apiSuccess (200) {String} msg 成功提示
*
* @apiSuccessExample {json} Success response:
* HTTPS 200 OK
* {
* "code": 200
* "msg": "ok"
* "data": [
* {
* "id": "EgmJ4Ga7LQ",
* "name": "测试的",
* }
* ]
* }
*/
func (*Supplier) Select(c *gin.Context) {
form := &struct {
Kind int `json:"kind" form:"kind" binding:"required"`
}{}
if err := bind(form)(c); err != nil {
APIFailure(err.(error))(c)
return
}
data, err := manage.NewSupplier()(getSession()(c).(*service.Session)).Select(form.Kind)
APIResponse(err, data)(c)
}
/**
* @api {post} /api/v1/supplier/material 器材信息
* @apiVersion 1.0.0

View File

@ -53,6 +53,70 @@ func (*User) Info(c *gin.Context) {
APIResponse(nil, data)(c)
}
/**
* @api {get} /api/v1/user/select 用户Select信息
* @apiVersion 1.0.0
* @apiName UserSelect
* @apiGroup User
*
* @apiHeader {string} x-token token
*
* @apiSuccess (200) {Object} data 数据信息
* @apiSuccess (200) {String} data.id ID-即uuid
* @apiSuccess (200) {String} data.name 用户名
* @apiSuccess (200) {Number} code 成功响应状态码!
* @apiSuccess (200) {String} msg 成功提示
*
* @apiSuccessExample {json} Success response:
* HTTPS 200 OK
* {
* "code": 200
* "msg": "ok"
* "data": [
* {
* "id": "2098151543063711744",
* "name": "超级管理员",
* }
* ]
* }
*/
func (*User) Select(c *gin.Context) {
data, err := user.NewInstance()(getSession()(c).(*service.Session)).Select()
APIResponse(err, data)(c)
}
/**
* @api {get} /api/v1/user/menu 用户菜单信息
* @apiVersion 1.0.0
* @apiName UserMenu
* @apiGroup User
*
* @apiHeader {string} x-token token
*
* @apiSuccess (200) {Object} data 数据信息-参考菜单信息
* @apiSuccess (200) {Number} code 成功响应状态码!
* @apiSuccess (200) {String} msg 成功提示
*
* @apiSuccessExample {json} Success response:
* HTTPS 200 OK
* {
* "code": 200
* "msg": "ok"
* "data": [
* {
* "id": "7X2JlBVknr",
* "name": "装备维修",
* "kind": 1,
* "link": "",
* "component": "",
* "icon": "",
* "parent_id": "0",
* "checked": true,
* "checked": [],
* }
* ]
* }
*/
func (*User) Menu(c *gin.Context) {
data, err := user.NewMenu()(getSession()(c).(*service.Session)).Menu()
APIResponse(err, data)(c)

View File

@ -270,6 +270,28 @@ func (*Work) Examine(c *gin.Context) {
APIResponse(err)
}
/**
* @api {post} /api/v1/work/delete 工单流程信息删除
* @apiVersion 1.0.0
* @apiName WorkDelete
* @apiGroup Work
*
* @apiHeader {string} x-token token
*
* @apiParam {String} id Id
*
* @apiSuccess (200) {Object} data 数据信息
* @apiSuccess (200) {Number} code 成功响应状态码!
* @apiSuccess (200) {String} msg 成功提示
*
* @apiSuccessExample {json} Success response:
* HTTPS 200 OK
* {
* "code": 200
* "msg": "ok"
* "data": null
* }
*/
func (*Work) Delete(c *gin.Context) {
form := new(IDStringForm)
@ -337,9 +359,9 @@ func (*Work) Schedule(c *gin.Context) {
}
/**
* @api {get} /api/v1/work/schedule/edit 工单流程信息修改
* @api {post} /api/v1/work/schedule/edit 工单流程信息修改
* @apiVersion 1.0.0
* @apiName WorkSchedulEdit
* @apiName WorkScheduleEdit
* @apiGroup Work
*
* @apiHeader {string} x-token token
@ -378,9 +400,9 @@ func (*Work) ScheduleEdit(c *gin.Context) {
}
/**
* @api {get} /api/v1/work/schedule/delete 工单流程信息删除
* @api {post} /api/v1/work/schedule/delete 工单流程信息删除
* @apiVersion 1.0.0
* @apiName WorkSchedulDelete
* @apiName WorkScheduleDelete
* @apiGroup Work
*
* @apiHeader {string} x-token token

View File

@ -24,6 +24,7 @@ type (
InstanceIdentityInfo struct {
ID string `json:"id"`
*model2.SysMenuBasic
ParentID string `json:"parent_id"`
Checked bool `json:"checked"`
Children []*InstanceIdentityInfo `json:"children"`
}
@ -67,9 +68,18 @@ func TreeIdentity(iModel model2.IModel, src []*model.SysMenuScene, parentID uint
for _, v := range src {
if v.ParentID == parentID {
iModel.SetID(v.ID)
id := iModel.GetEncodeID()
_parentID := "0"
if v.ParentID > 0 {
iModel.SetID(v.ParentID)
_parentID = iModel.GetEncodeID()
}
out = append(out, &InstanceIdentityInfo{
ID: iModel.GetEncodeID(),
ID: id,
SysMenuBasic: v.SysMenuBasic,
ParentID: _parentID,
Checked: v.SceneID > 0,
Children: TreeIdentity(iModel, src, v.ID),
})

View File

@ -30,6 +30,11 @@ type (
Account, Name, Avatar, Mobile, Password, Remark string
Gender int
}
// InstanceBasicInfo 基本信息
InstanceBasicInfo struct {
UUID string `json:"id"` // 别名更改为ID
Name string `json:"name"`
}
)
// Info 基本信息
@ -37,6 +42,18 @@ func (c *Instance) Info() *InstanceBasic {
return &InstanceBasic{Name: c.Name, Avatar: c.Avatar}
}
// Select 筛选信息
func (c *Instance) Select() ([]*InstanceBasicInfo, error) {
mSysUser := model.NewSysUser()
out := make([]*InstanceBasicInfo, 0)
if err := model2.ScanFields(mSysUser.SysUser, &out, []string{"uuid", "name"}); err != nil {
return nil, err
}
return out, nil
}
// List 列表信息
func (c *Instance) List(name, mobile string, tenantID uint64, page, pageSize int) (*basic.PageDataResponse, error) {
mSysUser := model.NewSysUser()

View File

@ -86,6 +86,7 @@ func (this *Router) registerAPI() {
{
_api := new(api.User)
userV1.GET("/info", _api.Info)
userV1.GET("/select", _api.Select)
userV1.GET("/menu", _api.Menu)
userV1.POST("/list", _api.List)
userV1.POST("/add", _api.Add)
@ -123,6 +124,7 @@ func (this *Router) registerAPI() {
supplierV1 := v1.Group("/supplier")
{
_api := new(api.Supplier)
supplierV1.POST("/select", _api.Select)
supplierV1.POST("/material", _api.Material)
supplierV1.POST("/material/add", _api.MaterialAdd)
supplierV1.POST("/material/edit", _api.MaterialEdit)