This commit is contained in:
熊成强 2020-11-05 17:28:40 +08:00
parent 0727735a91
commit f750eec2f2
2 changed files with 24 additions and 12 deletions

View File

@ -20,7 +20,7 @@
<el-tab-pane
v-for="(i,index) in obj.recortModelDtos"
:key="i.id"
:label="i.name"
:label="i.name + ' ( '+( i.maxCount===null?(handleNumber(i)):(handleNumber(i)+'/'+i.maxCount))+' ) '"
:name="String(i.id)">
<div class="goals-content-tabbar-table">
<div class="goals-content-tabbar-table-header commonFont">
@ -174,9 +174,13 @@ export default {
this.handleGetTbale()
},
methods: {
handleNumber (item) {
return item.detailDtos ? item.detailDtos.filter(i => !i.isDelete).length : 0
},
async handleGetNext () {
console.log('this.obj.recortModelDtos: ', this.obj.recortModelDtos)
for (let i in this.obj.recortModelDtos) {
if (!this.obj.recortModelDtos[i].isTrue) {
if (this.obj.recortModelDtos[i].detailDtos.length > 0 && !this.obj.recortModelDtos[i].isTrue) {
this.$message.error(this.obj.recortModelDtos[i].name + '维度内的权重和必须为' + Math.round((this.obj.recortModelDtos[i].weight * 100) * 1000) / 1000)
return
}
@ -200,7 +204,7 @@ export default {
history.go(-1)
},
handleGetWeight (arr) {
const weight = arr.detailDtos.reduce((num, i) => {
const weight = arr.detailDtos.filter(i => !i.isDelete).reduce((num, i) => {
num += i.isDelete !== 1 ? i.checkWeight : 0
return num
}, 0)
@ -208,13 +212,6 @@ export default {
return Math.round((weight * 100) * 1000) / 1000
},
async handleSaveDetail (params = this.obj) {
console.log('params: ', params)
for (let i in params.recortModelDtos) {
if (!params.recortModelDtos[i].isTrue) {
this.$message.error(params.recortModelDtos[i].name + '维度内的权重和必须为' + Math.round((params.recortModelDtos[i].weight * 100) * 1000) / 1000)
return
}
}
let res = await apiSaveDetail(params)
if (res.code !== 200) {
this.$message.error(res.msg)
@ -263,6 +260,14 @@ export default {
},
//
hanidleEdit (item, index, type) {
if (item.maxCount !== null) {
const len = this.handleNumber(item)
console.log('len: ', len)
if (item.maxCount <= len) {
this.$message.info('指标数量不能大于' + item.maxCount)
return
}
}
if (index === -1) {
this.formIndicators = {}
} else {

View File

@ -15,14 +15,21 @@
<script>
export default {
props: ['info'],
data () {
return {
form: {
optType: -1
}
}
},
computed: {},
beforeMount () {},
mounted () {},
mounted () {
const params = JSON.parse(JSON.stringify(this.info))
params.chartDetails.recordSimpleDtos = params.chartDetails.recordSimpleDtos.length ? params.chartDetails.recordSimpleDtos : [this.form]
this.$emit('update:info', params)
},
methods: {},
watch: {}