添加新的sampleType 类型,完成新页面的展示,删除功能

This commit is contained in:
任珮宇 2024-01-11 20:05:44 +08:00
parent bed1fb4830
commit e73f9df914
6 changed files with 125 additions and 31 deletions

View File

@ -18,7 +18,6 @@
style="width: 246px"
class="sample-select"
></custom-select>
<div @click="handleDetalSelfStationCache">删除</div>
</div>
<!-- 二级交互栏结束 -->
@ -35,13 +34,14 @@
:gammaEnergyData="gammaEnergyData"
:histogramDataList="histogramDataList"
:boundary="boundaryList"
:currIdx="currIdx"
/>
</beta-gamma-chart-container>
</div>
<div class="beta-gamma-analysis-main-charts-right">
<beta-gamma-chart-container>
<template slot="title"> ROI LIMITS </template>
<roi-limits ref="RoiChartRef" :ROILists="ROILists" />
<roi-limits ref="RoiChartRef" :ROILists="ROILists" @sendIndex="getIndex" />
</beta-gamma-chart-container>
</div>
</div>
@ -110,6 +110,11 @@ export default {
RoiLimits,
RoiParam,
},
props: {
sample: {
type: Object,
},
},
data() {
this.SampleType = SampleType
return {
@ -134,12 +139,42 @@ export default {
sampleDetail: {},
qcFlags: {},
resultDisplay: [],
currIdx: 0,
}
},
watch: {
sample: {
async handler(newVal, oldVal) {
this.resultDisplay = []
const sampleData = await this.$store.dispatch('GET_SAMPLE_DATA', newVal.inputFileName)
if (sampleData) {
const { data, from } = sampleData
this.sampleDetail = data
// this.changeChartByType('sample')
if (from == 'db') {
this.sampleDetail = data
this.emitGetFiles(data)
}
} else {
if (newVal.sampleId) {
this.getSampleDetail()
} else {
this.getSelfStationSampleDetail()
}
}
this.$refs.betaChartRef.handleUnzoom()
},
immediate: true,
deep: true,
},
},
mounted() {
this.getSelfStationSampleDetail()
// this.getSelfStationSampleDetail()
},
methods: {
getIndex(val) {
this.currIdx = val
},
async handleDetalSelfStationCache() {
let params = {
sampleFileName: 'ABC01_001-20240108_1405_S_FULL_40186.0.PHD',
@ -151,9 +186,10 @@ export default {
}
},
async getSelfStationSampleDetail() {
const { inputFileName, detFileName } = this.sample
let params = {
sampleFileName: 'ABC01_001-20240108_1405_S_FULL_40186.0.PHD',
detFileName: 'ABC01_001-20240108_1327_D_FULL_381505.PHD',
sampleFileName: inputFileName,
detFileName: detFileName,
}
try {
this.isLoading = true
@ -161,6 +197,11 @@ export default {
const cancelToken = this.createCancelToken()
const { success, result, message } = await getAction('/selfStation/loadFromFile', params, cancelToken)
if (success) {
this.$store.commit('ADD_SAMPLE_DATA', {
inputFileName,
data: result,
from: 'file',
})
this.sampleDetail = result
const {
spectrumData,
@ -193,7 +234,7 @@ export default {
this.roiParam.ROIThreeStop = ROIThreeStop
this.roiParam.ROIFourStart = ROIFourStart
this.roiParam.ROIFourStop = ROIFourStop
let boundary1 = { minX: 500, maxX: ROIOneStop, minY: 0, maxY: 4096 }
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 }
@ -232,6 +273,7 @@ export default {
handleGetFlag(val, obj) {
console.log(val, obj)
},
resize() {},
},
destroyed() {
this.cancelLastRequest()

View File

@ -15,6 +15,10 @@ export const clearSampleCache = sampleList => {
url = '/spectrumAnalysis/deleteSpectrumCacheData'
params = { sampleFileName: fileName }
}
if (sample.sampleType == 'C') {
url = '/selfStation/deleteSelfStationCache'
params = { sampleFileName: fileName }
}
deleteAction(url, params)
store.commit('REMOVE_SAMPLE_DATA', fileName)
Vue.ls.remove(`CALIBRATION_GAMMA_${fileName}`)

View File

@ -21,6 +21,7 @@
:option="twoDOption"
@zr:mousedown="handleMouseDown"
@zr:mouseup="handleMouseUp"
@brushEnd="handleBrushEnd"
/>
<!-- @brushEnd="handleBrushEnd" -->
<!-- @zr:mousemove="handleMouseMove" -->
@ -133,7 +134,7 @@ const twoDOption = {
color: '#fff',
},
markLine: {
silent: true,
silent: false,
symbol: 'none',
data: [],
animation: false,
@ -312,6 +313,9 @@ export default {
type: Array,
default: () => [],
},
currIdx: {
type: Number,
},
},
watch: {
// 2D
@ -343,7 +347,7 @@ export default {
this.boundaryData = newVal[0]
this.reDrawRect()
},
immediate: true,
// immediate: true,
},
currCount: {
handler() {
@ -351,6 +355,13 @@ export default {
},
immediate: true,
},
currIdx: {
handler(newVal) {
this.boundaryData = this.boundary[newVal]
this.reDrawRect()
},
// immediate: true,
},
},
data() {
this.buttons = buttons
@ -606,25 +617,25 @@ export default {
},
]
},
// Beta-Gamma Spectrum: Sample
// ROI LIMITS
handleChange(index) {
this.active = index
},
// unzoom
handleUnzoom() {
this.twoDOption.xAxis.min = 0
this.twoDOption.xAxis.max = 256
this.twoDOption.xAxis.max = 1024
this.twoDOption.yAxis.min = 0
this.twoDOption.yAxis.max = 256
this.twoDOption.yAxis.max = 4096
// this.emitRangeChange([0, 256, 0, 256])
// this.reDrawRect()
this.reDrawRect()
this.buildScatterList()
},
//
handleMouseDown() {
const chart = this.$refs.chartRef.getChartInstance()
const chart = this.$refs.chartTwoDRef.getChartInstance()
chart.dispatchAction({
type: 'takeGlobalCursor',
//
@ -638,13 +649,13 @@ export default {
handleMouseUp() {
setTimeout(() => {
const chart = this.$refs.chartRef.getChartInstance()
const chart = this.$refs.chartTwoDRef.getChartInstance()
this.clearBrush(chart)
}, 0)
},
//
handleBrushEnd(param) {
const chart = this.$refs.chartRef.getChartInstance()
const chart = this.$refs.chartTwoDRef.getChartInstance()
const areas = param.areas[0]
if (areas) {
const range = areas.range
@ -655,14 +666,15 @@ export default {
const [x1, y2, x2, y1] = [...point1, ...point2] //
const rangeNumberFunc = rangeNumber(0, 256)
const rangeNumberFuncX = rangeNumber(0, 1024)
const rangeNumberFuncY = rangeNumber(0, 4096)
this.twoDOption.xAxis.min = rangeNumberFunc(x1)
this.twoDOption.xAxis.max = rangeNumberFunc(x2)
this.twoDOption.yAxis.min = rangeNumberFunc(y1)
this.twoDOption.yAxis.max = rangeNumberFunc(y2)
this.twoDOption.xAxis.min = rangeNumberFuncX(x1)
this.twoDOption.xAxis.max = rangeNumberFuncX(x2)
this.twoDOption.yAxis.min = rangeNumberFuncY(y1)
this.twoDOption.yAxis.max = rangeNumberFuncY(y2)
this.emitRangeChange([x1, x2, y1, y2])
// this.emitRangeChange([x1, x2, y1, y2])
this.reDrawRect()
@ -671,6 +683,18 @@ export default {
this.clearBrush(chart)
},
clearBrush(chart) {
//
chart.dispatchAction({
type: 'brush',
areas: [],
})
//
chart.dispatchAction({
type: 'takeGlobalCursor',
})
},
// ROI
handleROI() {

View File

@ -106,7 +106,7 @@ export default {
const [ROIOneList, ...lists] = newVal
this.buildOneLineList(ROIOneList)
},
immediate: true,
// immediate: true,
},
},
data() {
@ -123,8 +123,11 @@ export default {
},
// 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

@ -22,12 +22,12 @@ export default {
props: {
list: {
type: Array,
default: () => []
}
default: () => [],
},
},
methods: {
handleClick(spectraItem) {
this.list.forEach(item => (item.checked = false))
this.list.forEach((item) => (item.checked = false))
spectraItem && (spectraItem.checked = true)
this.$emit('change', spectraItem)
this.$forceUpdate()
@ -46,17 +46,18 @@ export default {
}
}
const deleted = this.list.splice(index, 1)
console.log('deleted', deleted)
clearSampleCache(deleted)
this.$forceUpdate()
}
},
},
watch: {
list(newVal) {
if (newVal.length && !newVal.find(item => item.checked)) {
if (newVal.length && !newVal.find((item) => item.checked)) {
this.handleClick(newVal[0])
}
}
}
},
},
}
</script>

View File

@ -50,7 +50,7 @@
/>
<!-- Gamma 分析 -->
<beta-analysis v-else-if="isBeta" />
<beta-analysis v-else-if="isBeta" ref="betaAnalysisRef" :sample="sampleData" />
<!-- Beta-Gamma 分析 -->
<!-- <beta-gamma-analysis v-else-if="isBetaGamma" ref="betaGammaAnalysisRef" :sample="sampleData" /> -->
@ -287,6 +287,7 @@ import CompareFromDbModal from './components/Modals/CompareFromDBModal.vue'
//
const ANALYZE_TYPE = {
BETA: 'betaAnalysis',
GAMMA: 'gammaAnalysis',
BETA_GAMMA: 'betaGammaAnalysis',
}
@ -564,6 +565,22 @@ export default {
})
const names = this.sampleList.map((item) => item.inputFileName) // Sampleid
const willAddList = arr.filter((item) => !names.includes(item.inputFileName))
console.log('willAddList', willAddList)
willAddList.push({
checked: true,
dbName: '',
detFileName: 'ABC01_001-20240108_1327_D_FULL_381505.PHD',
detFileStatus: null,
gasFileName: '',
gasFileStatus: null,
inputFileName: 'ABC01_001-20240108_1405_S_FULL_40186.0.PHD',
qcFileName: '',
qcFileStatus: null,
sampleFileName: 'ABC01_001-20240108_1405_S_FULL_40186.0.PHD',
sampleId: null,
sampleSystemType: 'C',
sampleType: 'C',
})
this.callInitValue(willAddList)
this.sampleList = this.sampleList.concat(willAddList)
},
@ -610,6 +627,8 @@ export default {
// Bbeta-gamma P Ggamma
if (sample.sampleType == 'B') {
this.analysisType = ANALYZE_TYPE.BETA_GAMMA
} else if (sample.sampleType == 'C') {
this.analysisType = ANALYZE_TYPE.BETA
} else {
this.analysisType = ANALYZE_TYPE.GAMMA
}
@ -966,6 +985,7 @@ export default {
handleResize() {
this.$refs.gammaAnalysisRef && this.$refs.gammaAnalysisRef.resize()
this.$refs.betaGammaAnalysisRef && this.$refs.betaGammaAnalysisRef.resize()
this.$refs.betaAnalysisRef && this.$refs.betaAnalysisRef.resize()
},
// Beta-Gamma Energy Calibration
@ -1653,7 +1673,7 @@ export default {
},
// Beta
isBeta() {
return this.analysisType == ANALYZE_TYPE.BETA_GAMMA ? false : true
return this.analysisType == ANALYZE_TYPE.BETA
},
// Beta-Gamma