优化
This commit is contained in:
parent
0727735a91
commit
f750eec2f2
@ -20,7 +20,7 @@
|
|||||||
<el-tab-pane
|
<el-tab-pane
|
||||||
v-for="(i,index) in obj.recortModelDtos"
|
v-for="(i,index) in obj.recortModelDtos"
|
||||||
:key="i.id"
|
:key="i.id"
|
||||||
:label="i.name"
|
:label="i.name + ' ( '+( i.maxCount===null?(handleNumber(i)):(handleNumber(i)+'/'+i.maxCount))+' ) '"
|
||||||
:name="String(i.id)">
|
:name="String(i.id)">
|
||||||
<div class="goals-content-tabbar-table">
|
<div class="goals-content-tabbar-table">
|
||||||
<div class="goals-content-tabbar-table-header commonFont">
|
<div class="goals-content-tabbar-table-header commonFont">
|
||||||
@ -174,9 +174,13 @@ export default {
|
|||||||
this.handleGetTbale()
|
this.handleGetTbale()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleNumber (item) {
|
||||||
|
return item.detailDtos ? item.detailDtos.filter(i => !i.isDelete).length : 0
|
||||||
|
},
|
||||||
async handleGetNext () {
|
async handleGetNext () {
|
||||||
|
console.log('this.obj.recortModelDtos: ', this.obj.recortModelDtos)
|
||||||
for (let i in 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)
|
this.$message.error(this.obj.recortModelDtos[i].name + '维度内的权重和必须为' + Math.round((this.obj.recortModelDtos[i].weight * 100) * 1000) / 1000)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -200,7 +204,7 @@ export default {
|
|||||||
history.go(-1)
|
history.go(-1)
|
||||||
},
|
},
|
||||||
handleGetWeight (arr) {
|
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
|
num += i.isDelete !== 1 ? i.checkWeight : 0
|
||||||
return num
|
return num
|
||||||
}, 0)
|
}, 0)
|
||||||
@ -208,13 +212,6 @@ export default {
|
|||||||
return Math.round((weight * 100) * 1000) / 1000
|
return Math.round((weight * 100) * 1000) / 1000
|
||||||
},
|
},
|
||||||
async handleSaveDetail (params = this.obj) {
|
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)
|
let res = await apiSaveDetail(params)
|
||||||
if (res.code !== 200) {
|
if (res.code !== 200) {
|
||||||
this.$message.error(res.msg)
|
this.$message.error(res.msg)
|
||||||
@ -263,6 +260,14 @@ export default {
|
|||||||
},
|
},
|
||||||
// 编辑
|
// 编辑
|
||||||
hanidleEdit (item, index, type) {
|
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) {
|
if (index === -1) {
|
||||||
this.formIndicators = {}
|
this.formIndicators = {}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -15,14 +15,21 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
|
props: ['info'],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
form: {
|
||||||
|
optType: -1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {},
|
computed: {},
|
||||||
beforeMount () {},
|
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: {},
|
methods: {},
|
||||||
watch: {}
|
watch: {}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user