...
|
...
|
@@ -14,6 +14,7 @@ type PerformanceApplicationForm struct { |
|
|
Definition string // 定义
|
|
|
Required string // 是否必填 是 否
|
|
|
Evaluator string // 项目评估人
|
|
|
IndicatorType string // 指标类型(任务 )
|
|
|
}
|
|
|
|
|
|
type PerformanceDimension struct {
|
...
|
...
|
@@ -28,6 +29,7 @@ type PerformanceModule struct { |
|
|
Target []*PerformanceTarget `json:"performanceTarget"` // 任务\指标
|
|
|
Required int `json:"required"` // 是否必填
|
|
|
Evaluator string `json:"evaluator"` // 项目评估人
|
|
|
IndicatorType int `json:"indicatorType"` // 指标类型(任务 )
|
|
|
}
|
|
|
|
|
|
type PerformanceTarget struct {
|
...
|
...
|
@@ -169,6 +171,11 @@ func loadPerformanceModule(forms []*PerformanceApplicationForm) ([]*PerformanceM |
|
|
if err != nil {
|
|
|
return modules, err
|
|
|
}
|
|
|
indicatorType, err := getIndicatorType(item)
|
|
|
if err != nil {
|
|
|
return modules, err
|
|
|
}
|
|
|
|
|
|
module := &PerformanceModule{
|
|
|
ModuleName: moduleName,
|
|
|
Weight: weightName,
|
...
|
...
|
@@ -176,6 +183,7 @@ func loadPerformanceModule(forms []*PerformanceApplicationForm) ([]*PerformanceM |
|
|
Target: tasks,
|
|
|
Required: required,
|
|
|
Evaluator: evaluator,
|
|
|
IndicatorType: indicatorType,
|
|
|
}
|
|
|
modules = append(modules, module)
|
|
|
}
|
...
|
...
|
@@ -260,7 +268,7 @@ func getEvaluator(items []*PerformanceApplicationForm) (string, error) { |
|
|
prevName = item.Evaluator
|
|
|
}
|
|
|
if prevName != item.Evaluator {
|
|
|
return "", errors.New(item.ModuleName + " 对应的项目评估人填不一致")
|
|
|
return "", errors.New(item.ModuleName + " 对应的项目评估人填写不一致")
|
|
|
}
|
|
|
}
|
|
|
if prevName == "/" {
|
...
|
...
|
@@ -269,6 +277,27 @@ func getEvaluator(items []*PerformanceApplicationForm) (string, error) { |
|
|
return prevName, nil
|
|
|
}
|
|
|
|
|
|
// 获取指标类型
|
|
|
func getIndicatorType(items []*PerformanceApplicationForm) (int, error) {
|
|
|
if len(items) <= 0 {
|
|
|
return IndicatorTypeDef, nil
|
|
|
}
|
|
|
var prevName string
|
|
|
for _, item := range items {
|
|
|
if prevName == "" {
|
|
|
prevName = item.IndicatorType
|
|
|
}
|
|
|
if prevName != item.IndicatorType {
|
|
|
return IndicatorTypeDef, errors.New(item.ModuleName + " 对应的指标类型填写不一致")
|
|
|
}
|
|
|
}
|
|
|
if prevName == "任务" {
|
|
|
return IndicatorTypeTask, nil
|
|
|
} else {
|
|
|
return IndicatorTypeDef, nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 获取任务
|
|
|
func getTasks(items []*PerformanceApplicationForm) ([]*PerformanceTarget, error) {
|
|
|
tasks := make([]*PerformanceTarget, 0)
|
...
|
...
|
|