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.
101 lines
3.3 KiB
101 lines
3.3 KiB
|
4 years ago
|
package evaluation
|
||
|
|
|
||
|
|
import (
|
||
|
|
"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)
|
||
|
|
}
|