Browse Source

添加考核方案列表

master
超级管理员 3 years ago
parent
commit
ddbc3a00a2
  1. 161
      api/version1/postseting/postpc/scheme.go
  2. 16
      api/version1/postseting/postpc/type.go
  3. 3
      apirouter/v1/postseting/pc.go

161
api/version1/postseting/postpc/scheme.go

@ -15,6 +15,87 @@ import (
"github.com/gin-gonic/gin"
)
// 获取岗位考核方案列表
func (a *ApiMethod) GetSchemeList(c *gin.Context) {
var receivedValue postSchemeList
c.ShouldBindJSON(&receivedValue)
if receivedValue.Page == 0 {
receivedValue.Page = 1
}
if receivedValue.PageSize == 0 {
receivedValue.PageSize = 20
}
var schemeList []modelskpi.PositionPlanVersio
gormDb := overall.CONSTANT_DB_KPI.Model(&modelskpi.PositionPlanVersio{}).Where("`state` BETWEEN ? AND ?", 1, 2)
if receivedValue.VersionNumber != "" {
gormDb = gormDb.Where("`key` LIKE ?", "%"+receivedValue.VersionNumber+"%")
}
if receivedValue.CompanyId != "" {
gormDb = gormDb.Where("`group` = ?", receivedValue.CompanyId)
}
if receivedValue.DepartmentId != "" {
gormDb = gormDb.Where("`department` = ?", receivedValue.DepartmentId)
}
if receivedValue.OrgId != "" {
gormDb = gormDb.Where("`orgid` = ?", receivedValue.OrgId)
}
if receivedValue.PostId != "" {
gormDb = gormDb.Where("`position` = ?", receivedValue.PostId)
}
if receivedValue.Year != 0 {
gormDb = gormDb.Where("`years` = ?", receivedValue.Year)
}
if receivedValue.State != 0 {
gormDb = gormDb.Where("`state` = ?", receivedValue.State)
} else {
gormDb = gormDb.Where("`state` BETWEEN ? AND ?", 1, 2)
}
gormDb = publicmethod.PageTurningSettings(gormDb, receivedValue.Page, receivedValue.PageSize)
err := gormDb.Order("`state` ASC").Order("`version` ASC").Order("`id` DESC").Find(&schemeList).Error
var total int64
totalErr := gormDb.Count(&total).Error
if totalErr != nil {
total = 0
}
if err != nil || len(schemeList) < 1 {
publicmethod.Result(107, err, c)
return
}
var sendData []sendPostSchemeList
for i := 0; i < len(schemeList); i++ {
var sendDataCont sendPostSchemeList
sendDataCont.Id = schemeList[i].Id
sendDataCont.Group = schemeList[i].Group //归属集团"`
sendDataCont.Department = schemeList[i].Department //归属部门"`
sendDataCont.OrgId = schemeList[i].OrgId //行政组织"`
sendDataCont.Position = schemeList[i].Position //归属岗位"`
sendDataCont.Key = schemeList[i].Key //编码"`
sendDataCont.Versio = schemeList[i].Versio //版本号"`
sendDataCont.Year = schemeList[i].Year //年度"`
sendDataCont.State = schemeList[i].State //状态(1:启用;2:禁用;3:删除)"`
sendDataCont.AddTime = schemeList[i].AddTime //创建时间"`
sendDataCont.EiteTime = schemeList[i].EiteTime //修改时间"`
sendDataCont.Content = schemeList[i].Content //版本内容"`
sendDataCont.IdStr = strconv.FormatInt(schemeList[i].Id, 10)
var comCont modelshr.AdministrativeOrganization
comCont.GetCont(map[string]interface{}{"`id`": schemeList[i].Group}, "`name`")
sendDataCont.CompanyName = comCont.Name //归属公司"`
comCont.GetCont(map[string]interface{}{"`id`": schemeList[i].Department}, "`name`")
sendDataCont.DepartmentName = comCont.Name //归属部门"`
comCont.GetCont(map[string]interface{}{"`id`": schemeList[i].OrgId}, "`name`")
sendDataCont.OrgName = comCont.Name //归属行政组织"`
var postContInfo modelshr.Position
postContInfo.GetCont(map[string]interface{}{"`id`": schemeList[i].Group}, "`name`")
sendDataCont.PostName = postContInfo.Name //`归属岗位"`
sendData = append(sendData, sendDataCont)
}
publicmethod.ResultList(0, receivedValue.Page, receivedValue.PageSize, total, int64(len(sendData)), sendData, c)
}
// 获取岗位相关指标
func (a *ApiMethod) GetPostAboutTarget(c *gin.Context) {
var receivedValue publicmethod.PublicId
@ -1049,3 +1130,83 @@ func (s *shemeSync) postHandleShemeNot(orgid, postid, dimensId int64) {
s.shememList = append(s.shememList, targetPostList)
syncSeting.Done()
}
// 编辑方案版本状态或删除
func (a *ApiMethod) EditSchemeStateOfDel(c *gin.Context) {
var receivedValue publicmethod.PublicState
err := c.ShouldBindJSON(&receivedValue)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if receivedValue.IsTrue == 0 {
receivedValue.IsTrue = 2
}
if receivedValue.State == 0 {
receivedValue.State = 1
}
if receivedValue.Id == "" {
publicmethod.Result(1, err, c, "未知系统参数!")
return
}
where := map[string]interface{}{"`id`": receivedValue.Id}
var oldSystemCont modelskpi.PositionPlanVersio
err = oldSystemCont.GetCont(where)
if err != nil {
publicmethod.Result(107, err, c)
return
}
if receivedValue.State != 3 {
saveData := publicmethod.MapOut[string]()
saveData["`state`"] = receivedValue.State
saveData["`eitetime`"] = time.Now().Unix()
err = oldSystemCont.EiteCont(where, saveData)
} else {
// if receivedValue.IsTrue != 1 {
saveData := publicmethod.MapOut[string]()
saveData["`state`"] = receivedValue.State
saveData["`eitetime`"] = time.Now().Unix()
err = oldSystemCont.EiteCont(where, saveData)
// } else {
// err = overall.CONSTANT_DB_System_Permission.Where(where).Delete(&oldSystemCont).Error
// }
}
if err != nil {
publicmethod.Result(106, err, c)
return
}
editSchemeOther(oldSystemCont, receivedValue.State)
publicmethod.Result(0, err, c)
}
// 编辑方案状态的时候将附属表单状态一块处理
func editSchemeOther(schemeCont modelskpi.PositionPlanVersio, state int) {
if schemeCont.Id == 0 {
return
}
switch state {
case 1:
// 将本岗位下其他方案内容禁用
saveData := publicmethod.MapOut[string]()
saveData["`state`"] = 2
saveData["`eitetime`"] = time.Now().Unix()
overall.CONSTANT_DB_KPI.Model(&modelskpi.QualitativeEvaluationScheme{}).Where("`company_id` = ? AND `department_id` = ? AND `org_id` = ? AND `post_id` = ? AND `version_number` <> ?", schemeCont.Group, schemeCont.Department, schemeCont.OrgId, schemeCont.Position, schemeCont.Key).Updates(saveData)
// 将本岗位下其他方案禁用
var oldSystemCont modelskpi.PositionPlanVersio
saveDataOther := publicmethod.MapOut[string]()
saveDataOther["`state`"] = 2
saveDataOther["`eitetime`"] = time.Now().Unix()
where := map[string]interface{}{"`id`": schemeCont.Id}
oldSystemCont.EiteCont(where, saveDataOther)
//开启本岗位方案详情
var qesCont modelskpi.QualitativeEvaluationScheme
qesCont.EiteCont(map[string]interface{}{"`version_number`": schemeCont.Key}, map[string]interface{}{"`state": 1})
case 3:
var qesCont modelskpi.QualitativeEvaluationScheme
qesCont.EiteCont(map[string]interface{}{"`version_number`": schemeCont.Key}, map[string]interface{}{"`state": 4})
default:
var qesCont modelskpi.QualitativeEvaluationScheme
qesCont.EiteCont(map[string]interface{}{"`version_number`": schemeCont.Key}, map[string]interface{}{"`state": 2})
}
}

16
api/version1/postseting/postpc/type.go

@ -132,6 +132,22 @@ type schemeDetailedStructure struct {
type postSchemeList struct {
publicmethod.PagesTurn
VersionNumber string `json:"versionnumber"` //版本号
CompanyId string `json:"companyid"` //归属公司"`
DepartmentId string `json:"departmentid"` //归属部门"`
OrgId string `json:"orgid"` //归属行政组织"`
PostId string `json:"postid"` //`归属岗位"`
Year int `json:"year"` //`年度"`
State int `json:"state"` //`状态(1:启用;2:禁用;3:删除)"`
}
// 输出岗位考核方案列表
type sendPostSchemeList struct {
modelskpi.PositionPlanVersio
IdStr string `json:"idstr"`
CompanyName string `json:"companyname"` //归属公司"`
DepartmentName string `json:"departmentname"` //归属部门"`
OrgName string `json:"orgname"` //归属行政组织"`
PostName string `json:"postname"` //`归属岗位"`
}
// 输出考核方案详细内容

3
apirouter/v1/postseting/pc.go

@ -16,6 +16,7 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) {
apiRouter.POST("", methodBinding.Index) //入口
apiRouter.POST("getpostabouttarget", methodBinding.GetPostAboutTarget) //获取岗位相关指标
apiRouter.POST("quote_department_target", methodBinding.QuoteDepartmentTarget) //引用指标部门指标
apiRouter.POST("get_scheme_list", methodBinding.GetSchemeList) //获取岗位考核方案列表
apiRouter.POST("submit_post_scheme", methodBinding.SubmitPostScheme) //提交岗位考核方案
apiRouter.POST("get_post_scheme", methodBinding.GetPostScheme) //获取岗位方案内容列表
apiRouter.POST("get_copy_sheme_infor", methodBinding.GetCopyShemeInfor) //获取复制岗位考核方案
@ -25,6 +26,8 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) {
apiRouter.POST("get_target_about_depart_to_post_man", methodBinding.GetTargetAboutDepartToPostMan) //获取岗位指标关联部门相关岗位及提报人
apiRouter.POST("add_post_target_cont", methodBinding.AddPostTargetCont) //根据指标添加岗位细则
apiRouter.POST("edit_scheme_state_of_del", methodBinding.EditSchemeStateOfDel) //编辑方案版本状态或删除
apiRouter.POST("posttargetsunlist", methodBinding.PostTargetSunList) //根据指标获取岗位定性指标细则列表
}
}

Loading…
Cancel
Save