feat: Calibration剩下的两个弹窗中的各操作和接口对接
This commit is contained in:
parent
890bc9fa73
commit
dcc75bd800
File diff suppressed because it is too large
Load Diff
|
@ -43,7 +43,7 @@ export default {
|
||||||
try {
|
try {
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
const { inputFileName: fileName } = this.sampleData
|
const { inputFileName: fileName } = this.sampleData
|
||||||
const { success, result, message } = await getAction('/gamma/viewGenralComment', {
|
const { success, result, message } = await getAction('/gamma/viewGeneralComment', {
|
||||||
fileName
|
fileName
|
||||||
})
|
})
|
||||||
if (success) {
|
if (success) {
|
||||||
|
|
|
@ -115,19 +115,21 @@
|
||||||
<div class="title">
|
<div class="title">
|
||||||
Possible Nuclide
|
Possible Nuclide
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<a-spin :spinning="!!(selectedTableItem && selectedTableItem._loading)">
|
||||||
<template v-if="selectedTableItem && selectedTableItem._possible">
|
<div class="content">
|
||||||
<div
|
<template v-if="selectedTableItem && selectedTableItem._possible">
|
||||||
class="item"
|
<div
|
||||||
:class="{ active: possible == model.possibleNuclide }"
|
class="item"
|
||||||
v-for="(possible, index) in selectedTableItem._possible"
|
:class="{ active: possible == model.possibleNuclide }"
|
||||||
:key="index"
|
v-for="(possible, index) in selectedTableItem._possible"
|
||||||
@click="model.possibleNuclide = possible"
|
:key="index"
|
||||||
>
|
@click="model.possibleNuclide = possible"
|
||||||
{{ possible }}
|
>
|
||||||
</div>
|
{{ possible }}
|
||||||
</template>
|
</div>
|
||||||
</div>
|
</template>
|
||||||
|
</div>
|
||||||
|
</a-spin>
|
||||||
</div>
|
</div>
|
||||||
<div class="identify-item">
|
<div class="identify-item">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
|
@ -187,9 +189,8 @@ import PeakCommentModal from './components/PeakCommentModal.vue'
|
||||||
import FitPeaksAndBaseLineModal from './components/FitPeaksAndBaselineModal.vue'
|
import FitPeaksAndBaseLineModal from './components/FitPeaksAndBaselineModal.vue'
|
||||||
import NuclideReviewModal from './components/NuclideReviewModal.vue'
|
import NuclideReviewModal from './components/NuclideReviewModal.vue'
|
||||||
import ModalMixin from '@/mixins/ModalMixin'
|
import ModalMixin from '@/mixins/ModalMixin'
|
||||||
import { getAction } from '@/api/manage'
|
import { getAction, postAction } from '@/api/manage'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
import Response from './Response.json'
|
|
||||||
import { findSeriesByName, getXAxisAndYAxisByPosition, rangeNumber } from '@/utils/chartHelper'
|
import { findSeriesByName, getXAxisAndYAxisByPosition, rangeNumber } from '@/utils/chartHelper'
|
||||||
import SampleDataMixin from '@/views/spectrumAnalysis/SampleDataMixin'
|
import SampleDataMixin from '@/views/spectrumAnalysis/SampleDataMixin'
|
||||||
import GeneralCommentModal from './components/GeneralCommentModal.vue'
|
import GeneralCommentModal from './components/GeneralCommentModal.vue'
|
||||||
|
@ -410,7 +411,6 @@ export default {
|
||||||
sampleId: -1,
|
sampleId: -1,
|
||||||
|
|
||||||
peakCommentModalVisible: false, // Comment 弹窗是否显示
|
peakCommentModalVisible: false, // Comment 弹窗是否显示
|
||||||
curRow: -1,
|
|
||||||
generalCommentModalVisible: false, // Comment 弹窗是否显示
|
generalCommentModalVisible: false, // Comment 弹窗是否显示
|
||||||
|
|
||||||
btnGroupType: 1, // 右侧 Peak 中的按钮组切换
|
btnGroupType: 1, // 右侧 Peak 中的按钮组切换
|
||||||
|
@ -446,7 +446,6 @@ export default {
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
this.option.series = []
|
this.option.series = []
|
||||||
|
|
||||||
// const { success, result, message } = Response
|
|
||||||
const { success, result, message } = await getAction('/gamma/InteractiveTool', {
|
const { success, result, message } = await getAction('/gamma/InteractiveTool', {
|
||||||
sampleId: this.sampleId,
|
sampleId: this.sampleId,
|
||||||
fileName: this.fileName
|
fileName: this.fileName
|
||||||
|
@ -676,6 +675,7 @@ export default {
|
||||||
this.model.identifiedNuclide = ''
|
this.model.identifiedNuclide = ''
|
||||||
|
|
||||||
if (!row._possible) {
|
if (!row._possible) {
|
||||||
|
this.$set(row, '_loading', true)
|
||||||
try {
|
try {
|
||||||
const { success, result, message } = await getAction('/gamma/getSelPosNuclide', {
|
const { success, result, message } = await getAction('/gamma/getSelPosNuclide', {
|
||||||
sampleId: this.sampleId,
|
sampleId: this.sampleId,
|
||||||
|
@ -691,6 +691,8 @@ export default {
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
row._loading = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -706,14 +708,11 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
// 显示peak comment弹窗
|
// 显示peak comment弹窗
|
||||||
handleAddPeakComment () {
|
handleAddPeakComment() {
|
||||||
if (!this.selectedKeys.length) {
|
if (!this.selectedKeys.length) {
|
||||||
this.$message.warn('Please Select a Peak that You Want to Add Comment!')
|
this.$message.warn('Please Select a Peak that You Want to Add Comment!')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const [willDelKey] = this.selectedKeys
|
|
||||||
const findIndex = this.list.findIndex(item => item.index == willDelKey)
|
|
||||||
this.curRow = findIndex
|
|
||||||
this.peakCommentModalVisible = true
|
this.peakCommentModalVisible = true
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -925,8 +924,6 @@ export default {
|
||||||
title: 'Warning',
|
title: 'Warning',
|
||||||
content: 'Are you sure to delete this peak?',
|
content: 'Are you sure to delete this peak?',
|
||||||
onOk: async () => {
|
onOk: async () => {
|
||||||
const [willDelKey] = this.selectedKeys
|
|
||||||
const findIndex = this.list.findIndex(item => item.index == willDelKey)
|
|
||||||
// this.list.splice(findIndex, 1)
|
// this.list.splice(findIndex, 1)
|
||||||
// this.selectedKeys = []
|
// this.selectedKeys = []
|
||||||
|
|
||||||
|
@ -945,7 +942,7 @@ export default {
|
||||||
const { inputFileName: fileName } = this.sampleData
|
const { inputFileName: fileName } = this.sampleData
|
||||||
const { success, result, message } = await getAction('/gamma/deletePeak', {
|
const { success, result, message } = await getAction('/gamma/deletePeak', {
|
||||||
fileName,
|
fileName,
|
||||||
curRow: findIndex
|
curRow: this.curRow
|
||||||
})
|
})
|
||||||
if (success) {
|
if (success) {
|
||||||
console.log('%c [ ]-935', 'font-size:13px; background:pink; color:#bf2c9f;', result)
|
console.log('%c [ ]-935', 'font-size:13px; background:pink; color:#bf2c9f;', result)
|
||||||
|
@ -1334,26 +1331,73 @@ export default {
|
||||||
handleAccept() {},
|
handleAccept() {},
|
||||||
|
|
||||||
// 右下角添加当前选中的nuclide
|
// 右下角添加当前选中的nuclide
|
||||||
handleAddNuclide() {
|
async handleAddNuclide() {
|
||||||
const nuclides = this.selectedTableItem.nuclides
|
const nuclides = this.selectedTableItem.nuclides
|
||||||
const possibleNuclide = this.model.possibleNuclide
|
const possibleNuclide = this.model.possibleNuclide
|
||||||
if (this.selectedTableItem && !nuclides.includes(possibleNuclide)) {
|
if (!nuclides.includes(possibleNuclide)) {
|
||||||
nuclides.push(possibleNuclide)
|
if (this.selectedTableItem._adding) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
this.$set(this.selectedTableItem, '_adding', true)
|
||||||
|
const { inputFileName: fileName } = this.sampleData
|
||||||
|
const { success, message } = await postAction('/gamma/addNuclide', {
|
||||||
|
curRow: this.curRow,
|
||||||
|
nuclideName: possibleNuclide,
|
||||||
|
fileName,
|
||||||
|
list_identify: nuclides
|
||||||
|
})
|
||||||
|
if (success) {
|
||||||
|
nuclides.push(possibleNuclide)
|
||||||
|
} else {
|
||||||
|
this.$message.error(message)
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.selectedTableItem._adding = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 右下角删除当前选中的nuclide
|
// 右下角删除当前选中的nuclide
|
||||||
handleDelNuclide() {
|
async handleDelNuclide() {
|
||||||
const [willDelKey] = this.selectedKeys
|
if (!this.model.identifiedNuclide) {
|
||||||
const find = this.list.find(item => item.index == willDelKey)
|
return
|
||||||
console.log('%c [ find ]-762', 'font-size:13px; background:pink; color:#bf2c9f;', find)
|
}
|
||||||
if (find) {
|
const nuclides = this.selectedTableItem.nuclides
|
||||||
const nuclides = find.nuclides
|
if (this.selectedTableItem._deleting) {
|
||||||
const findIndex = nuclides.findIndex(nuclide => nuclide == this.model.identifiedNuclide)
|
return
|
||||||
if (-1 !== findIndex) {
|
}
|
||||||
nuclides.splice(findIndex, 1)
|
const findIndex = nuclides.findIndex(nuclide => nuclide == this.model.identifiedNuclide)
|
||||||
|
if (-1 !== findIndex) {
|
||||||
|
try {
|
||||||
|
this.$set(this.selectedTableItem, '_deleting', true)
|
||||||
|
const { inputFileName: fileName } = this.sampleData
|
||||||
|
const { success, message } = await postAction('/gamma/deleteNuclide', {
|
||||||
|
curRow: this.curRow,
|
||||||
|
nuclideName: this.model.identifiedNuclide,
|
||||||
|
fileName,
|
||||||
|
list_identify: nuclides
|
||||||
|
})
|
||||||
|
if (success) {
|
||||||
|
nuclides.splice(findIndex, 1)
|
||||||
|
} else {
|
||||||
|
this.$message.error(message)
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
this.selectedTableItem._deleting = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
curRow() {
|
||||||
|
const [selectedKey] = this.selectedKeys
|
||||||
|
const findIndex = this.list.findIndex(item => item.index == selectedKey)
|
||||||
|
return findIndex
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,94 +1,105 @@
|
||||||
<template>
|
<template>
|
||||||
<custom-modal v-model="visible" :width="1280" title="Efficiency Calibration" :footer="null">
|
<custom-modal v-model="visible" :width="1280" title="Efficiency Calibration" :footer="null" destroy-on-close>
|
||||||
<div class="efficiency-calibration">
|
<a-spin :spinning="isLoading">
|
||||||
<div class="left">
|
<div class="energy-calibration">
|
||||||
<!-- Calibration Data -->
|
<div class="left">
|
||||||
<title-over-border title="Calibration Data">
|
<!-- Calibration Data -->
|
||||||
<div class="calibration-data">
|
<title-over-border title="Calibration Data">
|
||||||
<a-form-model
|
<div class="calibration-data">
|
||||||
:colon="false"
|
<a-form-model
|
||||||
:labelCol="{
|
:colon="false"
|
||||||
style: {
|
:labelCol="{
|
||||||
width: '70px',
|
style: {
|
||||||
textAlign: 'left',
|
width: '70px',
|
||||||
flexShrink: 0
|
textAlign: 'left',
|
||||||
}
|
flexShrink: 0
|
||||||
}"
|
}
|
||||||
:wrapperCol="{
|
}"
|
||||||
style: {
|
:wrapperCol="{
|
||||||
flex: 1
|
style: {
|
||||||
}
|
flex: 1
|
||||||
}"
|
}
|
||||||
>
|
}"
|
||||||
<a-form-model-item label="Energy">
|
>
|
||||||
<a-input></a-input>
|
<a-form-model-item label="Energy">
|
||||||
</a-form-model-item>
|
<a-input type="number" v-model="model.energy"></a-input>
|
||||||
<a-form-model-item label="Efficiency">
|
</a-form-model-item>
|
||||||
<a-input></a-input>
|
<a-form-model-item label="Efficiency">
|
||||||
</a-form-model-item>
|
<a-input type="number" v-model="model.efficiency"></a-input>
|
||||||
<a-form-model-item :label="' '">
|
</a-form-model-item>
|
||||||
<a-button type="primary">Insert</a-button>
|
<a-form-model-item :label="' '">
|
||||||
</a-form-model-item>
|
<a-button type="primary" @click="handleInsert">Insert</a-button>
|
||||||
<a-form-model-item :label="' '">
|
</a-form-model-item>
|
||||||
<a-button type="primary">Modify</a-button>
|
<a-form-model-item :label="' '">
|
||||||
</a-form-model-item>
|
<a-button type="primary" @click="handleModify">Modify</a-button>
|
||||||
<a-form-model-item :label="' '">
|
</a-form-model-item>
|
||||||
<a-button type="primary">Delete</a-button>
|
<a-form-model-item :label="' '">
|
||||||
</a-form-model-item>
|
<a-button type="primary" @click="handleDelete">Delete</a-button>
|
||||||
</a-form-model>
|
</a-form-model-item>
|
||||||
<!-- 表格 -->
|
</a-form-model>
|
||||||
<a-table
|
<!-- 表格 -->
|
||||||
:columns="columns"
|
<custom-table
|
||||||
:dataSource="list"
|
:columns="columns"
|
||||||
:pagination="false"
|
:list="list"
|
||||||
:class="list.length ? 'has-data' : ''"
|
:pagination="false"
|
||||||
:scroll="{ y: 182 }"
|
size="small"
|
||||||
></a-table>
|
:class="list.length ? 'has-data' : ''"
|
||||||
<!-- 表格结束 -->
|
:scroll="{ y: 182 }"
|
||||||
<div class="operators">
|
:selectedRowKeys.sync="selectedRowKeys"
|
||||||
<div>
|
:canDeselect="false"
|
||||||
<a-button type="primary">Call</a-button>
|
@rowClick="handleRowClick"
|
||||||
<a-button type="primary">Save</a-button>
|
></custom-table>
|
||||||
</div>
|
<!-- 表格结束 -->
|
||||||
<div>
|
<div class="operators">
|
||||||
<a-select :value="''">
|
<div>
|
||||||
<a-select-option value="">
|
<a-button type="primary">Call</a-button>
|
||||||
Interpolation
|
<a-button type="primary">Save</a-button>
|
||||||
</a-select-option>
|
</div>
|
||||||
</a-select>
|
<div>
|
||||||
<a-button type="primary">Apply</a-button>
|
<a-select v-model="funcId" @change="recalculate">
|
||||||
|
<a-select-option v-for="(func, index) in functions" :key="index" :value="func.value">
|
||||||
|
{{ func.label }}
|
||||||
|
</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
<a-button type="primary" @click="handleApply">Apply</a-button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</title-over-border>
|
||||||
</title-over-border>
|
<!-- Equation -->
|
||||||
<!-- Equation -->
|
<title-over-border class="mt-20" title="Equation">
|
||||||
<title-over-border class="mt-20" title="Equation">
|
<div class="equation" v-html="equation"></div>
|
||||||
<div class="equation">
|
</title-over-border>
|
||||||
Efficiency = 59.541 + (88.034 - 59.541) * (E - 1) / (0.058243 - 1)
|
<!-- curve -->
|
||||||
</div>
|
<title-over-border class="mt-20" title="curve">
|
||||||
</title-over-border>
|
<div class="curve">
|
||||||
<!-- curve -->
|
<custom-chart :option="option" :opts="opts" />
|
||||||
<title-over-border class="mt-20" title="curve">
|
|
||||||
<div class="curve">
|
|
||||||
<custom-chart :option="option" />
|
|
||||||
</div>
|
|
||||||
</title-over-border>
|
|
||||||
</div>
|
|
||||||
<div class="right">
|
|
||||||
<title-over-border title="Data Source" style="height: 100%">
|
|
||||||
<div class="data-source">
|
|
||||||
<div class="data-source-main">
|
|
||||||
<div class="title">PHD</div>
|
|
||||||
<div class="content"></div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="footer mt-20">
|
</title-over-border>
|
||||||
<a-button type="primary">Set to Current</a-button>
|
</div>
|
||||||
<div class="mt-20">PHD</div>
|
<div class="right">
|
||||||
|
<title-over-border title="Data Source" style="height: 100%">
|
||||||
|
<div class="data-source">
|
||||||
|
<div class="content">
|
||||||
|
<div
|
||||||
|
class="item"
|
||||||
|
:class="item == currSelectedDataSource ? 'active' : ''"
|
||||||
|
v-for="(item, index) in dataSourceList"
|
||||||
|
:key="index"
|
||||||
|
@click="handleDataSourceClick(item)"
|
||||||
|
>
|
||||||
|
{{ item }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="footer mt-20">
|
||||||
|
<a-button type="primary" @click="handleSetToCurrent">Set to Current</a-button>
|
||||||
|
<div class="mt-20">{{ appliedDataSource }}</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</title-over-border>
|
||||||
</title-over-border>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</a-spin>
|
||||||
</custom-modal>
|
</custom-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -96,6 +107,10 @@
|
||||||
import ModalMixin from '@/mixins/ModalMixin'
|
import ModalMixin from '@/mixins/ModalMixin'
|
||||||
import TitleOverBorder from '../TitleOverBorder.vue'
|
import TitleOverBorder from '../TitleOverBorder.vue'
|
||||||
import CustomChart from '@/components/CustomChart/index.vue'
|
import CustomChart from '@/components/CustomChart/index.vue'
|
||||||
|
import { getAction, postAction } from '@/api/manage'
|
||||||
|
import { cloneDeep } from 'lodash'
|
||||||
|
import { buildLineSeries } from '@/utils/chartHelper'
|
||||||
|
import SampleDataMixin from '../../SampleDataMixin'
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
|
@ -107,7 +122,7 @@ const columns = [
|
||||||
dataIndex: 'efficiency'
|
dataIndex: 'efficiency'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Fit',
|
title: 'Fit(keV)',
|
||||||
dataIndex: 'fit'
|
dataIndex: 'fit'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -124,7 +139,7 @@ const initialOption = {
|
||||||
left: 70
|
left: 70
|
||||||
},
|
},
|
||||||
title: {
|
title: {
|
||||||
text: 'Energy(keV)',
|
text: 'Channel',
|
||||||
textStyle: {
|
textStyle: {
|
||||||
color: '#8FD4F8',
|
color: '#8FD4F8',
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
|
@ -133,9 +148,20 @@ const initialOption = {
|
||||||
right: 10,
|
right: 10,
|
||||||
bottom: 0
|
bottom: 0
|
||||||
},
|
},
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis',
|
||||||
|
formatter: params => {
|
||||||
|
const [x, y] = params[0].value
|
||||||
|
const energy = parseInt(x)
|
||||||
|
const efficiency = y.toFixed(3)
|
||||||
|
return `<div class="channel">Energy: ${energy}</div>
|
||||||
|
<div class="energy">Efficiency: ${efficiency}</div>`
|
||||||
|
},
|
||||||
|
className: 'figure-chart-option-tooltip'
|
||||||
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
min: 42,
|
min: 1,
|
||||||
max: 2740,
|
max: 'dataMax',
|
||||||
axisLabel: {
|
axisLabel: {
|
||||||
color: '#fff'
|
color: '#fff'
|
||||||
},
|
},
|
||||||
|
@ -163,7 +189,7 @@ const initialOption = {
|
||||||
splitLine: {
|
splitLine: {
|
||||||
show: false
|
show: false
|
||||||
},
|
},
|
||||||
name: 'Efficiency',
|
name: 'keV',
|
||||||
nameLocation: 'center',
|
nameLocation: 'center',
|
||||||
nameGap: 50,
|
nameGap: 50,
|
||||||
nameTextStyle: {
|
nameTextStyle: {
|
||||||
|
@ -171,48 +197,319 @@ const initialOption = {
|
||||||
fontSize: 14
|
fontSize: 14
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
series: [
|
series: []
|
||||||
{
|
|
||||||
type: 'line',
|
|
||||||
symbol: 'square',
|
|
||||||
itemStyle: {
|
|
||||||
color: '#FF0000' // 设置符号的颜色
|
|
||||||
},
|
|
||||||
lineStyle: {
|
|
||||||
color: '#C2CC11' // 设置折线的颜色
|
|
||||||
},
|
|
||||||
data: [
|
|
||||||
[42, 0],
|
|
||||||
[100, 0.2],
|
|
||||||
[978, 0.1]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const functions = [
|
||||||
|
{
|
||||||
|
label: 'Interpolation',
|
||||||
|
value: 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'HT Efficiency',
|
||||||
|
value: 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Log Polynomial',
|
||||||
|
value: 6
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Invlog Polynomial',
|
||||||
|
value: 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'HAE Efficiency(1-3)',
|
||||||
|
value: 93
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'HAE Efficiency(1-2)',
|
||||||
|
value: 94
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'HAE Efficiency(1-2-3)',
|
||||||
|
value: 95
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { TitleOverBorder, CustomChart },
|
components: { TitleOverBorder, CustomChart },
|
||||||
mixins: [ModalMixin],
|
mixins: [ModalMixin, SampleDataMixin],
|
||||||
data() {
|
data() {
|
||||||
this.columns = columns
|
this.columns = columns
|
||||||
|
this.functions = functions
|
||||||
|
|
||||||
return {
|
return {
|
||||||
list: [
|
isLoading: false,
|
||||||
{
|
equation: '',
|
||||||
energy: 'energy',
|
dataSourceList: [],
|
||||||
efficiency: 'efficiency',
|
list: [],
|
||||||
fit: 'fit',
|
option: cloneDeep(initialOption),
|
||||||
delta: 'delta'
|
selectedRowKeys: [],
|
||||||
|
model: {},
|
||||||
|
currSelectedDataSource: '',
|
||||||
|
appliedDataSource: '',
|
||||||
|
opts: {
|
||||||
|
notMerge: true
|
||||||
|
},
|
||||||
|
ECutAnalysis_Low: -1,
|
||||||
|
G_energy_span: -1,
|
||||||
|
funcId: 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async getData(currentText) {
|
||||||
|
try {
|
||||||
|
this.isLoading = true
|
||||||
|
const { sampleId, inputFileName: fileName } = this.sampleData
|
||||||
|
const { success, result, message } = await getAction('/gamma/EfficiencyCalibration', {
|
||||||
|
sampleId,
|
||||||
|
fileName,
|
||||||
|
currentText
|
||||||
|
})
|
||||||
|
this.isLoading = false
|
||||||
|
if (success) {
|
||||||
|
console.log('%c [ ]-220', 'font-size:13px; background:pink; color:#bf2c9f;', result)
|
||||||
|
const { list_dataSource, ECutAnalysis_Low, G_energy_span } = result
|
||||||
|
this.dataSourceList = list_dataSource
|
||||||
|
if (!currentText) {
|
||||||
|
this.currSelectedDataSource = list_dataSource[list_dataSource.length - 1]
|
||||||
|
this.appliedDataSource = list_dataSource[list_dataSource.length - 1]
|
||||||
|
}
|
||||||
|
|
||||||
|
this.ECutAnalysis_Low = ECutAnalysis_Low
|
||||||
|
this.G_energy_span = G_energy_span
|
||||||
|
|
||||||
|
this.handleResult(result)
|
||||||
|
} else {
|
||||||
|
this.$message.error(message)
|
||||||
}
|
}
|
||||||
],
|
} catch (error) {
|
||||||
option: initialOption
|
console.error(error)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
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.funcId = 1
|
||||||
|
this.getData()
|
||||||
|
},
|
||||||
|
|
||||||
|
// 表格单行点击
|
||||||
|
handleRowClick(row) {
|
||||||
|
this.model = cloneDeep(row)
|
||||||
|
},
|
||||||
|
|
||||||
|
// 插入
|
||||||
|
handleInsert() {
|
||||||
|
const energy = parseFloat(this.model.energy)
|
||||||
|
const efficiency = parseFloat(this.model.efficiency)
|
||||||
|
|
||||||
|
if (Number.isNaN(energy) || Number.isNaN(efficiency)) {
|
||||||
|
this.$message.warn('Format is invalid.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (energy <= this.ECutAnalysis_Low || energy >= this.G_energy_span) {
|
||||||
|
this.$message.warn('Energy is out of analysis range.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let i,
|
||||||
|
num = this.list.length
|
||||||
|
for (i = 0; i < num; ++i) {
|
||||||
|
const currEnergy = this.list[i].energy
|
||||||
|
if (Math.abs(currEnergy - energy) < 0.001) {
|
||||||
|
this.$message.warn('The centroid has already existed!')
|
||||||
|
return
|
||||||
|
} else if (currEnergy > energy) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.list.splice(i, 0, {
|
||||||
|
energy: energy,
|
||||||
|
efficiency
|
||||||
|
})
|
||||||
|
|
||||||
|
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() {
|
||||||
|
if (this.selectedRowKeys.length) {
|
||||||
|
const energy = parseFloat(this.model.energy)
|
||||||
|
const efficiency = parseFloat(this.model.efficiency)
|
||||||
|
|
||||||
|
if (Number.isNaN(energy) || Number.isNaN(efficiency)) {
|
||||||
|
this.$message.warn('Format is invalid.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (energy <= this.ECutAnalysis_Low || energy >= this.G_energy_span) {
|
||||||
|
this.$message.warn('Energy is out of analysis range.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const [currSelectedIndex] = this.selectedRowKeys
|
||||||
|
|
||||||
|
this.list[currSelectedIndex].energy = energy
|
||||||
|
this.list[currSelectedIndex].efficiency = efficiency
|
||||||
|
|
||||||
|
this.uncert[currSelectedIndex] = 0
|
||||||
|
|
||||||
|
this.recalculate()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
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/changeDataEfficiency', {
|
||||||
|
sampleId,
|
||||||
|
fileName,
|
||||||
|
m_vCurEnergy: this.list.map(item => item.energy),
|
||||||
|
m_vCurEffi: this.list.map(item => item.efficiency),
|
||||||
|
m_vCurUncert: this.uncert,
|
||||||
|
m_curParam: this.param,
|
||||||
|
funcId: this.funcId
|
||||||
|
})
|
||||||
|
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/applyDataEfficiency', {
|
||||||
|
m_vCurEnergy: this.list.map(item => item.energy),
|
||||||
|
m_vCurEffi: this.list.map(item => item.efficiency),
|
||||||
|
m_vCurUncert: this.uncert,
|
||||||
|
m_curParam: this.param,
|
||||||
|
curCalName,
|
||||||
|
sampleId,
|
||||||
|
fileName
|
||||||
|
})
|
||||||
|
if (success) {
|
||||||
|
this.handleDataSourceClick(curCalName)
|
||||||
|
} else {
|
||||||
|
this.$message.error(message)
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 右侧DataSource中的选项点击
|
||||||
|
handleDataSourceClick(item) {
|
||||||
|
this.currSelectedDataSource = item
|
||||||
|
this.getData(item)
|
||||||
|
},
|
||||||
|
|
||||||
|
handleSetToCurrent() {
|
||||||
|
this.appliedDataSource = this.currSelectedDataSource
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.efficiency-calibration {
|
.energy-calibration {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
margin-top: 5px;
|
||||||
|
|
||||||
.left {
|
.left {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
@ -286,10 +583,11 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
.equation {
|
.equation {
|
||||||
height: 32px;
|
height: 40px;
|
||||||
line-height: 32px;
|
|
||||||
text-align: center;
|
|
||||||
background-color: #1b5465;
|
background-color: #1b5465;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.curve {
|
.curve {
|
||||||
|
@ -302,16 +600,21 @@ export default {
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
|
|
||||||
.data-source {
|
.data-source {
|
||||||
.title {
|
|
||||||
height: 32px;
|
|
||||||
line-height: 32px;
|
|
||||||
background-color: #296d81;
|
|
||||||
padding: 0 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
height: 300px;
|
height: 330px;
|
||||||
background-color: #275466;
|
background-color: #275466;
|
||||||
|
overflow: auto;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
height: 32px;
|
||||||
|
line-height: 32px;
|
||||||
|
padding: 0 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
background-color: #296d81;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer {
|
.footer {
|
||||||
|
|
|
@ -212,25 +212,33 @@ export default {
|
||||||
appliedDataSource: '',
|
appliedDataSource: '',
|
||||||
opts: {
|
opts: {
|
||||||
notMerge: true
|
notMerge: true
|
||||||
}
|
},
|
||||||
|
|
||||||
|
rg_high: -1,
|
||||||
|
rg_low: -1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async getData() {
|
async getData(currentText) {
|
||||||
try {
|
try {
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
const { sampleId, inputFileName: fileName } = this.sampleData
|
const { sampleId, inputFileName: fileName } = this.sampleData
|
||||||
const { success, result, message } = await getAction('/gamma/energyCalibration', {
|
const { success, result, message } = await getAction('/gamma/energyCalibration', {
|
||||||
sampleId,
|
sampleId,
|
||||||
fileName
|
fileName,
|
||||||
|
currentText
|
||||||
})
|
})
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
if (success) {
|
if (success) {
|
||||||
console.log('%c [ ]-220', 'font-size:13px; background:pink; color:#bf2c9f;', result)
|
const { list_dataSource, rg_high, rg_low } = result
|
||||||
const { list_dataSource } = result
|
|
||||||
this.dataSourceList = list_dataSource
|
this.dataSourceList = list_dataSource
|
||||||
this.currSelectedDataSource = list_dataSource[0]
|
if (!currentText) {
|
||||||
this.appliedDataSource = list_dataSource[0]
|
this.currSelectedDataSource = list_dataSource[list_dataSource.length - 1]
|
||||||
|
this.appliedDataSource = list_dataSource[list_dataSource.length - 1]
|
||||||
|
}
|
||||||
|
|
||||||
|
this.rg_high = rg_high
|
||||||
|
this.rg_low = rg_low
|
||||||
|
|
||||||
this.handleResult(result)
|
this.handleResult(result)
|
||||||
} else {
|
} else {
|
||||||
|
@ -306,7 +314,7 @@ export default {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (centroid <= 100 || centroid >= 16342) {
|
if (centroid <= this.rg_low || centroid >= this.rg_high) {
|
||||||
this.$message.warn('Centroid must be in the range of analysis!')
|
this.$message.warn('Centroid must be in the range of analysis!')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -354,7 +362,7 @@ export default {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (centroid <= 100 || centroid >= 16342) {
|
if (centroid <= this.rg_low || centroid >= this.rg_high) {
|
||||||
this.$message.warn('Centroid must be in the range of analysis!')
|
this.$message.warn('Centroid must be in the range of analysis!')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -435,7 +443,7 @@ export default {
|
||||||
fileName
|
fileName
|
||||||
})
|
})
|
||||||
if (success) {
|
if (success) {
|
||||||
this.dataSourceList.push(curCalName)
|
this.handleDataSourceClick(curCalName)
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(message)
|
this.$message.error(message)
|
||||||
}
|
}
|
||||||
|
@ -447,6 +455,7 @@ export default {
|
||||||
// 右侧DataSource中的选项点击
|
// 右侧DataSource中的选项点击
|
||||||
handleDataSourceClick(item) {
|
handleDataSourceClick(item) {
|
||||||
this.currSelectedDataSource = item
|
this.currSelectedDataSource = item
|
||||||
|
this.getData(item)
|
||||||
},
|
},
|
||||||
|
|
||||||
handleSetToCurrent() {
|
handleSetToCurrent() {
|
||||||
|
@ -459,6 +468,7 @@ export default {
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.energy-calibration {
|
.energy-calibration {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
margin-top: 5px;
|
||||||
|
|
||||||
.left {
|
.left {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
|
|
@ -290,6 +290,7 @@ export default {
|
||||||
.nuclide-library {
|
.nuclide-library {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 20px;
|
gap: 20px;
|
||||||
|
margin-top: 5px;
|
||||||
|
|
||||||
&-list {
|
&-list {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
|
|
|
@ -1,89 +1,100 @@
|
||||||
<template>
|
<template>
|
||||||
<custom-modal v-model="visible" :width="1280" title="Resolution Calibration" :footer="null">
|
<custom-modal v-model="visible" :width="1280" title="Resolution Calibration" :footer="null" destroy-on-close>
|
||||||
<div class="resolution-calibration">
|
<a-spin :spinning="isLoading">
|
||||||
<div class="left">
|
<div class="energy-calibration">
|
||||||
<!-- Calibration Data -->
|
<div class="left">
|
||||||
<title-over-border title="Calibration Data">
|
<!-- Calibration Data -->
|
||||||
<div class="calibration-data">
|
<title-over-border title="Calibration Data">
|
||||||
<a-form-model
|
<div class="calibration-data">
|
||||||
:colon="false"
|
<a-form-model
|
||||||
:labelCol="{
|
:colon="false"
|
||||||
style: {
|
:labelCol="{
|
||||||
width: '70px',
|
style: {
|
||||||
textAlign: 'left',
|
width: '70px',
|
||||||
flexShrink: 0
|
textAlign: 'left',
|
||||||
}
|
flexShrink: 0
|
||||||
}"
|
}
|
||||||
:wrapperCol="{
|
}"
|
||||||
style: {
|
:wrapperCol="{
|
||||||
flex: 1
|
style: {
|
||||||
}
|
flex: 1
|
||||||
}"
|
}
|
||||||
>
|
}"
|
||||||
<a-form-model-item label="Energy ">
|
>
|
||||||
<a-input></a-input>
|
<a-form-model-item label="Energy">
|
||||||
</a-form-model-item>
|
<a-input type="number" v-model="model.energy"></a-input>
|
||||||
<a-form-model-item label="FWHM">
|
</a-form-model-item>
|
||||||
<a-input></a-input>
|
<a-form-model-item label="FWHM">
|
||||||
</a-form-model-item>
|
<a-input type="number" v-model="model.fwhm"></a-input>
|
||||||
<a-form-model-item :label="' '">
|
</a-form-model-item>
|
||||||
<a-button type="primary">Insert</a-button>
|
<a-form-model-item :label="' '">
|
||||||
</a-form-model-item>
|
<a-button type="primary" @click="handleInsert">Insert</a-button>
|
||||||
<a-form-model-item :label="' '">
|
</a-form-model-item>
|
||||||
<a-button type="primary">Modify</a-button>
|
<a-form-model-item :label="' '">
|
||||||
</a-form-model-item>
|
<a-button type="primary" @click="handleModify">Modify</a-button>
|
||||||
<a-form-model-item :label="' '">
|
</a-form-model-item>
|
||||||
<a-button type="primary">Delete</a-button>
|
<a-form-model-item :label="' '">
|
||||||
</a-form-model-item>
|
<a-button type="primary" @click="handleDelete">Delete</a-button>
|
||||||
</a-form-model>
|
</a-form-model-item>
|
||||||
<!-- 表格 -->
|
</a-form-model>
|
||||||
<a-table
|
<!-- 表格 -->
|
||||||
:columns="columns"
|
<custom-table
|
||||||
:dataSource="list"
|
:columns="columns"
|
||||||
:pagination="false"
|
:list="list"
|
||||||
:class="list.length ? 'has-data' : ''"
|
:pagination="false"
|
||||||
:scroll="{ y: 182 }"
|
size="small"
|
||||||
></a-table>
|
:class="list.length ? 'has-data' : ''"
|
||||||
<!-- 表格结束 -->
|
:scroll="{ y: 182 }"
|
||||||
<div class="operators">
|
:selectedRowKeys.sync="selectedRowKeys"
|
||||||
<div>
|
:canDeselect="false"
|
||||||
<a-button type="primary">Call</a-button>
|
@rowClick="handleRowClick"
|
||||||
<a-button type="primary">Save</a-button>
|
></custom-table>
|
||||||
</div>
|
<!-- 表格结束 -->
|
||||||
<div>
|
<div class="operators">
|
||||||
<a-button type="primary">Apply</a-button>
|
<div>
|
||||||
|
<a-button type="primary">Call</a-button>
|
||||||
|
<a-button type="primary">Save</a-button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a-button type="primary" @click="handleApply">Apply</a-button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</title-over-border>
|
||||||
</title-over-border>
|
<!-- Equation -->
|
||||||
<!-- Equation -->
|
<title-over-border class="mt-20" title="Equation">
|
||||||
<title-over-border class="mt-20" title="Equation">
|
<div class="equation" v-html="equation"></div>
|
||||||
<div class="equation">
|
</title-over-border>
|
||||||
FWHM = (0.514363 + E * 0/00281408)<sup>1/2</sup>
|
<!-- curve -->
|
||||||
</div>
|
<title-over-border class="mt-20" title="curve">
|
||||||
</title-over-border>
|
<div class="curve">
|
||||||
<!-- curve -->
|
<custom-chart :option="option" :opts="opts" />
|
||||||
<title-over-border class="mt-20" title="curve">
|
|
||||||
<div class="curve">
|
|
||||||
<custom-chart :option="option" />
|
|
||||||
</div>
|
|
||||||
</title-over-border>
|
|
||||||
</div>
|
|
||||||
<div class="right">
|
|
||||||
<title-over-border title="Data Source" style="height: 100%">
|
|
||||||
<div class="data-source">
|
|
||||||
<div class="data-source-main">
|
|
||||||
<div class="title">PHD</div>
|
|
||||||
<div class="content"></div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="footer mt-20">
|
</title-over-border>
|
||||||
<a-button type="primary">Set to Current</a-button>
|
</div>
|
||||||
<div class="mt-20">CalResUpdate</div>
|
<div class="right">
|
||||||
|
<title-over-border title="Data Source" style="height: 100%">
|
||||||
|
<div class="data-source">
|
||||||
|
<div class="content">
|
||||||
|
<div
|
||||||
|
class="item"
|
||||||
|
:class="item == currSelectedDataSource ? 'active' : ''"
|
||||||
|
v-for="(item, index) in dataSourceList"
|
||||||
|
:key="index"
|
||||||
|
@click="handleDataSourceClick(item)"
|
||||||
|
>
|
||||||
|
{{ item }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="footer mt-20">
|
||||||
|
<a-button type="primary" @click="handleSetToCurrent">Set to Current</a-button>
|
||||||
|
<div class="mt-20">{{ appliedDataSource }}</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</title-over-border>
|
||||||
</title-over-border>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</a-spin>
|
||||||
</custom-modal>
|
</custom-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -91,6 +102,10 @@
|
||||||
import ModalMixin from '@/mixins/ModalMixin'
|
import ModalMixin from '@/mixins/ModalMixin'
|
||||||
import TitleOverBorder from '../TitleOverBorder.vue'
|
import TitleOverBorder from '../TitleOverBorder.vue'
|
||||||
import CustomChart from '@/components/CustomChart/index.vue'
|
import CustomChart from '@/components/CustomChart/index.vue'
|
||||||
|
import { getAction, postAction } from '@/api/manage'
|
||||||
|
import { cloneDeep } from 'lodash'
|
||||||
|
import { buildLineSeries } from '@/utils/chartHelper'
|
||||||
|
import SampleDataMixin from '../../SampleDataMixin'
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
|
@ -128,9 +143,20 @@ const initialOption = {
|
||||||
right: 10,
|
right: 10,
|
||||||
bottom: 0
|
bottom: 0
|
||||||
},
|
},
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis',
|
||||||
|
formatter: params => {
|
||||||
|
const [x, y] = params[0].value
|
||||||
|
const energy = parseInt(x)
|
||||||
|
const fwhm = y.toFixed(3)
|
||||||
|
return `<div class="channel">Energy: ${energy}</div>
|
||||||
|
<div class="energy">Fwhm: ${fwhm}</div>`
|
||||||
|
},
|
||||||
|
className: 'figure-chart-option-tooltip'
|
||||||
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
min: 42,
|
min: 1,
|
||||||
max: 2740,
|
max: 'dataMax',
|
||||||
axisLabel: {
|
axisLabel: {
|
||||||
color: '#fff'
|
color: '#fff'
|
||||||
},
|
},
|
||||||
|
@ -166,48 +192,283 @@ const initialOption = {
|
||||||
fontSize: 14
|
fontSize: 14
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
series: [
|
series: []
|
||||||
{
|
|
||||||
type: 'line',
|
|
||||||
symbol: 'square',
|
|
||||||
itemStyle: {
|
|
||||||
color: '#FF0000' // 设置符号的颜色
|
|
||||||
},
|
|
||||||
lineStyle: {
|
|
||||||
color: '#C2CC11' // 设置折线的颜色
|
|
||||||
},
|
|
||||||
data: [
|
|
||||||
[42, 0],
|
|
||||||
[100, 0.2],
|
|
||||||
[978, 0.1]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { TitleOverBorder, CustomChart },
|
components: { TitleOverBorder, CustomChart },
|
||||||
mixins: [ModalMixin],
|
mixins: [ModalMixin, SampleDataMixin],
|
||||||
data() {
|
data() {
|
||||||
this.columns = columns
|
this.columns = columns
|
||||||
return {
|
return {
|
||||||
list: [
|
isLoading: false,
|
||||||
{
|
equation: '',
|
||||||
energy: 'energy',
|
dataSourceList: [],
|
||||||
fwhm: 'fwhm',
|
list: [],
|
||||||
fit: 'fit',
|
option: cloneDeep(initialOption),
|
||||||
delta: 'delta'
|
selectedRowKeys: [],
|
||||||
|
model: {},
|
||||||
|
currSelectedDataSource: '',
|
||||||
|
appliedDataSource: '',
|
||||||
|
opts: {
|
||||||
|
notMerge: true
|
||||||
|
},
|
||||||
|
ECutAnalysis_Low: -1,
|
||||||
|
G_energy_span: -1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async getData(currentText) {
|
||||||
|
try {
|
||||||
|
this.isLoading = true
|
||||||
|
const { sampleId, inputFileName: fileName } = this.sampleData
|
||||||
|
const { success, result, message } = await getAction('/gamma/resolutionCalibration', {
|
||||||
|
sampleId,
|
||||||
|
fileName,
|
||||||
|
currentText
|
||||||
|
})
|
||||||
|
this.isLoading = false
|
||||||
|
if (success) {
|
||||||
|
console.log('%c [ ]-220', 'font-size:13px; background:pink; color:#bf2c9f;', result)
|
||||||
|
const { list_dataSource, ECutAnalysis_Low, G_energy_span } = result
|
||||||
|
this.dataSourceList = list_dataSource
|
||||||
|
if (!currentText) {
|
||||||
|
this.currSelectedDataSource = list_dataSource[list_dataSource.length - 1]
|
||||||
|
this.appliedDataSource = list_dataSource[list_dataSource.length - 1]
|
||||||
|
}
|
||||||
|
|
||||||
|
this.ECutAnalysis_Low = ECutAnalysis_Low
|
||||||
|
this.G_energy_span = G_energy_span
|
||||||
|
|
||||||
|
this.handleResult(result)
|
||||||
|
} else {
|
||||||
|
this.$message.error(message)
|
||||||
}
|
}
|
||||||
],
|
} catch (error) {
|
||||||
option: initialOption
|
console.error(error)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
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) {
|
||||||
|
this.model = cloneDeep(row)
|
||||||
|
},
|
||||||
|
|
||||||
|
// 插入
|
||||||
|
handleInsert() {
|
||||||
|
const energy = parseFloat(this.model.energy)
|
||||||
|
const fwhm = parseFloat(this.model.fwhm)
|
||||||
|
|
||||||
|
if (Number.isNaN(energy) || Number.isNaN(fwhm)) {
|
||||||
|
this.$message.warn('Format is invalid.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (energy <= this.ECutAnalysis_Low || energy >= this.G_energy_span) {
|
||||||
|
this.$message.warn('Energy is out of analysis range.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let i,
|
||||||
|
num = this.list.length
|
||||||
|
for (i = 0; i < num; ++i) {
|
||||||
|
const currEnergy = this.list[i].energy
|
||||||
|
if (Math.abs(currEnergy - energy) < 0.001) {
|
||||||
|
this.$message.warn('The centroid has already existed!')
|
||||||
|
return
|
||||||
|
} else if (currEnergy > energy) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.list.splice(i, 0, {
|
||||||
|
energy: energy,
|
||||||
|
fwhm
|
||||||
|
})
|
||||||
|
|
||||||
|
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() {
|
||||||
|
if (this.selectedRowKeys.length) {
|
||||||
|
const energy = parseFloat(this.model.energy)
|
||||||
|
const fwhm = parseFloat(this.model.fwhm)
|
||||||
|
|
||||||
|
if (Number.isNaN(energy) || Number.isNaN(fwhm)) {
|
||||||
|
this.$message.warn('Format is invalid.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (energy <= this.ECutAnalysis_Low || energy >= this.G_energy_span) {
|
||||||
|
this.$message.warn('Energy is out of analysis range.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const [currSelectedIndex] = this.selectedRowKeys
|
||||||
|
|
||||||
|
this.list[currSelectedIndex].energy = energy
|
||||||
|
this.list[currSelectedIndex].fwhm = fwhm
|
||||||
|
|
||||||
|
this.uncert[currSelectedIndex] = 0
|
||||||
|
|
||||||
|
this.recalculate()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
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/changeDataResolution', {
|
||||||
|
sampleId,
|
||||||
|
fileName,
|
||||||
|
m_vCurEnergy: this.list.map(item => item.energy),
|
||||||
|
m_vCurReso: this.list.map(item => item.fwhm),
|
||||||
|
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/applyDataResolution', {
|
||||||
|
m_vCurEnergy: this.list.map(item => item.energy),
|
||||||
|
m_vCurReso: this.list.map(item => item.fwhm),
|
||||||
|
m_vCurUncert: this.uncert,
|
||||||
|
m_curParam: this.param,
|
||||||
|
curCalName,
|
||||||
|
sampleId,
|
||||||
|
fileName
|
||||||
|
})
|
||||||
|
if (success) {
|
||||||
|
this.handleDataSourceClick(curCalName)
|
||||||
|
} else {
|
||||||
|
this.$message.error(message)
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 右侧DataSource中的选项点击
|
||||||
|
handleDataSourceClick(item) {
|
||||||
|
this.currSelectedDataSource = item
|
||||||
|
this.getData(item)
|
||||||
|
},
|
||||||
|
|
||||||
|
handleSetToCurrent() {
|
||||||
|
this.appliedDataSource = this.currSelectedDataSource
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.resolution-calibration {
|
.energy-calibration {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
margin-top: 5px;
|
||||||
|
|
||||||
.left {
|
.left {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
@ -281,10 +542,11 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
.equation {
|
.equation {
|
||||||
height: 32px;
|
height: 40px;
|
||||||
line-height: 32px;
|
|
||||||
text-align: center;
|
|
||||||
background-color: #1b5465;
|
background-color: #1b5465;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.curve {
|
.curve {
|
||||||
|
@ -297,16 +559,21 @@ export default {
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
|
|
||||||
.data-source {
|
.data-source {
|
||||||
.title {
|
|
||||||
height: 32px;
|
|
||||||
line-height: 32px;
|
|
||||||
background-color: #296d81;
|
|
||||||
padding: 0 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
height: 300px;
|
height: 330px;
|
||||||
background-color: #275466;
|
background-color: #275466;
|
||||||
|
overflow: auto;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
height: 32px;
|
||||||
|
line-height: 32px;
|
||||||
|
padding: 0 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
background-color: #296d81;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer {
|
.footer {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user