fix: 修复存在的问题
This commit is contained in:
		
							parent
							
								
									59f373df3c
								
							
						
					
					
						commit
						5672b47ca4
					
				|  | @ -26,6 +26,11 @@ export default { | |||
|     this._chart.setOption(this.option) | ||||
|     this.initEventListener() | ||||
|   }, | ||||
|   destroyed() { | ||||
|     if(this._chart) { | ||||
|       this._chart.dispose() | ||||
|     } | ||||
|   }, | ||||
|   methods: { | ||||
|     initEventListener() { | ||||
|       events.forEach(eventName => { | ||||
|  |  | |||
|  | @ -30,6 +30,11 @@ export default { | |||
|     this._chart.setOption(this.option) | ||||
|     this.initEventListener() | ||||
|   }, | ||||
|   destroyed() { | ||||
|     if(this._chart) { | ||||
|       this._chart.dispose() | ||||
|     } | ||||
|   }, | ||||
|   methods: { | ||||
|     initEventListener() { | ||||
|       events.forEach(eventName => { | ||||
|  |  | |||
|  | @ -39,4 +39,24 @@ export function exportEchartImg(chartInstance, type = 'png', backgroundColor = ' | |||
|     link.click() | ||||
|     document.body.removeChild(link) //下载完成移除元素
 | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| /** | ||||
|  * 按份数分割轴线 | ||||
|  * @param {Number} max  | ||||
|  * @param {Number} min  | ||||
|  * @param {Number} cnt  | ||||
|  * @param {Number} maxBoundaryGap  | ||||
|  */ | ||||
| export function splitAxis(max, min, cnt, maxBoundaryGap = 1.1) { | ||||
|     const _min = Math.floor(min) | ||||
|     const interval = Math.ceil((Math.ceil(max * maxBoundaryGap) - _min) / cnt) | ||||
|     const _max = _min + interval * cnt | ||||
| 
 | ||||
|     return { | ||||
|         min: _min, | ||||
|         interval, | ||||
|         max: _max | ||||
|     } | ||||
| } | ||||
|  | @ -3,6 +3,7 @@ import * as api from '@/api/api' | |||
| import { isURL } from '@/utils/validate' | ||||
| import { ACCESS_TOKEN } from '@/store/mutation-types' | ||||
| import onlineCommons from '@jeecg/antd-online-mini' | ||||
| import { isNull, isUndefined } from 'xe-utils/methods' | ||||
| 
 | ||||
| export function timeFix() { | ||||
|   const time = new Date() | ||||
|  | @ -702,4 +703,8 @@ export function flat(arr, flatKey = 'children') { | |||
|       } | ||||
|       return result | ||||
|   }, []) | ||||
| } | ||||
| 
 | ||||
| export function isNullOrUndefined(val) { | ||||
|   return isNull(val) || isUndefined(val) | ||||
| } | ||||
|  | @ -11,17 +11,7 @@ | |||
|           QC Flags | ||||
|           <beta-gamma-qc-flags slot="content" :data="qcFlags" @click="handleQcFlagClick" /> | ||||
|         </pop-over-with-icon> | ||||
|         <pop-over-with-icon placement="bottomLeft" style="width: 159px" v-model="spectraVisible"> | ||||
|           Spectra | ||||
|           <spectra | ||||
|             slot="content" | ||||
|             v-model="spectraType" | ||||
|             @input=" | ||||
|               spectraVisible = false | ||||
|               changeChartByType($event) | ||||
|             " | ||||
|           /> | ||||
|         </pop-over-with-icon> | ||||
|         <custom-select v-model="spectraType" :options="SampleType" @change="changeChartByType" style="width: 246px;"></custom-select> | ||||
|       </div> | ||||
| 
 | ||||
|       <!-- 二级交互栏结束 --> | ||||
|  | @ -148,6 +138,7 @@ import BetaGammaDetailedInfomation from './components/SubOperators/BetaGammaDeta | |||
| import BetaGammaQcFlags from './components/SubOperators/BetaGammaQcFlags.vue' | ||||
| import PopOverWithIcon from './components/SubOperators/PopOverWithIcon.vue' | ||||
| import Spectra from './components/SubOperators/Spectra.vue' | ||||
| import CustomSelect from '@/components/CustomSelect/index.vue' | ||||
| 
 | ||||
| const StatisticsType = { | ||||
|   'Collection Time': 'Colloc_Time', | ||||
|  | @ -156,6 +147,25 @@ const StatisticsType = { | |||
|   'Air Volume': 'Sample_Volumn' | ||||
| } | ||||
| 
 | ||||
| const SampleType = [ | ||||
|   { | ||||
|     label: 'Sample Data', | ||||
|     value: 'sample' | ||||
|   }, | ||||
|   { | ||||
|     label: 'GasBg Data', | ||||
|     value: 'gasBg' | ||||
|   }, | ||||
|   { | ||||
|     label: 'DetBg Data', | ||||
|     value: 'detBg' | ||||
|   }, | ||||
|   { | ||||
|     label: 'QC Data', | ||||
|     value: 'qc' | ||||
|   } | ||||
| ] | ||||
| 
 | ||||
| export default { | ||||
|   components: { | ||||
|     BetaGammaChartContainer, | ||||
|  | @ -168,7 +178,8 @@ export default { | |||
|     Spectra, | ||||
|     BetaGammaQcFlags, | ||||
|     BetaGammaDetailedInfomation, | ||||
|     StatisticsParamerHistoryModalForQcFlags | ||||
|     StatisticsParamerHistoryModalForQcFlags, | ||||
|     CustomSelect | ||||
|   }, | ||||
|   props: { | ||||
|     sample: { | ||||
|  | @ -176,6 +187,8 @@ export default { | |||
|     } | ||||
|   }, | ||||
|   data() { | ||||
|     this.SampleType = SampleType | ||||
| 
 | ||||
|     return { | ||||
|       qcFlags: {}, | ||||
| 
 | ||||
|  | @ -209,7 +222,7 @@ export default { | |||
|   }, | ||||
|   methods: { | ||||
|     async getSampleDetail() { | ||||
|       this.spectraType = 'sample' | ||||
|       this.spectraType = this.SampleType[0].value | ||||
| 
 | ||||
|       const { dbName, sampleId } = this.sample | ||||
|       try { | ||||
|  | @ -230,7 +243,7 @@ export default { | |||
|       } | ||||
|     }, | ||||
| 
 | ||||
|     changeChartByType(type) { | ||||
|     changeChartByType() { | ||||
|       const { | ||||
|         betaOriginalData, | ||||
|         betaProjectedData, | ||||
|  | @ -253,7 +266,7 @@ export default { | |||
|         XeVolumeBtn, // QC Flags 相关 | ||||
|         GasBgBtn, // QC Flags 相关 | ||||
|         DetBgBtn // QC Flags 相关 | ||||
|       } = this.sampleDetail[type] | ||||
|       } = this.sampleDetail[this.spectraType] | ||||
| 
 | ||||
|       this.spectrumData = spectrumData | ||||
| 
 | ||||
|  |  | |||
|  | @ -10,6 +10,7 @@ | |||
|         {{ item }} | ||||
|       </span> | ||||
|       <span @click="handleUnzoom">Unzoom</span> | ||||
|       <span @click="handleROI">ROI</span> | ||||
|     </div> | ||||
|     <div class="beta-gamma-spectrum-chart-main"> | ||||
|       <!-- 2D 图表,为了相应Unzoom采用的v-show --> | ||||
|  | @ -328,7 +329,8 @@ export default { | |||
| 
 | ||||
|       twoDOption, | ||||
|       threeDSurfaceOption, | ||||
|       threeDScatterOption | ||||
|       threeDScatterOption, | ||||
|       showROI: true | ||||
|     } | ||||
|   }, | ||||
| 
 | ||||
|  | @ -360,6 +362,12 @@ export default { | |||
|       this.reDrawRect() | ||||
|     }, | ||||
| 
 | ||||
|     // 点击ROI | ||||
|     handleROI() { | ||||
|       this.showROI = !this.showROI | ||||
|       this.reDrawRect() | ||||
|     }, | ||||
| 
 | ||||
|     resize() { | ||||
|       this.$refs.chartRef && this.$refs.chartRef.resize() | ||||
|       this.$refs._3dSurfaceRef && this.$refs._3dSurfaceRef.resize() | ||||
|  | @ -473,17 +481,19 @@ export default { | |||
|     reDrawRect() { | ||||
|       const rectList = [] | ||||
| 
 | ||||
|       this.boundaryData.forEach(({ minX, maxX, minY, maxY, color }) => { | ||||
|         // rect 遵循 左下 右下 右上 左上 的顺序 | ||||
|         const rect = [ | ||||
|           [minX, minY], | ||||
|           [maxX, minY], | ||||
|           [maxX, maxY], | ||||
|           [minX, maxY] | ||||
|         ] | ||||
|       if (this.showROI) { | ||||
|         this.boundaryData.forEach(({ minX, maxX, minY, maxY, color }) => { | ||||
|           // rect 遵循 左下 右下 右上 左上 的顺序 | ||||
|           const rect = [ | ||||
|             [minX, minY], | ||||
|             [maxX, minY], | ||||
|             [maxX, maxY], | ||||
|             [minX, maxY] | ||||
|           ] | ||||
| 
 | ||||
|         rectList.push(...this.drawOneRect(rect, color)) | ||||
|       }) | ||||
|           rectList.push(...this.drawOneRect(rect, color)) | ||||
|         }) | ||||
|       } | ||||
|       this.twoDOption.series.markLine.data = rectList | ||||
|     }, | ||||
| 
 | ||||
|  |  | |||
|  | @ -11,7 +11,7 @@ | |||
|                   <span> Channel: {{ betaGammaInfo.channel }} </span> | ||||
|                   <span> | ||||
|                     Gamma Channel Width: | ||||
|                     <a-input-number :min="1" v-model="gammaChannelWidth"></a-input-number> | ||||
|                     <a-input-number :min="1" v-model="gammaChannelWidth" size="small"></a-input-number> | ||||
|                   </span> | ||||
|                 </div> | ||||
|                 <div class="energy"> | ||||
|  | @ -64,13 +64,13 @@ | |||
|             <div class="content channel-and-energy"> | ||||
|               <a-form-model layout="inline"> | ||||
|                 <a-form-model-item label="Channel"> | ||||
|                   <a-input type="number" v-model="channelAndEnergyModel.channel"></a-input> | ||||
|                   <a-input-number type="number" v-model="channelAndEnergyModel.channel" size="small"></a-input-number> | ||||
|                 </a-form-model-item> | ||||
|                 <a-form-model-item label="Energy"> | ||||
|                   <a-input type="number" v-model="channelAndEnergyModel.energy"></a-input> | ||||
|                   <a-input-number type="number" v-model="channelAndEnergyModel.energy" size="small"></a-input-number> | ||||
|                 </a-form-model-item> | ||||
|               </a-form-model> | ||||
|               <a-button type="primary" @click="handleAddChannelAndEnergy">Add</a-button> | ||||
|               <a-button type="primary" @click="handleAddChannelAndEnergy" size="small">Add</a-button> | ||||
|             </div> | ||||
|             <!-- 表格开始 --> | ||||
|             <a-table | ||||
|  | @ -122,9 +122,9 @@ | |||
|                   <span>C to E : </span> | ||||
|                   <span> | ||||
|                     E = | ||||
|                     <a-input type="number" size="small" v-model="newCalibrationFuncModel.paramA" /> + | ||||
|                     <a-input type="number" size="small" v-model="newCalibrationFuncModel.paramB" /> *C + | ||||
|                     <a-input type="number" size="small" v-model="newCalibrationFuncModel.paramC" /> *C <sup>2</sup> | ||||
|                     <a-input-number size="small" v-model="newCalibrationFuncModel.paramA" /> + | ||||
|                     <a-input-number size="small" v-model="newCalibrationFuncModel.paramB" /> *C + | ||||
|                     <a-input-number size="small" v-model="newCalibrationFuncModel.paramC" /> *C <sup>2</sup> | ||||
|                   </span> | ||||
|                 </p> | ||||
|                 <div class="func"> | ||||
|  | @ -174,10 +174,11 @@ | |||
| <script> | ||||
| import CustomChart from '@/components/CustomChart/index.vue' | ||||
| import TitleOverBorder from '@/views/spectrumAnalysis/components/TitleOverBorder.vue' | ||||
| import { getAction } from '@/api/manage' | ||||
| import { getAction, postAction } from '@/api/manage' | ||||
| import { cloneDeep } from 'lodash' | ||||
| import { exportEchartImg, getXAxisAndYAxisByPosition } from '@/utils/chartHelper' | ||||
| import { exportEchartImg, getXAxisAndYAxisByPosition, splitAxis } from '@/utils/chartHelper' | ||||
| import { graphic } from 'echarts' | ||||
| import { isNullOrUndefined } from '@/utils/util' | ||||
| 
 | ||||
| const initialBetaGammaChartOption = { | ||||
|   grid: { | ||||
|  | @ -252,7 +253,8 @@ const initialBetaGammaChartOption = { | |||
|     data: [], | ||||
|     itemStyle: { | ||||
|       color: '#fff' | ||||
|     } | ||||
|     }, | ||||
|     cursor: 'default' | ||||
|   } | ||||
| } | ||||
| 
 | ||||
|  | @ -388,11 +390,11 @@ const initialFigureChartOption = { | |||
|       const [channel, energy1] = series1.value | ||||
| 
 | ||||
|       let html = `<div class="channel">Channel: ${channel}</div> | ||||
|                   <div class="energy">Energy: ${energy1.toFixed(3)}</div>` | ||||
|                   <div class="energy">Energy: ${energy1.toPrecision(6)}</div>` | ||||
| 
 | ||||
|       if (series2) { | ||||
|         const [_, energy2] = series2.value | ||||
|         html += `<div class="warning">Energy: ${energy2}</div>` | ||||
|         html += `<div class="warning">Energy: ${energy2.toPrecision(6)}</div>` | ||||
|       } | ||||
| 
 | ||||
|       return html | ||||
|  | @ -456,7 +458,7 @@ const initialFigureChartOption = { | |||
|       fontSize: 14, | ||||
|       color: '#5b9cba' | ||||
|     }, | ||||
|     nameGap: 55 | ||||
|     nameGap: 80 | ||||
|   }, | ||||
|   series: [ | ||||
|     { | ||||
|  | @ -503,7 +505,7 @@ const columns = [ | |||
|     title: 'Energy/keV', | ||||
|     dataIndex: 'energy', | ||||
|     align: 'center', | ||||
|     customRender: (text) => { | ||||
|     customRender: text => { | ||||
|       return text.toPrecision(6) | ||||
|     } | ||||
|   }, | ||||
|  | @ -527,9 +529,9 @@ const columns = [ | |||
| ] | ||||
| 
 | ||||
| const newCalibrationFuncModel = { | ||||
|   paramA: '', | ||||
|   paramB: '', | ||||
|   paramC: '' | ||||
|   paramA: undefined, | ||||
|   paramB: undefined, | ||||
|   paramC: undefined | ||||
| } | ||||
| 
 | ||||
| export default { | ||||
|  | @ -571,7 +573,10 @@ export default { | |||
|         left: 0 | ||||
|       }, | ||||
| 
 | ||||
|       channelAndEnergyModel: {}, | ||||
|       channelAndEnergyModel: { | ||||
|         channel: undefined, | ||||
|         energy: undefined | ||||
|       }, | ||||
| 
 | ||||
|       c2e: {}, | ||||
|       e2c: {}, | ||||
|  | @ -581,7 +586,11 @@ export default { | |||
|       newCalibrationFuncModel: cloneDeep(newCalibrationFuncModel), | ||||
| 
 | ||||
|       newCalibrationIsAppliedTo: '2', | ||||
|       recalculateROICountsFor: [] | ||||
|       recalculateROICountsFor: [], | ||||
| 
 | ||||
|       count: 0, //反算时需要传递的数值  非反算的情况下不需要传递  数值大小是  第一次调用接口时返回的tableWidgets 大小 | ||||
|       isFirstFitting: true, | ||||
|       isInverse: false // 是否需要反算 | ||||
|     } | ||||
|   }, | ||||
|   created() { | ||||
|  | @ -613,19 +622,29 @@ export default { | |||
|           this.c2e = CToE | ||||
|           this.e2c = EToC | ||||
| 
 | ||||
|           this.oldScatterSeries = oldScatterSeries | ||||
|           this.count = oldScatterSeries.length | ||||
|           this.isFirstFitting = true | ||||
| 
 | ||||
|           this.betaGammaChartOption.series.data = histogramData.map(({ b, g, c }) => [b, g, c]) | ||||
|           this.gammaEnergy = gammaEnergy | ||||
|           this.gammaGatedBetaSpectrum = gammaGatedBetaSpectrum | ||||
|           this.oldScatterSeries = oldScatterSeries | ||||
| 
 | ||||
|           const gammaEnergyValue = betaEnergy.map(item => item[0]) | ||||
|           const gammaEnergyMax = Math.ceil(Math.max(...gammaEnergyValue)) | ||||
|           const gammaEnergyMin = Math.floor(Math.min(...gammaEnergyValue)) | ||||
|           const gammaEnergyInterval = Math.ceil(((gammaEnergyMax - gammaEnergyMin) / 4) * 1.1) | ||||
|           this.figureChartOption.yAxis.max = gammaEnergyInterval * 4 | ||||
|           this.figureChartOption.yAxis.min = gammaEnergyMin | ||||
|           this.figureChartOption.yAxis.interval = Math.ceil((gammaEnergyMax * 1.1) / 4) | ||||
|           const gammaEnergyMax = Math.max(...gammaEnergyValue) | ||||
|           const gammaEnergyMin = Math.min(...gammaEnergyValue) | ||||
| 
 | ||||
|           const { max, min, interval } = splitAxis(gammaEnergyMax, gammaEnergyMin, 4) | ||||
| 
 | ||||
|           this.figureChartOption.yAxis.max = max | ||||
|           this.figureChartOption.yAxis.min = min | ||||
|           this.figureChartOption.yAxis.interval = interval | ||||
| 
 | ||||
|           this.figureChartOption.series[0].data = gammaEnergyValue.map((item, index) => [index, item]) | ||||
|           this.figureChartOption.series[0].markPoint.data = oldScatterSeries.map(({ x, y }) => ({ xAxis: x, yAxis: y })) | ||||
| 
 | ||||
|           this.oldChartOption = cloneDeep(this.figureChartOption) | ||||
|         } else { | ||||
|           this.$message.error(res.message) | ||||
|         } | ||||
|  | @ -647,15 +666,42 @@ export default { | |||
|         // 设置 gamma-gated beta spectrum | ||||
|         const yAxis = parseInt(point[1].toFixed()) | ||||
| 
 | ||||
|         this.currEnergy = this.gammaEnergy[yAxis][0].toFixed(2) // 设置当前选中位置的Energy | ||||
|         this.channelAndEnergyModel = {} | ||||
|         this.currEnergy = parseFloat(this.gammaEnergy[yAxis][0].toFixed(2)) // 设置当前选中位置的Energy | ||||
|         this.channelAndEnergyModel = { | ||||
|           channel: undefined, | ||||
|           energy: undefined | ||||
|         } | ||||
| 
 | ||||
|         const currGammaGatedBetaSpectrum = this.gammaGatedBetaSpectrum[yAxis] | ||||
|         const max = Math.max(...currGammaGatedBetaSpectrum) | ||||
|         const interval = Math.ceil((max / 4) * 1.1) | ||||
|         this.gammaGatedChartOption.yAxis.max = interval * 4 | ||||
|         this.gammaGatedChartOption.yAxis.interval = interval | ||||
|         this.gammaGatedChartOption.series.data = currGammaGatedBetaSpectrum.map((item, index) => [index, item]) | ||||
|         this.getGammaGated(yAxis) | ||||
|       } | ||||
|     }, | ||||
| 
 | ||||
|     // 获取右侧图表数据 | ||||
|     async getGammaGated(gammaChannel) { | ||||
|       try { | ||||
|         const { | ||||
|           success, | ||||
|           result: { data }, | ||||
|           message | ||||
|         } = await getAction('/spectrumAnalysis/getGammaGated', { | ||||
|           gammaChannel, | ||||
|           sampleId: this.sampleId, | ||||
|           chartHeight: this.gammaEnergy.length, | ||||
|           channelWidth: this.gammaChannelWidth | ||||
|         }) | ||||
|         if (success) { | ||||
|           const max = Math.max(...data.map(({ y }) => y)) | ||||
| 
 | ||||
|           const { max: _max, interval } = splitAxis(max, 0, 4) | ||||
| 
 | ||||
|           this.gammaGatedChartOption.yAxis.interval = interval | ||||
|           this.gammaGatedChartOption.yAxis.max = _max | ||||
|           this.gammaGatedChartOption.series.data = data.map(({ x, y }) => [x, y]) | ||||
|         } else { | ||||
|           this.$message.error(message) | ||||
|         } | ||||
|       } catch (error) { | ||||
|         console.error(error) | ||||
|       } | ||||
|     }, | ||||
| 
 | ||||
|  | @ -670,10 +716,13 @@ export default { | |||
|         if (this.gammaEnergy && this.gammaEnergy.length) { | ||||
|           // 设置 Channel 和 Energy | ||||
|           const yAxis = parseInt(point[1].toFixed()) | ||||
|           const energy = this.gammaEnergy[yAxis][0].toFixed(2) | ||||
|           this.betaGammaInfo = { | ||||
|             channel: yAxis, | ||||
|             energy | ||||
|           const gammaEnergy = this.gammaEnergy[yAxis] | ||||
|           if (gammaEnergy) { | ||||
|             const energy = gammaEnergy[0].toPrecision(6) | ||||
|             this.betaGammaInfo = { | ||||
|               channel: yAxis, | ||||
|               energy | ||||
|             } | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|  | @ -704,21 +753,64 @@ export default { | |||
|     handleAddChannelAndEnergy() { | ||||
|       const { channel, energy } = this.channelAndEnergyModel | ||||
| 
 | ||||
|       if (!channel || !energy) { | ||||
|       if (isNullOrUndefined(channel) || isNullOrUndefined(energy)) { | ||||
|         return | ||||
|       } | ||||
| 
 | ||||
|       this.list.push({ | ||||
|         rowCount: this.list.length + 1, | ||||
|         channel, | ||||
|         energy | ||||
|       }) | ||||
| 
 | ||||
|       this.channelAndEnergyModel = {} | ||||
|       this.figureChartOption.series[1].markPoint.data.push({ xAxis: channel, yAxis: energy }) | ||||
| 
 | ||||
|       const { min, max } = this.getFigureChartMaxAndMin() | ||||
| 
 | ||||
|       const newMax = energy > max ? energy : max | ||||
|       const newMin = energy < min ? energy : min | ||||
| 
 | ||||
|       // 如果最大/最小值范围改变,重新计算范围 | ||||
|       if (newMax === energy || newMin === energy) { | ||||
|         const { max: _max, min: _min, interval } = splitAxis(newMax, newMin, 4) | ||||
|         this.figureChartOption.yAxis.max = _max | ||||
|         this.figureChartOption.yAxis.min = _min | ||||
|         this.figureChartOption.yAxis.interval = interval | ||||
|       } | ||||
| 
 | ||||
|       this.channelAndEnergyModel = { | ||||
|         channel: undefined, | ||||
|         energy: undefined | ||||
|       } | ||||
| 
 | ||||
|       this.isInverse = true | ||||
|     }, | ||||
| 
 | ||||
|     // 删除表格里的单项 | ||||
|     handleDel(index) { | ||||
|       this.list.splice(index, 1) | ||||
|       const willDelItem = this.list.splice(index, 1)[0] | ||||
| 
 | ||||
|       const findIndex = this.figureChartOption.series[1].markPoint.data.findIndex( | ||||
|         item => item.xAxis == willDelItem.channel && item.yAxis == willDelItem.energy | ||||
|       ) | ||||
| 
 | ||||
|       if (-1 !== findIndex) { | ||||
|         const markPointData = this.figureChartOption.series[1].markPoint.data | ||||
| 
 | ||||
|         const { max: prevMax, min: prevMin } = this.getFigureChartMaxAndMin() | ||||
|         const deletedItem = markPointData.splice(findIndex, 1)[0] // 删除图表上相应的点 | ||||
| 
 | ||||
|         // 如果最大/最小值范围改变,重新计算范围 | ||||
|         if (deletedItem.yAxis == prevMax || deletedItem.yAxis == prevMin) { | ||||
|           const { max: newMax, min: newMin } = this.getFigureChartMaxAndMin() | ||||
|           const { max: _max, min: _min, interval } = splitAxis(newMax, newMin, 4) | ||||
|           this.figureChartOption.yAxis.max = _max | ||||
|           this.figureChartOption.yAxis.min = _min | ||||
|           this.figureChartOption.yAxis.interval = interval | ||||
|         } | ||||
|       } | ||||
| 
 | ||||
|       this.isInverse = true | ||||
|     }, | ||||
| 
 | ||||
|     // 下载图表图片 | ||||
|  | @ -732,8 +824,12 @@ export default { | |||
|       this.newCalibrationFuncModel = cloneDeep(newCalibrationFuncModel) | ||||
|       this.list = [] | ||||
|       this.newE2C = [] | ||||
|        | ||||
| 
 | ||||
|       this.figureChartOption = this.oldChartOption | ||||
| 
 | ||||
|       this.figureChartOption = cloneDeep(this.oldChartOption) | ||||
|       this.isFirstFitting = true | ||||
|       this.isInverse = false | ||||
|     }, | ||||
| 
 | ||||
|     // 点击Fitting按钮执行重新计算 | ||||
|  | @ -743,35 +839,54 @@ export default { | |||
|         return | ||||
|       } | ||||
|       try { | ||||
|         const { success, result, message } = await getAction('/spectrumAnalysis/fitting', { | ||||
|         const { success, result, message } = await postAction('/spectrumAnalysis/fitting', { | ||||
|           ...this.newCalibrationFuncModel, | ||||
|           tempPoints: this.figureChartOption.series[0].markPoint.data.map(item => item.xAxis).join(',') | ||||
|           tempPoints: this.isFirstFitting | ||||
|             ? this.oldScatterSeries | ||||
|             : this.list.map(item => ({ x: item.channel, y: item.energy })), | ||||
|           count: this.isFirstFitting || !this.isInverse ? undefined : this.count | ||||
|         }) | ||||
|         if (success) { | ||||
|           const { EToC, newLineSeries, newScatterSeriesData, tableWidgets } = result | ||||
|           this.isFirstFitting = false | ||||
| 
 | ||||
|           const { EToC, newLineSeries, newScatterSeriesData, tableWidgets, CToE } = result | ||||
|           this.newE2C = EToC | ||||
|           this.list = tableWidgets | ||||
|           this.oldChartOption = cloneDeep(this.figureChartOption) | ||||
| 
 | ||||
|           if (tableWidgets) { | ||||
|             this.list = tableWidgets | ||||
|           } | ||||
|           // 反算时重新设置C to E 的值 | ||||
|           if (CToE) { | ||||
|             const [paramA, paramB, paramC] = CToE | ||||
|             this.newCalibrationFuncModel = { | ||||
|               paramA: Number(paramA).toPrecision(6), | ||||
|               paramB: Number(paramB).toPrecision(6), | ||||
|               paramC: Number(paramC).toPrecision(6) | ||||
|             } | ||||
|           } | ||||
| 
 | ||||
|           const energyValues = newLineSeries.map(item => item.y) | ||||
| 
 | ||||
|           const { max: prevMax, min: prevMin } = this.figureChartOption.yAxis | ||||
|           const { max: prevMax, min: prevMin } = this.oldChartOption.yAxis | ||||
| 
 | ||||
|           const energyMax = Math.max(Math.max(...energyValues), prevMax) | ||||
|           const energyMin = Math.min(Math.min(...energyValues), prevMin) | ||||
| 
 | ||||
|           const energyInterval = Math.ceil(((energyMax - energyMin) / 4) * 1.1) | ||||
|           this.figureChartOption.yAxis.max = energyInterval * 4 | ||||
|           this.figureChartOption.yAxis.min = energyMin | ||||
|           this.figureChartOption.yAxis.interval = Math.ceil((energyMax * 1.1) / 4) | ||||
|           const { min, max, interval } = splitAxis(energyMax, energyMin, 4) | ||||
| 
 | ||||
|           this.figureChartOption.yAxis.max = max | ||||
|           this.figureChartOption.yAxis.min = min | ||||
|           this.figureChartOption.yAxis.interval = interval | ||||
| 
 | ||||
|           this.figureChartOption.series[1].data = newLineSeries.map(({ x, y }) => [x, y]) | ||||
|           this.figureChartOption.series[1].markPoint.data = newScatterSeriesData.map(({ x, y }) => { | ||||
|             return { | ||||
|               xAxis: x, | ||||
|               yAxis: y | ||||
|             } | ||||
|           }) | ||||
|           if (newScatterSeriesData) { | ||||
|             this.figureChartOption.series[1].markPoint.data = newScatterSeriesData.map(({ x, y }) => { | ||||
|               return { | ||||
|                 xAxis: x, | ||||
|                 yAxis: y | ||||
|               } | ||||
|             }) | ||||
|           } | ||||
|         } else { | ||||
|           this.$message.error(message) | ||||
|         } | ||||
|  | @ -780,6 +895,30 @@ export default { | |||
|       } | ||||
|     }, | ||||
| 
 | ||||
|     // 获取Figure Chart 最大值 和 最小值 | ||||
|     getFigureChartMaxAndMin() { | ||||
|       const [series0, series1] = this.figureChartOption.series | ||||
|       const { | ||||
|         data: data0, | ||||
|         markPoint: { data: markPointData0 } | ||||
|       } = series0 | ||||
|       const { | ||||
|         data: data1, | ||||
|         markPoint: { data: markPointData1 } | ||||
|       } = series1 | ||||
|       const newArr = [ | ||||
|         ...data0.map(item => item[1]), | ||||
|         ...markPointData0.map(item => item.yAxis), | ||||
|         ...data1.map(item => item[1]), | ||||
|         ...markPointData1.map(item => item.yAxis) | ||||
|       ] | ||||
| 
 | ||||
|       return { | ||||
|         max: Math.max(...newArr), | ||||
|         min: Math.min(...newArr) | ||||
|       } | ||||
|     }, | ||||
| 
 | ||||
|     /** | ||||
|      * 返回的科学计数法的字符串处理 | ||||
|      * @param {string} str | ||||
|  | @ -816,7 +955,7 @@ p { | |||
| 
 | ||||
| .QCs { | ||||
|   display: flex; | ||||
|   gap: 20px; | ||||
|   gap: 10px; | ||||
| 
 | ||||
|   .beta-gamma-spectrum { | ||||
|     flex: 10; | ||||
|  | @ -832,7 +971,7 @@ p { | |||
|     } | ||||
| 
 | ||||
|     .beta-gamma-chart { | ||||
|       height: 427px; | ||||
|       height: 353px; | ||||
|       position: relative; | ||||
| 
 | ||||
|       .markline { | ||||
|  | @ -847,7 +986,7 @@ p { | |||
|       .rect { | ||||
|         position: absolute; | ||||
|         left: 55px; | ||||
|         width: 442px; | ||||
|         width: 446px; | ||||
|         border: 1px solid #0f0; | ||||
|         background-color: rgba(0, 255, 0, 0.4); | ||||
|         transform: translateY(-50%); | ||||
|  | @ -860,7 +999,7 @@ p { | |||
|     flex: 11; | ||||
| 
 | ||||
|     .gamma-gated-chart { | ||||
|       height: 250px; | ||||
|       height: 200px; | ||||
|       position: relative; | ||||
| 
 | ||||
|       .ant-btn { | ||||
|  | @ -871,12 +1010,12 @@ p { | |||
|     } | ||||
| 
 | ||||
|     .channel-and-energy { | ||||
|       margin-top: 20px; | ||||
|       margin-top: 10px; | ||||
|       display: flex; | ||||
|       justify-content: space-between; | ||||
|       align-items: center; | ||||
| 
 | ||||
|       .ant-input { | ||||
|       .ant-input-number { | ||||
|         width: 120px; | ||||
|       } | ||||
| 
 | ||||
|  | @ -886,7 +1025,7 @@ p { | |||
|     } | ||||
| 
 | ||||
|     .ant-table-wrapper { | ||||
|       margin-top: 20px; | ||||
|       margin-top: 10px; | ||||
| 
 | ||||
|       &.has-data { | ||||
|         ::v-deep { | ||||
|  | @ -910,10 +1049,10 @@ p { | |||
| } | ||||
| 
 | ||||
| .figure { | ||||
|   margin-top: 20px; | ||||
|   margin-top: 10px; | ||||
| 
 | ||||
|   &-chart { | ||||
|     height: 250px; | ||||
|     height: 200px; | ||||
|     position: relative; | ||||
| 
 | ||||
|     .ant-btn { | ||||
|  | @ -925,7 +1064,7 @@ p { | |||
| } | ||||
| 
 | ||||
| .calibration-parameter { | ||||
|   margin-top: 20px; | ||||
|   margin-top: 10px; | ||||
| 
 | ||||
|   .calibration-funcs { | ||||
|     margin-top: 15px; | ||||
|  | @ -935,7 +1074,7 @@ p { | |||
|     &-func { | ||||
|       display: flex; | ||||
|       flex: 1; | ||||
|       gap: 20px; | ||||
|       gap: 10px; | ||||
| 
 | ||||
|       > div { | ||||
|         &:first-child { | ||||
|  | @ -973,9 +1112,9 @@ p { | |||
| } | ||||
| 
 | ||||
| .footer { | ||||
|   margin-top: 20px; | ||||
|   margin-top: 10px; | ||||
|   display: flex; | ||||
|   gap: 20px; | ||||
|   gap: 10px; | ||||
| 
 | ||||
|   .title-over-border { | ||||
|     &:first-child { | ||||
|  |  | |||
|  | @ -11,7 +11,9 @@ | |||
|                 :option="gammaSpectrumChartOption" | ||||
|                 @zr:click="handleGammaSpectrumChartClick" | ||||
|               /> | ||||
|               <a-button type="primary" @click="handleSnapshot($refs.gammaSpectrumChart)">Snapshot</a-button> | ||||
|               <a-button type="primary" @click="handleSnapshot($refs.gammaSpectrumChart)" size="small" | ||||
|                 >Snapshot</a-button | ||||
|               > | ||||
|               <!-- 自定义tooltip,用于点击图表后的tooltip显示 --> | ||||
|               <div | ||||
|                 v-if="tooltipVisible" | ||||
|  | @ -29,13 +31,17 @@ | |||
|           <div class="content channel-and-energy"> | ||||
|             <a-form-model layout="inline"> | ||||
|               <a-form-model-item label="Channel"> | ||||
|                 <a-input v-model="channelAndEnergyModel.channel"></a-input> | ||||
|                 <a-input-number v-model="channelAndEnergyModel.channel" size="small"></a-input-number> | ||||
|               </a-form-model-item> | ||||
|               <a-form-model-item label="Energy"> | ||||
|                 <a-input ref="energyInputRef" v-model="channelAndEnergyModel.energy"></a-input> | ||||
|                 <a-input-number | ||||
|                   ref="energyInputRef" | ||||
|                   v-model="channelAndEnergyModel.energy" | ||||
|                   size="small" | ||||
|                 ></a-input-number> | ||||
|               </a-form-model-item> | ||||
|             </a-form-model> | ||||
|             <a-button type="primary" @click="handleAddChannelAndEnergy">Add</a-button> | ||||
|             <a-button type="primary" @click="handleAddChannelAndEnergy" size="small">Add</a-button> | ||||
|           </div> | ||||
|           <!-- 表格开始 --> | ||||
|           <a-table | ||||
|  | @ -57,7 +63,7 @@ | |||
|           <div class="content"> | ||||
|             <div class="figure-chart"> | ||||
|               <custom-chart ref="figureChartRef" :option="figureChartOption" /> | ||||
|               <a-button type="primary" @click="handleSnapshot($refs.figureChartRef)">Snapshot</a-button> | ||||
|               <a-button type="primary" @click="handleSnapshot($refs.figureChartRef)" size="small">Snapshot</a-button> | ||||
|             </div> | ||||
|           </div> | ||||
|         </div> | ||||
|  | @ -89,9 +95,9 @@ | |||
|                   <span>C to E : </span> | ||||
|                   <span> | ||||
|                     E = | ||||
|                     <a-input type="number" size="small" v-model="newCalibrationFuncModel.paramA" /> + | ||||
|                     <a-input type="number" size="small" v-model="newCalibrationFuncModel.paramB" /> *C + | ||||
|                     <a-input type="number" size="small" v-model="newCalibrationFuncModel.paramC" /> *C <sup>2</sup> | ||||
|                     <a-input-number size="small" v-model="newCalibrationFuncModel.paramA" /> + | ||||
|                     <a-input-number size="small" v-model="newCalibrationFuncModel.paramB" /> *C + | ||||
|                     <a-input-number size="small" v-model="newCalibrationFuncModel.paramC" /> *C <sup>2</sup> | ||||
|                   </span> | ||||
|                 </p> | ||||
|                 <div class="func"> | ||||
|  | @ -141,11 +147,12 @@ | |||
| <script> | ||||
| import CustomChart from '@/components/CustomChart/index.vue' | ||||
| import TitleOverBorder from '@/views/spectrumAnalysis/components/TitleOverBorder.vue' | ||||
| import { getAction } from '@/api/manage' | ||||
| import { getAction, postAction } from '@/api/manage' | ||||
| import { graphic } from 'echarts' | ||||
| import { exportEchartImg, getXAxisAndYAxisByPosition } from '@/utils/chartHelper' | ||||
| import { exportEchartImg, getXAxisAndYAxisByPosition, splitAxis } from '@/utils/chartHelper' | ||||
| 
 | ||||
| import { cloneDeep } from 'lodash' | ||||
| import { isNullOrUndefined } from '@/utils/util' | ||||
| 
 | ||||
| const initialGammaSpectrumChartOption = { | ||||
|   grid: { | ||||
|  | @ -279,11 +286,11 @@ const initialFigureChartOption = { | |||
|       const [channel, energy1] = series1.value | ||||
| 
 | ||||
|       let html = `<div class="channel">Channel: ${channel}</div> | ||||
|                   <div class="energy">Energy: ${energy1.toFixed(3)}</div>` | ||||
|                   <div class="energy">Energy: ${energy1.toPrecision(6)}</div>` | ||||
| 
 | ||||
|       if (series2) { | ||||
|         const [_, energy2] = series2.value | ||||
|         html += `<div class="warning">Energy: ${energy2}</div>` | ||||
|         html += `<div class="warning">Energy: ${energy2.toPrecision(6)}</div>` | ||||
|       } | ||||
| 
 | ||||
|       return html | ||||
|  | @ -347,7 +354,7 @@ const initialFigureChartOption = { | |||
|       fontSize: 14, | ||||
|       color: '#5b9cba' | ||||
|     }, | ||||
|     nameGap: 55 | ||||
|     nameGap: 80 | ||||
|   }, | ||||
|   series: [ | ||||
|     { | ||||
|  | @ -394,7 +401,7 @@ const columns = [ | |||
|     title: 'Energy/keV', | ||||
|     dataIndex: 'energy', | ||||
|     align: 'center', | ||||
|     customRender: (text) => { | ||||
|     customRender: text => { | ||||
|       return text.toPrecision(6) | ||||
|     } | ||||
|   }, | ||||
|  | @ -418,9 +425,9 @@ const columns = [ | |||
| ] | ||||
| 
 | ||||
| const newCalibrationFuncModel = { | ||||
|   paramA: '', | ||||
|   paramB: '', | ||||
|   paramC: '' | ||||
|   paramA: undefined, | ||||
|   paramB: undefined, | ||||
|   paramC: undefined | ||||
| } | ||||
| 
 | ||||
| export default { | ||||
|  | @ -450,12 +457,19 @@ export default { | |||
|       }, | ||||
|       tooltipChannel: '', | ||||
| 
 | ||||
|       channelAndEnergyModel: {}, | ||||
|       channelAndEnergyModel: { | ||||
|         channel: undefined, | ||||
|         energy: undefined | ||||
|       }, | ||||
| 
 | ||||
|       newCalibrationFuncModel: cloneDeep(newCalibrationFuncModel), | ||||
| 
 | ||||
|       newCalibrationIsAppliedTo: '2', | ||||
|       recalculateROICountsFor: [] | ||||
|       recalculateROICountsFor: [], | ||||
| 
 | ||||
|       count: 0, //反算时需要传递的数值  非反算的情况下不需要传递  数值大小是  第一次调用接口时返回的tableWidgets 大小 | ||||
|       isFirstFitting: true, | ||||
|       isInverse: false // 是否需要反算 | ||||
|     } | ||||
|   }, | ||||
|   created() { | ||||
|  | @ -480,22 +494,32 @@ export default { | |||
| 
 | ||||
|           this.c2e = CToE | ||||
|           this.e2c = EToC | ||||
|           this.oldScatterSeries = oldScatterSeries | ||||
|           this.count = oldScatterSeries.length | ||||
|           this.isFirstFitting = true | ||||
| 
 | ||||
|           const interval = Math.ceil(((max - min) / 4) * 1.1) | ||||
|           this.gammaSpectrumChartOption.yAxis.max = interval * 4 | ||||
|           this.gammaSpectrumChartOption.yAxis.min = min | ||||
|           this.gammaSpectrumChartOption.yAxis.interval = interval | ||||
|           const { max: _max, min: _min, interval: _interval } = splitAxis(max, min, 4) | ||||
| 
 | ||||
|           this.gammaSpectrumChartOption.yAxis.max = _max | ||||
|           this.gammaSpectrumChartOption.yAxis.min = _min | ||||
|           this.gammaSpectrumChartOption.yAxis.interval = _interval | ||||
|           this.gammaSpectrumChartOption.series.data = gammaSpectrum.map(({ x, y }) => [x, y]) | ||||
| 
 | ||||
|           const gammaEnergyValue = gammaEnergy.map(item => item[0]) | ||||
|           const gammaEnergyMax = Math.ceil(Math.max(...gammaEnergyValue)) | ||||
|           const gammaEnergyMin = Math.floor(Math.min(...gammaEnergyValue)) | ||||
|           const gammaEnergyInterval = Math.ceil(((gammaEnergyMax - gammaEnergyMin) / 4) * 1.1) | ||||
|           this.figureChartOption.yAxis.max = gammaEnergyInterval * 4 | ||||
|           this.figureChartOption.yAxis.min = gammaEnergyMin | ||||
|           this.figureChartOption.yAxis.interval = Math.ceil((gammaEnergyMax * 1.1) / 4) | ||||
| 
 | ||||
|           const { max: __max, min: __min, interval: __interval } = splitAxis( | ||||
|             Math.max(...gammaEnergyValue), | ||||
|             Math.min(...gammaEnergyValue), | ||||
|             4 | ||||
|           ) | ||||
| 
 | ||||
|           this.figureChartOption.yAxis.max = __max | ||||
|           this.figureChartOption.yAxis.min = __min | ||||
|           this.figureChartOption.yAxis.interval = __interval | ||||
|           this.figureChartOption.series[0].data = gammaEnergyValue.map((item, index) => [index, item]) | ||||
|           this.figureChartOption.series[0].markPoint.data = oldScatterSeries.map(({ x, y }) => ({ xAxis: x, yAxis: y })) | ||||
| 
 | ||||
|           this.oldChartOption = cloneDeep(this.figureChartOption) | ||||
|         } else { | ||||
|           this.$message.error(res.message) | ||||
|         } | ||||
|  | @ -539,21 +563,63 @@ export default { | |||
|     handleAddChannelAndEnergy() { | ||||
|       const { channel, energy } = this.channelAndEnergyModel | ||||
| 
 | ||||
|       if (!channel || !energy) { | ||||
|       if (isNullOrUndefined(channel) || isNullOrUndefined(energy)) { | ||||
|         return | ||||
|       } | ||||
| 
 | ||||
|       this.list.push({ | ||||
|         rowCount: this.list.length + 1, | ||||
|         channel, | ||||
|         energy | ||||
|       }) | ||||
| 
 | ||||
|       this.channelAndEnergyModel = {} | ||||
|       this.figureChartOption.series[1].markPoint.data.push({ xAxis: channel, yAxis: energy }) | ||||
| 
 | ||||
|       const { min, max } = this.getFigureChartMaxAndMin() | ||||
| 
 | ||||
|       const newMax = energy > max ? energy : max | ||||
|       const newMin = energy < min ? energy : min | ||||
| 
 | ||||
|       // 如果最大/最小值范围改变,重新计算范围 | ||||
|       if (newMax === energy || newMin === energy) { | ||||
|         const { max: _max, min: _min, interval } = splitAxis(newMax, newMin, 4) | ||||
|         this.figureChartOption.yAxis.max = _max | ||||
|         this.figureChartOption.yAxis.min = _min | ||||
|         this.figureChartOption.yAxis.interval = interval | ||||
|       } | ||||
| 
 | ||||
|       this.channelAndEnergyModel = { | ||||
|         channel: undefined, | ||||
|         energy: undefined | ||||
|       } | ||||
| 
 | ||||
|       this.isInverse = true | ||||
|     }, | ||||
| 
 | ||||
|     // 删除表格里的单项 | ||||
|     handleDel(index) { | ||||
|       this.list.splice(index, 1) | ||||
|       const willDelItem = this.list.splice(index, 1)[0] | ||||
| 
 | ||||
|       const findIndex = this.figureChartOption.series[1].markPoint.data.findIndex( | ||||
|         item => item.xAxis == willDelItem.channel && item.yAxis == willDelItem.energy | ||||
|       ) | ||||
|       if (-1 !== findIndex) { | ||||
|         const markPointData = this.figureChartOption.series[1].markPoint.data | ||||
| 
 | ||||
|         const { max: prevMax, min: prevMin } = this.getFigureChartMaxAndMin() | ||||
|         const deletedItem = markPointData.splice(findIndex, 1)[0] // 删除图表上相应的点 | ||||
| 
 | ||||
|         // 如果最大/最小值范围改变,重新计算范围 | ||||
|         if (deletedItem.yAxis == prevMax || deletedItem.yAxis == prevMin) { | ||||
|           const { max: newMax, min: newMin } = this.getFigureChartMaxAndMin() | ||||
|           const { max: _max, min: _min, interval } = splitAxis(newMax, newMin, 4) | ||||
|           this.figureChartOption.yAxis.max = _max | ||||
|           this.figureChartOption.yAxis.min = _min | ||||
|           this.figureChartOption.yAxis.interval = interval | ||||
|         } | ||||
|       } | ||||
| 
 | ||||
|       this.isInverse = true | ||||
|     }, | ||||
| 
 | ||||
|     // 点击Reset Button 重置 | ||||
|  | @ -561,8 +627,10 @@ export default { | |||
|       this.newCalibrationFuncModel = cloneDeep(newCalibrationFuncModel) | ||||
|       this.list = [] | ||||
|       this.newE2C = [] | ||||
|        | ||||
|       this.figureChartOption = this.oldChartOption | ||||
| 
 | ||||
|       this.figureChartOption = cloneDeep(this.oldChartOption) | ||||
|       this.isFirstFitting = true | ||||
|       this.isInverse = false | ||||
|     }, | ||||
| 
 | ||||
|     // 点击Fitting按钮执行重新计算 | ||||
|  | @ -572,35 +640,51 @@ export default { | |||
|         return | ||||
|       } | ||||
|       try { | ||||
|         const { success, result, message } = await getAction('/spectrumAnalysis/fitting', { | ||||
|         const { success, result, message } = await postAction('/spectrumAnalysis/fitting', { | ||||
|           ...this.newCalibrationFuncModel, | ||||
|           tempPoints: this.figureChartOption.series[0].markPoint.data.map(item => item.xAxis).join(',') | ||||
|           tempPoints: this.isFirstFitting | ||||
|             ? this.oldScatterSeries | ||||
|             : this.list.map(item => ({ x: item.channel, y: item.energy })), | ||||
|           count: this.isFirstFitting || !this.isInverse ? undefined : this.count | ||||
|         }) | ||||
|         if (success) { | ||||
|           const { EToC, newLineSeries, newScatterSeriesData, tableWidgets } = result | ||||
|           this.isFirstFitting = false | ||||
| 
 | ||||
|           const { EToC, newLineSeries, newScatterSeriesData, tableWidgets, CToE } = result | ||||
|           this.newE2C = EToC | ||||
|           this.list = tableWidgets | ||||
|           this.oldChartOption = cloneDeep(this.figureChartOption) | ||||
|           if (tableWidgets) { | ||||
|             this.list = tableWidgets | ||||
|           } | ||||
|           // 反算时重新设置C to E 的值 | ||||
|           if (CToE) { | ||||
|             const [paramA, paramB, paramC] = CToE | ||||
|             this.newCalibrationFuncModel = { | ||||
|               paramA: Number(paramA).toPrecision(6), | ||||
|               paramB: Number(paramB).toPrecision(6), | ||||
|               paramC: Number(paramC).toPrecision(6) | ||||
|             } | ||||
|           } | ||||
| 
 | ||||
|           const energyValues = newLineSeries.map(item => item.y) | ||||
| 
 | ||||
|           const { max: prevMax, min: prevMin } = this.figureChartOption.yAxis | ||||
|           const { max: prevMax, min: prevMin } = this.oldChartOption.yAxis | ||||
| 
 | ||||
|           const energyMax = Math.max(Math.max(...energyValues), prevMax) | ||||
|           const energyMin = Math.min(Math.min(...energyValues), prevMin) | ||||
| 
 | ||||
|           const energyInterval = Math.ceil(((energyMax - energyMin) / 4) * 1.1) | ||||
|           this.figureChartOption.yAxis.max = energyInterval * 4 | ||||
|           this.figureChartOption.yAxis.min = energyMin | ||||
|           this.figureChartOption.yAxis.interval = Math.ceil((energyMax * 1.1) / 4) | ||||
|           const { min, max, interval } = splitAxis(energyMax, energyMin, 4) | ||||
| 
 | ||||
|           this.figureChartOption.yAxis.max = max | ||||
|           this.figureChartOption.yAxis.min = min | ||||
|           this.figureChartOption.yAxis.interval = interval | ||||
| 
 | ||||
|           this.figureChartOption.series[1].data = newLineSeries.map(({ x, y }) => [x, y]) | ||||
|           this.figureChartOption.series[1].markPoint.data = newScatterSeriesData.map(({ x, y }) => { | ||||
|             return { | ||||
|           if (newScatterSeriesData) { | ||||
|             this.figureChartOption.series[1].markPoint.data = newScatterSeriesData.map(({ x, y }) => ({ | ||||
|               xAxis: x, | ||||
|               yAxis: y | ||||
|             } | ||||
|           }) | ||||
|             })) | ||||
|           } | ||||
|         } else { | ||||
|           this.$message.error(message) | ||||
|         } | ||||
|  | @ -609,6 +693,30 @@ export default { | |||
|       } | ||||
|     }, | ||||
| 
 | ||||
|     // 获取Figure Chart 最大值 和 最小值 | ||||
|     getFigureChartMaxAndMin() { | ||||
|       const [series0, series1] = this.figureChartOption.series | ||||
|       const { | ||||
|         data: data0, | ||||
|         markPoint: { data: markPointData0 } | ||||
|       } = series0 | ||||
|       const { | ||||
|         data: data1, | ||||
|         markPoint: { data: markPointData1 } | ||||
|       } = series1 | ||||
|       const newArr = [ | ||||
|         ...data0.map(item => item[1]), | ||||
|         ...markPointData0.map(item => item.yAxis), | ||||
|         ...data1.map(item => item[1]), | ||||
|         ...markPointData1.map(item => item.yAxis) | ||||
|       ] | ||||
| 
 | ||||
|       return { | ||||
|         max: Math.max(...newArr), | ||||
|         min: Math.min(...newArr) | ||||
|       } | ||||
|     }, | ||||
| 
 | ||||
|     /** | ||||
|      * 返回的科学计数法的字符串处理 | ||||
|      * @param {string} str | ||||
|  | @ -637,7 +745,7 @@ p { | |||
| } | ||||
| .gamma-spectrum-qc { | ||||
|   .gamma-spectrum-chart { | ||||
|     height: 300px; | ||||
|     height: 200px; | ||||
|     position: relative; | ||||
| 
 | ||||
|     .ant-btn { | ||||
|  | @ -648,11 +756,11 @@ p { | |||
|   } | ||||
| 
 | ||||
|   .channel-and-energy { | ||||
|     margin-top: 20px; | ||||
|     margin-top: 10px; | ||||
|     display: flex; | ||||
|     align-items: center; | ||||
| 
 | ||||
|     .ant-input { | ||||
|     .ant-input-number { | ||||
|       width: 150px; | ||||
|     } | ||||
| 
 | ||||
|  | @ -663,7 +771,7 @@ p { | |||
|   } | ||||
| 
 | ||||
|   .ant-table-wrapper { | ||||
|     margin-top: 20px; | ||||
|     margin-top: 10px; | ||||
| 
 | ||||
|     &.has-data { | ||||
|       ::v-deep { | ||||
|  | @ -686,10 +794,10 @@ p { | |||
| } | ||||
| 
 | ||||
| .figure { | ||||
|   margin-top: 20px; | ||||
|   margin-top: 10px; | ||||
| 
 | ||||
|   &-chart { | ||||
|     height: 250px; | ||||
|     height: 200px; | ||||
|     position: relative; | ||||
| 
 | ||||
|     .ant-btn { | ||||
|  | @ -701,7 +809,7 @@ p { | |||
| } | ||||
| 
 | ||||
| .calibration-parameter { | ||||
|   margin-top: 20px; | ||||
|   margin-top: 10px; | ||||
| 
 | ||||
|   .calibration-funcs { | ||||
|     margin-top: 15px; | ||||
|  | @ -711,7 +819,7 @@ p { | |||
|     &-func { | ||||
|       display: flex; | ||||
|       flex: 1; | ||||
|       gap: 20px; | ||||
|       gap: 10px; | ||||
| 
 | ||||
|       > div { | ||||
|         &:first-child { | ||||
|  | @ -749,9 +857,9 @@ p { | |||
| } | ||||
| 
 | ||||
| .footer { | ||||
|   margin-top: 20px; | ||||
|   margin-top: 10px; | ||||
|   display: flex; | ||||
|   gap: 20px; | ||||
|   gap: 10px; | ||||
| 
 | ||||
|   .title-over-border { | ||||
|     &:first-child { | ||||
|  |  | |||
|  | @ -1,5 +1,12 @@ | |||
| <template> | ||||
|   <custom-modal v-model="visible" :width="1200" title="Tool of Calibration" :footer="null" destroy-on-close> | ||||
|   <custom-modal | ||||
|     v-model="visible" | ||||
|     :width="1200" | ||||
|     title="Tool of Calibration" | ||||
|     class="beta-gamma-tool-of-calibration" | ||||
|     :footer="null" | ||||
|     destroy-on-close | ||||
|   > | ||||
|     <a-tabs :animated="false"> | ||||
|       <a-tab-pane tab="Gamma Detector Calibration" key="1"> | ||||
|         <gamma-detector-calibration @exit="visible = false" :sampleId="sampleId" /> | ||||
|  | @ -26,4 +33,28 @@ export default { | |||
| } | ||||
| </script> | ||||
| 
 | ||||
| <style></style> | ||||
| <style lang="less"> | ||||
| .beta-gamma-tool-of-calibration { | ||||
|   .ant-modal-body { | ||||
|     padding-top: 0; | ||||
|   } | ||||
| 
 | ||||
|   .ant-tabs-nav .ant-tabs-tab { | ||||
|     padding: 5px 10px; | ||||
|     margin: 0 !important; | ||||
|   } | ||||
| } | ||||
| </style> | ||||
| 
 | ||||
| <style lang="less" scoped> | ||||
| ::v-deep { | ||||
|   .ant-form-item-label, | ||||
|   .ant-form-item-control { | ||||
|     line-height: 30px !important; | ||||
|   } | ||||
| 
 | ||||
|   .title-over-border-content { | ||||
|     padding: 10px; | ||||
|   } | ||||
| } | ||||
| </style> | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| <template> | ||||
|   <custom-modal v-model="visible" :width="750" title="QC Result"> | ||||
|     <a-table :columns="columns" :dataSource="list" :pagination="false"> </a-table> | ||||
|     <a-table :loading="isLoading" :columns="columns" :dataSource="list" :pagination="false"> </a-table> | ||||
|     <a-space slot="custom-footer" :size="20"> | ||||
|       <a-button type="primary">Save Text</a-button> | ||||
|       <a-button type="primary">Save Excel</a-button> | ||||
|  | @ -37,7 +37,6 @@ const columns = [ | |||
|       customRender: 'status' | ||||
|     }, | ||||
|     customCell: record => { | ||||
|       console.log('%c [  ]-36', 'font-size:13px; background:pink; color:#bf2c9f;', record) | ||||
|       return { | ||||
|         style: { | ||||
|           backgroundColor: record.status.toLowerCase() == 'pass' ? '#008000 !important' : '#f00 !important' | ||||
|  | @ -82,7 +81,6 @@ export default { | |||
|         }) | ||||
|         if (res.success) { | ||||
|           const result = res.result | ||||
|           console.log('%c [ result ]-89', 'font-size:13px; background:pink; color:#bf2c9f;', result) | ||||
| 
 | ||||
|           this.list.push({ | ||||
|             qcFlags: 'Collection Time (h)', | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user