From ce1fcb3e49cc705d2a8bf6af0adb6c28a0e53383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=86=8A=E6=88=90=E5=BC=BA?= Date: Fri, 20 Nov 2020 09:41:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/kpi/assessment/goals/index.vue | 26 +++++++++++++++---- .../edit/components/templateSet.vue | 2 +- src/views/kpi/workbench/home/report.vue | 2 +- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/views/kpi/assessment/goals/index.vue b/src/views/kpi/assessment/goals/index.vue index e7fd545..5c4d493 100644 --- a/src/views/kpi/assessment/goals/index.vue +++ b/src/views/kpi/assessment/goals/index.vue @@ -62,7 +62,7 @@
- 业务指标权重:{{handleGetWeight(i)}}%/{{Math.round((i.weight * 100)*1000)/1000}}% + 业务指标权重:{{handleGetWeight(i)}}% /{{Math.round((i.weight * 100)*1000)/1000}}%
所有指标总权重: {{ handleGetWeight1()}}% @@ -176,12 +176,28 @@ export default { }, async handleGetNext () { const arr = this.handleFilter(this.obj.recortModelDtos) - console.log('arr: ', arr) - for (let i in arr) { - if (arr[i].detailDtos.length > 0 && !arr[i].isTrue) { - this.$message.error(arr[i].name + '维度内的权重和必须为' + Math.round((arr[i].weight * 100) * 1000) / 1000) + if (arr.some(i => i.weight === null)) { + let weight = 0 + let maxWeight = 0 + const nullArray = arr.map(i => { + i.detailDtos.map(j => { + if (i.weight === null) maxWeight += j.checkWeight + weight += j.checkWeight + }) + }) + if (weight !== 1) { + const noWeightArr = arr.filter(i => i.weight === null) + let str = noWeightArr.map(i => i.name).join(',') + this.$message.error(str + '维度内的权重和必须为' + Math.round(((1 - maxWeight) * 100) * 1000) / 1000 + '%') return } + } else { + for (let i in arr) { + if (arr[i].detailDtos.length > 0 && !arr[i].isTrue) { + this.$message.error(arr[i].name + '维度内的权重和必须为' + Math.round((arr[i].weight * 100) * 1000) / 1000) + return + } + } } let res1 = await apiSaveDetail(this.obj) if (res1.code !== 200) { diff --git a/src/views/kpi/workbench/assessmentGroup/edit/components/templateSet.vue b/src/views/kpi/workbench/assessmentGroup/edit/components/templateSet.vue index 75f1c06..b5e13d6 100644 --- a/src/views/kpi/workbench/assessmentGroup/edit/components/templateSet.vue +++ b/src/views/kpi/workbench/assessmentGroup/edit/components/templateSet.vue @@ -401,7 +401,7 @@ export default { this.show = true } else { this.zhibiaoTitle = '编辑指标' - this.formIndicators = Object.assign({}, item, {index, index2: type, isEdit: true}) + this.formIndicators = Object.assign({}, item, {index: type, index2: index, isEdit: true}) this.formIndicators.weight = this.formIndicators.weight * 100 this.showIndicators = true } diff --git a/src/views/kpi/workbench/home/report.vue b/src/views/kpi/workbench/home/report.vue index 34fa391..1703c4b 100644 --- a/src/views/kpi/workbench/home/report.vue +++ b/src/views/kpi/workbench/home/report.vue @@ -9,7 +9,7 @@ v-model="value1" value-format='yyyy-MM-dd' type="daterange" - range-separator="至" + range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期">