作者 tangxvhui

机会列表调整

@@ -77,6 +77,7 @@ func (c *AuditController) AuditListBefore() { @@ -77,6 +77,7 @@ func (c *AuditController) AuditListBefore() {
77 auditPermission serverbac.OptionOpportunity 77 auditPermission serverbac.OptionOpportunity
78 ) 78 )
79 auditPermission = serveaudit.GetPermissionInAuditPage(uid, companyId) 79 auditPermission = serveaudit.GetPermissionInAuditPage(uid, companyId)
  80 + reserveType := serveaudit.GetChanceReserveTypeAll(companyId)
80 data := map[string]interface{}{ 81 data := map[string]interface{}{
81 "template": templatelist, 82 "template": templatelist,
82 "chance_type": chanceTypeList, 83 "chance_type": chanceTypeList,
@@ -85,6 +86,12 @@ func (c *AuditController) AuditListBefore() { @@ -85,6 +86,12 @@ func (c *AuditController) AuditListBefore() {
85 "review_status": reviewStatus, 86 "review_status": reviewStatus,
86 "department": departmentList, 87 "department": departmentList,
87 "permission": auditPermission, 88 "permission": auditPermission,
  89 + "store_type": map[string]string{
  90 + "-1": "全部",
  91 + "0": "机会池",
  92 + "1": "储备池",
  93 + },
  94 + "reserve_type": reserveType,
88 } 95 }
89 msg = protocol.NewReturnResponse(data, nil) 96 msg = protocol.NewReturnResponse(data, nil)
90 return 97 return
@@ -243,7 +250,7 @@ func (c *AuditController) ChanceCheckResultPassOrNo() { @@ -243,7 +250,7 @@ func (c *AuditController) ChanceCheckResultPassOrNo() {
243 return 250 return
244 } 251 }
245 252
246 -//GetChanceReserveTypeList 获取机会储备池分类类型 253 +//ChanceReserveTypeList 获取机会储备池分类类型
247 //@router /v1/chance/reserve_type/list 254 //@router /v1/chance/reserve_type/list
248 func (c *AuditController) ChanceReserveTypeList() { 255 func (c *AuditController) ChanceReserveTypeList() {
249 var msg *protocol.ResponseMessage 256 var msg *protocol.ResponseMessage
@@ -282,6 +289,15 @@ func (c *AuditController) EditReserveType() { @@ -282,6 +289,15 @@ func (c *AuditController) EditReserveType() {
282 msg = protocol.BadRequestParam("1") 289 msg = protocol.BadRequestParam("1")
283 return 290 return
284 } 291 }
  292 + nameRune := []rune(param.Name)
  293 + if len(nameRune) == 0 {
  294 + msg = protocol.BadRequestParam("10133")
  295 + return
  296 + }
  297 + if len(nameRune) > 20 {
  298 + msg = protocol.BadRequestParam("10134")
  299 + return
  300 + }
285 companyId := c.GetCompanyId() 301 companyId := c.GetCompanyId()
286 var err error 302 var err error
287 if param.Id == 0 { 303 if param.Id == 0 {
@@ -293,7 +309,7 @@ func (c *AuditController) EditReserveType() { @@ -293,7 +309,7 @@ func (c *AuditController) EditReserveType() {
293 return 309 return
294 } 310 }
295 311
296 -//EditReserveType 编辑机会储备池分类类型 312 +//DeleteReserveType 删除机会储备池分类类型
297 //@router /v1/chance/reserve_type/delete 313 //@router /v1/chance/reserve_type/delete
298 func (c *AuditController) DeleteReserveType() { 314 func (c *AuditController) DeleteReserveType() {
299 var msg *protocol.ResponseMessage 315 var msg *protocol.ResponseMessage
@@ -39,6 +39,8 @@ type Chance struct { @@ -39,6 +39,8 @@ type Chance struct {
39 CheckResultStatus int8 ` orm:"column(check_result_status)"` 39 CheckResultStatus int8 ` orm:"column(check_result_status)"`
40 CheckTime time.Time `orm:"column(check_time);type(timestamp);"` 40 CheckTime time.Time `orm:"column(check_time);type(timestamp);"`
41 CheckResult string `orm:"column(check_result)" description:"自查内容筛选结果"` 41 CheckResult string `orm:"column(check_result)" description:"自查内容筛选结果"`
  42 + ChanceType int8 `orm:"column(type)" description:"机会类别:0:机会池 1:储备池"`
  43 + ReserveTypeId int `orm:"column(reserve_type_id)" description:"储备类型编号"`
42 } 44 }
43 45
44 func (t *Chance) TableName() string { 46 func (t *Chance) TableName() string {
@@ -283,6 +283,9 @@ type RspAuditList struct { @@ -283,6 +283,9 @@ type RspAuditList struct {
283 StatusName string `json:"status_name"` 283 StatusName string `json:"status_name"`
284 DiscoveryScore string `json:"discovery_score"` 284 DiscoveryScore string `json:"discovery_score"`
285 CommentTotal string `json:"comment_total"` 285 CommentTotal string `json:"comment_total"`
  286 + ReserveType string `json:"reserve_type"`
  287 + StoreType int8 `json:"store_type"`
  288 + StoreTypeName string `json:"store_type_name"`
286 } 289 }
287 290
288 type ChanceFlowLog struct { 291 type ChanceFlowLog struct {
@@ -130,6 +130,8 @@ var errmessge ErrorMap = map[string]string{ @@ -130,6 +130,8 @@ var errmessge ErrorMap = map[string]string{
130 "10130": "同一级的自查内容不能重复", 130 "10130": "同一级的自查内容不能重复",
131 "10131": "储备池分类名称已存在", 131 "10131": "储备池分类名称已存在",
132 "10132": "无法删除已使用的储备池分类", 132 "10132": "无法删除已使用的储备池分类",
  133 + "10133": "储备池分类名称必填",
  134 + "10134": "储备池分类名称最多20个字",
133 } 135 }
134 136
135 //错误码转换 ,兼容需要 137 //错误码转换 ,兼容需要
@@ -115,3 +115,23 @@ func DeleteReserveType(id int, companyid int64) error { @@ -115,3 +115,23 @@ func DeleteReserveType(id int, companyid int64) error {
115 } 115 }
116 return nil 116 return nil
117 } 117 }
  118 +
  119 +func GetChanceReserveTypeAll(companyId int64) []protocol.ChanceReserveTypeData {
  120 + data := []protocol.ChanceReserveTypeData{}
  121 + var sourceData []models.ChanceReserveType
  122 + o := orm.NewOrm()
  123 + _, err := o.QueryTable(&models.ChanceReserveType{}).
  124 + Filter("company_id", companyId).
  125 + All(&sourceData)
  126 + if err != nil {
  127 + return data
  128 + }
  129 + for i := range data {
  130 + m := protocol.ChanceReserveTypeData{
  131 + Id: data[i].Id,
  132 + Name: data[i].Name,
  133 + }
  134 + data = append(data, m)
  135 + }
  136 + return data
  137 +}