From 2bb2136e23bc6b847baebc0193be13fab84a8bd5 Mon Sep 17 00:00:00 2001 From: wulin Date: Tue, 2 Mar 2021 17:42:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E7=BB=A9=E6=95=88=E6=98=AF?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=B7=BB=E5=8A=A0=E6=98=BE=E7=A4=BAweight?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/kpi/assessment/goals/index.vue | 8 ++++++-- .../assessment/performance/components/UseButton/index.vue | 3 +-- 2 files changed, 7 insertions(+), 4 deletions(-) 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)