自建台站页面散点图优化

Energy  Resolution  Efficiency  弹窗功能开发,接口对接
This commit is contained in:
任珮宇 2024-01-16 18:02:42 +08:00
parent 82f707971a
commit 666c332c56
7 changed files with 118 additions and 103 deletions

View File

@ -35,6 +35,7 @@
:histogramDataList="histogramDataList"
:boundary="boundaryList"
:currIdx="currIdx"
@refreshRoi="refreshRoi"
/>
</beta-gamma-chart-container>
</div>
@ -57,7 +58,7 @@
<div class="beta-gamma-analysis-main-bottom-right">
<beta-gamma-chart-container>
<template slot="title"> ROI Param </template>
<roi-param :roiParam="roiParam" />
<roi-param :roiParamList="roiParamList" />
</beta-gamma-chart-container>
</div>
</div>
@ -125,16 +126,7 @@ export default {
gammaEnergyData: [],
betaEnergyData: [],
ROILists: [],
roiParam: {
ROIOneStart: 0,
ROIOneStop: 0,
ROITwoStart: 0,
ROITwoStop: 0,
ROIThreeStart: 0,
ROIThreeStop: 0,
ROIFourStart: 0,
ROIFourStop: 0,
},
roiParamList: [],
boundaryList: [],
sampleDetail: {},
qcFlags: {},
@ -172,6 +164,14 @@ export default {
// this.getSelfStationSampleDetail()
},
methods: {
refreshRoi(data) {
const { list, start, stop } = data
let currRoiParam = { start, stop }
let currBoundary = { minX: start, maxX: stop, minY: 0, maxY: 4096 }
this.ROILists.splice(this.currIdx, 1, list)
this.roiParamList.splice(this.currIdx, 1, currRoiParam)
this.boundaryList.splice(this.currIdx, 1, currBoundary)
},
getIndex(val) {
this.currIdx = val
},
@ -229,24 +229,16 @@ export default {
this.gammaEnergyData = gammaEnergyData
this.betaEnergyData = betaEnergyData
this.ROILists = [ROIOneList, ROITwoList, ROIThreeList, ROIFourList]
this.roiParam.ROIOneStart = ROIOneStart
this.roiParam.ROIOneStop = ROIOneStop
this.roiParam.ROITwoStart = ROITwoStart
this.roiParam.ROITwoStop = ROITwoStop
this.roiParam.ROIThreeStart = ROIThreeStart
this.roiParam.ROIThreeStop = ROIThreeStop
this.roiParam.ROIFourStart = ROIFourStart
this.roiParam.ROIFourStop = ROIFourStop
let roiParam1 = { start: ROIOneStart, stop: ROIOneStop }
let roiParam2 = { start: ROITwoStart, stop: ROITwoStop }
let roiParam3 = { start: ROIThreeStart, stop: ROIThreeStop }
let roiParam4 = { start: ROIFourStart, stop: ROIFourStop }
this.roiParamList.push(roiParam1, roiParam2, roiParam3, roiParam4)
let boundary1 = { minX: ROIOneStart, maxX: ROIOneStop, minY: 0, maxY: 4096 }
let boundary2 = { minX: ROITwoStart, maxX: ROITwoStop, minY: 0, maxY: 4096 }
let boundary3 = { minX: ROIThreeStart, maxX: ROIThreeStop, minY: 0, maxY: 4096 }
let boundary4 = { minX: ROIFourStart, maxX: ROIFourStop, minY: 0, maxY: 4096 }
this.boundaryList.push(boundary1, boundary2, boundary3, boundary4)
// this.$store.commit('ADD_SAMPLE_DATA', {
// inputFileName: this.sample.sampleFileName,
// data: result,
// from: 'file',
// })
this.isLoading = false
} else {
this.$message.error(message)

View File

@ -43,7 +43,7 @@
import CustomChart from '@/components/CustomChart/index.vue'
import ColorPalette from './ColorPalette.vue'
import { getXAxisAndYAxisByPosition, rangeNumber } from '@/utils/chartHelper.js'
import { getAction, postAction, deleteAction } from '../../../api/manage'
import { getAction, putAction, deleteAction } from '../../../api/manage'
import SampleDataMixin from '../SampleDataMixin'
const buttons = ['Beta-Gamma', 'Gamma', 'Beta']
// Beta-Gamma
@ -169,8 +169,8 @@ const dragOption = {
position: [],
draggable: true,
style: {
fill: 'rgba(255,0,255,0.3)', // fill: 'rgba(0,0,0,0.03)', 便
stroke: 'rgba(255,0,255,0.3)', // stroke: 'rgba(0,0,0,0.03)', 便
fill: 'rgba(0,0,0,0)', // fill: 'rgba(0,0,0,0.03)', 便
stroke: 'rgba(0,0,0,0)', // stroke: 'rgba(0,0,0,0.03)', 便
lineWidth: 10,
},
cursor: 'move',
@ -178,7 +178,6 @@ const dragOption = {
},
{
type: 'rect',
// rotation: Math.PI/2,
z: 1000,
shape: {
width: 5,
@ -189,8 +188,8 @@ const dragOption = {
position: [],
draggable: true,
style: {
fill: 'rgba(255,0,255,0.3)', // fill: 'rgba(0,0,0,0.03)', 便
stroke: 'rgba(255,0,255,0.3)', // stroke: 'rgba(0,0,0,0.03)', 便
fill: 'rgba(0,0,0,0)', // fill: 'rgba(0,0,0,0.03)', 便
stroke: 'rgba(0,0,0,0)', // stroke: 'rgba(0,0,0,0.03)', 便
lineWidth: 10,
},
cursor: 'move',
@ -252,7 +251,6 @@ const gammaOption = {
},
},
series: {
name: '今日',
type: 'line',
smooth: true,
showSymbol: false,
@ -324,7 +322,6 @@ const betaOption = {
},
},
series: {
name: '今日',
type: 'line',
smooth: true,
showSymbol: false,
@ -418,6 +415,8 @@ export default {
boundaryData: {
handler(newVal) {
const { minX, maxX, minY, maxY, color } = newVal
this.startChannel = minX
this.endChannel = maxX
const [graphic1, graphic2] = this.dragOption.graphic
const _this = this
this.myChart = this.$refs.chartTwoDRef.getChartInstance()
@ -429,15 +428,14 @@ export default {
]
graphic1.ondrag = function () {
const rectList = []
this.startChannel = _this.myChart.convertFromPixel({ xAxisId: '2' }, this.position[0])
_this.startChannel = parseInt(_this.myChart.convertFromPixel({ xAxisId: '2' }, this.position[0]))
const rect = [
[this.startChannel, minY],
[maxX, minY],
[maxX, maxY],
[this.startChannel, maxY],
[_this.startChannel, minY],
[_this.endChannel, minY],
[_this.endChannel, maxY],
[_this.startChannel, maxY],
]
rectList.push(..._this.drawOneRect(rect, color))
console.log(rectList)
_this.myChart.setOption({
series: {
markLine: {
@ -453,15 +451,14 @@ export default {
]
graphic2.ondrag = function () {
const rectList = []
this.endChannel = _this.myChart.convertFromPixel({ xAxisId: '2' }, this.position[0])
_this.endChannel = parseInt(_this.myChart.convertFromPixel({ xAxisId: '2' }, this.position[0]))
const rect = [
[minX, minY],
[this.endChannel, minY],
[this.endChannel, maxY],
[minX, maxY],
[_this.startChannel, minY],
[_this.endChannel, minY],
[_this.endChannel, maxY],
[_this.startChannel, maxY],
]
rectList.push(..._this.drawOneRect(rect, color))
console.log(rectList)
_this.myChart.setOption({
series: {
markLine: {
@ -494,27 +491,6 @@ export default {
this.twoDOption.brush = { toolbox: [] }
},
methods: {
// onLineDragging(position, data) {
// const { minX, maxX, minY, maxY, color } = data
// console.log(this)
// const rectList = []
// let xAxis = this.myChart.convertFromPixel({ xAxisId: '2' }, position[0])
// const rect = [
// [xAxis, minY],
// [maxX, minY],
// [maxX, maxY],
// [xAxis, maxY],
// ]
// rectList.push(...this.drawOneRect(rect, color))
// console.log(rectList)
// this.myChart.setOption({
// series: {
// markLine: {
// data: rectList,
// },
// },
// })
// },
// Gamma 线
buildGammaLineList(val) {
const gammaSeries = this.gammaOption.series
@ -576,7 +552,7 @@ export default {
xAxis: { min: minX, max: maxX },
yAxis: { min: minY, max: maxY },
} = this.twoDOption
debugger
const inchartPoints = this.getInChartPoints(rect)
const outchartPoints = rect.filter((pointItem) => !inchartPoints.includes(pointItem))
//
@ -738,6 +714,13 @@ export default {
return xAxis >= minX && xAxis <= maxX && yAxis >= minY && yAxis <= maxY
})
},
/**
* 根据俩点判断是横向还是纵向
* x坐标相同则是纵向否则横向
*/
isVerticleLine(point1, point2) {
return point1[0] == point2[0] ? true : false
},
/**
* 根据两个点生成一个markLine直线
*/
@ -844,10 +827,39 @@ export default {
sampleFileName: inputFileName,
startChannel: this.startChannel,
endChannel: this.endChannel,
ROINum: this.currCount + 1,
ROINum: this.currIdx + 1,
}
try {
const { success, result, message } = await postAction('/selfStation/updateROI', params)
const { success, result, message } = await putAction(
`/selfStation/updateROI?sampleFileName=${inputFileName}&startChannel=${this.startChannel}&endChannel=${
this.endChannel
}&ROINum=${this.currIdx + 1}`
)
if (success) {
let obj = {}
for (const key in result) {
if (Object.hasOwnProperty.call(result, key)) {
const element = result[key]
if (key.includes('List')) {
obj.list = element
} else if (key.includes('Start')) {
obj.start = element
} else {
obj.stop = element
}
}
}
this.$emit('refreshRoi', obj)
// this.$bus.$emit('updateRoi', obj.list)
// this.boundaryData = {
// minX: obj.start,
// maxX: obj.stop,
// minY: 0,
// maxY: 4096,
// color: '#99CA53',
// }
// this.reDrawRect()
}
} catch (error) {
console.error(error)
}

View File

@ -479,16 +479,16 @@ export default {
try {
this.isLoading = true
const { sampleId, inputFileName: fileName } = this.sampleData
const { success, result, message } = await postAction('/gamma/changeDataEfficiency', {
sampleId,
const { success, result, message } = await postAction('/selfStation/changeDataEfficiency', {
// sampleId,
fileName,
m_vCurEnergy: this.list.map((item) => item.energy),
m_vCurEffi: this.list.map((item) => item.efficiency),
m_vCurUncert: this.uncert,
m_curParam: this.param,
funcId: this.funcId,
width: 922,
curRow: this.selectedRowKeys[0] || 0,
width: 768,
// curRow: this.selectedRowKeys[0] || 0,
})
if (success) {
this.handleResult(result)
@ -506,7 +506,7 @@ export default {
async handleSave() {
try {
this.isSaving = true
const res = await postAction('/gamma/saveDataEfficiency', {
const res = await postAction('/selfStation/saveDataEfficiency', {
m_vCurEnergy: this.list.map((item) => item.energy),
m_vCurEffi: this.list.map((item) => item.efficiency),
m_vCurUncert: this.uncert,
@ -572,13 +572,13 @@ export default {
}
const { sampleId, inputFileName: fileName } = this.sampleData
const { success, result, message } = await postAction('/gamma/applyDataEfficiency', {
const { success, result, message } = await postAction('/selfStation/applyDataEfficiency', {
m_vCurEnergy: this.list.map((item) => item.energy),
m_vCurEffi: this.list.map((item) => item.efficiency),
m_vCurUncert: this.uncert,
m_curParam: this.param,
curCalName,
sampleId,
sampleId: '',
fileName,
})
if (success) {
@ -603,7 +603,7 @@ export default {
const { inputFileName: fileName } = this.sampleData
const { success, message } = await putAction(
`/gamma/setCurrentEfficiency?fileName=${fileName}&currentName=${this.currSelectedDataSource}`
`/selfStation/setCurrentEfficiency?fileName=${fileName}&currentName=${this.currSelectedDataSource}`
)
if (!success) {
this.$message.error(message)

View File

@ -438,14 +438,14 @@ export default {
try {
this.isLoading = true
const { sampleId, inputFileName: fileName } = this.sampleData
const { success, result, message } = await postAction('/gamma/changeDataEnergy', {
sampleId,
const { success, result, message } = await postAction('/selfStation/changeDataEnergy', {
sampleId: '',
fileName,
m_vCurCentroid: this.list.map((item) => item.channel),
m_vCurEnergy: this.list.map((item) => item.energy),
m_vCurUncert: this.uncert,
m_curParam: this.param,
width: 922,
width: 768,
})
if (success) {
this.handleResult(result)
@ -463,7 +463,7 @@ export default {
async handleSave() {
try {
this.isSaving = true
const res = await postAction('/gamma/saveDataEnergy', {
const res = await postAction('/selfStation/saveDataEnergy', {
m_vCurCentroid: this.list.map((item) => item.channel),
m_vCurEnergy: this.list.map((item) => item.energy),
m_vCurUncert: this.uncert,
@ -528,13 +528,13 @@ export default {
}
const { sampleId, inputFileName: fileName } = this.sampleData
const { success, result, message } = await postAction('/gamma/applyDataEnergy', {
const { success, result, message } = await postAction('/selfStation/applyDataEnergy', {
m_vCurCentroid: this.list.map((item) => item.channel),
m_vCurEnergy: this.list.map((item) => item.energy),
m_vCurUncert: this.uncert,
m_curParam: this.param,
curCalName,
sampleId,
sampleId: '',
fileName,
})
if (success) {
@ -559,7 +559,7 @@ export default {
const { inputFileName: fileName } = this.sampleData
const { success, message } = await putAction(
`/gamma/setCurrentEnergy?fileName=${fileName}&currentName=${this.currSelectedDataSource}`
`/selfStation/setCurrentEnergy?fileName=${fileName}&currentName=${this.currSelectedDataSource}`
)
if (!success) {
this.$message.error(message)

View File

@ -436,14 +436,14 @@ export default {
try {
this.isLoading = true
const { sampleId, inputFileName: fileName } = this.sampleData
const { success, result, message } = await postAction('/gamma/changeDataResolution', {
sampleId,
const { success, result, message } = await postAction('/selfStation/changeDataResolution', {
sampleId: '',
fileName,
m_vCurEnergy: this.list.map((item) => item.energy),
m_vCurReso: this.list.map((item) => item.fwhm),
m_vCurUncert: this.uncert,
m_curParam: this.param,
width: 922,
width: 768,
})
if (success) {
this.handleResult(result)
@ -461,7 +461,7 @@ export default {
async handleSave() {
try {
this.isSaving = true
const res = await postAction('/gamma/saveDataResolution', {
const res = await postAction('/selfStation/saveDataResolution', {
m_vCurEnergy: this.list.map((item) => item.energy),
m_vCurReso: this.list.map((item) => item.fwhm),
m_vCurUncert: this.uncert,
@ -526,13 +526,13 @@ export default {
}
const { sampleId, inputFileName: fileName } = this.sampleData
const { success, result, message } = await postAction('/gamma/applyDataResolution', {
const { success, result, message } = await postAction('/selfStation/applyDataResolution', {
m_vCurEnergy: this.list.map((item) => item.energy),
m_vCurReso: this.list.map((item) => item.fwhm),
m_vCurUncert: this.uncert,
m_curParam: this.param,
curCalName,
sampleId,
sampleId: '',
fileName,
})
if (success) {
@ -557,7 +557,7 @@ export default {
const { inputFileName: fileName } = this.sampleData
const { success, message } = await putAction(
`/gamma/setCurrentResolution?fileName=${fileName}&currentName=${this.currSelectedDataSource}`
`/selfStation/setCurrentResolution?fileName=${fileName}&currentName=${this.currSelectedDataSource}`
)
if (!success) {
this.$message.error(message)

View File

@ -103,6 +103,7 @@ export default {
watch: {
ROILists: {
handler(newVal) {
this.active = 0
const [ROIOneList, ...lists] = newVal
this.buildOneLineList(ROIOneList)
},
@ -116,17 +117,27 @@ export default {
roiLimitsOption,
}
},
mounted() {
// this.$bus.$on('updateRoi', this.updateRoi)
},
destroyed() {
// this.$bus.$off('updateRoi', this.updateRoi)
},
methods: {
updateRoi(data) {
this.buildOneLineList(data)
this.active = 0
},
buildOneLineList(val) {
if (val) {
const currSeries = this.roiLimitsOption.series
currSeries.data = val.map((item) => [item.x, item.y])
}
},
// Beta-Gamma Spectrum: Sample
handleChange(index) {
console.log(index)
this.active = index
this.buildOneLineList(this.ROILists[index])
// this.$bus.$emit('sendIndex', index)
this.$emit('sendIndex', index)
},
},

View File

@ -1,14 +1,14 @@
<template>
<div class="roi-param-container">
<div class="roi-param-container-roi">
<div class="roi-param-container-roi-label">ROI1</div>
<div class="roi-param-container-roi" v-for="(item, index) in roiParamList" :key="index">
<div class="roi-param-container-roi-label">ROI{{ index + 1 }}</div>
<div class="roi-param-container-roi-item">
<div style="text-align: center">Beta</div>
<a-input :value="roiParam.ROIOneStart" style="margin: 15px 0 20px" />
<a-input :value="roiParam.ROIOneStop" />
<a-input :value="item.start" style="margin: 15px 0 20px" />
<a-input :value="item.stop" />
</div>
</div>
<div class="roi-param-container-roi">
<!-- <div class="roi-param-container-roi">
<div class="roi-param-container-roi-label">ROI2</div>
<div class="roi-param-container-roi-item">
<div style="text-align: center">Beta</div>
@ -31,16 +31,16 @@
<a-input :value="roiParam.ROIFourStart" style="margin: 15px 0 20px" />
<a-input :value="roiParam.ROIFourStop" />
</div>
</div>
</div> -->
</div>
</template>
<script>
export default {
props: {
roiParam: {
type: Object,
default: () => {},
roiParamList: {
type: Array,
default: () => [],
},
},
}