作者 tangxvhui

机会列表调整

... ... @@ -77,6 +77,7 @@ func (c *AuditController) AuditListBefore() {
auditPermission serverbac.OptionOpportunity
)
auditPermission = serveaudit.GetPermissionInAuditPage(uid, companyId)
reserveType := serveaudit.GetChanceReserveTypeAll(companyId)
data := map[string]interface{}{
"template": templatelist,
"chance_type": chanceTypeList,
... ... @@ -85,6 +86,12 @@ func (c *AuditController) AuditListBefore() {
"review_status": reviewStatus,
"department": departmentList,
"permission": auditPermission,
"store_type": map[string]string{
"-1": "全部",
"0": "机会池",
"1": "储备池",
},
"reserve_type": reserveType,
}
msg = protocol.NewReturnResponse(data, nil)
return
... ... @@ -243,7 +250,7 @@ func (c *AuditController) ChanceCheckResultPassOrNo() {
return
}
//GetChanceReserveTypeList 获取机会储备池分类类型
//ChanceReserveTypeList 获取机会储备池分类类型
//@router /v1/chance/reserve_type/list
func (c *AuditController) ChanceReserveTypeList() {
var msg *protocol.ResponseMessage
... ... @@ -282,6 +289,15 @@ func (c *AuditController) EditReserveType() {
msg = protocol.BadRequestParam("1")
return
}
nameRune := []rune(param.Name)
if len(nameRune) == 0 {
msg = protocol.BadRequestParam("10133")
return
}
if len(nameRune) > 20 {
msg = protocol.BadRequestParam("10134")
return
}
companyId := c.GetCompanyId()
var err error
if param.Id == 0 {
... ... @@ -293,7 +309,7 @@ func (c *AuditController) EditReserveType() {
return
}
//EditReserveType 编辑机会储备池分类类型
//DeleteReserveType 删除机会储备池分类类型
//@router /v1/chance/reserve_type/delete
func (c *AuditController) DeleteReserveType() {
var msg *protocol.ResponseMessage
... ...
... ... @@ -39,6 +39,8 @@ type Chance struct {
CheckResultStatus int8 ` orm:"column(check_result_status)"`
CheckTime time.Time `orm:"column(check_time);type(timestamp);"`
CheckResult string `orm:"column(check_result)" description:"自查内容筛选结果"`
ChanceType int8 `orm:"column(type)" description:"机会类别:0:机会池 1:储备池"`
ReserveTypeId int `orm:"column(reserve_type_id)" description:"储备类型编号"`
}
func (t *Chance) TableName() string {
... ...
... ... @@ -283,6 +283,9 @@ type RspAuditList struct {
StatusName string `json:"status_name"`
DiscoveryScore string `json:"discovery_score"`
CommentTotal string `json:"comment_total"`
ReserveType string `json:"reserve_type"`
StoreType int8 `json:"store_type"`
StoreTypeName string `json:"store_type_name"`
}
type ChanceFlowLog struct {
... ...
... ... @@ -130,6 +130,8 @@ var errmessge ErrorMap = map[string]string{
"10130": "同一级的自查内容不能重复",
"10131": "储备池分类名称已存在",
"10132": "无法删除已使用的储备池分类",
"10133": "储备池分类名称必填",
"10134": "储备池分类名称最多20个字",
}
//错误码转换 ,兼容需要
... ...
... ... @@ -115,3 +115,23 @@ func DeleteReserveType(id int, companyid int64) error {
}
return nil
}
func GetChanceReserveTypeAll(companyId int64) []protocol.ChanceReserveTypeData {
data := []protocol.ChanceReserveTypeData{}
var sourceData []models.ChanceReserveType
o := orm.NewOrm()
_, err := o.QueryTable(&models.ChanceReserveType{}).
Filter("company_id", companyId).
All(&sourceData)
if err != nil {
return data
}
for i := range data {
m := protocol.ChanceReserveTypeData{
Id: data[i].Id,
Name: data[i].Name,
}
data = append(data, m)
}
return data
}
... ...