fix:解决表单数据取错的问题

This commit is contained in:
xiaoguangbin 2023-12-11 15:44:24 +08:00
parent 35b315421a
commit 9615c6c3b0
2 changed files with 12 additions and 13 deletions

View File

@ -22,10 +22,10 @@
}"
>
<a-form-model-item label="Energy">
<a-input type="number" v-model="model.energy" @change="handleChannelChange"></a-input>
<a-input type="number" v-model="model.energy" @change="handleEnergyChange"></a-input>
</a-form-model-item>
<a-form-model-item label="Efficiency">
<a-input type="number" v-model="model.efficiency" @change="handleEnergyChange"></a-input>
<a-input type="number" v-model="model.efficiency" @change="handleChannelChange"></a-input>
</a-form-model-item>
<a-form-model-item :label="' '">
<a-button type="primary" @click="handleInsert">Insert</a-button>
@ -357,7 +357,7 @@ export default {
//
handleRowClick(row) {
this.model = cloneDeep(row)
this.model.channel = parseFloat(Number(this.model.channel).toPrecision(6))
this.model.efficiency = parseFloat(Number(this.model.efficiency).toPrecision(6))
this.model.energy = parseFloat(Number(this.model.energy).toPrecision(6))
this.emptyModal = cloneDeep(row)
},
@ -409,8 +409,8 @@ export default {
})
},
handleChannelChange(e) {
if (e.target.value != parseFloat(Number(this.emptyModal.channel).toPrecision(6))) {
this.emptyModal.channel = e.target.value
if (e.target.value != parseFloat(Number(this.emptyModal.efficiency).toPrecision(6))) {
this.emptyModal.efficiency = e.target.value
}
},
handleEnergyChange(e) {
@ -425,6 +425,7 @@ export default {
if (this.selectedRowKeys.length) {
const energy = parseFloat(this.emptyModal.energy)
const efficiency = parseFloat(this.emptyModal.efficiency)
console.log(energy+">>>>"+efficiency);
if (Number.isNaN(energy) || Number.isNaN(efficiency)) {
this.$message.warn('Format is invalid.')

View File

@ -22,10 +22,10 @@
}"
>
<a-form-model-item label="Energy">
<a-input type="number" v-model="model.energy" @change="handleChannelChange"></a-input>
<a-input type="number" v-model="model.energy" @change="handleEnergyChange"></a-input>
</a-form-model-item>
<a-form-model-item label="FWHM">
<a-input type="number" v-model="model.fwhm" @change="handleEnergyChange"></a-input>
<a-input type="number" v-model="model.fwhm" @change="handleChannelChange"></a-input>
</a-form-model-item>
<a-form-model-item :label="' '">
<a-button type="primary" @click="handleInsert">Insert</a-button>
@ -158,7 +158,7 @@ const initialOption = {
const energy = parseInt(x)
const fwhm = y.toFixed(3)
return `<div class="channel">Energy: ${energy}</div>
<div class="energy">Fwhm: ${fwhm}</div>`
<div class="energy">Efficiency : ${efficiency}</div>`
},
className: 'figure-chart-option-tooltip',
},
@ -317,7 +317,7 @@ export default {
//
handleRowClick(row) {
this.model = cloneDeep(row)
this.model.channel = parseFloat(Number(this.model.channel).toPrecision(6))
this.model.fwhm = parseFloat(Number(this.model.fwhm).toPrecision(6))
this.model.energy = parseFloat(Number(this.model.energy).toPrecision(6))
this.emptyModal = cloneDeep(row)
},
@ -326,7 +326,6 @@ export default {
handleInsert() {
const energy = parseFloat(this.model.energy)
const fwhm = parseFloat(this.model.fwhm)
if (Number.isNaN(energy) || Number.isNaN(fwhm)) {
this.$message.warn('Format is invalid.')
return
@ -369,12 +368,11 @@ export default {
})
},
handleChannelChange(e) {
if (e.target.value != parseFloat(Number(this.emptyModal.channel).toPrecision(6))) {
this.emptyModal.channel = e.target.value
if (e.target.value != parseFloat(Number(this.emptyModal.fwhm).toPrecision(6))) {
this.emptyModal.fwhm = e.target.value
}
},
handleEnergyChange(e) {
console.log(e.target.value)
if (e.target.value != parseFloat(Number(this.emptyModal.energy).toPrecision(6))) {
this.emptyModal.energy = e.target.value
}