...
|
...
|
@@ -14,6 +14,7 @@ type PerformanceApplicationForm struct { |
|
|
Definition string // 定义
|
|
|
Required string // 是否必填 是 否
|
|
|
Evaluator string // 项目评估人
|
|
|
IndicatorType string // 指标类型(任务 )
|
|
|
}
|
|
|
|
|
|
type PerformanceDimension struct {
|
...
|
...
|
@@ -22,12 +23,13 @@ type PerformanceDimension struct { |
|
|
}
|
|
|
|
|
|
type PerformanceModule struct {
|
|
|
ModuleName string `json:"moduleName"` // 模块名称
|
|
|
Weight string `json:"weight"` // 权重
|
|
|
Standard string `json:"standard"` // 标准(结构化的成果描述)
|
|
|
Target []*PerformanceTarget `json:"performanceTarget"` // 任务\指标
|
|
|
Required int `json:"required"` // 是否必填
|
|
|
Evaluator string `json:"evaluator"` // 项目评估人
|
|
|
ModuleName string `json:"moduleName"` // 模块名称
|
|
|
Weight string `json:"weight"` // 权重
|
|
|
Standard string `json:"standard"` // 标准(结构化的成果描述)
|
|
|
Target []*PerformanceTarget `json:"performanceTarget"` // 任务\指标
|
|
|
Required int `json:"required"` // 是否必填
|
|
|
Evaluator string `json:"evaluator"` // 项目评估人
|
|
|
IndicatorType int `json:"indicatorType"` // 指标类型(任务 )
|
|
|
}
|
|
|
|
|
|
type PerformanceTarget struct {
|
...
|
...
|
@@ -169,13 +171,19 @@ 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,
|
|
|
Standard: standardName,
|
|
|
Target: tasks,
|
|
|
Required: required,
|
|
|
Evaluator: evaluator,
|
|
|
ModuleName: moduleName,
|
|
|
Weight: weightName,
|
|
|
Standard: standardName,
|
|
|
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)
|
...
|
...
|
|