diff --git a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/components/CommentModal.vue b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/components/CommentModal.vue
deleted file mode 100644
index da97f6e..0000000
--- a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/components/CommentModal.vue
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/components/GeneralCommentModal.vue b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/components/GeneralCommentModal.vue
new file mode 100644
index 0000000..2235632
--- /dev/null
+++ b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/components/GeneralCommentModal.vue
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/components/PeakCommentModal.vue b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/components/PeakCommentModal.vue
new file mode 100644
index 0000000..6dbc02d
--- /dev/null
+++ b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/components/PeakCommentModal.vue
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue
index 8a15e03..2250df4 100644
--- a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue
+++ b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue
@@ -40,8 +40,8 @@
Nuclide Review Window
-
Add Peak Comment
-
Add General Comment
+
Add Peak Comment
+
Add General Comment
@@ -158,9 +158,14 @@
-
-
-
+
+
+
+
+
+
+
+
import CustomChart from '@/components/CustomChart/index.vue'
import TitleOverBorder from '../../TitleOverBorder.vue'
-import CommentModal from './components/CommentModal.vue'
+import PeakCommentModal from './components/PeakCommentModal.vue'
import FitPeaksAndBaseLineModal from './components/FitPeaksAndBaselineModal.vue'
import NuclideReviewModal from './components/NuclideReviewModal.vue'
import ModalMixin from '@/mixins/ModalMixin'
@@ -187,6 +192,7 @@ import { cloneDeep } from 'lodash'
import Response from './Response.json'
import { findSeriesByName, getXAxisAndYAxisByPosition, rangeNumber } from '@/utils/chartHelper'
import SampleDataMixin from '@/views/spectrumAnalysis/SampleDataMixin'
+import GeneralCommentModal from './components/GeneralCommentModal.vue'
// 初始配置
const initialOption = {
@@ -381,9 +387,10 @@ export default {
components: {
CustomChart,
TitleOverBorder,
- CommentModal,
+ PeakCommentModal,
FitPeaksAndBaseLineModal,
- NuclideReviewModal
+ NuclideReviewModal,
+ GeneralCommentModal
},
data() {
this.columns = columns
@@ -402,8 +409,9 @@ export default {
list: [],
sampleId: -1,
- commentModalVisible: false, // Comment 弹窗是否显示
- commentType: 'Peak',
+ peakCommentModalVisible: false, // Comment 弹窗是否显示
+ curRow: -1,
+ generalCommentModalVisible: false, // Comment 弹窗是否显示
btnGroupType: 1, // 右侧 Peak 中的按钮组切换
@@ -697,14 +705,21 @@ export default {
return maxXAxises
},
- // 显示comment弹窗
- handleAddComment(type) {
- if (type == 'Peak' && !this.selectedKeys.length) {
+ // 显示peak comment弹窗
+ handleAddPeakComment () {
+ if (!this.selectedKeys.length) {
this.$message.warn('Please Select a Peak that You Want to Add Comment!')
return
}
- this.commentType = type
- this.commentModalVisible = true
+ const [willDelKey] = this.selectedKeys
+ const findIndex = this.list.findIndex(item => item.index == willDelKey)
+ this.curRow = findIndex
+ this.peakCommentModalVisible = true
+ },
+
+ // 显示general comment弹窗
+ handleAddGeneralComment() {
+ this.generalCommentModalVisible = true
},
// Insert按钮
diff --git a/src/views/spectrumAnalysis/components/Modals/EnergyCalibrationModal.vue b/src/views/spectrumAnalysis/components/Modals/EnergyCalibrationModal.vue
index 4583f94..260d5c6 100644
--- a/src/views/spectrumAnalysis/components/Modals/EnergyCalibrationModal.vue
+++ b/src/views/spectrumAnalysis/components/Modals/EnergyCalibrationModal.vue
@@ -56,7 +56,7 @@
Save
@@ -68,7 +68,7 @@
-
+
@@ -102,7 +102,7 @@
import ModalMixin from '@/mixins/ModalMixin'
import TitleOverBorder from '../TitleOverBorder.vue'
import CustomChart from '@/components/CustomChart/index.vue'
-import { getAction } from '@/api/manage'
+import { getAction, postAction } from '@/api/manage'
import { cloneDeep } from 'lodash'
import { buildLineSeries } from '@/utils/chartHelper'
import SampleDataMixin from '../../SampleDataMixin'
@@ -143,6 +143,17 @@ const initialOption = {
right: 10,
bottom: 0
},
+ tooltip: {
+ trigger: 'axis',
+ formatter: params => {
+ const [x, y] = params[0].value
+ const channel = parseInt(x)
+ const energy = y.toFixed(3)
+ return `Channel: ${channel}
+ Energy: ${energy}
`
+ },
+ className: 'figure-chart-option-tooltip'
+ },
xAxis: {
min: 1,
max: 'dataMax',
@@ -198,7 +209,10 @@ export default {
selectedRowKeys: [],
model: {},
currSelectedDataSource: '',
- appliedDataSource: ''
+ appliedDataSource: '',
+ opts: {
+ notMerge: true
+ }
}
},
methods: {
@@ -213,46 +227,12 @@ export default {
this.isLoading = false
if (success) {
console.log('%c [ ]-220', 'font-size:13px; background:pink; color:#bf2c9f;', result)
- const { AllData, equation, list_dataSource, param, table, uncert } = result
- const [linePoint, scatterPoint] = AllData
-
- this.dataSourceList = [...list_dataSource, 'other']
+ const { list_dataSource } = result
+ this.dataSourceList = list_dataSource
this.currSelectedDataSource = list_dataSource[0]
this.appliedDataSource = list_dataSource[0]
- this.equation = equation
-
- table.forEach((item, index) => {
- item.id = index
- })
- this.list = table
-
- const series = []
- series.push(
- buildLineSeries(
- 'LineSeries',
- linePoint.pointlist.map(({ x, y }) => [x, y]),
- `rgb(${linePoint.color})`
- )
- )
- series.push({
- type: 'scatter',
- data: scatterPoint.pointlist.map(({ x, y }) => {
- return {
- value: [x, y],
- itemStyle: {
- color: scatterPoint.color,
- borderWidth: 0
- }
- }
- }),
- emphasis: {
- disabled: true
- },
- animation: false,
- zlevel: 20
- })
- this.option.series = series
+ this.handleResult(result)
} else {
this.$message.error(message)
}
@@ -261,14 +241,59 @@ export default {
}
},
+ handleResult(result) {
+ const { AllData, equation, param, table, uncert } = result
+ // 有数据
+ if (AllData) {
+ const [linePoint, scatterPoint] = AllData
+ this.equation = equation
+ this.param = param
+ this.uncert = uncert
+
+ this.list = table
+ this.generateTableId()
+
+ const series = []
+ series.push(
+ buildLineSeries(
+ 'LineSeries',
+ linePoint.pointlist.map(({ x, y }) => [x, y]),
+ `rgb(${linePoint.color})`
+ )
+ )
+ series.push({
+ type: 'scatter',
+ data: scatterPoint.pointlist.map(({ x, y }) => {
+ return {
+ value: [x, y],
+ itemStyle: {
+ color: scatterPoint.color,
+ borderWidth: 0
+ }
+ }
+ }),
+ emphasis: {
+ disabled: true
+ },
+ animation: false,
+ zlevel: 20
+ })
+ this.option.series = series
+ }
+ // 没数据
+ else {
+ this.option.series = []
+ }
+ },
+
beforeModalOpen() {
+ this.selectedRowKeys = []
this.getData()
},
// 表格单行点击
- handleRowClick(row, index) {
+ handleRowClick(row) {
this.model = cloneDeep(row)
- this.currSelectedIndex = index
},
// 插入
@@ -298,18 +323,126 @@ export default {
}
}
- console.log('%c [ 在位置插入 ]-297', 'font-size:13px; background:pink; color:#bf2c9f;', i)
this.list.splice(i, 0, {
channel: centroid,
energy
})
+
+ this.uncert.splice(i, 0, 0.5)
+
+ this.selectedRowKeys = [i]
+ this.generateTableId()
+
+ this.recalculate()
+ },
+
+ // 生成table中数据的id,用以选中
+ generateTableId() {
+ this.list.forEach((item, index) => {
+ item.id = index
+ })
},
// 修改
- handleModify() {},
+ handleModify() {
+ if (this.selectedRowKeys.length) {
+ const centroid = parseFloat(this.model.channel)
+ const energy = parseFloat(this.model.energy)
+
+ if (Number.isNaN(centroid) || Number.isNaN(energy)) {
+ this.$message.warn('Format is invalid.')
+ return
+ }
+
+ if (centroid <= 100 || centroid >= 16342) {
+ this.$message.warn('Centroid must be in the range of analysis!')
+ return
+ }
+
+ const [currSelectedIndex] = this.selectedRowKeys
+
+ this.list[currSelectedIndex].channel = centroid
+ this.list[currSelectedIndex].energy = energy
+
+ this.uncert[currSelectedIndex] = 0
+
+ this.recalculate()
+ }
+ },
// 删除
- handleDelete() {},
+ handleDelete() {
+ if (this.selectedRowKeys.length) {
+ const [currSelectedIndex] = this.selectedRowKeys
+
+ this.list.splice(currSelectedIndex, 1)
+ this.uncert.splice(currSelectedIndex, 1)
+ this.generateTableId()
+ if (this.list.length) {
+ const selectedKey = this.selectedRowKeys[0]
+ if (selectedKey > this.list.length - 1) {
+ this.selectedRowKeys[0] = selectedKey - 1
+ }
+ } else {
+ this.selectedRowKeys = []
+ }
+ this.recalculate()
+ }
+ },
+
+ // 重新计算
+ async recalculate() {
+ try {
+ this.isLoading = true
+ const { sampleId, inputFileName: fileName } = this.sampleData
+ const { success, result, message } = await postAction('/gamma/changeDataEnergy', {
+ sampleId,
+ fileName,
+ m_vCurCentroid: this.list.map(item => item.channel),
+ m_vCurEnergy: this.list.map(item => item.energy),
+ m_vCurUncert: this.uncert,
+ m_curParam: this.param
+ })
+ if (success) {
+ this.handleResult(result)
+ } else {
+ this.$message.error(message)
+ }
+ } catch (error) {
+ console.error(error)
+ } finally {
+ this.isLoading = false
+ }
+ },
+
+ // 应用
+ async handleApply() {
+ try {
+ let curCalName = this.currSelectedDataSource
+ // 如果沒选中以Input开头的,也就是选中了PHD之类的
+ if (!curCalName.includes('Input')) {
+ curCalName = `Input ${this.dataSourceList.filter(item => item.includes('Input')).length + 1}`
+ }
+
+ const { sampleId, inputFileName: fileName } = this.sampleData
+ const { success, result, message } = await postAction('/gamma/applyDataEnergy', {
+ m_vCurCentroid: this.list.map(item => item.channel),
+ m_vCurEnergy: this.list.map(item => item.energy),
+ m_vCurUncert: this.uncert,
+ m_curParam: this.param,
+ curCalName,
+ sampleId,
+ fileName
+ })
+ if (success) {
+ this.dataSourceList.push(curCalName)
+ } else {
+ this.$message.error(message)
+ }
+ } catch (error) {
+ console.error(error)
+ }
+ },
// 右侧DataSource中的选项点击
handleDataSourceClick(item) {
@@ -400,9 +533,10 @@ export default {
.equation {
height: 40px;
- line-height: 32px;
- text-align: center;
background-color: #1b5465;
+ display: flex;
+ justify-content: center;
+ align-items: center;
}
.curve {