保存绩效是错误添加显示weight

This commit is contained in:
wulin 2021-03-02 17:42:41 +08:00
parent 9ff7f9024c
commit 2bb2136e23
2 changed files with 7 additions and 4 deletions

View File

@ -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 => {

View File

@ -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)