|
@@ -114,3 +114,39 @@ func (itemValue *SummaryEvaluationValue) valueTypeScore(item *EvaluationItemUsed |
|
@@ -114,3 +114,39 @@ func (itemValue *SummaryEvaluationValue) valueTypeScore(item *EvaluationItemUsed |
|
114
|
}
|
114
|
}
|
|
115
|
return nil
|
115
|
return nil
|
|
116
|
}
|
116
|
}
|
|
|
|
117
|
+
|
|
|
|
118
|
+// 填写综合自评
|
|
|
|
119
|
+func (itemValue *SummaryEvaluationValue) EvaluationSelfFillValue(item *EvaluationItemUsed, value string, remark string) error {
|
|
|
|
120
|
+ itemValue.Remark = remark
|
|
|
|
121
|
+ if item.Weight == 0 {
|
|
|
|
122
|
+ //使用评级的形式
|
|
|
|
123
|
+ err := itemValue.valueTypeRating(item, value)
|
|
|
|
124
|
+ return err
|
|
|
|
125
|
+ }
|
|
|
|
126
|
+ //综合自评 评分的形式,特殊处理
|
|
|
|
127
|
+ err := itemValue.valueTypeScoreEvaluationSelf(item, value)
|
|
|
|
128
|
+ return err
|
|
|
|
129
|
+}
|
|
|
|
130
|
+
|
|
|
|
131
|
+func (itemValue *SummaryEvaluationValue) valueTypeScoreEvaluationSelf(item *EvaluationItemUsed, value string) error {
|
|
|
|
132
|
+ if item.Weight <= 0 {
|
|
|
|
133
|
+ return errors.New("评分方式错误")
|
|
|
|
134
|
+ }
|
|
|
|
135
|
+ value = strings.TrimSpace(value)
|
|
|
|
136
|
+ itemValue.Value = value
|
|
|
|
137
|
+ //处理空值
|
|
|
|
138
|
+ if len(value) == 0 {
|
|
|
|
139
|
+ itemValue.Score = "0"
|
|
|
|
140
|
+ return nil
|
|
|
|
141
|
+ }
|
|
|
|
142
|
+ valueNumber, err := strconv.ParseFloat(value, 64)
|
|
|
|
143
|
+ if err != nil {
|
|
|
|
144
|
+ return fmt.Errorf("条目%d:%s-%s评分值异常", item.Id, item.Category, item.Name)
|
|
|
|
145
|
+ }
|
|
|
|
146
|
+
|
|
|
|
147
|
+ // 分数保留2位小数
|
|
|
|
148
|
+ score := valueNumber * item.Weight
|
|
|
|
149
|
+ itemValue.Score = fmt.Sprintf("%.2f", score)
|
|
|
|
150
|
+
|
|
|
|
151
|
+ return nil
|
|
|
|
152
|
+} |