This commit is contained in:
熊成强 2020-11-20 09:41:08 +08:00
parent b6420af873
commit ce1fcb3e49
3 changed files with 23 additions and 7 deletions

View File

@ -62,7 +62,7 @@
</draggable>
<div style=" padding: 10px;font-size:16px;" class="commonFont">
<div>
业务指标权重{{handleGetWeight(i)}}%/{{Math.round((i.weight * 100)*1000)/1000}}%
业务指标权重{{handleGetWeight(i)}}% <span v-if="i.weight !== null">/{{Math.round((i.weight * 100)*1000)/1000}}%</span>
</div>
<div>
所有指标总权重: {{ 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) {

View File

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

View File

@ -9,7 +9,7 @@
v-model="value1"
value-format='yyyy-MM-dd'
type="daterange"
range-separator=""
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>