You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
207 lines
6.7 KiB
207 lines
6.7 KiB
package evaluation
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"strconv"
|
|
|
|
"github.com/flipped-aurora/gin-vue-admin/server/commonus"
|
|
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
|
"github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel"
|
|
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
//查看定量考核目标设定
|
|
func (e *EvaluationInterface) LookQuantitativeConfig(c *gin.Context) {
|
|
var requestData SelectQuantitativeConfig
|
|
err := c.ShouldBindJSON(&requestData)
|
|
if err != nil {
|
|
response.Result(101, err, "数据获取失败!", c)
|
|
return
|
|
}
|
|
var qualConfigList []assessmentmodel.QuantitativeConfig
|
|
gormDb := global.GVA_DB_Performanceappraisal
|
|
if requestData.GroupId != "" {
|
|
gormDb = gormDb.Where("`group` = ?", requestData.GroupId)
|
|
}
|
|
if requestData.DepartmentID != "" {
|
|
gormDb = gormDb.Where("`departmentid` = ?", requestData.DepartmentID)
|
|
}
|
|
if requestData.Dimension != "" {
|
|
gormDb = gormDb.Where("`dimension` = ?", requestData.Dimension)
|
|
}
|
|
if requestData.Target != "" {
|
|
gormDb = gormDb.Where("`target` = ?", requestData.Target)
|
|
}
|
|
if requestData.DetailedTarget != "" {
|
|
gormDb = gormDb.Where("`targetconfig` = ?", requestData.DetailedTarget)
|
|
}
|
|
switch requestData.Type {
|
|
case 1:
|
|
gormDb = gormDb.Where("`type` = ?", requestData.Type)
|
|
case 2:
|
|
gormDb = gormDb.Where("`type` = ?", requestData.Type)
|
|
if requestData.Class != 0 {
|
|
gormDb = gormDb.Where("`timecopy` = ?", requestData.Class)
|
|
}
|
|
case 3:
|
|
gormDb = gormDb.Where("`type` = ?", requestData.Type)
|
|
if requestData.Class != 0 {
|
|
gormDb = gormDb.Where("`timecopy` = ?", requestData.Class)
|
|
}
|
|
default:
|
|
}
|
|
if requestData.Year != 0 {
|
|
gormDb = gormDb.Where("`year` = ?", requestData.Year)
|
|
}
|
|
if requestData.State != 0 {
|
|
gormDb = gormDb.Where("`state` = ?", requestData.State)
|
|
}
|
|
// gormDb = gormDb.Order("group ASC,departmentid ASC,dimension ASC,target ASC,targetconfig ASC").Order("year DESC").Order("timecopy ASC,id ASC")
|
|
gormDb = gormDb.Order("`group` ASC").Order("`departmentid` ASC").Order("`dimension` ASC").Order("`target` ASC").Order("`targetconfig` ASC").Order("`year` DESC").Order("`timecopy` ASC").Order("`id` ASC")
|
|
contErr := gormDb.Find(&qualConfigList).Error
|
|
if contErr != nil {
|
|
response.Result(102, err, "没有数据!", c)
|
|
return
|
|
}
|
|
var outList []OutQuantitativeConfig
|
|
for _, v := range qualConfigList {
|
|
var outCont OutQuantitativeConfig
|
|
outCont.Id = v.Id
|
|
outCont.DepartmentId = v.DepartmentId
|
|
outCont.Group = v.Group
|
|
outCont.Dimension = v.Dimension
|
|
outCont.Target = v.Target
|
|
outCont.TargetConfig = v.TargetConfig
|
|
outCont.Type = v.Type
|
|
outCont.Year = v.Year
|
|
outCont.Timecopy = v.Timecopy
|
|
outCont.Zeroprize = v.Zeroprize / 100
|
|
outCont.Allprize = v.Allprize / 100
|
|
outCont.Time = v.Time
|
|
outCont.State = v.State
|
|
|
|
gErr, groupInfo := commonus.GetGroupCont(v.Group)
|
|
if gErr == true {
|
|
outCont.GroupTitle = groupInfo.Name
|
|
}
|
|
dErr, departmentInfo := commonus.GetBranchFactory(v.DepartmentId)
|
|
if dErr == true {
|
|
outCont.DimensionTitle = departmentInfo.Name
|
|
}
|
|
targetInfo, tErr := commonus.GetTargetInfo(v.Target)
|
|
if tErr == true {
|
|
outCont.TargetTitle = targetInfo.Title
|
|
}
|
|
dtargetInfo, dtErr := commonus.GetDetailedTargetInfo(v.TargetConfig)
|
|
if dtErr == true {
|
|
outCont.DetailedTargetTitle = dtargetInfo.Title
|
|
}
|
|
outList = append(outList, outCont)
|
|
}
|
|
response.Result(0, outList, "获取成功!", c)
|
|
}
|
|
|
|
//查看审批流程
|
|
func (e *EvaluationInterface) SeeFlowLog(c *gin.Context) {
|
|
isTrue, userCont := commonus.ClientIdentity()
|
|
if isTrue != true {
|
|
response.Result(101, isTrue, "您的身份令牌已经失效!请重新登录获取身份令牌!", c)
|
|
return
|
|
}
|
|
var requestData FlowLogType
|
|
c.ShouldBindJSON(&requestData)
|
|
|
|
if requestData.PageSize == 0 {
|
|
requestData.PageSize = 20
|
|
}
|
|
if requestData.Page <= 0 {
|
|
requestData.Page = 1
|
|
}
|
|
offSetPage := commonus.CalculatePages(requestData.Page, requestData.PageSize)
|
|
|
|
var evalProContList []assessmentmodel.EvaluationProcess
|
|
gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.EvaluationProcess{}).Where("FIND_IN_SET(?,`ep_participants`)", userCont.Key)
|
|
if requestData.State != 0 {
|
|
gormDb = gormDb.Where("ep_state = ?", requestData.State)
|
|
}
|
|
/*
|
|
获取总共有多少记录
|
|
*/
|
|
var total int64
|
|
totalErr := gormDb.Count(&total).Error
|
|
if totalErr != nil {
|
|
total = 0
|
|
}
|
|
//获取记录数据
|
|
evaErr := gormDb.Order("ep_id ASC").Limit(requestData.PageSize).Offset(offSetPage).Find(&evalProContList).Error
|
|
if evaErr != nil {
|
|
response.Result(104, evaErr, "数据获取失败!", c)
|
|
return
|
|
}
|
|
var flowLogListOut []FlowLogListOut
|
|
for _, v := range evalProContList {
|
|
var flowLogListCont FlowLogListOut
|
|
orderId := strconv.FormatInt(v.OrderKey, 10)
|
|
flowLogListCont.OutId = orderId
|
|
flowLogListCont.Class = v.TypeClass
|
|
if v.TypeClass == 1 {
|
|
//获取考核项目关联项目
|
|
targettitle, detailedRulesTitle, _, _, scoreFlowCont, dutyTarDetErr := commonus.GetDutyAssociatedItems(orderId)
|
|
if dutyTarDetErr == true {
|
|
if detailedRulesTitle != "" {
|
|
flowLogListCont.Title = fmt.Sprintf("%v", detailedRulesTitle)
|
|
} else {
|
|
flowLogListCont.Title = fmt.Sprintf("%v", targettitle)
|
|
}
|
|
addUser, addUserErr := commonus.GetWorkUser(strconv.FormatInt(scoreFlowCont.EvaluationUser, 10))
|
|
if addUserErr == true {
|
|
flowLogListCont.FounDer = addUser.Name
|
|
}
|
|
}
|
|
} else {
|
|
flowLogInfo, flowLogErr := commonus.GetFlowLog(orderId)
|
|
if flowLogErr == true {
|
|
flowLogListCont.Title = fmt.Sprintf("%v-%v-%v数据上报", flowLogInfo.Year, flowLogInfo.Month, flowLogInfo.ToDay)
|
|
addUser, addUserErr := commonus.GetWorkUser(strconv.FormatInt(flowLogInfo.EvaluationUser, 10))
|
|
if addUserErr == true {
|
|
flowLogListCont.FounDer = addUser.Name
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
//解析审批流
|
|
var flowLog []FlowStep
|
|
jsonFlowErr := json.Unmarshal([]byte(v.Content), &flowLog)
|
|
setpLen := len(flowLog)
|
|
if jsonFlowErr == nil {
|
|
//得到当前步进值
|
|
currentSetp := setpLen - 1
|
|
if currentSetp < 0 {
|
|
currentSetp = 0
|
|
}
|
|
flowLogListCont.Node = flowLog[currentSetp].StepName
|
|
addUser, addUserErr := commonus.GetWorkUser(flowLog[currentSetp].ClickName)
|
|
if addUserErr == true {
|
|
flowLogListCont.CurrentPeo = addUser.Name
|
|
}
|
|
}
|
|
switch v.State {
|
|
case 2:
|
|
flowLogListCont.Result = "审批通过"
|
|
flowLogListCont.Condition = "已结束"
|
|
case 3:
|
|
flowLogListCont.Result = "驳回"
|
|
flowLogListCont.Condition = "审批中"
|
|
default:
|
|
flowLogListCont.Result = "审批中"
|
|
flowLogListCont.Condition = "审批中"
|
|
}
|
|
flowLogListOut = append(flowLogListOut, flowLogListCont)
|
|
}
|
|
countSum := len(flowLogListOut)
|
|
printData := commonus.OutPutList(total, int64(countSum), requestData.Page, requestData.PageSize, flowLogListOut)
|
|
response.Result(0, printData, "查询成功!", c)
|
|
}
|
|
|