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

View File

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

View File

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

View File

@ -106,7 +106,7 @@ export default {
const [ROIOneList, ...lists] = newVal const [ROIOneList, ...lists] = newVal
this.buildOneLineList(ROIOneList) this.buildOneLineList(ROIOneList)
}, },
immediate: true, // immediate: true,
}, },
}, },
data() { data() {
@ -123,8 +123,11 @@ export default {
}, },
// Beta-Gamma Spectrum: Sample // Beta-Gamma Spectrum: Sample
handleChange(index) { handleChange(index) {
console.log(index)
this.active = index this.active = index
this.buildOneLineList(this.ROILists[index]) this.buildOneLineList(this.ROILists[index])
// this.$bus.$emit('sendIndex', index)
this.$emit('sendIndex', index)
}, },
}, },
} }

View File

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

View File

@ -50,7 +50,7 @@
/> />
<!-- Gamma 分析 --> <!-- Gamma 分析 -->
<beta-analysis v-else-if="isBeta" /> <beta-analysis v-else-if="isBeta" ref="betaAnalysisRef" :sample="sampleData" />
<!-- Beta-Gamma 分析 --> <!-- Beta-Gamma 分析 -->
<!-- <beta-gamma-analysis v-else-if="isBetaGamma" ref="betaGammaAnalysisRef" :sample="sampleData" /> --> <!-- <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 = { const ANALYZE_TYPE = {
BETA: 'betaAnalysis',
GAMMA: 'gammaAnalysis', GAMMA: 'gammaAnalysis',
BETA_GAMMA: 'betaGammaAnalysis', BETA_GAMMA: 'betaGammaAnalysis',
} }
@ -564,6 +565,22 @@ export default {
}) })
const names = this.sampleList.map((item) => item.inputFileName) // Sampleid const names = this.sampleList.map((item) => item.inputFileName) // Sampleid
const willAddList = arr.filter((item) => !names.includes(item.inputFileName)) 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.callInitValue(willAddList)
this.sampleList = this.sampleList.concat(willAddList) this.sampleList = this.sampleList.concat(willAddList)
}, },
@ -610,6 +627,8 @@ export default {
// Bbeta-gamma P Ggamma // Bbeta-gamma P Ggamma
if (sample.sampleType == 'B') { if (sample.sampleType == 'B') {
this.analysisType = ANALYZE_TYPE.BETA_GAMMA this.analysisType = ANALYZE_TYPE.BETA_GAMMA
} else if (sample.sampleType == 'C') {
this.analysisType = ANALYZE_TYPE.BETA
} else { } else {
this.analysisType = ANALYZE_TYPE.GAMMA this.analysisType = ANALYZE_TYPE.GAMMA
} }
@ -966,6 +985,7 @@ export default {
handleResize() { handleResize() {
this.$refs.gammaAnalysisRef && this.$refs.gammaAnalysisRef.resize() this.$refs.gammaAnalysisRef && this.$refs.gammaAnalysisRef.resize()
this.$refs.betaGammaAnalysisRef && this.$refs.betaGammaAnalysisRef.resize() this.$refs.betaGammaAnalysisRef && this.$refs.betaGammaAnalysisRef.resize()
this.$refs.betaAnalysisRef && this.$refs.betaAnalysisRef.resize()
}, },
// Beta-Gamma Energy Calibration // Beta-Gamma Energy Calibration
@ -1653,7 +1673,7 @@ export default {
}, },
// Beta // Beta
isBeta() { isBeta() {
return this.analysisType == ANALYZE_TYPE.BETA_GAMMA ? false : true return this.analysisType == ANALYZE_TYPE.BETA
}, },
// Beta-Gamma // Beta-Gamma