优化
This commit is contained in:
parent
b6420af873
commit
ce1fcb3e49
@ -62,7 +62,7 @@
|
|||||||
</draggable>
|
</draggable>
|
||||||
<div style=" padding: 10px;font-size:16px;" class="commonFont">
|
<div style=" padding: 10px;font-size:16px;" class="commonFont">
|
||||||
<div>
|
<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>
|
||||||
<div>
|
<div>
|
||||||
所有指标总权重: {{ handleGetWeight1()}}%
|
所有指标总权重: {{ handleGetWeight1()}}%
|
||||||
@ -176,13 +176,29 @@ export default {
|
|||||||
},
|
},
|
||||||
async handleGetNext () {
|
async handleGetNext () {
|
||||||
const arr = this.handleFilter(this.obj.recortModelDtos)
|
const arr = this.handleFilter(this.obj.recortModelDtos)
|
||||||
console.log('arr: ', arr)
|
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) {
|
for (let i in arr) {
|
||||||
if (arr[i].detailDtos.length > 0 && !arr[i].isTrue) {
|
if (arr[i].detailDtos.length > 0 && !arr[i].isTrue) {
|
||||||
this.$message.error(arr[i].name + '维度内的权重和必须为' + Math.round((arr[i].weight * 100) * 1000) / 1000)
|
this.$message.error(arr[i].name + '维度内的权重和必须为' + Math.round((arr[i].weight * 100) * 1000) / 1000)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
let res1 = await apiSaveDetail(this.obj)
|
let res1 = await apiSaveDetail(this.obj)
|
||||||
if (res1.code !== 200) {
|
if (res1.code !== 200) {
|
||||||
this.$message.error(res1.msg)
|
this.$message.error(res1.msg)
|
||||||
|
|||||||
@ -401,7 +401,7 @@ export default {
|
|||||||
this.show = true
|
this.show = true
|
||||||
} else {
|
} else {
|
||||||
this.zhibiaoTitle = '编辑指标'
|
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.formIndicators.weight = this.formIndicators.weight * 100
|
||||||
this.showIndicators = true
|
this.showIndicators = true
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
v-model="value1"
|
v-model="value1"
|
||||||
value-format='yyyy-MM-dd'
|
value-format='yyyy-MM-dd'
|
||||||
type="daterange"
|
type="daterange"
|
||||||
range-separator="至"
|
range-separator="-"
|
||||||
start-placeholder="开始日期"
|
start-placeholder="开始日期"
|
||||||
end-placeholder="结束日期">
|
end-placeholder="结束日期">
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user