diff --git a/src/views/kpi/assessment/goals/index.vue b/src/views/kpi/assessment/goals/index.vue index 303e31d..5b66b3f 100644 --- a/src/views/kpi/assessment/goals/index.vue +++ b/src/views/kpi/assessment/goals/index.vue @@ -409,6 +409,7 @@ export default { return item ? item.filter(i => !i.isDelete) : [] }, async handleGetNext () { + // 提交绩效详情 const arr = this.handleFilter(this.obj.recortModelDtos) if (arr.some(i => i.weight === null)) { let weight = 0 @@ -419,7 +420,7 @@ export default { weight += j.checkWeight }) }) - if (weight !== 1) { + if (Math.round((weight * 100) * 1000) / 1000 !== 100) { const noWeightArr = arr.filter(i => i.weight === null) let str = noWeightArr.map(i => i.name).join(',') this.$message.error(str + '维度内的权重和必须为100%!') @@ -486,6 +487,7 @@ export default { }, async handleSaveDetail (params = this.obj, type) { if (type === 1) { + // 保存绩效详情 const arr = this.handleFilter(this.obj.recortModelDtos) if (arr.some(i => i.weight === null)) { let weight = 0 @@ -496,13 +498,15 @@ export default { weight += j.checkWeight }) }) - if (weight !== 1) { + if (Math.round((weight * 100) * 1000) / 1000 !== 100) { const noWeightArr = arr.filter(i => i.weight === null) let str = noWeightArr.map(i => i.name).join(',') + str += Math.round((weight * 100) * 1000) / 1000 this.$message.error(str + '维度内的权重和必须为100%!') return } } else { + // 暂存绩效详情 for (let i in arr) { let num = 0 this.handleFilter(arr[i].detailDtos).map(l => { diff --git a/src/views/kpi/assessment/performance/components/UseButton/index.vue b/src/views/kpi/assessment/performance/components/UseButton/index.vue index c3d87a1..6b43cdc 100644 --- a/src/views/kpi/assessment/performance/components/UseButton/index.vue +++ b/src/views/kpi/assessment/performance/components/UseButton/index.vue @@ -408,7 +408,7 @@ export default { result += item.checkWeight return result }, 0).toFixed(5) - if (Math.round((res * 100) * 1000) / 1000 !== 100) { + if (i.weight !== Number(res)) { this.$message.error(i.name + '维度内的权重和必须为100%!') _boolean = false } @@ -416,7 +416,6 @@ export default { if (!_boolean) { return } - i.weight = res } let res1 = await apiSaveDetail(this.obj)