优化
This commit is contained in:
parent
2085b60d7d
commit
59d94eafdf
@ -197,10 +197,16 @@
|
||||
<div class="goals-bottom">
|
||||
<div class="goals-bottom-content">
|
||||
<el-button size='small'
|
||||
@click="handleSaveDetail()"
|
||||
v-if="this.$route.query.saveIn===1"
|
||||
@click="handleSaveDetail(obj,1)"
|
||||
plain>保存</el-button>
|
||||
<el-button size='small'
|
||||
v-if="this.$route.query.saveAndAdd===1"
|
||||
@click="handleSaveDetail(obj,2)"
|
||||
plain>暂存</el-button>
|
||||
<el-button size='small'
|
||||
type="primary"
|
||||
v-if="this.$route.query.saveAndAdd===1"
|
||||
@click="handleGetNext">提交</el-button>
|
||||
</div>
|
||||
</div>
|
||||
@ -283,6 +289,7 @@ export default {
|
||||
computed: {},
|
||||
beforeMount () { },
|
||||
mounted () {
|
||||
console.log('auth', this.auth)
|
||||
this.handleGetDimensions()
|
||||
this.handleGetTbale()
|
||||
},
|
||||
@ -451,7 +458,36 @@ export default {
|
||||
arr.isTrue = (Math.round((weight * 100) * 1000) / 1000) === (Math.round((arr.weight * 100) * 1000) / 1000)
|
||||
return Math.round((weight * 100) * 1000) / 1000
|
||||
},
|
||||
async handleSaveDetail (params = this.obj) {
|
||||
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
|
||||
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 + '维度内的权重和必须为100%!')
|
||||
return
|
||||
}
|
||||
} else {
|
||||
for (let i in arr) {
|
||||
let num = 0
|
||||
arr[i].detailDtos.map(l => {
|
||||
num += l.checkWeight
|
||||
})
|
||||
if (num.toFixed(2) !== arr[i].weight.toFixed(2)) {
|
||||
return this.$message.error(arr[i].name + '维度内的权重和必须为' + Math.round((arr[i].weight * 100) * 1000) / 1000)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
params.recortModelDtos.map(i => {
|
||||
i.detailDtos.map(j => {
|
||||
const result = this.handleFilter(j.taskDtos).reduce((result, item) => {
|
||||
|
||||
@ -502,7 +502,7 @@ export default {
|
||||
handleZhiding () {
|
||||
this.$router.push({
|
||||
name: 'assessment-goals',
|
||||
query: {
|
||||
query: {...this.formList.auth,
|
||||
id: this.resultRecordId || ''
|
||||
}
|
||||
})
|
||||
|
||||
@ -251,7 +251,7 @@ export default {
|
||||
return k.scoreDtos[index][l] || 0
|
||||
})
|
||||
// eslint-disable-next-line no-eval
|
||||
result += (k.scoreDtos[index].score || eval(str))
|
||||
result += (eval(str))
|
||||
!k.scoreDtos[index].score && (k.scoreDtos[index].score = result)
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user