fix: Load From File关闭时保留表格内容,修复斜率编辑时值不对的问题,修复有斜率的基线控制点旁边+号位置问题,修复Peak Infomation切换时底部图表标题未更新问题
This commit is contained in:
		
							parent
							
								
									36ba4a8167
								
							
						
					
					
						commit
						0a021a3c53
					
				| 
						 | 
					@ -37,7 +37,7 @@ export default {
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    handleOK() {
 | 
					    handleOK() {
 | 
				
			||||||
      if (this.allowNaN || this.value) {
 | 
					      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
 | 
					        this.visible = false
 | 
				
			||||||
      } else {
 | 
					      } else {
 | 
				
			||||||
        this.$message.warn('Input value invalid.')
 | 
					        this.$message.warn('Input value invalid.')
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -206,6 +206,7 @@ import SampleDataMixin from '@/views/spectrumAnalysis/SampleDataMixin'
 | 
				
			||||||
import GeneralCommentModal from './components/GeneralCommentModal.vue'
 | 
					import GeneralCommentModal from './components/GeneralCommentModal.vue'
 | 
				
			||||||
import EditSlopeModal from './components/EditSlopeModal.vue'
 | 
					import EditSlopeModal from './components/EditSlopeModal.vue'
 | 
				
			||||||
import Response from './Response.json'
 | 
					import Response from './Response.json'
 | 
				
			||||||
 | 
					import { isNullOrUndefined } from '@/utils/util'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 初始配置
 | 
					// 初始配置
 | 
				
			||||||
const initialOption = {
 | 
					const initialOption = {
 | 
				
			||||||
| 
						 | 
					@ -414,7 +415,7 @@ const nuclideIdentifyModal = {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 操作类型
 | 
					// 操作类型
 | 
				
			||||||
export const Operators = {
 | 
					const Operators = {
 | 
				
			||||||
  ADD: 1, // 新增
 | 
					  ADD: 1, // 新增
 | 
				
			||||||
  REMOVE: 2, // 移除
 | 
					  REMOVE: 2, // 移除
 | 
				
			||||||
  MODIFY: 3, // 改变
 | 
					  MODIFY: 3, // 改变
 | 
				
			||||||
| 
						 | 
					@ -693,6 +694,7 @@ export default {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!peaksBetweenChannel.length) {
 | 
					        if (!peaksBetweenChannel.length) {
 | 
				
			||||||
          this.$message.warn(`There are 0 peak between channel ${left} and ${right}`)
 | 
					          this.$message.warn(`There are 0 peak between channel ${left} and ${right}`)
 | 
				
			||||||
 | 
					          this.isFitting = false
 | 
				
			||||||
          return
 | 
					          return
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1377,9 +1379,9 @@ export default {
 | 
				
			||||||
        xctrlList.forEach((xctrl, index) => {
 | 
					        xctrlList.forEach((xctrl, index) => {
 | 
				
			||||||
          const yctrl = yctrlList[index]
 | 
					          const yctrl = yctrlList[index]
 | 
				
			||||||
          const yslope = yslopeList[index]
 | 
					          const yslope = yslopeList[index]
 | 
				
			||||||
          if (yslope != 0) {
 | 
					          if (!isNullOrUndefined(yslope)) {
 | 
				
			||||||
            plusGraphic.push(this.buildGraphicPlus(xctrl + 2, yctrl + 2 * yslope))
 | 
					 | 
				
			||||||
            plusGraphic.push(this.buildGraphicPlus(xctrl - 2, yctrl - 2 * 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
 | 
					        this.option.graphic[1].children = plusGraphic
 | 
				
			||||||
| 
						 | 
					@ -1396,11 +1398,11 @@ export default {
 | 
				
			||||||
        $action: 'replace',
 | 
					        $action: 'replace',
 | 
				
			||||||
        position: [xPix, yPix],
 | 
					        position: [xPix, yPix],
 | 
				
			||||||
        style: {
 | 
					        style: {
 | 
				
			||||||
          x: -10,
 | 
					 | 
				
			||||||
          y: -10,
 | 
					 | 
				
			||||||
          text: '+',
 | 
					          text: '+',
 | 
				
			||||||
          fill: '#0f0',
 | 
					          fill: '#0f0',
 | 
				
			||||||
          font: 'bolder 20px "Microsoft YaHei", sans-serif'
 | 
					          font: 'bolder 20px "Microsoft YaHei", sans-serif',
 | 
				
			||||||
 | 
					          textAlign: 'center',
 | 
				
			||||||
 | 
					          textVerticalAlign: 'middle'
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        zlevel: 101
 | 
					        zlevel: 101
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -319,6 +319,9 @@ export default {
 | 
				
			||||||
      canUseFilePicker,
 | 
					      canUseFilePicker,
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					  created() {
 | 
				
			||||||
 | 
					    this.handleReset()
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
  methods: {
 | 
					  methods: {
 | 
				
			||||||
    // 初始化为10*4的表格
 | 
					    // 初始化为10*4的表格
 | 
				
			||||||
    getInitialList() {
 | 
					    getInitialList() {
 | 
				
			||||||
| 
						 | 
					@ -386,6 +389,7 @@ export default {
 | 
				
			||||||
          if (!isFileInDirectory) {
 | 
					          if (!isFileInDirectory) {
 | 
				
			||||||
            this.$message.warn('File and Directory Not in Same')
 | 
					            this.$message.warn('File and Directory Not in Same')
 | 
				
			||||||
            this.directoryHanlder = undefined
 | 
					            this.directoryHanlder = undefined
 | 
				
			||||||
 | 
					            this.useFilePicker(column, record, rowIndex)
 | 
				
			||||||
            return
 | 
					            return
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -679,10 +683,6 @@ export default {
 | 
				
			||||||
    handleCancel() {
 | 
					    handleCancel() {
 | 
				
			||||||
      this.visible = false
 | 
					      this.visible = false
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					 | 
				
			||||||
    beforeModalOpen() {
 | 
					 | 
				
			||||||
      this.handleReset()
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -194,7 +194,7 @@ export default {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  created() {
 | 
					  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.option.tooltip.formatter = this.tooltipFormatter
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.$bus.$on('colorChange', this.handleColorChange)
 | 
					    this.$bus.$on('colorChange', this.handleColorChange)
 | 
				
			||||||
| 
						 | 
					@ -458,7 +458,7 @@ export default {
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return `<div class="channel">Channel: ${channel}</div>
 | 
					      return `<div class="channel">Channel: ${channel}</div>
 | 
				
			||||||
              <div class="energy">Energy: ${energy}</div>`
 | 
					              <div class="energy">${energy? `Energy: ${energy}`: ''}</div>`
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Graph Assistance 操作
 | 
					    // Graph Assistance 操作
 | 
				
			||||||
| 
						 | 
					@ -643,19 +643,37 @@ export default {
 | 
				
			||||||
        const spectrumLineSeries = findSeriesByName(this.option.series, 'Spectrum')
 | 
					        const spectrumLineSeries = findSeriesByName(this.option.series, 'Spectrum')
 | 
				
			||||||
        spectrumLineSeries.markLine.data[0].xAxis = xAxis
 | 
					        spectrumLineSeries.markLine.data[0].xAxis = xAxis
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const channel = this.isEnergy() ? this.getChannelByEnergy(xAxis) : parseInt(xAxis.toFixed())
 | 
					        const { channel, energy, counts } = this.getEnergyAndCountsByXAxis(xAxis)
 | 
				
			||||||
        const energy = this.isEnergy()
 | 
					        this.setChartBottomTitle(channel, energy, counts)
 | 
				
			||||||
          ? 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}`
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        this.getSelPosNuclide(channel)
 | 
					        this.getSelPosNuclide(channel)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // 设置图表底部的标题
 | 
				
			||||||
 | 
					    setChartBottomTitle(channel, energy, counts) {
 | 
				
			||||||
 | 
					      this.option.title.text = `{a|Channel:${channel}} {a|Energy:${energy}} {a|Counts:${counts}} {a|Detectability:0}`
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // 根据xAixs值找channel、energy和counts
 | 
				
			||||||
 | 
					    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() {
 | 
					    handleChartDblClick() {
 | 
				
			||||||
      this.handleResetChart()
 | 
					      this.handleResetChart()
 | 
				
			||||||
| 
						 | 
					@ -789,6 +807,8 @@ export default {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (find) {
 | 
					      if (find) {
 | 
				
			||||||
        this.getSelPosNuclide(find)
 | 
					        this.getSelPosNuclide(find)
 | 
				
			||||||
 | 
					        const { channel, energy, counts } = this.getEnergyAndCountsByXAxis(find)
 | 
				
			||||||
 | 
					        this.setChartBottomTitle(channel, energy, counts)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1135,6 +1155,8 @@ export default {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      } catch (error) {
 | 
					      } catch (error) {
 | 
				
			||||||
        console.error(error)
 | 
					        console.error(error)
 | 
				
			||||||
 | 
					      } finally {
 | 
				
			||||||
 | 
					        this.isLoading = false
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      // this.reprocessingModalVisible = true
 | 
					      // this.reprocessingModalVisible = true
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user