...
|
...
|
@@ -6,26 +6,28 @@ import ( |
|
|
)
|
|
|
|
|
|
type PerformanceApplicationForm struct {
|
|
|
DimensionName string //维度名称
|
|
|
ModuleName string //模块名称
|
|
|
Weight string //权重
|
|
|
Standard string //标准
|
|
|
Task string //任务、指标
|
|
|
Definition string //定义
|
|
|
DimensionName string // 维度名称
|
|
|
ModuleName string // 模块名称
|
|
|
Weight string // 权重
|
|
|
Standard string // 标准
|
|
|
Task string // 任务、指标
|
|
|
Definition string // 定义
|
|
|
Required string // 是否必填 是 否
|
|
|
Evaluator string // 项目评估人
|
|
|
}
|
|
|
|
|
|
type PerformanceDimension struct {
|
|
|
Name string `json:"name"` //维度名称
|
|
|
PerformanceModule []*PerformanceModule `json:"performanceModule"` //模块
|
|
|
Name string `json:"name"` // 维度名称
|
|
|
PerformanceModule []*PerformanceModule `json:"performanceModule"` // 模块
|
|
|
}
|
|
|
|
|
|
type PerformanceModule struct {
|
|
|
ModuleName string `json:"moduleName"` //模块名称
|
|
|
Weight string `json:"weight"` //权重
|
|
|
Standard string `json:"standard"` //标准(结构化的成果描述)
|
|
|
Target []*PerformanceTarget `json:"performanceTarget"` //任务\指标
|
|
|
ModuleName string `json:"moduleName"` // 模块名称
|
|
|
Weight string `json:"weight"` // 权重
|
|
|
Standard string `json:"standard"` // 标准(结构化的成果描述)
|
|
|
Target []*PerformanceTarget `json:"performanceTarget"` // 任务\指标
|
|
|
Required int `json:"required"` // 是否必填
|
|
|
Evaluator string `json:"evaluator"` // 项目评估人
|
|
|
}
|
|
|
|
|
|
type PerformanceTarget struct {
|
...
|
...
|
@@ -35,7 +37,7 @@ type PerformanceTarget struct { |
|
|
|
|
|
func LoadPerformanceDimensions(rows [][]string) ([]*PerformanceDimension, error) {
|
|
|
formRows := make([]*PerformanceApplicationForm, 0)
|
|
|
var dimensionName, moduleName, taskName, weightName, standardName string
|
|
|
var dimensionName, moduleName, taskName, weightName, standardName, evaluator string
|
|
|
required := "是"
|
|
|
for key, item := range rows {
|
|
|
if key < 3 {
|
...
|
...
|
@@ -88,6 +90,13 @@ func LoadPerformanceDimensions(rows [][]string) ([]*PerformanceDimension, error) |
|
|
required = strings.TrimSpace(item[9])
|
|
|
}
|
|
|
form.Required = required
|
|
|
|
|
|
// 项目评估人
|
|
|
if len(item) > 10 && item[10] != "" {
|
|
|
evaluator = strings.TrimSpace(item[10])
|
|
|
}
|
|
|
form.Evaluator = evaluator
|
|
|
|
|
|
formRows = append(formRows, form)
|
|
|
}
|
|
|
dimensions := make([]*PerformanceDimension, 0)
|
...
|
...
|
@@ -156,12 +165,17 @@ func loadPerformanceModule(forms []*PerformanceApplicationForm) ([]*PerformanceM |
|
|
if err != nil {
|
|
|
return modules, err
|
|
|
}
|
|
|
evaluator, err := getEvaluator(item)
|
|
|
if err != nil {
|
|
|
return modules, err
|
|
|
}
|
|
|
module := &PerformanceModule{
|
|
|
ModuleName: moduleName,
|
|
|
Weight: weightName,
|
|
|
Standard: standardName,
|
|
|
Target: tasks,
|
|
|
Required: required,
|
|
|
Evaluator: evaluator,
|
|
|
}
|
|
|
modules = append(modules, module)
|
|
|
}
|
...
|
...
|
@@ -235,6 +249,23 @@ func getRequired(items []*PerformanceApplicationForm) (int, error) { |
|
|
}
|
|
|
}
|
|
|
|
|
|
// 获取项目评估人
|
|
|
func getEvaluator(items []*PerformanceApplicationForm) (string, error) {
|
|
|
if len(items) <= 0 {
|
|
|
return "", nil
|
|
|
}
|
|
|
var prevName string
|
|
|
for _, item := range items {
|
|
|
if prevName == "" {
|
|
|
prevName = item.Evaluator
|
|
|
}
|
|
|
if prevName != item.Evaluator {
|
|
|
return "", errors.New(item.ModuleName + " 对应的项目评估人填不一致")
|
|
|
}
|
|
|
}
|
|
|
return prevName, nil
|
|
|
}
|
|
|
|
|
|
// 获取任务
|
|
|
func getTasks(items []*PerformanceApplicationForm) ([]*PerformanceTarget, error) {
|
|
|
tasks := make([]*PerformanceTarget, 0)
|
...
|
...
|
|