This commit is contained in:
xiongchengqiang 2020-12-16 15:19:29 +08:00
parent 2085b60d7d
commit 59d94eafdf
3 changed files with 40 additions and 4 deletions

View File

@ -197,10 +197,16 @@
<div class="goals-bottom"> <div class="goals-bottom">
<div class="goals-bottom-content"> <div class="goals-bottom-content">
<el-button size='small' <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> plain>暂存</el-button>
<el-button size='small' <el-button size='small'
type="primary" type="primary"
v-if="this.$route.query.saveAndAdd===1"
@click="handleGetNext">提交</el-button> @click="handleGetNext">提交</el-button>
</div> </div>
</div> </div>
@ -283,6 +289,7 @@ export default {
computed: {}, computed: {},
beforeMount () { }, beforeMount () { },
mounted () { mounted () {
console.log('auth', this.auth)
this.handleGetDimensions() this.handleGetDimensions()
this.handleGetTbale() this.handleGetTbale()
}, },
@ -451,7 +458,36 @@ export default {
arr.isTrue = (Math.round((weight * 100) * 1000) / 1000) === (Math.round((arr.weight * 100) * 1000) / 1000) arr.isTrue = (Math.round((weight * 100) * 1000) / 1000) === (Math.round((arr.weight * 100) * 1000) / 1000)
return Math.round((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 => { params.recortModelDtos.map(i => {
i.detailDtos.map(j => { i.detailDtos.map(j => {
const result = this.handleFilter(j.taskDtos).reduce((result, item) => { const result = this.handleFilter(j.taskDtos).reduce((result, item) => {

View File

@ -502,7 +502,7 @@ export default {
handleZhiding () { handleZhiding () {
this.$router.push({ this.$router.push({
name: 'assessment-goals', name: 'assessment-goals',
query: { query: {...this.formList.auth,
id: this.resultRecordId || '' id: this.resultRecordId || ''
} }
}) })

View File

@ -251,7 +251,7 @@ export default {
return k.scoreDtos[index][l] || 0 return k.scoreDtos[index][l] || 0
}) })
// eslint-disable-next-line no-eval // 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) !k.scoreDtos[index].score && (k.scoreDtos[index].score = result)
}) })
}) })