保存绩效是错误添加显示weight
This commit is contained in:
parent
9ff7f9024c
commit
2bb2136e23
@ -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 => {
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user