fix: Load From File关闭时保留表格内容,修复斜率编辑时值不对的问题,修复有斜率的基线控制点旁边+号位置问题,修复Peak Infomation切换时底部图表标题未更新问题

This commit is contained in:
Xu Zhimeng 2023-10-10 15:55:43 +08:00
parent 36ba4a8167
commit 0a021a3c53
4 changed files with 45 additions and 21 deletions

View File

@ -37,7 +37,7 @@ export default {
},
handleOK() {
if (this.allowNaN || this.value) {
this.$emit('change', this.value || 0, this.index, this.prevValue)
this.$emit('change', this.value, this.index, this.prevValue)
this.visible = false
} else {
this.$message.warn('Input value invalid.')

View File

@ -206,6 +206,7 @@ import SampleDataMixin from '@/views/spectrumAnalysis/SampleDataMixin'
import GeneralCommentModal from './components/GeneralCommentModal.vue'
import EditSlopeModal from './components/EditSlopeModal.vue'
import Response from './Response.json'
import { isNullOrUndefined } from '@/utils/util'
//
const initialOption = {
@ -414,7 +415,7 @@ const nuclideIdentifyModal = {
}
//
export const Operators = {
const Operators = {
ADD: 1, //
REMOVE: 2, //
MODIFY: 3, //
@ -693,6 +694,7 @@ export default {
if (!peaksBetweenChannel.length) {
this.$message.warn(`There are 0 peak between channel ${left} and ${right}`)
this.isFitting = false
return
}
@ -1377,9 +1379,9 @@ export default {
xctrlList.forEach((xctrl, index) => {
const yctrl = yctrlList[index]
const yslope = yslopeList[index]
if (yslope != 0) {
plusGraphic.push(this.buildGraphicPlus(xctrl + 2, yctrl + 2 * yslope))
if (!isNullOrUndefined(yslope)) {
plusGraphic.push(this.buildGraphicPlus(xctrl - 2, yctrl - 2 * yslope))
plusGraphic.push(this.buildGraphicPlus(xctrl + 2, yctrl + 2 * yslope))
}
})
this.option.graphic[1].children = plusGraphic
@ -1396,11 +1398,11 @@ export default {
$action: 'replace',
position: [xPix, yPix],
style: {
x: -10,
y: -10,
text: '+',
fill: '#0f0',
font: 'bolder 20px "Microsoft YaHei", sans-serif'
font: 'bolder 20px "Microsoft YaHei", sans-serif',
textAlign: 'center',
textVerticalAlign: 'middle'
},
zlevel: 101
}

View File

@ -319,6 +319,9 @@ export default {
canUseFilePicker,
}
},
created() {
this.handleReset()
},
methods: {
// 10*4
getInitialList() {
@ -386,6 +389,7 @@ export default {
if (!isFileInDirectory) {
this.$message.warn('File and Directory Not in Same')
this.directoryHanlder = undefined
this.useFilePicker(column, record, rowIndex)
return
}
@ -679,10 +683,6 @@ export default {
handleCancel() {
this.visible = false
},
beforeModalOpen() {
this.handleReset()
},
},
}
</script>

View File

@ -194,7 +194,7 @@ export default {
}
},
created() {
this.option.title.text = '{a|Channel:0} {a|Energy:0} {a|Counts:0} {a|Detectability:0}'
this.setChartBottomTitle(0, 0, 0)
this.option.tooltip.formatter = this.tooltipFormatter
this.$bus.$on('colorChange', this.handleColorChange)
@ -458,7 +458,7 @@ export default {
}
return `<div class="channel">Channel: ${channel}</div>
<div class="energy">Energy: ${energy}</div>`
<div class="energy">${energy? `Energy: ${energy}`: ''}</div>`
},
// Graph Assistance
@ -643,19 +643,37 @@ export default {
const spectrumLineSeries = findSeriesByName(this.option.series, 'Spectrum')
spectrumLineSeries.markLine.data[0].xAxis = xAxis
const channel = this.isEnergy() ? this.getChannelByEnergy(xAxis) : parseInt(xAxis.toFixed())
const energy = this.isEnergy()
? xAxis.toFixed(2)
: this.energyData.all.pointlist && this.energyData.all.pointlist[channel - 1].x.toFixed(2)
const counts = this.isEnergy()
? this.energyData.all.pointlist[channel - 1]
: this.channelData.all.pointlist[channel - 1]
this.option.title.text = `{a|Channel:${channel}} {a|Energy:${energy}} {a|Counts:${counts.y}} {a|Detectability:0}`
const { channel, energy, counts } = this.getEnergyAndCountsByXAxis(xAxis)
this.setChartBottomTitle(channel, energy, counts)
this.getSelPosNuclide(channel)
}
},
//
setChartBottomTitle(channel, energy, counts) {
this.option.title.text = `{a|Channel:${channel}} {a|Energy:${energy}} {a|Counts:${counts}} {a|Detectability:0}`
},
// xAixschannelenergycounts
getEnergyAndCountsByXAxis(xAxis) {
let channel, energy, counts
if (this.isEnergy()) {
channel = this.getChannelByEnergy(xAxis)
energy = xAxis.toFixed(2)
counts = this.energyData.all.pointlist[channel - 1]
} else {
channel = parseInt(xAxis.toFixed())
energy = this.energyData.all.pointlist && this.energyData.all.pointlist[channel - 1].x.toFixed(2)
counts = this.channelData.all.pointlist[channel - 1]
}
return {
channel,
energy,
counts: counts.y
}
},
//
handleChartDblClick() {
this.handleResetChart()
@ -789,6 +807,8 @@ export default {
if (find) {
this.getSelPosNuclide(find)
const { channel, energy, counts } = this.getEnergyAndCountsByXAxis(find)
this.setChartBottomTitle(channel, energy, counts)
}
},
@ -1135,6 +1155,8 @@ export default {
}
} catch (error) {
console.error(error)
} finally {
this.isLoading = false
}
// this.reprocessingModalVisible = true
},