...
|
...
|
@@ -114,3 +114,39 @@ func (itemValue *SummaryEvaluationValue) valueTypeScore(item *EvaluationItemUsed |
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
// 填写综合自评
|
|
|
func (itemValue *SummaryEvaluationValue) EvaluationSelfFillValue(item *EvaluationItemUsed, value string, remark string) error {
|
|
|
itemValue.Remark = remark
|
|
|
if item.Weight == 0 {
|
|
|
//使用评级的形式
|
|
|
err := itemValue.valueTypeRating(item, value)
|
|
|
return err
|
|
|
}
|
|
|
//综合自评 评分的形式,特殊处理
|
|
|
err := itemValue.valueTypeScoreEvaluationSelf(item, value)
|
|
|
return err
|
|
|
}
|
|
|
|
|
|
func (itemValue *SummaryEvaluationValue) valueTypeScoreEvaluationSelf(item *EvaluationItemUsed, value string) error {
|
|
|
if item.Weight <= 0 {
|
|
|
return errors.New("评分方式错误")
|
|
|
}
|
|
|
value = strings.TrimSpace(value)
|
|
|
itemValue.Value = value
|
|
|
//处理空值
|
|
|
if len(value) == 0 {
|
|
|
itemValue.Score = "0"
|
|
|
return nil
|
|
|
}
|
|
|
valueNumber, err := strconv.ParseFloat(value, 64)
|
|
|
if err != nil {
|
|
|
return fmt.Errorf("条目%d:%s-%s评分值异常", item.Id, item.Category, item.Name)
|
|
|
}
|
|
|
|
|
|
// 分数保留2位小数
|
|
|
score := valueNumber * item.Weight
|
|
|
itemValue.Score = fmt.Sprintf("%.2f", score)
|
|
|
|
|
|
return nil
|
|
|
} |
...
|
...
|
|