fix: 优化部分逻辑和代码
This commit is contained in:
		
							parent
							
								
									4edd3d250b
								
							
						
					
					
						commit
						0f8d019a56
					
				| 
						 | 
				
			
			@ -251,7 +251,6 @@ export default {
 | 
			
		|||
        if (success) {
 | 
			
		||||
          this.sampleDetail = result
 | 
			
		||||
          this.changeChartByType('sample')
 | 
			
		||||
          this.isLoading = false
 | 
			
		||||
          this.$emit('getFiles', {
 | 
			
		||||
            detFileName: result.detBg.fileName,
 | 
			
		||||
            gasFileName: result.gasBg.fileName,
 | 
			
		||||
| 
						 | 
				
			
			@ -262,6 +261,8 @@ export default {
 | 
			
		|||
        }
 | 
			
		||||
      } catch (error) {
 | 
			
		||||
        console.error(error)
 | 
			
		||||
      } finally {
 | 
			
		||||
        this.isLoading = false
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    async getSampleDetail_file() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -476,7 +476,8 @@ export default {
 | 
			
		|||
      isAccepting: false,
 | 
			
		||||
      isReploting: false,
 | 
			
		||||
 | 
			
		||||
      operationStack: [] // 操作记录
 | 
			
		||||
      operationStack: [], // 操作记录
 | 
			
		||||
      replotNeeded: false
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  created() {
 | 
			
		||||
| 
						 | 
				
			
			@ -563,6 +564,7 @@ export default {
 | 
			
		|||
      this.btnGroupType = 1
 | 
			
		||||
      this.opts.notMerge = false
 | 
			
		||||
      this.isFitting = false
 | 
			
		||||
      this.replotNeeded = false
 | 
			
		||||
      this.$nextTick(() => {
 | 
			
		||||
        this.option.brush = { toolbox: [] }
 | 
			
		||||
        this.selectedKeys = []
 | 
			
		||||
| 
						 | 
				
			
			@ -611,13 +613,12 @@ export default {
 | 
			
		|||
          }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        const selectedRow = this.list[index]
 | 
			
		||||
 | 
			
		||||
        this.selectedKeys = [selectedRow.index]
 | 
			
		||||
 | 
			
		||||
        this.getSelPosNuclide(selectedRow)
 | 
			
		||||
 | 
			
		||||
        this.selectedTableItem = selectedRow
 | 
			
		||||
        if (this.list.length) {
 | 
			
		||||
          const selectedRow = this.list[index]
 | 
			
		||||
          this.selectedKeys = [selectedRow.index]
 | 
			
		||||
          this.getSelPosNuclide(selectedRow)
 | 
			
		||||
          this.selectedTableItem = selectedRow
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 如果点击了Fit按钮
 | 
			
		||||
        if (this.isFitting) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1027,6 +1028,7 @@ export default {
 | 
			
		|||
      if (this.btnGroupType == 1) {
 | 
			
		||||
        this.btnGroupType = 2
 | 
			
		||||
        this.baseCtrls_Copy = cloneDeep(this.BaseCtrls)
 | 
			
		||||
        this.replotNeeded = false
 | 
			
		||||
 | 
			
		||||
        // 供编辑的白色基线
 | 
			
		||||
        const baseLineEditSeries = buildLineSeries(
 | 
			
		||||
| 
						 | 
				
			
			@ -1100,6 +1102,7 @@ export default {
 | 
			
		|||
 | 
			
		||||
    // 重新生成基线
 | 
			
		||||
    redrawBaseLine() {
 | 
			
		||||
      this.replotNeeded = true
 | 
			
		||||
      try {
 | 
			
		||||
        console.time('updateBaseLine')
 | 
			
		||||
        const res = updateBaseLine(JSON.stringify(this.baseCtrls_Copy))
 | 
			
		||||
| 
						 | 
				
			
			@ -1117,7 +1120,7 @@ export default {
 | 
			
		|||
 | 
			
		||||
    // 重绘Peaks
 | 
			
		||||
    redrawPeaks(peakList) {
 | 
			
		||||
      this.option.series = this.option.series.filter((item) => {
 | 
			
		||||
      this.option.series = this.option.series.filter(item => {
 | 
			
		||||
        return !item.name.includes('Peak_')
 | 
			
		||||
      })
 | 
			
		||||
      this.option.series.push(...this.buildPeaks(peakList))
 | 
			
		||||
| 
						 | 
				
			
			@ -1257,13 +1260,16 @@ export default {
 | 
			
		|||
 | 
			
		||||
    // 将原先的基线和控制点移动到新位置
 | 
			
		||||
    async handleReplot() {
 | 
			
		||||
      if (!this.replotNeeded) {
 | 
			
		||||
        return
 | 
			
		||||
      }
 | 
			
		||||
      try {
 | 
			
		||||
        const { inputFileName: fileName } = this.sampleData
 | 
			
		||||
        this.isReploting = true
 | 
			
		||||
        const { success, result, message } = await postAction('/gamma/replotBaseLine', {
 | 
			
		||||
          ...this.baseCtrls_Copy,
 | 
			
		||||
          fileName,
 | 
			
		||||
          replotNeeded: true
 | 
			
		||||
          replotNeeded: this.replotNeeded
 | 
			
		||||
        })
 | 
			
		||||
        if (success) {
 | 
			
		||||
          const { chartData, peakSet, shapeData } = result
 | 
			
		||||
| 
						 | 
				
			
			@ -1295,6 +1301,7 @@ export default {
 | 
			
		|||
          })
 | 
			
		||||
 | 
			
		||||
          this.BaseCtrls = cloneDeep(this.baseCtrls_Copy)
 | 
			
		||||
          this.replotNeeded = false
 | 
			
		||||
        } else {
 | 
			
		||||
          this.$message.error(message)
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -794,6 +794,7 @@ export default {
 | 
			
		|||
                        key: 'all',
 | 
			
		||||
                      },
 | 
			
		||||
                    ],
 | 
			
		||||
                    key: 'resultsToDB'
 | 
			
		||||
                  },
 | 
			
		||||
                  {
 | 
			
		||||
                    title: 'Save PHD to File',
 | 
			
		||||
| 
						 | 
				
			
			@ -807,6 +808,7 @@ export default {
 | 
			
		|||
                        key: 'all',
 | 
			
		||||
                      },
 | 
			
		||||
                    ],
 | 
			
		||||
                    key: 'phdToFile'
 | 
			
		||||
                  },
 | 
			
		||||
                ],
 | 
			
		||||
                width: '170px',
 | 
			
		||||
| 
						 | 
				
			
			@ -817,9 +819,9 @@ export default {
 | 
			
		|||
                  this.saveSettingModalVisible = true
 | 
			
		||||
                },
 | 
			
		||||
                submenuClick: ({ item, child }) => {
 | 
			
		||||
                  if (item.title == 'Save Results to DB') {
 | 
			
		||||
                  if (item.key == 'resultsToDB') {
 | 
			
		||||
                    this.handleSaveResultsToDB(child.key)
 | 
			
		||||
                  } else if (item.title == 'Save PHD to File') {
 | 
			
		||||
                  } else if (item.key == 'phdToFile') {
 | 
			
		||||
                    this.handleSavePHDToFile(child.key)
 | 
			
		||||
                  }
 | 
			
		||||
                },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user