优化
This commit is contained in:
parent
ed6bbaba45
commit
79fd1696ef
@ -207,6 +207,9 @@ export default {
|
||||
handleNumber (item) {
|
||||
return item.detailDtos ? item.detailDtos.filter(i => !i.isDelete).length : 0
|
||||
},
|
||||
handleFilter (item) {
|
||||
return item ? item.filter(i => !i.isDelete) : []
|
||||
},
|
||||
async handleGetNext () {
|
||||
const arr = this.handleFilter(this.obj.recortModelDtos)
|
||||
if (arr.some(i => i.weight === null)) {
|
||||
@ -235,7 +238,6 @@ export default {
|
||||
const obj = { status: 1, menuName: '制定了' }
|
||||
const params = Object.assign({}, { resultRecordId: this.$route.query.id || '' }, obj)
|
||||
let res = await apiSaveapproval(params)
|
||||
console.log("🚀 ~ file: index.vue ~ line 238 ~ handleGetNext ~ res", res)
|
||||
if (res.code !== 200) {
|
||||
this.$message.error(res.msg || '出错了 ')
|
||||
return
|
||||
@ -299,16 +301,30 @@ export default {
|
||||
this.showIndicators = false
|
||||
},
|
||||
handleSubmitZhibiao () {
|
||||
console.log(this.formIndicators)
|
||||
const arr = this.obj.recortModelDtos[this.formIndicators.dazhibiaoIndex].detailDtos
|
||||
this.$refs.formIndicators.validate((v) => {
|
||||
if (v) {
|
||||
if (this.formIndicators.index === -1) {
|
||||
this.obj.recortModelDtos[this.formIndicators.dazhibiaoIndex].detailDtos.push(Object.assign({}, this.formIndicators, { checkWeight: this.formIndicators.checkWeight / 100 }))
|
||||
arr.push(Object.assign({}, this.formIndicators, { checkWeight: this.formIndicators.checkWeight / 100 }))
|
||||
} else {
|
||||
this.obj.recortModelDtos[this.formIndicators.dazhibiaoIndex].detailDtos[this.formIndicators.index] = Object.assign({}, this.formIndicators, { checkWeight: this.formIndicators.checkWeight / 100 })
|
||||
let _index = 0
|
||||
this.obj.recortModelDtos[this.formIndicators.dazhibiaoIndex].detailDtos = arr.map(i => {
|
||||
if (i.isDelete !== 1) {
|
||||
if (_index === this.formIndicators.index) {
|
||||
i = Object.assign({}, this.formIndicators, { checkWeight: this.formIndicators.checkWeight / 100 })
|
||||
}
|
||||
_index++
|
||||
|
||||
}
|
||||
return i
|
||||
})
|
||||
}
|
||||
this.$forceUpdate()
|
||||
this.showIndicators = false
|
||||
}
|
||||
})
|
||||
console.log(" this.obj", this.obj)
|
||||
},
|
||||
// 编辑
|
||||
hanidleEdit (item, index, type) {
|
||||
@ -319,6 +335,7 @@ export default {
|
||||
return
|
||||
}
|
||||
}
|
||||
this.zhibiaoTitle = index === -1 ? "添加指标" : "编辑指标"
|
||||
if (index === -1) {
|
||||
this.formIndicators = {
|
||||
checkWeight: 0
|
||||
@ -341,9 +358,7 @@ export default {
|
||||
this.obj.recortModelDtos[type].detailDtos = this.obj.recortModelDtos[type].detailDtos.filter(i => i !== item)
|
||||
this.$forceUpdate()
|
||||
},
|
||||
handleFilter (item) {
|
||||
return item ? item.filter(i => !i.isDelete) : []
|
||||
},
|
||||
|
||||
async handleGetTbale (id = this.$route.query.id) {
|
||||
let res = await apiResultGetDetail({ id })
|
||||
if (res.code !== 200) return
|
||||
|
||||
@ -123,9 +123,9 @@
|
||||
<script>
|
||||
import getPersonnel from '@/components/getPersonnel'
|
||||
import PopupRight from '@/components/PopupRight'
|
||||
import { apiSaveapproval, apiAssessresetdata } from '@/api/assessment'
|
||||
import { apiSaveapproval, apiAssessresetdata, apiSaveDetail } from '@/api/assessment'
|
||||
export default {
|
||||
props: ['tableInfo', 'formList', 'info', 'resultRecordId'],
|
||||
props: ['tableInfo', 'formList', 'info', 'resultRecordId', 'obj'],
|
||||
data () {
|
||||
return {
|
||||
authList: [
|
||||
@ -241,6 +241,8 @@ export default {
|
||||
computed: {},
|
||||
beforeMount () { },
|
||||
mounted () {
|
||||
console.log(this.resultRecordId)
|
||||
console.log("🚀 ~ file: index.vue ~ line 308 ~ handleGetNext ~ this.obj", this.obj)
|
||||
},
|
||||
methods: {
|
||||
async handleResetData (resultRecordId) {
|
||||
@ -294,10 +296,66 @@ export default {
|
||||
},
|
||||
async handleAgree () {
|
||||
this.$loadingStart()
|
||||
let res = await this.handlApiSaveapproval({ status: 1, menuName: '同意了' })
|
||||
await this.handleGetNext()
|
||||
this.$loadingEnd()
|
||||
this.dialogFormVisible = !!res
|
||||
|
||||
|
||||
},
|
||||
handleFilter (item) {
|
||||
return item ? item.filter(i => !i.isDelete) : []
|
||||
},
|
||||
async handleGetNext () {
|
||||
const arr = this.handleFilter(this.obj.recortModelDtos)
|
||||
arr.pop()
|
||||
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 {
|
||||
let _boolean = true
|
||||
arr.map(i => {
|
||||
if (i.weight !== i.detailDtos.reduce((result, item) => {
|
||||
return result += item.checkWeight
|
||||
}, 0)) {
|
||||
this.$message.error(i.name + '维度内的权重和必须为100%!')
|
||||
_boolean = false
|
||||
}
|
||||
})
|
||||
if (!_boolean) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
const obj = { status: 1, menuName: '同意了' }
|
||||
const params = Object.assign({}, { resultRecordId: this.$route.query.id || '' }, obj)
|
||||
let res = await apiSaveapproval(params)
|
||||
if (res.code !== 200) {
|
||||
this.$message.error(res.msg || '出错了 ')
|
||||
return
|
||||
}
|
||||
this.obj.commentId = res.commentId
|
||||
let res1 = await apiSaveDetail(this.obj)
|
||||
if (res1.code !== 200) {
|
||||
this.$message.error(res1.msg)
|
||||
return
|
||||
}
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: 'success'
|
||||
})
|
||||
this.dialogFormVisible = false
|
||||
history.go(0)
|
||||
},
|
||||
// 驳回
|
||||
handleBohui () {
|
||||
|
||||
@ -26,8 +26,9 @@
|
||||
departmentName:obj.departmentName
|
||||
}" />
|
||||
<div class="performance-content-title-right">
|
||||
<UseButton :resultRecordId='resultRecordId'
|
||||
v-if="isShow && !tableInfo.result && !tableInfo.score"
|
||||
<UseButton :obj='obj'
|
||||
:resultRecordId='resultRecordId'
|
||||
v-if="isShow && !tableInfo.result && !tableInfo.score && obj.recortModelDtos.length !==0"
|
||||
:formList='formList'
|
||||
:tableInfo.sync='tableInfo' />
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user