2023-07-11 19:35:18 +08:00
|
|
|
|
<template>
|
2023-08-28 19:52:35 +08:00
|
|
|
|
<custom-modal v-model="visible" :width="1280" title="Interactive Analyse Tools" :footer="null" destroy-on-close>
|
|
|
|
|
|
<a-spin :spinning="isLoading">
|
|
|
|
|
|
<div class="interactive-analysis-tools">
|
|
|
|
|
|
<div class="interactive-analysis-tools-left">
|
|
|
|
|
|
<div class="chart">
|
2023-09-06 19:30:02 +08:00
|
|
|
|
<CustomChart
|
|
|
|
|
|
ref="chartRef"
|
|
|
|
|
|
:option="option"
|
|
|
|
|
|
:opts="opts"
|
|
|
|
|
|
@zr:mousedown="handleMouseDown"
|
|
|
|
|
|
@zr:mouseup="handleMouseUp"
|
|
|
|
|
|
@brushEnd="handleBrushEnd"
|
|
|
|
|
|
@zr:click="handleChartClick"
|
|
|
|
|
|
/>
|
2023-08-28 19:52:35 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<!-- 缩略图 -->
|
|
|
|
|
|
<div class="thumbnail">
|
|
|
|
|
|
<CustomChart :option="thumbnailOption" />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<!-- 缩略图结束 -->
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 表格 -->
|
|
|
|
|
|
<div class="table">
|
|
|
|
|
|
<p class="title">
|
|
|
|
|
|
<span @click="handleChangeMarkLine('prev')">< </span>
|
|
|
|
|
|
6 Peaks with Anthro.Nuclides
|
|
|
|
|
|
<span @click="handleChangeMarkLine('next')">></span>
|
|
|
|
|
|
</p>
|
|
|
|
|
|
<custom-table
|
|
|
|
|
|
:class="list.length ? 'has-data' : ''"
|
|
|
|
|
|
:list="list"
|
|
|
|
|
|
:columns="columns"
|
|
|
|
|
|
:scroll="{ y: 288 }"
|
|
|
|
|
|
:selectedRowKeys.sync="selectedKeys"
|
|
|
|
|
|
rowKey="index"
|
|
|
|
|
|
:canDeselect="false"
|
|
|
|
|
|
@rowClick="handleTableRowClick"
|
|
|
|
|
|
>
|
|
|
|
|
|
</custom-table>
|
|
|
|
|
|
<div class="operators">
|
|
|
|
|
|
<a-button type="primary" @click="nuclideReviewModalVisible = true">Nuclide Review Window</a-button>
|
2023-09-07 19:29:59 +08:00
|
|
|
|
<a-button type="primary" @click="handleAddPeakComment()">Add Peak Comment</a-button>
|
|
|
|
|
|
<a-button type="primary" @click="handleAddGeneralComment()">Add General Comment</a-button>
|
2023-08-28 19:52:35 +08:00
|
|
|
|
</div>
|
2023-07-11 19:35:18 +08:00
|
|
|
|
</div>
|
2023-08-28 19:52:35 +08:00
|
|
|
|
<!-- 表格结束 -->
|
2023-07-11 19:35:18 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2023-08-28 19:52:35 +08:00
|
|
|
|
<!-- 右侧 -->
|
|
|
|
|
|
<div class="interactive-analysis-tools-right">
|
2023-09-04 19:40:13 +08:00
|
|
|
|
<title-over-border :title="btnGroupType == 1 ? 'Peak' : 'Baseline Control Points'">
|
2023-08-28 19:52:35 +08:00
|
|
|
|
<div class="peak-box">
|
|
|
|
|
|
<!-- 按钮组1 -->
|
|
|
|
|
|
<template v-if="btnGroupType == 1">
|
|
|
|
|
|
<div class="peak-box-item">
|
2023-08-29 19:54:09 +08:00
|
|
|
|
<a-button type="primary" @click="handleInsert">Insert</a-button>
|
2023-08-28 19:52:35 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="peak-box-item">
|
|
|
|
|
|
<a-button type="primary" @click="handleDel">Delete</a-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="peak-box-item">
|
2023-09-13 19:42:28 +08:00
|
|
|
|
<a-button type="primary" :class="{ 'is-fitting': isFitting }" @click="handleFit">Fit</a-button>
|
2023-08-28 19:52:35 +08:00
|
|
|
|
</div>
|
2023-07-11 19:35:18 +08:00
|
|
|
|
|
2023-08-28 19:52:35 +08:00
|
|
|
|
<div class="peak-box-item symbol" :key="4">
|
|
|
|
|
|
<a-button type="primary" @click="handleChangeMarkLine('prev')"><</a-button>
|
|
|
|
|
|
<a-button type="primary" @click="handleChangeMarkLine('next')">></a-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="peak-box-item base-line">
|
2023-09-04 19:40:13 +08:00
|
|
|
|
<a-button type="primary" @click="handleSwitchOperation">BaseLine</a-button>
|
2023-08-28 19:52:35 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<!-- 按钮组2 -->
|
|
|
|
|
|
<template v-if="btnGroupType == 2">
|
|
|
|
|
|
<div class="peak-box-item">
|
2023-09-04 19:40:13 +08:00
|
|
|
|
<a-button type="primary" @click="handleAddCP">(A)dd CP</a-button>
|
2023-08-28 19:52:35 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="peak-box-item">
|
2023-09-05 19:06:19 +08:00
|
|
|
|
<a-button type="primary" @click="handleRemoveCP">(R)emove CP</a-button>
|
2023-08-28 19:52:35 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="peak-box-item">
|
2023-09-12 19:42:36 +08:00
|
|
|
|
<a-button
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
key="modify-btn"
|
|
|
|
|
|
:class="{ 'is-modify': isModifying }"
|
|
|
|
|
|
@click="handleModifyCP"
|
|
|
|
|
|
>(M)odify CP</a-button
|
|
|
|
|
|
>
|
2023-08-28 19:52:35 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="peak-box-item">
|
2023-09-11 18:59:08 +08:00
|
|
|
|
<a-button type="primary" @click="handleEditSlope">Edit (S)lope</a-button>
|
2023-08-28 19:52:35 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="peak-box-item">
|
2023-09-12 19:42:36 +08:00
|
|
|
|
<a-button type="primary" :disabled="isOperationStackEmpty" @click="handleUndo">Undo</a-button>
|
2023-08-28 19:52:35 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="peak-box-item">
|
2023-09-13 19:42:28 +08:00
|
|
|
|
<a-button type="primary" @click="handleReplot">Replot</a-button>
|
2023-08-28 19:52:35 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="peak-box-item">
|
2023-09-04 19:40:13 +08:00
|
|
|
|
<a-button type="primary" @click="handleAccept">Accept</a-button>
|
2023-08-28 19:52:35 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="peak-box-item">
|
2023-09-04 19:40:13 +08:00
|
|
|
|
<a-button type="primary" @click="handleSwitchOperation">Cancel</a-button>
|
2023-08-28 19:52:35 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</title-over-border>
|
|
|
|
|
|
<div class="reset-btn-box">
|
2023-09-06 19:30:02 +08:00
|
|
|
|
<a-button type="primary" @click="handleResetChart">Reset Chart</a-button>
|
2023-08-28 19:52:35 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="identify-box">
|
|
|
|
|
|
<title-over-border title="Nuclide Identify">
|
|
|
|
|
|
<a-form-model class="tolerance">
|
|
|
|
|
|
<a-form-model-item label="Tolerance">
|
2023-08-29 19:54:09 +08:00
|
|
|
|
<a-input-number v-model="model.tolerance"></a-input-number>
|
2023-08-28 19:52:35 +08:00
|
|
|
|
</a-form-model-item>
|
|
|
|
|
|
</a-form-model>
|
|
|
|
|
|
<div class="identify-item">
|
|
|
|
|
|
<div class="title">
|
|
|
|
|
|
Possible Nuclide
|
|
|
|
|
|
</div>
|
2023-09-08 18:43:49 +08:00
|
|
|
|
<a-spin :spinning="!!(selectedTableItem && selectedTableItem._loading)">
|
|
|
|
|
|
<div class="content">
|
|
|
|
|
|
<template v-if="selectedTableItem && selectedTableItem._possible">
|
|
|
|
|
|
<div
|
|
|
|
|
|
class="item"
|
|
|
|
|
|
:class="{ active: possible == model.possibleNuclide }"
|
|
|
|
|
|
v-for="(possible, index) in selectedTableItem._possible"
|
|
|
|
|
|
:key="index"
|
|
|
|
|
|
@click="model.possibleNuclide = possible"
|
|
|
|
|
|
>
|
|
|
|
|
|
{{ possible }}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</a-spin>
|
2023-07-11 19:35:18 +08:00
|
|
|
|
</div>
|
2023-08-28 19:52:35 +08:00
|
|
|
|
<div class="identify-item">
|
|
|
|
|
|
<div class="title">
|
|
|
|
|
|
Nuclide Identified
|
|
|
|
|
|
</div>
|
2023-09-04 19:40:13 +08:00
|
|
|
|
<div class="content">
|
|
|
|
|
|
<template v-if="selectedTableItem">
|
|
|
|
|
|
<div
|
|
|
|
|
|
class="item"
|
|
|
|
|
|
:class="{ active: identified == model.identifiedNuclide }"
|
|
|
|
|
|
v-for="(identified, index) in selectedTableItem.nuclides"
|
|
|
|
|
|
:key="index"
|
|
|
|
|
|
@click="model.identifiedNuclide = identified"
|
|
|
|
|
|
>
|
|
|
|
|
|
{{ identified }}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</div>
|
2023-07-11 19:35:18 +08:00
|
|
|
|
</div>
|
2023-08-28 19:52:35 +08:00
|
|
|
|
<div class="identify-operators">
|
2023-09-04 19:40:13 +08:00
|
|
|
|
<span class="text">{{ model.possibleNuclide }}</span>
|
|
|
|
|
|
<a-button type="primary" :disabled="!model.possibleNuclide" @click="handleAddNuclide">Add</a-button>
|
|
|
|
|
|
<a-button type="primary" @click="handleDelNuclide">Del</a-button>
|
2023-07-11 19:35:18 +08:00
|
|
|
|
</div>
|
2023-08-28 19:52:35 +08:00
|
|
|
|
</title-over-border>
|
2023-07-11 19:35:18 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2023-08-28 19:52:35 +08:00
|
|
|
|
<!-- 右侧结束 -->
|
2023-07-11 19:35:18 +08:00
|
|
|
|
</div>
|
2023-08-28 19:52:35 +08:00
|
|
|
|
</a-spin>
|
2023-09-07 19:29:59 +08:00
|
|
|
|
<!-- Peak Comment弹窗 开始 -->
|
|
|
|
|
|
<peak-comment-modal v-model="peakCommentModalVisible" :curRow="curRow" />
|
|
|
|
|
|
<!-- Peak Comment弹窗 结束 -->
|
|
|
|
|
|
|
|
|
|
|
|
<!-- General Comment弹窗 开始 -->
|
|
|
|
|
|
<general-comment-modal v-model="generalCommentModalVisible" />
|
|
|
|
|
|
<!-- General Comment弹窗 结束 -->
|
|
|
|
|
|
|
2023-07-11 19:35:18 +08:00
|
|
|
|
<!-- Fit Peaks and Baseline弹窗 开始 -->
|
2023-09-06 19:30:02 +08:00
|
|
|
|
<fit-peaks-and-base-line-modal
|
|
|
|
|
|
v-model="fitPeaksAndBaselineModalVisible"
|
|
|
|
|
|
:curChan="currChannel"
|
|
|
|
|
|
@result="handleInsertSuccess"
|
|
|
|
|
|
@cancel="handleCancelSuccess"
|
|
|
|
|
|
/>
|
2023-07-11 19:35:18 +08:00
|
|
|
|
<!-- Fit Peaks and Baseline弹窗 结束 -->
|
|
|
|
|
|
<!-- Nuclide Review 弹窗开始 -->
|
2023-09-04 19:40:13 +08:00
|
|
|
|
<nuclide-review-modal v-model="nuclideReviewModalVisible" :sampleId="sampleId" :channel="currChannel" />
|
2023-07-11 19:35:18 +08:00
|
|
|
|
<!-- Nuclide Review 弹窗结束 -->
|
2023-09-12 19:42:36 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- Edit Slope 弹窗 -->
|
|
|
|
|
|
<edit-slope-modal ref="editSlopeModal" @change="handleSlopeChange" />
|
|
|
|
|
|
<!-- Edit Slope 结束 -->
|
2023-07-11 19:35:18 +08:00
|
|
|
|
</custom-modal>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import CustomChart from '@/components/CustomChart/index.vue'
|
2023-07-24 19:26:46 +08:00
|
|
|
|
import TitleOverBorder from '../../TitleOverBorder.vue'
|
2023-09-07 19:29:59 +08:00
|
|
|
|
import PeakCommentModal from './components/PeakCommentModal.vue'
|
2023-07-11 19:35:18 +08:00
|
|
|
|
import FitPeaksAndBaseLineModal from './components/FitPeaksAndBaselineModal.vue'
|
|
|
|
|
|
import NuclideReviewModal from './components/NuclideReviewModal.vue'
|
2023-08-15 18:23:22 +08:00
|
|
|
|
import ModalMixin from '@/mixins/ModalMixin'
|
2023-09-08 18:43:49 +08:00
|
|
|
|
import { getAction, postAction } from '@/api/manage'
|
2023-08-28 19:52:35 +08:00
|
|
|
|
import { cloneDeep } from 'lodash'
|
2023-09-12 19:42:36 +08:00
|
|
|
|
import { buildLineSeries, findSeriesByName, getXAxisAndYAxisByPosition, rangeNumber } from '@/utils/chartHelper'
|
2023-09-04 19:40:13 +08:00
|
|
|
|
import SampleDataMixin from '@/views/spectrumAnalysis/SampleDataMixin'
|
2023-09-07 19:29:59 +08:00
|
|
|
|
import GeneralCommentModal from './components/GeneralCommentModal.vue'
|
2023-09-12 19:42:36 +08:00
|
|
|
|
import EditSlopeModal from './components/EditSlopeModal.vue'
|
2023-09-13 19:42:28 +08:00
|
|
|
|
import Response from './Response.json'
|
2023-07-11 19:35:18 +08:00
|
|
|
|
|
2023-08-28 19:52:35 +08:00
|
|
|
|
// 初始配置
|
2023-07-11 19:35:18 +08:00
|
|
|
|
const initialOption = {
|
|
|
|
|
|
grid: {
|
2023-08-28 19:52:35 +08:00
|
|
|
|
top: 40,
|
2023-09-04 19:40:13 +08:00
|
|
|
|
left: 40,
|
|
|
|
|
|
right: 30,
|
|
|
|
|
|
bottom: 30,
|
2023-08-28 19:52:35 +08:00
|
|
|
|
containLabel: true
|
2023-07-11 19:35:18 +08:00
|
|
|
|
},
|
2023-08-28 19:52:35 +08:00
|
|
|
|
title: {
|
|
|
|
|
|
text: '',
|
|
|
|
|
|
left: 'center',
|
|
|
|
|
|
bottom: 10,
|
|
|
|
|
|
textStyle: {
|
|
|
|
|
|
color: '#8FD4F8',
|
|
|
|
|
|
rich: {
|
|
|
|
|
|
a: {
|
|
|
|
|
|
padding: [0, 20, 0, 0],
|
|
|
|
|
|
fontSize: 16
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-07-11 19:35:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2023-08-28 19:52:35 +08:00
|
|
|
|
tooltip: {
|
|
|
|
|
|
trigger: 'axis',
|
|
|
|
|
|
axisPointer: {
|
|
|
|
|
|
lineStyle: {
|
|
|
|
|
|
color: '#3CAEBB',
|
|
|
|
|
|
width: 1
|
|
|
|
|
|
}
|
2023-07-11 19:35:18 +08:00
|
|
|
|
},
|
2023-09-06 19:30:02 +08:00
|
|
|
|
formatter: undefined,
|
2023-08-28 19:52:35 +08:00
|
|
|
|
className: 'figure-chart-option-tooltip'
|
|
|
|
|
|
},
|
|
|
|
|
|
xAxis: {
|
|
|
|
|
|
axisLine: {
|
|
|
|
|
|
lineStyle: {
|
|
|
|
|
|
color: '#ade6ee'
|
|
|
|
|
|
}
|
2023-07-11 19:35:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
splitLine: {
|
|
|
|
|
|
show: false
|
|
|
|
|
|
},
|
2023-08-28 19:52:35 +08:00
|
|
|
|
axisLabel: {
|
|
|
|
|
|
textStyle: {
|
|
|
|
|
|
color: '#ade6ee'
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
min: 1,
|
|
|
|
|
|
max: 'dataMax',
|
|
|
|
|
|
animation: false
|
2023-07-11 19:35:18 +08:00
|
|
|
|
},
|
2023-08-28 19:52:35 +08:00
|
|
|
|
yAxis: {
|
2023-09-05 19:06:19 +08:00
|
|
|
|
type: 'log',
|
2023-08-28 19:52:35 +08:00
|
|
|
|
name: 'Counts',
|
2023-09-04 19:40:13 +08:00
|
|
|
|
nameLocation: 'center',
|
|
|
|
|
|
nameGap: 40,
|
2023-08-28 19:52:35 +08:00
|
|
|
|
nameTextStyle: {
|
|
|
|
|
|
color: '#8FD4F8',
|
|
|
|
|
|
fontSize: 16
|
|
|
|
|
|
},
|
|
|
|
|
|
axisLine: {
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
lineStyle: {
|
|
|
|
|
|
color: '#ade6ee'
|
2023-07-11 19:35:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2023-08-28 19:52:35 +08:00
|
|
|
|
splitLine: {
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
lineStyle: {
|
|
|
|
|
|
color: 'rgba(173, 230, 238, .2)'
|
2023-07-11 19:35:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2023-08-28 19:52:35 +08:00
|
|
|
|
axisLabel: {
|
|
|
|
|
|
textStyle: {
|
|
|
|
|
|
color: '#ade6ee'
|
2023-07-11 19:35:18 +08:00
|
|
|
|
}
|
2023-08-28 19:52:35 +08:00
|
|
|
|
},
|
2023-09-05 19:06:19 +08:00
|
|
|
|
min: 0.1,
|
2023-08-28 19:52:35 +08:00
|
|
|
|
max: 'dataMax',
|
|
|
|
|
|
animation: false
|
|
|
|
|
|
},
|
|
|
|
|
|
series: [],
|
2023-09-05 19:06:19 +08:00
|
|
|
|
brush: {},
|
2023-09-14 19:49:32 +08:00
|
|
|
|
graphic: [
|
|
|
|
|
|
{
|
|
|
|
|
|
type: 'group',
|
|
|
|
|
|
id: 1,
|
|
|
|
|
|
children: []
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
type: 'group',
|
|
|
|
|
|
id: 2,
|
|
|
|
|
|
children: []
|
|
|
|
|
|
}
|
|
|
|
|
|
]
|
2023-07-11 19:35:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const columns = [
|
|
|
|
|
|
{
|
|
|
|
|
|
title: 'ID',
|
2023-08-28 19:52:35 +08:00
|
|
|
|
customRender: (_, __, index) => {
|
|
|
|
|
|
return index + 1
|
|
|
|
|
|
},
|
2023-07-11 19:35:18 +08:00
|
|
|
|
width: 60
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: 'Energy (keV)',
|
|
|
|
|
|
dataIndex: 'energy',
|
2023-09-06 19:30:02 +08:00
|
|
|
|
width: 120,
|
|
|
|
|
|
customRender: text => {
|
|
|
|
|
|
return text.toFixed(3)
|
|
|
|
|
|
}
|
2023-07-11 19:35:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: 'Centroid (C)',
|
2023-09-04 19:40:13 +08:00
|
|
|
|
dataIndex: 'peakCentroid',
|
2023-09-06 19:30:02 +08:00
|
|
|
|
width: 120,
|
|
|
|
|
|
customRender: text => {
|
|
|
|
|
|
return text.toFixed(3)
|
|
|
|
|
|
}
|
2023-07-11 19:35:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: 'FWHM (keV)',
|
|
|
|
|
|
dataIndex: 'fwhm',
|
2023-09-06 19:30:02 +08:00
|
|
|
|
width: 120,
|
|
|
|
|
|
customRender: text => {
|
|
|
|
|
|
return text.toFixed(3)
|
|
|
|
|
|
}
|
2023-07-11 19:35:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: 'Area',
|
|
|
|
|
|
dataIndex: 'area',
|
2023-09-06 19:30:02 +08:00
|
|
|
|
width: 120,
|
|
|
|
|
|
customRender: text => {
|
|
|
|
|
|
return text.toFixed(3)
|
|
|
|
|
|
}
|
2023-07-11 19:35:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: 'Detectability',
|
2023-09-06 19:30:02 +08:00
|
|
|
|
dataIndex: 'significance',
|
|
|
|
|
|
width: 120,
|
|
|
|
|
|
customRender: text => {
|
|
|
|
|
|
return text.toFixed(3)
|
|
|
|
|
|
}
|
2023-07-11 19:35:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2023-09-06 19:30:02 +08:00
|
|
|
|
title: '#Cmnt',
|
|
|
|
|
|
dataIndex: 'comments',
|
2023-07-11 19:35:18 +08:00
|
|
|
|
width: 120
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: 'Nuclides',
|
|
|
|
|
|
dataIndex: 'nuclides',
|
2023-09-04 19:40:13 +08:00
|
|
|
|
width: 120,
|
|
|
|
|
|
customRender: text => {
|
|
|
|
|
|
return text && text.join(';')
|
|
|
|
|
|
}
|
2023-07-11 19:35:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
]
|
|
|
|
|
|
|
2023-08-28 19:52:35 +08:00
|
|
|
|
// 缩略图配置
|
|
|
|
|
|
const thumbnailOption = {
|
|
|
|
|
|
grid: {
|
|
|
|
|
|
top: 0,
|
|
|
|
|
|
left: 5,
|
|
|
|
|
|
right: 5,
|
|
|
|
|
|
bottom: 0
|
|
|
|
|
|
},
|
|
|
|
|
|
xAxis: {
|
|
|
|
|
|
type: 'category',
|
|
|
|
|
|
axisLine: {
|
|
|
|
|
|
show: false
|
|
|
|
|
|
},
|
|
|
|
|
|
splitLine: {
|
|
|
|
|
|
show: false
|
|
|
|
|
|
},
|
|
|
|
|
|
axisLabel: {
|
|
|
|
|
|
show: false
|
|
|
|
|
|
},
|
|
|
|
|
|
min: 1,
|
|
|
|
|
|
max: 'dataMax'
|
|
|
|
|
|
},
|
|
|
|
|
|
yAxis: {
|
|
|
|
|
|
type: 'value',
|
|
|
|
|
|
axisLine: {
|
|
|
|
|
|
show: false
|
|
|
|
|
|
},
|
|
|
|
|
|
splitLine: {
|
|
|
|
|
|
show: false
|
|
|
|
|
|
},
|
|
|
|
|
|
axisLabel: {
|
|
|
|
|
|
show: false
|
|
|
|
|
|
},
|
2023-09-06 19:30:02 +08:00
|
|
|
|
min: 0.1,
|
|
|
|
|
|
max: 'dataMax'
|
2023-08-28 19:52:35 +08:00
|
|
|
|
},
|
2023-09-06 19:30:02 +08:00
|
|
|
|
series: null
|
2023-08-28 19:52:35 +08:00
|
|
|
|
}
|
2023-09-11 18:59:08 +08:00
|
|
|
|
|
2023-09-25 14:55:51 +08:00
|
|
|
|
const nuclideIdentifyModal = {
|
|
|
|
|
|
possibleNuclide: '',
|
|
|
|
|
|
tolerance: 0.5,
|
|
|
|
|
|
identifiedNuclide: ''
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-11 18:59:08 +08:00
|
|
|
|
// 操作类型
|
|
|
|
|
|
export const Operators = {
|
|
|
|
|
|
ADD: 1, // 新增
|
|
|
|
|
|
REMOVE: 2, // 移除
|
2023-09-12 19:42:36 +08:00
|
|
|
|
MODIFY: 3, // 改变
|
|
|
|
|
|
SLOPE_CHANGE: 4 // 改变slope
|
2023-09-11 18:59:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-07-11 19:35:18 +08:00
|
|
|
|
export default {
|
2023-09-04 19:40:13 +08:00
|
|
|
|
mixins: [ModalMixin, SampleDataMixin],
|
2023-07-11 19:35:18 +08:00
|
|
|
|
components: {
|
|
|
|
|
|
CustomChart,
|
2023-07-24 19:26:46 +08:00
|
|
|
|
TitleOverBorder,
|
2023-09-07 19:29:59 +08:00
|
|
|
|
PeakCommentModal,
|
2023-07-11 19:35:18 +08:00
|
|
|
|
FitPeaksAndBaseLineModal,
|
2023-09-07 19:29:59 +08:00
|
|
|
|
NuclideReviewModal,
|
2023-09-12 19:42:36 +08:00
|
|
|
|
GeneralCommentModal,
|
|
|
|
|
|
EditSlopeModal
|
2023-07-11 19:35:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
this.columns = columns
|
|
|
|
|
|
return {
|
2023-08-28 19:52:35 +08:00
|
|
|
|
option: cloneDeep(initialOption),
|
|
|
|
|
|
opts: { notMerge: false },
|
|
|
|
|
|
thumbnailOption: cloneDeep(thumbnailOption),
|
|
|
|
|
|
|
|
|
|
|
|
isLoading: false,
|
2023-09-06 19:30:02 +08:00
|
|
|
|
|
|
|
|
|
|
channelBaseCPChart: [],
|
|
|
|
|
|
channelBaseLineChart: [],
|
|
|
|
|
|
channelCountChart: [],
|
|
|
|
|
|
channelPeakChart: [],
|
|
|
|
|
|
energy: [],
|
2023-07-12 19:56:41 +08:00
|
|
|
|
list: [],
|
2023-09-12 19:42:36 +08:00
|
|
|
|
BaseCtrls: {},
|
2023-09-25 14:55:51 +08:00
|
|
|
|
FitBaseLine: '#fff',
|
2023-09-04 19:40:13 +08:00
|
|
|
|
sampleId: -1,
|
2023-08-28 19:52:35 +08:00
|
|
|
|
|
2023-09-07 19:29:59 +08:00
|
|
|
|
peakCommentModalVisible: false, // Comment 弹窗是否显示
|
|
|
|
|
|
generalCommentModalVisible: false, // Comment 弹窗是否显示
|
2023-07-11 19:35:18 +08:00
|
|
|
|
|
|
|
|
|
|
btnGroupType: 1, // 右侧 Peak 中的按钮组切换
|
|
|
|
|
|
|
|
|
|
|
|
selectedKeys: [], // 选中的列表
|
|
|
|
|
|
|
|
|
|
|
|
fitPeaksAndBaselineModalVisible: false, // Fit Peaks And Base Line 弹窗
|
2023-08-29 19:54:09 +08:00
|
|
|
|
nuclideReviewModalVisible: false, // Nuclide Review 弹窗
|
|
|
|
|
|
|
2023-09-25 14:55:51 +08:00
|
|
|
|
model: cloneDeep(nuclideIdentifyModal),
|
2023-09-04 19:40:13 +08:00
|
|
|
|
|
|
|
|
|
|
currChannel: undefined, // 当currChannel前选中的channel
|
2023-09-06 19:30:02 +08:00
|
|
|
|
selectedTableItem: undefined, // 当前选中的表格项
|
|
|
|
|
|
|
2023-09-11 18:59:08 +08:00
|
|
|
|
isModifying: false, // 正在修改控制点
|
2023-09-13 19:42:28 +08:00
|
|
|
|
isFitting: false, // 正在进行Fit操作
|
|
|
|
|
|
firstFittingChannel: null, // Fit操作时点击的第一个channel
|
2023-09-11 18:59:08 +08:00
|
|
|
|
|
|
|
|
|
|
operationStack: [] // 操作记录
|
2023-09-06 19:30:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
created() {
|
|
|
|
|
|
this.option.tooltip.formatter = params => {
|
|
|
|
|
|
const channel = parseInt(params[0].value[0])
|
|
|
|
|
|
const energy = this.energy[channel - 1]
|
|
|
|
|
|
return `<div class="channel">Channel: ${channel}</div>
|
|
|
|
|
|
<div class="energy">Energy: ${energy.toFixed(2)}</div>`
|
2023-07-11 19:35:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2023-08-15 18:23:22 +08:00
|
|
|
|
async getInfo() {
|
|
|
|
|
|
try {
|
2023-08-28 19:52:35 +08:00
|
|
|
|
this.isLoading = true
|
|
|
|
|
|
this.option.series = []
|
2023-09-25 14:55:51 +08:00
|
|
|
|
this.thumbnailOption.series = []
|
|
|
|
|
|
this.list = []
|
|
|
|
|
|
this.model = cloneDeep(nuclideIdentifyModal)
|
2023-08-28 19:52:35 +08:00
|
|
|
|
|
2023-09-06 19:30:02 +08:00
|
|
|
|
const { success, result, message } = await getAction('/gamma/InteractiveTool', {
|
|
|
|
|
|
sampleId: this.sampleId,
|
|
|
|
|
|
fileName: this.fileName
|
|
|
|
|
|
})
|
2023-09-12 19:42:36 +08:00
|
|
|
|
|
2023-09-13 19:42:28 +08:00
|
|
|
|
// const { success, result, message } = Response
|
|
|
|
|
|
|
2023-08-15 18:23:22 +08:00
|
|
|
|
if (success) {
|
2023-09-06 19:30:02 +08:00
|
|
|
|
this.isLoading = false
|
2023-08-28 19:52:35 +08:00
|
|
|
|
const {
|
|
|
|
|
|
barChart,
|
|
|
|
|
|
channelBaseCPChart,
|
|
|
|
|
|
channelBaseLineChart,
|
|
|
|
|
|
channelCountChart,
|
|
|
|
|
|
channelPeakChart,
|
2023-09-06 19:30:02 +08:00
|
|
|
|
energy,
|
2023-09-12 19:42:36 +08:00
|
|
|
|
table,
|
2023-09-25 14:55:51 +08:00
|
|
|
|
BaseCtrls,
|
|
|
|
|
|
FitBaseLine
|
2023-08-28 19:52:35 +08:00
|
|
|
|
} = result
|
|
|
|
|
|
|
|
|
|
|
|
console.log('%c [ ]-374', 'font-size:13px; background:pink; color:#bf2c9f;', result)
|
|
|
|
|
|
|
2023-09-05 19:06:19 +08:00
|
|
|
|
this.channelBaseCPChart = channelBaseCPChart
|
2023-09-06 19:30:02 +08:00
|
|
|
|
this.channelBaseLineChart = channelBaseLineChart
|
|
|
|
|
|
this.channelCountChart = channelCountChart
|
|
|
|
|
|
this.channelPeakChart = channelPeakChart
|
|
|
|
|
|
this.energy = energy
|
2023-09-12 19:42:36 +08:00
|
|
|
|
this.BaseCtrls = BaseCtrls
|
2023-09-25 14:55:51 +08:00
|
|
|
|
this.FitBaseLine = FitBaseLine
|
2023-08-28 19:52:35 +08:00
|
|
|
|
|
|
|
|
|
|
const series = []
|
|
|
|
|
|
|
|
|
|
|
|
// 推入BaseLine
|
2023-09-12 19:42:36 +08:00
|
|
|
|
series.push(
|
|
|
|
|
|
buildLineSeries(
|
2023-08-28 19:52:35 +08:00
|
|
|
|
'BaseLine',
|
|
|
|
|
|
channelBaseLineChart.pointlist.map(({ x, y }) => [x, y]),
|
2023-09-13 19:42:28 +08:00
|
|
|
|
channelBaseLineChart.color,
|
2023-09-12 19:42:36 +08:00
|
|
|
|
{
|
|
|
|
|
|
markLine: {
|
|
|
|
|
|
silent: true,
|
|
|
|
|
|
symbol: 'none',
|
|
|
|
|
|
label: {
|
|
|
|
|
|
show: false
|
|
|
|
|
|
},
|
|
|
|
|
|
lineStyle: {
|
|
|
|
|
|
color: 'red',
|
|
|
|
|
|
width: 1
|
|
|
|
|
|
},
|
|
|
|
|
|
data: [{ xAxis: -1 }]
|
|
|
|
|
|
},
|
|
|
|
|
|
zlevel: 10
|
|
|
|
|
|
}
|
|
|
|
|
|
)
|
|
|
|
|
|
)
|
2023-08-28 19:52:35 +08:00
|
|
|
|
|
|
|
|
|
|
// 推入Count
|
|
|
|
|
|
series.push(
|
2023-09-12 19:42:36 +08:00
|
|
|
|
buildLineSeries(
|
2023-08-28 19:52:35 +08:00
|
|
|
|
'CountChart',
|
|
|
|
|
|
channelCountChart.pointlist.map(({ x, y }) => [x, y]),
|
2023-09-13 19:42:28 +08:00
|
|
|
|
channelCountChart.color
|
2023-08-28 19:52:35 +08:00
|
|
|
|
)
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// 推入Peak
|
|
|
|
|
|
const peakSeries = []
|
|
|
|
|
|
channelPeakChart.forEach((item, index) => {
|
|
|
|
|
|
peakSeries.push(
|
2023-09-12 19:42:36 +08:00
|
|
|
|
buildLineSeries(
|
2023-08-28 19:52:35 +08:00
|
|
|
|
'Peak_' + (index + 1),
|
|
|
|
|
|
item.pointlist.map(({ x, y }) => [x, y]),
|
2023-09-13 19:42:28 +08:00
|
|
|
|
item.color
|
2023-08-28 19:52:35 +08:00
|
|
|
|
)
|
|
|
|
|
|
)
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
series.push(...peakSeries)
|
|
|
|
|
|
|
|
|
|
|
|
// 推入基线控制点
|
|
|
|
|
|
series.push({
|
|
|
|
|
|
name: 'BaseLine_Ctrl_Point',
|
|
|
|
|
|
type: 'scatter',
|
2023-09-14 19:49:32 +08:00
|
|
|
|
data: this.buildCPPointData(channelBaseCPChart),
|
2023-09-05 19:06:19 +08:00
|
|
|
|
silent: true,
|
2023-08-28 19:52:35 +08:00
|
|
|
|
animation: false,
|
|
|
|
|
|
zlevel: 20
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2023-09-12 19:42:36 +08:00
|
|
|
|
this.thumbnailOption.series = buildLineSeries(
|
2023-09-06 19:30:02 +08:00
|
|
|
|
'BarChart',
|
|
|
|
|
|
barChart.map(({ x, y }) => [x, y]),
|
|
|
|
|
|
'#fff',
|
|
|
|
|
|
{
|
|
|
|
|
|
silent: true
|
|
|
|
|
|
}
|
2023-08-28 19:52:35 +08:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
this.list = table
|
|
|
|
|
|
this.option.series = series
|
2023-08-15 18:23:22 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(message)
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error(error)
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2023-09-13 19:42:28 +08:00
|
|
|
|
reset() {
|
2023-09-04 19:40:13 +08:00
|
|
|
|
this.currChannel = undefined
|
|
|
|
|
|
this.btnGroupType = 1
|
2023-08-28 19:52:35 +08:00
|
|
|
|
this.opts.notMerge = false
|
2023-09-13 19:42:28 +08:00
|
|
|
|
this.isFitting = false
|
2023-08-28 19:52:35 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.option.brush = { toolbox: [] }
|
|
|
|
|
|
this.selectedKeys = []
|
|
|
|
|
|
})
|
2023-09-14 19:49:32 +08:00
|
|
|
|
this.removeGraphics()
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 清空graphic(小方块和加号)
|
|
|
|
|
|
removeGraphics() {
|
|
|
|
|
|
this.option.graphic[0].children = []
|
|
|
|
|
|
this.option.graphic[1].children = []
|
2023-08-28 19:52:35 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
2023-09-13 19:42:28 +08:00
|
|
|
|
beforeModalOpen() {
|
|
|
|
|
|
const { sampleId, inputFileName } = this.sampleData
|
|
|
|
|
|
this.sampleId = sampleId
|
|
|
|
|
|
this.fileName = inputFileName
|
|
|
|
|
|
|
|
|
|
|
|
this.getInfo()
|
|
|
|
|
|
this.reset()
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2023-08-28 19:52:35 +08:00
|
|
|
|
// 点击图表,设置红线,改变表格的选中项
|
|
|
|
|
|
handleChartClick(param) {
|
|
|
|
|
|
const { offsetX, offsetY } = param
|
|
|
|
|
|
const point = getXAxisAndYAxisByPosition(this.$refs.chartRef.getChartInstance(), offsetX, offsetY)
|
|
|
|
|
|
if (point) {
|
|
|
|
|
|
const xAxis = parseInt(point[0].toFixed())
|
|
|
|
|
|
this.option.series[0].markLine.data[0].xAxis = xAxis
|
|
|
|
|
|
|
2023-09-04 19:40:13 +08:00
|
|
|
|
this.currChannel = xAxis
|
|
|
|
|
|
|
2023-08-28 19:52:35 +08:00
|
|
|
|
// 获取每一段 Channel 中的最大值
|
|
|
|
|
|
const maxXAxises = this.getPeakMaxValues()
|
|
|
|
|
|
|
|
|
|
|
|
let index = 0
|
|
|
|
|
|
// 计算当前选中的xAxis跟哪条 peak的最大值 最近
|
|
|
|
|
|
if (xAxis >= maxXAxises[maxXAxises.length - 1]) {
|
|
|
|
|
|
index = maxXAxises.length - 1
|
|
|
|
|
|
} else if (xAxis <= maxXAxises[0]) {
|
|
|
|
|
|
index = 0
|
|
|
|
|
|
} else {
|
|
|
|
|
|
for (let i = 1; i < maxXAxises.length; i++) {
|
|
|
|
|
|
const prev = maxXAxises[i - 1]
|
|
|
|
|
|
const curr = maxXAxises[i]
|
|
|
|
|
|
|
|
|
|
|
|
if (xAxis >= prev && xAxis <= curr) {
|
|
|
|
|
|
index = xAxis - prev < curr - xAxis ? i - 1 : i
|
|
|
|
|
|
break
|
|
|
|
|
|
}
|
|
|
|
|
|
continue
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-09-04 19:40:13 +08:00
|
|
|
|
|
|
|
|
|
|
const selectedRow = this.list[index]
|
|
|
|
|
|
|
|
|
|
|
|
this.selectedKeys = [selectedRow.index]
|
|
|
|
|
|
|
|
|
|
|
|
this.getSelPosNuclide(selectedRow)
|
2023-09-12 19:42:36 +08:00
|
|
|
|
|
|
|
|
|
|
this.selectedTableItem = selectedRow
|
2023-09-13 19:42:28 +08:00
|
|
|
|
|
|
|
|
|
|
// 如果点击了Fit按钮
|
|
|
|
|
|
if (this.isFitting) {
|
|
|
|
|
|
this.handleFittingChannel(xAxis)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 处理Fit中的两个channel
|
|
|
|
|
|
handleFittingChannel(channel) {
|
|
|
|
|
|
// 第一个channel存在,又点了一次,则是第二次点击
|
|
|
|
|
|
if (this.firstFittingChannel !== null) {
|
|
|
|
|
|
// 查找两个channel之间的Peak峰
|
|
|
|
|
|
|
|
|
|
|
|
let left = this.firstFittingChannel
|
|
|
|
|
|
let right = channel
|
|
|
|
|
|
if (left > right) {
|
|
|
|
|
|
right = left
|
|
|
|
|
|
left = channel
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const peaksBetweenChannel = this.list.filter(peak => {
|
|
|
|
|
|
const centroidId = peak.peakCentroid
|
|
|
|
|
|
return centroidId >= left && centroidId <= right
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if (!peaksBetweenChannel.length) {
|
|
|
|
|
|
this.$message.warn(`There are 0 peak between channel ${left} and ${right}`)
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.fitPeaksAndBaselineModalVisible = true
|
|
|
|
|
|
|
|
|
|
|
|
this.isFitting = false
|
|
|
|
|
|
this.firstFittingChannel = null
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.firstFittingChannel = channel
|
2023-08-28 19:52:35 +08:00
|
|
|
|
}
|
2023-08-15 18:23:22 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
2023-08-28 19:52:35 +08:00
|
|
|
|
// 切换图表上的红色竖线及表格选中
|
2023-07-12 19:56:41 +08:00
|
|
|
|
handleChangeMarkLine(direction) {
|
2023-08-28 19:52:35 +08:00
|
|
|
|
const markLineOption = this.option.series[0].markLine.data[0]
|
|
|
|
|
|
const prevAxis = markLineOption.xAxis
|
|
|
|
|
|
|
|
|
|
|
|
// 获取每一段 Channel 中的最大值
|
|
|
|
|
|
const maxXAxises = this.getPeakMaxValues()
|
|
|
|
|
|
if (direction == 'next') {
|
|
|
|
|
|
// 找到第一个比prevAxis大的xAxis
|
|
|
|
|
|
const find = maxXAxises.find(xAxis => xAxis > prevAxis)
|
|
|
|
|
|
if (find) {
|
|
|
|
|
|
markLineOption.xAxis = find
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (direction == 'prev') {
|
|
|
|
|
|
// 找到第一个比prevAxis小的xAxis
|
|
|
|
|
|
const find = cloneDeep(maxXAxises)
|
|
|
|
|
|
.reverse()
|
|
|
|
|
|
.find(xAxis => xAxis < prevAxis)
|
|
|
|
|
|
if (find) {
|
|
|
|
|
|
markLineOption.xAxis = find
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const xAxis = markLineOption.xAxis
|
|
|
|
|
|
if (xAxis >= 0) {
|
|
|
|
|
|
const index = maxXAxises.findIndex(item => item == xAxis)
|
|
|
|
|
|
if (index !== -1) {
|
|
|
|
|
|
this.selectedKeys = [this.list[index].index]
|
|
|
|
|
|
}
|
2023-07-12 19:56:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2023-08-28 19:52:35 +08:00
|
|
|
|
|
2023-09-04 19:40:13 +08:00
|
|
|
|
// 获取右下角possible nuclide 和 identified nuclide
|
|
|
|
|
|
async getSelPosNuclide(row) {
|
|
|
|
|
|
this.model.possibleNuclide = ''
|
|
|
|
|
|
this.model.identifiedNuclide = ''
|
|
|
|
|
|
|
|
|
|
|
|
if (!row._possible) {
|
2023-09-08 18:43:49 +08:00
|
|
|
|
this.$set(row, '_loading', true)
|
2023-09-04 19:40:13 +08:00
|
|
|
|
try {
|
|
|
|
|
|
const { success, result, message } = await getAction('/gamma/getSelPosNuclide', {
|
|
|
|
|
|
sampleId: this.sampleId,
|
|
|
|
|
|
channel: parseInt(row.peakCentroid),
|
|
|
|
|
|
fileName: this.fileName
|
|
|
|
|
|
})
|
|
|
|
|
|
if (success) {
|
|
|
|
|
|
const { possible } = result
|
|
|
|
|
|
this.$set(row, '_possible', possible)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(message)
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error(error)
|
2023-09-08 18:43:49 +08:00
|
|
|
|
} finally {
|
|
|
|
|
|
row._loading = false
|
2023-09-04 19:40:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2023-08-28 19:52:35 +08:00
|
|
|
|
// 获取每一段 Channel 中的最大值
|
|
|
|
|
|
getPeakMaxValues() {
|
|
|
|
|
|
const maxXAxises = this.channelPeakChart.map(item => {
|
|
|
|
|
|
const allY = item.pointlist.map(point => point.y)
|
|
|
|
|
|
const max = item.pointlist.find(point => point.y == Math.max(...allY))
|
|
|
|
|
|
return max.x
|
|
|
|
|
|
})
|
|
|
|
|
|
return maxXAxises
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2023-09-07 19:29:59 +08:00
|
|
|
|
// 显示peak comment弹窗
|
2023-09-08 18:43:49 +08:00
|
|
|
|
handleAddPeakComment() {
|
2023-09-07 19:29:59 +08:00
|
|
|
|
if (!this.selectedKeys.length) {
|
2023-09-05 19:06:19 +08:00
|
|
|
|
this.$message.warn('Please Select a Peak that You Want to Add Comment!')
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
2023-09-07 19:29:59 +08:00
|
|
|
|
this.peakCommentModalVisible = true
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 显示general comment弹窗
|
|
|
|
|
|
handleAddGeneralComment() {
|
|
|
|
|
|
this.generalCommentModalVisible = true
|
2023-07-11 19:35:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
2023-08-29 19:54:09 +08:00
|
|
|
|
// Insert按钮
|
|
|
|
|
|
handleInsert() {
|
2023-09-13 19:42:28 +08:00
|
|
|
|
this.isFitting = false
|
|
|
|
|
|
|
2023-09-05 19:06:19 +08:00
|
|
|
|
const xAxises = this.channelBaseCPChart.map(({ point: { x } }) => x)
|
|
|
|
|
|
const min = xAxises[0]
|
|
|
|
|
|
const max = xAxises[xAxises.length - 1]
|
|
|
|
|
|
if (!this.currChannel || this.currChannel < min || this.currChannel > max) {
|
|
|
|
|
|
this.$message.warn("Couldn't insert peak, maybe out of range")
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-08-29 19:54:09 +08:00
|
|
|
|
this.fitPeaksAndBaselineModalVisible = true
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2023-09-06 19:30:02 +08:00
|
|
|
|
// 点击 Fit Peak XXX 弹窗中的 Peaks 按钮
|
|
|
|
|
|
handleInsertSuccess(result) {
|
|
|
|
|
|
const {
|
|
|
|
|
|
allData,
|
|
|
|
|
|
barChart,
|
|
|
|
|
|
channelBaseLineChart,
|
|
|
|
|
|
channelPeakChart,
|
|
|
|
|
|
shadowChannelChart,
|
|
|
|
|
|
shadowEnergyChart,
|
|
|
|
|
|
shapeChannelData,
|
|
|
|
|
|
shapeEnergyData,
|
|
|
|
|
|
table
|
|
|
|
|
|
} = result
|
|
|
|
|
|
|
2023-09-14 19:49:32 +08:00
|
|
|
|
this.$bus.$emit('refresh', {
|
2023-09-06 19:30:02 +08:00
|
|
|
|
allData,
|
|
|
|
|
|
channelPeakChart,
|
|
|
|
|
|
shadowChannelChart,
|
|
|
|
|
|
shadowEnergyChart,
|
|
|
|
|
|
shapeChannelData,
|
|
|
|
|
|
shapeEnergyData
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
this.channelPeakChart = channelPeakChart
|
|
|
|
|
|
this.channelBaseLineChart = channelBaseLineChart
|
|
|
|
|
|
|
|
|
|
|
|
const series = []
|
|
|
|
|
|
|
|
|
|
|
|
// 推入BaseLine
|
2023-09-12 19:42:36 +08:00
|
|
|
|
series.push(
|
|
|
|
|
|
buildLineSeries(
|
2023-09-06 19:30:02 +08:00
|
|
|
|
'BaseLine',
|
|
|
|
|
|
channelBaseLineChart.pointlist.map(({ x, y }) => [x, y]),
|
2023-09-13 19:42:28 +08:00
|
|
|
|
channelBaseLineChart.color,
|
2023-09-12 19:42:36 +08:00
|
|
|
|
{
|
|
|
|
|
|
markLine: {
|
|
|
|
|
|
silent: true,
|
|
|
|
|
|
symbol: 'none',
|
|
|
|
|
|
label: {
|
|
|
|
|
|
show: false
|
|
|
|
|
|
},
|
|
|
|
|
|
lineStyle: {
|
|
|
|
|
|
color: 'red',
|
|
|
|
|
|
width: 1
|
|
|
|
|
|
},
|
|
|
|
|
|
data: [{ xAxis: -1 }]
|
|
|
|
|
|
},
|
|
|
|
|
|
zlevel: 10
|
|
|
|
|
|
}
|
|
|
|
|
|
)
|
|
|
|
|
|
)
|
2023-09-06 19:30:02 +08:00
|
|
|
|
|
|
|
|
|
|
// 推入旧的Count
|
|
|
|
|
|
series.push(
|
2023-09-12 19:42:36 +08:00
|
|
|
|
buildLineSeries(
|
2023-09-06 19:30:02 +08:00
|
|
|
|
'CountChart',
|
|
|
|
|
|
this.channelCountChart.pointlist.map(({ x, y }) => [x, y]),
|
2023-09-13 19:42:28 +08:00
|
|
|
|
this.channelCountChart.color
|
2023-09-06 19:30:02 +08:00
|
|
|
|
)
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// 推入Peak
|
|
|
|
|
|
const peakSeries = []
|
|
|
|
|
|
channelPeakChart.forEach((item, index) => {
|
|
|
|
|
|
peakSeries.push(
|
2023-09-12 19:42:36 +08:00
|
|
|
|
buildLineSeries(
|
2023-09-06 19:30:02 +08:00
|
|
|
|
'Peak_' + (index + 1),
|
|
|
|
|
|
item.pointlist.map(({ x, y }) => [x, y]),
|
2023-09-13 19:42:28 +08:00
|
|
|
|
item.color
|
2023-09-06 19:30:02 +08:00
|
|
|
|
)
|
|
|
|
|
|
)
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
series.push(...peakSeries)
|
|
|
|
|
|
|
|
|
|
|
|
// 推入旧的基线控制点
|
|
|
|
|
|
series.push({
|
|
|
|
|
|
name: 'BaseLine_Ctrl_Point',
|
|
|
|
|
|
type: 'scatter',
|
|
|
|
|
|
data: this.channelBaseCPChart.map(({ size, color, point: { x, y } }) => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
value: [x, y],
|
|
|
|
|
|
itemStyle: {
|
|
|
|
|
|
color: 'transparent',
|
|
|
|
|
|
borderColor: color,
|
|
|
|
|
|
borderWidth: size / 2
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}),
|
|
|
|
|
|
silent: true,
|
|
|
|
|
|
animation: false,
|
|
|
|
|
|
zlevel: 20
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2023-09-12 19:42:36 +08:00
|
|
|
|
this.thumbnailOption.series = buildLineSeries(
|
2023-09-06 19:30:02 +08:00
|
|
|
|
'BarChart',
|
|
|
|
|
|
barChart.map(({ x, y }) => [x, y]),
|
|
|
|
|
|
'#fff',
|
|
|
|
|
|
{
|
|
|
|
|
|
silent: true
|
|
|
|
|
|
}
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
this.list = table
|
|
|
|
|
|
this.option.series = series
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 点击 Fit Peak XXX 弹窗中的 Cancel 按钮
|
|
|
|
|
|
handleCancelSuccess(result) {
|
|
|
|
|
|
const { channelPeakChart, table } = result
|
|
|
|
|
|
this.channelPeakChart = channelPeakChart
|
|
|
|
|
|
const series = []
|
|
|
|
|
|
|
|
|
|
|
|
// 推入旧的BaseLine
|
2023-09-12 19:42:36 +08:00
|
|
|
|
series.push(
|
|
|
|
|
|
buildLineSeries(
|
2023-09-06 19:30:02 +08:00
|
|
|
|
'BaseLine',
|
|
|
|
|
|
this.channelBaseLineChart.pointlist.map(({ x, y }) => [x, y]),
|
2023-09-13 19:42:28 +08:00
|
|
|
|
this.channelBaseLineChart.color,
|
2023-09-12 19:42:36 +08:00
|
|
|
|
{
|
|
|
|
|
|
markLine: {
|
|
|
|
|
|
silent: true,
|
|
|
|
|
|
symbol: 'none',
|
|
|
|
|
|
label: {
|
|
|
|
|
|
show: false
|
|
|
|
|
|
},
|
|
|
|
|
|
lineStyle: {
|
|
|
|
|
|
color: 'red',
|
|
|
|
|
|
width: 1
|
|
|
|
|
|
},
|
|
|
|
|
|
data: [{ xAxis: -1 }]
|
|
|
|
|
|
},
|
|
|
|
|
|
zlevel: 10
|
|
|
|
|
|
}
|
|
|
|
|
|
)
|
|
|
|
|
|
)
|
2023-09-06 19:30:02 +08:00
|
|
|
|
|
|
|
|
|
|
// 推入旧的Count
|
|
|
|
|
|
series.push(
|
2023-09-12 19:42:36 +08:00
|
|
|
|
buildLineSeries(
|
2023-09-06 19:30:02 +08:00
|
|
|
|
'CountChart',
|
|
|
|
|
|
this.channelCountChart.pointlist.map(({ x, y }) => [x, y]),
|
2023-09-13 19:42:28 +08:00
|
|
|
|
this.channelCountChart.color
|
2023-09-06 19:30:02 +08:00
|
|
|
|
)
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// 推入Peak
|
|
|
|
|
|
const peakSeries = []
|
|
|
|
|
|
channelPeakChart.forEach((item, index) => {
|
|
|
|
|
|
peakSeries.push(
|
2023-09-12 19:42:36 +08:00
|
|
|
|
buildLineSeries(
|
2023-09-06 19:30:02 +08:00
|
|
|
|
'Peak_' + (index + 1),
|
|
|
|
|
|
item.pointlist.map(({ x, y }) => [x, y]),
|
2023-09-13 19:42:28 +08:00
|
|
|
|
item.color
|
2023-09-06 19:30:02 +08:00
|
|
|
|
)
|
|
|
|
|
|
)
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
series.push(...peakSeries)
|
|
|
|
|
|
|
|
|
|
|
|
// 推入旧的基线控制点
|
|
|
|
|
|
series.push({
|
|
|
|
|
|
name: 'BaseLine_Ctrl_Point',
|
|
|
|
|
|
type: 'scatter',
|
|
|
|
|
|
data: this.channelBaseCPChart.map(({ size, color, point: { x, y } }) => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
value: [x, y],
|
|
|
|
|
|
itemStyle: {
|
|
|
|
|
|
color: 'transparent',
|
|
|
|
|
|
borderColor: color,
|
|
|
|
|
|
borderWidth: size / 2
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}),
|
|
|
|
|
|
silent: true,
|
|
|
|
|
|
animation: false,
|
|
|
|
|
|
zlevel: 20
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
this.list = table
|
|
|
|
|
|
this.option.series = series
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2023-07-11 19:35:18 +08:00
|
|
|
|
// 删除
|
|
|
|
|
|
handleDel() {
|
2023-09-13 19:42:28 +08:00
|
|
|
|
this.isFitting = false
|
|
|
|
|
|
|
2023-07-11 19:35:18 +08:00
|
|
|
|
if (!this.selectedKeys.length) {
|
2023-08-28 19:52:35 +08:00
|
|
|
|
this.$message.warn('No peak to delete.')
|
2023-07-11 19:35:18 +08:00
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-13 19:42:28 +08:00
|
|
|
|
this.$confirm({
|
2023-07-11 19:35:18 +08:00
|
|
|
|
title: 'Warning',
|
|
|
|
|
|
content: 'Are you sure to delete this peak?',
|
2023-09-13 19:42:28 +08:00
|
|
|
|
cancelButtonProps: {
|
|
|
|
|
|
props: {
|
|
|
|
|
|
type: 'warn'
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2023-09-06 19:30:02 +08:00
|
|
|
|
onOk: async () => {
|
|
|
|
|
|
// this.list.splice(findIndex, 1)
|
|
|
|
|
|
// this.selectedKeys = []
|
|
|
|
|
|
|
|
|
|
|
|
// const seriesIndex = this.option.series.findIndex(item => {
|
|
|
|
|
|
// return item.name == 'Peak_' + willDelKey
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
|
|
// this.opts.notMerge = true
|
|
|
|
|
|
// this.option.series.splice(seriesIndex, 1)
|
|
|
|
|
|
// this.channelPeakChart.splice(findIndex, 1)
|
|
|
|
|
|
|
|
|
|
|
|
// this.$nextTick(() => {
|
|
|
|
|
|
// this.resetChartOpts()
|
|
|
|
|
|
// })
|
|
|
|
|
|
try {
|
|
|
|
|
|
const { inputFileName: fileName } = this.sampleData
|
|
|
|
|
|
const { success, result, message } = await getAction('/gamma/deletePeak', {
|
|
|
|
|
|
fileName,
|
2023-09-08 18:43:49 +08:00
|
|
|
|
curRow: this.curRow
|
2023-09-06 19:30:02 +08:00
|
|
|
|
})
|
|
|
|
|
|
if (success) {
|
|
|
|
|
|
const {
|
|
|
|
|
|
allData,
|
|
|
|
|
|
channelPeakChart,
|
|
|
|
|
|
shadowChannelChart,
|
|
|
|
|
|
shadowEnergyChart,
|
|
|
|
|
|
shapeChannelData,
|
|
|
|
|
|
shapeEnergyData,
|
|
|
|
|
|
table
|
|
|
|
|
|
} = result
|
|
|
|
|
|
|
2023-09-14 19:49:32 +08:00
|
|
|
|
this.$bus.$emit('refresh', {
|
2023-09-06 19:30:02 +08:00
|
|
|
|
allData,
|
|
|
|
|
|
channelPeakChart,
|
|
|
|
|
|
shadowChannelChart,
|
|
|
|
|
|
shadowEnergyChart,
|
|
|
|
|
|
shapeChannelData,
|
|
|
|
|
|
shapeEnergyData
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
this.channelPeakChart = channelPeakChart
|
|
|
|
|
|
const series = []
|
|
|
|
|
|
// 推入旧的BaseLine
|
2023-09-12 19:42:36 +08:00
|
|
|
|
series.push(
|
|
|
|
|
|
buildLineSeries(
|
2023-09-06 19:30:02 +08:00
|
|
|
|
'BaseLine',
|
|
|
|
|
|
this.channelBaseLineChart.pointlist.map(({ x, y }) => [x, y]),
|
2023-09-13 19:42:28 +08:00
|
|
|
|
this.channelBaseLineChart.color,
|
2023-09-12 19:42:36 +08:00
|
|
|
|
{
|
|
|
|
|
|
markLine: {
|
|
|
|
|
|
silent: true,
|
|
|
|
|
|
symbol: 'none',
|
|
|
|
|
|
label: {
|
|
|
|
|
|
show: false
|
|
|
|
|
|
},
|
|
|
|
|
|
lineStyle: {
|
|
|
|
|
|
color: 'red',
|
|
|
|
|
|
width: 1
|
|
|
|
|
|
},
|
|
|
|
|
|
data: [{ xAxis: -1 }]
|
|
|
|
|
|
},
|
|
|
|
|
|
zlevel: 10
|
|
|
|
|
|
}
|
|
|
|
|
|
)
|
|
|
|
|
|
)
|
2023-09-06 19:30:02 +08:00
|
|
|
|
|
|
|
|
|
|
// 推入旧的Count
|
|
|
|
|
|
series.push(
|
2023-09-12 19:42:36 +08:00
|
|
|
|
buildLineSeries(
|
2023-09-06 19:30:02 +08:00
|
|
|
|
'CountChart',
|
|
|
|
|
|
this.channelCountChart.pointlist.map(({ x, y }) => [x, y]),
|
2023-09-13 19:42:28 +08:00
|
|
|
|
this.channelCountChart.color
|
2023-09-06 19:30:02 +08:00
|
|
|
|
)
|
|
|
|
|
|
)
|
2023-08-28 19:52:35 +08:00
|
|
|
|
|
2023-09-06 19:30:02 +08:00
|
|
|
|
// 推入Peak
|
|
|
|
|
|
const peakSeries = []
|
|
|
|
|
|
channelPeakChart.forEach((item, index) => {
|
|
|
|
|
|
peakSeries.push(
|
2023-09-12 19:42:36 +08:00
|
|
|
|
buildLineSeries(
|
2023-09-06 19:30:02 +08:00
|
|
|
|
'Peak_' + (index + 1),
|
|
|
|
|
|
item.pointlist.map(({ x, y }) => [x, y]),
|
2023-09-13 19:42:28 +08:00
|
|
|
|
item.color
|
2023-09-06 19:30:02 +08:00
|
|
|
|
)
|
|
|
|
|
|
)
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
series.push(...peakSeries)
|
|
|
|
|
|
|
|
|
|
|
|
// 推入旧的基线控制点
|
|
|
|
|
|
series.push({
|
|
|
|
|
|
name: 'BaseLine_Ctrl_Point',
|
|
|
|
|
|
type: 'scatter',
|
2023-09-14 19:49:32 +08:00
|
|
|
|
data: this.buildCPPointData(this.channelBaseCPChart),
|
2023-09-06 19:30:02 +08:00
|
|
|
|
silent: true,
|
|
|
|
|
|
animation: false,
|
|
|
|
|
|
zlevel: 20
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
this.list = table
|
|
|
|
|
|
this.option.series = series
|
2023-09-13 19:42:28 +08:00
|
|
|
|
|
|
|
|
|
|
this.selectedKeys = []
|
2023-09-06 19:30:02 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(message)
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error(error)
|
|
|
|
|
|
}
|
2023-08-28 19:52:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2023-09-05 19:06:19 +08:00
|
|
|
|
// 重置图表配置
|
|
|
|
|
|
resetChartOpts() {
|
|
|
|
|
|
this.opts.notMerge = false
|
|
|
|
|
|
this.option.brush = { toolbox: [] }
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2023-08-29 19:54:09 +08:00
|
|
|
|
// 匹配
|
|
|
|
|
|
handleFit() {
|
2023-09-13 19:42:28 +08:00
|
|
|
|
if (!this.channelPeakChart || !this.channelPeakChart.length) {
|
2023-08-29 19:54:09 +08:00
|
|
|
|
this.$message.warn('No peak to fit.')
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
2023-09-13 19:42:28 +08:00
|
|
|
|
|
|
|
|
|
|
this.isFitting = true
|
|
|
|
|
|
this.firstFittingChannel = null
|
2023-08-29 19:54:09 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
2023-08-28 19:52:35 +08:00
|
|
|
|
// 表格的行点击
|
2023-09-04 19:40:13 +08:00
|
|
|
|
handleTableRowClick(row) {
|
|
|
|
|
|
if (this.selectedTableItem == row) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const channel = row.peakCentroid
|
|
|
|
|
|
this.currChannel = channel
|
2023-08-28 19:52:35 +08:00
|
|
|
|
|
2023-09-04 19:40:13 +08:00
|
|
|
|
this.option.series[0].markLine.data[0].xAxis = channel
|
|
|
|
|
|
|
|
|
|
|
|
this.getSelPosNuclide(row)
|
|
|
|
|
|
|
|
|
|
|
|
this.selectedTableItem = row
|
2023-08-28 19:52:35 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 鼠标按下时开启可刷选状态
|
|
|
|
|
|
handleMouseDown() {
|
2023-09-06 19:30:02 +08:00
|
|
|
|
if (this.isModifying) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-08-28 19:52:35 +08:00
|
|
|
|
const chart = this.$refs.chartRef.getChartInstance()
|
|
|
|
|
|
chart.dispatchAction({
|
|
|
|
|
|
type: 'takeGlobalCursor',
|
|
|
|
|
|
// 如果想变为“可刷选状态”,必须设置。不设置则会关闭“可刷选状态”。
|
|
|
|
|
|
key: 'brush',
|
|
|
|
|
|
brushOption: {
|
|
|
|
|
|
// 参见 brush 组件的 brushType。如果设置为 false 则关闭“可刷选状态”。
|
|
|
|
|
|
brushType: 'rect'
|
2023-07-11 19:35:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
2023-08-29 19:54:09 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
2023-09-06 19:30:02 +08:00
|
|
|
|
handleMouseUp() {
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
const chart = this.$refs.chartRef.getChartInstance()
|
|
|
|
|
|
this.clearBrush(chart)
|
|
|
|
|
|
}, 0)
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
clearBrush(chart) {
|
|
|
|
|
|
// 清理刷选的范围
|
|
|
|
|
|
chart.dispatchAction({
|
|
|
|
|
|
type: 'brush',
|
|
|
|
|
|
areas: []
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// 改为不可刷选状态
|
|
|
|
|
|
chart.dispatchAction({
|
|
|
|
|
|
type: 'takeGlobalCursor'
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 刷选完毕时
|
|
|
|
|
|
handleBrushEnd(param) {
|
|
|
|
|
|
const chart = this.$refs.chartRef.getChartInstance()
|
|
|
|
|
|
const areas = param.areas[0]
|
|
|
|
|
|
if (areas) {
|
|
|
|
|
|
const range = areas.range
|
|
|
|
|
|
const [[minX, maxX], [minY, maxY]] = range
|
|
|
|
|
|
const point1 = chart.convertFromPixel({ seriesIndex: 0 }, [minX, minY]).map(num => parseInt(num.toFixed()))
|
|
|
|
|
|
const point2 = chart.convertFromPixel({ seriesIndex: 0 }, [maxX, maxY]).map(num => parseInt(num.toFixed()))
|
|
|
|
|
|
const xAxisMax = chart.getModel().getComponent('xAxis').axis.scale._extent[1]
|
|
|
|
|
|
const yAxisMax = this.option.yAxis.max
|
|
|
|
|
|
let [x1, y2, x2, y1] = [...point1, ...point2] // 根据解析出的数据确定真实的范围
|
|
|
|
|
|
const xAxisLimit = rangeNumber(1, xAxisMax)
|
|
|
|
|
|
const yAxisLimit = rangeNumber(0.1, yAxisMax)
|
|
|
|
|
|
x1 = xAxisLimit(x1)
|
|
|
|
|
|
x2 = xAxisLimit(x2)
|
|
|
|
|
|
y1 = yAxisLimit(y1)
|
|
|
|
|
|
y2 = yAxisLimit(y2)
|
|
|
|
|
|
this.option.xAxis.min = x1
|
|
|
|
|
|
this.option.xAxis.max = x2
|
|
|
|
|
|
this.option.yAxis.min = y1
|
|
|
|
|
|
this.option.yAxis.max = y2
|
|
|
|
|
|
|
|
|
|
|
|
this.thumbnailOption.xAxis.min = x1
|
|
|
|
|
|
this.thumbnailOption.xAxis.max = x2
|
|
|
|
|
|
this.thumbnailOption.yAxis.min = y1
|
|
|
|
|
|
this.thumbnailOption.yAxis.max = y2
|
|
|
|
|
|
|
|
|
|
|
|
if (this.btnGroupType == 2) {
|
2023-09-14 19:49:32 +08:00
|
|
|
|
this.buildGraphicRectByData()
|
|
|
|
|
|
this.buildGraphicPlusByData()
|
2023-09-06 19:30:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
this.clearBrush(chart)
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
handleResetChart() {
|
|
|
|
|
|
this.option.xAxis.min = 1
|
|
|
|
|
|
this.option.xAxis.max = 'dataMax'
|
|
|
|
|
|
this.option.yAxis.min = 0.1
|
|
|
|
|
|
this.option.yAxis.max = 'dataMax'
|
|
|
|
|
|
|
|
|
|
|
|
this.thumbnailOption.xAxis.min = 1
|
|
|
|
|
|
this.thumbnailOption.xAxis.max = 'dataMax'
|
|
|
|
|
|
this.thumbnailOption.yAxis.min = 0.1
|
|
|
|
|
|
this.thumbnailOption.yAxis.max = 'dataMax'
|
|
|
|
|
|
|
|
|
|
|
|
if (this.btnGroupType == 2) {
|
2023-09-14 19:49:32 +08:00
|
|
|
|
this.buildGraphicRectByData()
|
|
|
|
|
|
this.buildGraphicPlusByData()
|
2023-09-06 19:30:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2023-09-04 19:40:13 +08:00
|
|
|
|
// 切换操作
|
|
|
|
|
|
handleSwitchOperation() {
|
|
|
|
|
|
// 切换到Base Line 和 Control Point 操作
|
|
|
|
|
|
if (this.btnGroupType == 1) {
|
|
|
|
|
|
this.btnGroupType = 2
|
2023-09-14 19:49:32 +08:00
|
|
|
|
this._channelBaseCPChart = cloneDeep(this.channelBaseCPChart)
|
|
|
|
|
|
this._channelBaseLineChart = cloneDeep(this.channelBaseLineChart)
|
|
|
|
|
|
this._baseCtrls = cloneDeep(this.BaseCtrls)
|
2023-09-05 19:06:19 +08:00
|
|
|
|
|
2023-09-14 19:49:32 +08:00
|
|
|
|
// 供编辑的白色基线
|
|
|
|
|
|
const baseLineEditSeries = buildLineSeries(
|
|
|
|
|
|
'BaseLine_Edit',
|
|
|
|
|
|
this._channelBaseLineChart.pointlist.map(({ x, y }) => [x, y]),
|
2023-09-25 14:55:51 +08:00
|
|
|
|
this.FitBaseLine,
|
2023-09-14 19:49:32 +08:00
|
|
|
|
{
|
|
|
|
|
|
zlevel: 21
|
|
|
|
|
|
}
|
|
|
|
|
|
)
|
2023-09-05 19:06:19 +08:00
|
|
|
|
this.option.series.push(baseLineEditSeries)
|
|
|
|
|
|
|
2023-09-14 19:49:32 +08:00
|
|
|
|
this.buildGraphicRectByData()
|
|
|
|
|
|
this.buildGraphicPlusByData()
|
2023-09-04 19:40:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
// 切换回 Peak 操作
|
|
|
|
|
|
else {
|
|
|
|
|
|
this.btnGroupType = 1
|
2023-09-05 19:06:19 +08:00
|
|
|
|
this.opts.notMerge = true
|
2023-09-13 19:42:28 +08:00
|
|
|
|
this.option.series.splice(this.option.series.length - 1, 1) // 去掉白色的基线副本
|
2023-09-14 19:49:32 +08:00
|
|
|
|
this.removeGraphics()
|
|
|
|
|
|
|
|
|
|
|
|
const baseLineSeries = findSeriesByName(this.option.series, 'BaseLine')
|
|
|
|
|
|
baseLineSeries.data = this.channelBaseLineChart.pointlist.map(({ x, y }) => [x, y]) // 恢复基线
|
2023-09-13 19:42:28 +08:00
|
|
|
|
|
2023-09-14 19:49:32 +08:00
|
|
|
|
const baseLineCP = findSeriesByName(this.option.series, 'BaseLine_Ctrl_Point')
|
|
|
|
|
|
baseLineCP.data = this.buildCPPointData(this.channelBaseCPChart)
|
2023-09-13 19:42:28 +08:00
|
|
|
|
|
2023-09-05 19:06:19 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.resetChartOpts()
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2023-09-12 19:42:36 +08:00
|
|
|
|
|
|
|
|
|
|
this.isModifying = false
|
2023-09-13 19:42:28 +08:00
|
|
|
|
this.isFitting = false
|
2023-09-12 19:42:36 +08:00
|
|
|
|
this.clearOperationStack()
|
2023-09-05 19:06:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
2023-09-14 19:49:32 +08:00
|
|
|
|
// 根据数据绘制小方块
|
|
|
|
|
|
buildGraphicRectByData() {
|
|
|
|
|
|
this.option.graphic[0].children.forEach(item => {
|
|
|
|
|
|
item.$action = 'remove'
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
this.option.graphic[0].children = this._channelBaseCPChart.map(({ point: { x, y } }) => {
|
|
|
|
|
|
return this.buildGraphicRect(x, y)
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 绘制单个红色小方块
|
|
|
|
|
|
buildGraphicRect(xAxis, yAxis) {
|
|
|
|
|
|
const chart = this.$refs.chartRef.getChartInstance()
|
|
|
|
|
|
const [xPix, yPix] = chart.convertToPixel('grid', [xAxis, yAxis])
|
2023-09-25 14:55:51 +08:00
|
|
|
|
const that = this
|
|
|
|
|
|
|
2023-09-05 19:06:19 +08:00
|
|
|
|
return {
|
|
|
|
|
|
type: 'rect',
|
2023-09-14 19:49:32 +08:00
|
|
|
|
id: Math.random().toString(),
|
|
|
|
|
|
$action: 'replace',
|
2023-09-05 19:06:19 +08:00
|
|
|
|
position: [xPix, yPix],
|
|
|
|
|
|
shape: {
|
|
|
|
|
|
x: -4,
|
|
|
|
|
|
y: -4,
|
|
|
|
|
|
width: 8,
|
|
|
|
|
|
height: 8
|
|
|
|
|
|
},
|
|
|
|
|
|
style: {
|
|
|
|
|
|
stroke: 'red',
|
|
|
|
|
|
fill: 'transparent',
|
|
|
|
|
|
lineWidth: 2
|
|
|
|
|
|
},
|
2023-09-25 14:55:51 +08:00
|
|
|
|
draggable: this.isModifying,
|
2023-09-05 19:06:19 +08:00
|
|
|
|
ondrag: function() {
|
2023-09-14 19:49:32 +08:00
|
|
|
|
const [xPixel] = chart.convertToPixel('grid', [xAxis, yAxis])
|
|
|
|
|
|
// 保持x轴不变
|
2023-09-05 19:06:19 +08:00
|
|
|
|
this.position[0] = xPixel
|
2023-09-25 14:55:51 +08:00
|
|
|
|
that.redrawBaseLine()
|
2023-09-05 19:06:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
ondragend: ({ offsetY }) => {
|
2023-09-14 19:49:32 +08:00
|
|
|
|
this.setGraphicDraggable(false)
|
2023-09-11 18:59:08 +08:00
|
|
|
|
|
2023-09-14 19:49:32 +08:00
|
|
|
|
const _channelBaseCPChart = this._channelBaseCPChart
|
|
|
|
|
|
const rectIndex = _channelBaseCPChart.findIndex(item => item.point.x == xAxis)
|
2023-09-11 18:59:08 +08:00
|
|
|
|
|
2023-09-14 19:49:32 +08:00
|
|
|
|
// 拖动到的位置
|
|
|
|
|
|
const [, rectYAxis] = getXAxisAndYAxisByPosition(chart, xPix, offsetY)
|
2023-09-05 19:06:19 +08:00
|
|
|
|
|
2023-09-14 19:49:32 +08:00
|
|
|
|
const willModifyPoint = this._channelBaseCPChart[rectIndex].point
|
|
|
|
|
|
this.pushOperationStack(Operators.MODIFY, {
|
|
|
|
|
|
index: rectIndex,
|
|
|
|
|
|
xAxis: willModifyPoint.x,
|
|
|
|
|
|
yAxis: willModifyPoint.y
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// 改变控制点位置
|
|
|
|
|
|
willModifyPoint.y = rectYAxis
|
|
|
|
|
|
this.buildGraphicRectByData()
|
2023-09-05 19:06:19 +08:00
|
|
|
|
|
2023-09-14 19:49:32 +08:00
|
|
|
|
// 改变基线位置
|
2023-09-05 19:06:19 +08:00
|
|
|
|
const baseLineEditSeries = findSeriesByName(this.option.series, 'BaseLine_Edit')
|
2023-09-14 19:49:32 +08:00
|
|
|
|
baseLineEditSeries.data[xAxis - 1][1] = rectYAxis
|
2023-09-05 19:06:19 +08:00
|
|
|
|
|
2023-09-14 19:49:32 +08:00
|
|
|
|
this._channelBaseLineChart.pointlist[xAxis - 1].y = rectYAxis
|
|
|
|
|
|
},
|
|
|
|
|
|
zlevel: 100
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2023-09-06 19:30:02 +08:00
|
|
|
|
|
2023-09-18 19:28:08 +08:00
|
|
|
|
// 重新生成基线
|
|
|
|
|
|
redrawBaseLine() {
|
2023-09-25 14:55:51 +08:00
|
|
|
|
console.log('%c [ 重新生成基线 ]-1355', 'font-size:13px; background:pink; color:#bf2c9f;')
|
2023-09-18 19:28:08 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
2023-09-14 19:49:32 +08:00
|
|
|
|
// 根据数据绘制 + 号
|
|
|
|
|
|
buildGraphicPlusByData() {
|
|
|
|
|
|
this.option.graphic[1].children.forEach(item => {
|
|
|
|
|
|
item.$action = 'remove'
|
|
|
|
|
|
})
|
2023-09-11 18:59:08 +08:00
|
|
|
|
|
2023-09-14 19:49:32 +08:00
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
const { xctrl: xctrlList, yctrl: yctrlList, yslope: yslopeList } = this._baseCtrls
|
|
|
|
|
|
const plusGraphic = []
|
|
|
|
|
|
|
|
|
|
|
|
xctrlList.forEach((xctrl, index) => {
|
|
|
|
|
|
const yctrl = yctrlList[index]
|
|
|
|
|
|
const yslope = yslopeList[index]
|
|
|
|
|
|
if (yslope != 0) {
|
|
|
|
|
|
plusGraphic.push(this.buildGraphicPlus(xctrl + 2, yctrl + 2 * yslope))
|
|
|
|
|
|
plusGraphic.push(this.buildGraphicPlus(xctrl - 2, yctrl - 2 * yslope))
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
this.option.graphic[1].children = plusGraphic
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 绘制单个绿色加号
|
|
|
|
|
|
buildGraphicPlus(x, y) {
|
|
|
|
|
|
const chart = this.$refs.chartRef.getChartInstance()
|
|
|
|
|
|
const [xPix, yPix] = chart.convertToPixel('grid', [x, y])
|
|
|
|
|
|
return {
|
|
|
|
|
|
type: 'text',
|
|
|
|
|
|
id: Math.random().toString(),
|
|
|
|
|
|
$action: 'replace',
|
|
|
|
|
|
position: [xPix, yPix],
|
|
|
|
|
|
style: {
|
|
|
|
|
|
x: -10,
|
|
|
|
|
|
y: -10,
|
|
|
|
|
|
text: '+',
|
|
|
|
|
|
fill: '#0f0',
|
|
|
|
|
|
font: 'bolder 20px "Microsoft YaHei", sans-serif'
|
2023-09-05 19:06:19 +08:00
|
|
|
|
},
|
2023-09-14 19:49:32 +08:00
|
|
|
|
zlevel: 101
|
2023-09-04 19:40:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2023-09-05 19:06:19 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 设置小方块可拖拽
|
|
|
|
|
|
*/
|
|
|
|
|
|
setGraphicDraggable(draggable) {
|
2023-09-14 19:49:32 +08:00
|
|
|
|
this.option.graphic[0].children.forEach(item => {
|
2023-09-05 19:06:19 +08:00
|
|
|
|
item.draggable = draggable
|
|
|
|
|
|
})
|
2023-09-06 19:30:02 +08:00
|
|
|
|
this.isModifying = draggable
|
2023-09-05 19:06:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
2023-09-04 19:40:13 +08:00
|
|
|
|
// 在当前选中的红线位置新增控制点
|
|
|
|
|
|
handleAddCP() {
|
2023-09-12 19:42:36 +08:00
|
|
|
|
this.setGraphicDraggable(false)
|
2023-09-14 19:49:32 +08:00
|
|
|
|
const { rg_high, rg_low } = this.BaseCtrls
|
|
|
|
|
|
if (!this.currChannel || this.currChannel < rg_low || this.currChannel > rg_high) {
|
2023-09-04 19:40:13 +08:00
|
|
|
|
this.$message.warn("Can't insert Control Point out of range")
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-05 19:06:19 +08:00
|
|
|
|
const chart = this.$refs.chartRef.getChartInstance()
|
2023-09-06 19:30:02 +08:00
|
|
|
|
|
2023-09-14 19:49:32 +08:00
|
|
|
|
const controlPointList = this.option.graphic[0].children
|
2023-09-06 19:30:02 +08:00
|
|
|
|
|
|
|
|
|
|
let i = 0 // 记录新控制点在列表中的位置
|
|
|
|
|
|
const [xPix] = chart.convertToPixel('grid', [this.currChannel, 0])
|
|
|
|
|
|
for (; i < controlPointList.length; ++i) {
|
|
|
|
|
|
const currCP = controlPointList[i].position[0]
|
|
|
|
|
|
if (currCP >= xPix) {
|
|
|
|
|
|
if (currCP == xPix) {
|
|
|
|
|
|
this.$message.warn(`The new control point in channel ${this.currChannel} exists, can't introduce twice`)
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
break
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-14 19:49:32 +08:00
|
|
|
|
// 新增的控制点跟基线的值平齐
|
|
|
|
|
|
const yAxis = this._channelBaseLineChart.pointlist[this.currChannel - 1].y
|
2023-09-06 19:30:02 +08:00
|
|
|
|
|
|
|
|
|
|
this._channelBaseCPChart.splice(i, 0, { point: { x: this.currChannel, y: yAxis } })
|
2023-09-14 19:49:32 +08:00
|
|
|
|
this.buildGraphicRectByData()
|
2023-09-11 18:59:08 +08:00
|
|
|
|
|
|
|
|
|
|
this.pushOperationStack(Operators.ADD, { index: i })
|
2023-09-05 19:06:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 移除控制点
|
2023-09-06 19:30:02 +08:00
|
|
|
|
handleRemoveCP() {
|
2023-09-12 19:42:36 +08:00
|
|
|
|
this.setGraphicDraggable(false)
|
|
|
|
|
|
|
2023-09-06 19:30:02 +08:00
|
|
|
|
// find nearest control-point
|
2023-09-14 19:49:32 +08:00
|
|
|
|
const controlPointList = this._channelBaseCPChart
|
2023-09-06 19:30:02 +08:00
|
|
|
|
let i = 1
|
|
|
|
|
|
for (; i < controlPointList.length; ++i) {
|
2023-09-14 19:49:32 +08:00
|
|
|
|
const { x: currXAxis } = controlPointList[i].point
|
2023-09-06 19:30:02 +08:00
|
|
|
|
if (currXAxis >= this.currChannel) {
|
2023-09-14 19:49:32 +08:00
|
|
|
|
const { x: prevX } = controlPointList[i - 1].point
|
|
|
|
|
|
if (currXAxis - this.currChannel > this.currChannel - prevX) --i
|
2023-09-06 19:30:02 +08:00
|
|
|
|
break
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (i == 0 || i >= controlPointList.length - 1) {
|
|
|
|
|
|
this.$message.warn("Can't remove first/last control point")
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-11 18:59:08 +08:00
|
|
|
|
const [point] = controlPointList.splice(i, 1)
|
2023-09-14 19:49:32 +08:00
|
|
|
|
this.buildGraphicRectByData()
|
2023-09-11 18:59:08 +08:00
|
|
|
|
this.pushOperationStack(Operators.REMOVE, {
|
|
|
|
|
|
index: i,
|
2023-09-14 19:49:32 +08:00
|
|
|
|
point: point.point
|
2023-09-11 18:59:08 +08:00
|
|
|
|
})
|
2023-09-06 19:30:02 +08:00
|
|
|
|
},
|
2023-09-05 19:06:19 +08:00
|
|
|
|
|
|
|
|
|
|
// 修改控制点
|
|
|
|
|
|
handleModifyCP() {
|
2023-09-25 14:55:51 +08:00
|
|
|
|
this.setGraphicDraggable(!this.isModifying)
|
2023-09-04 19:40:13 +08:00
|
|
|
|
},
|
2023-08-29 19:54:09 +08:00
|
|
|
|
|
2023-09-11 18:59:08 +08:00
|
|
|
|
// 编辑斜率
|
|
|
|
|
|
handleEditSlope() {
|
2023-09-12 19:42:36 +08:00
|
|
|
|
this.setGraphicDraggable(false)
|
|
|
|
|
|
|
|
|
|
|
|
const { xctrl, yslope } = this._baseCtrls
|
|
|
|
|
|
if (!xctrl.length) {
|
|
|
|
|
|
this.$message.warn('No control points to be edited')
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
// find nearest control-point
|
|
|
|
|
|
let i = 1,
|
|
|
|
|
|
n = xctrl.length
|
|
|
|
|
|
for (; i < n; ++i) {
|
|
|
|
|
|
const currXCtrl = xctrl[i]
|
|
|
|
|
|
const prevXCtrl = xctrl[i - 1]
|
|
|
|
|
|
if (currXCtrl >= this.currChannel) {
|
|
|
|
|
|
if (currXCtrl - this.currChannel > this.currChannel - prevXCtrl) {
|
|
|
|
|
|
--i
|
|
|
|
|
|
}
|
|
|
|
|
|
break
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (i == n) i = n - 1
|
|
|
|
|
|
|
|
|
|
|
|
this.$refs.editSlopeModal.open({
|
|
|
|
|
|
index: i,
|
|
|
|
|
|
value: yslope[i],
|
|
|
|
|
|
allowNaN: !(i == 0 || i == n - 1)
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 确认编辑斜率
|
|
|
|
|
|
handleSlopeChange(slope, index, prevSlope) {
|
|
|
|
|
|
if (slope === prevSlope) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const { yslope } = this._baseCtrls
|
|
|
|
|
|
yslope[index] = slope
|
|
|
|
|
|
this.pushOperationStack(Operators.SLOPE_CHANGE, {
|
|
|
|
|
|
index,
|
|
|
|
|
|
slope: prevSlope
|
|
|
|
|
|
})
|
2023-09-14 19:49:32 +08:00
|
|
|
|
|
|
|
|
|
|
this.buildGraphicPlusByData()
|
2023-09-12 19:42:36 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 撤销
|
|
|
|
|
|
handleUndo() {
|
|
|
|
|
|
this.setGraphicDraggable(false)
|
|
|
|
|
|
this.popOperationStack()
|
2023-09-11 18:59:08 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
2023-09-13 19:42:28 +08:00
|
|
|
|
// 将原先的基线和控制点移动到新位置
|
2023-09-14 19:49:32 +08:00
|
|
|
|
handleReplot() {
|
|
|
|
|
|
const baseLineSeries = findSeriesByName(this.option.series, 'BaseLine')
|
|
|
|
|
|
baseLineSeries.data = this._channelBaseLineChart.pointlist.map(({ x, y }) => [x, y])
|
|
|
|
|
|
|
|
|
|
|
|
const baseLineCP = findSeriesByName(this.option.series, 'BaseLine_Ctrl_Point')
|
|
|
|
|
|
baseLineCP.data = this.buildCPPointData(this._channelBaseCPChart)
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 构建基线控制点数据
|
|
|
|
|
|
* @param {Array} controlPointList
|
|
|
|
|
|
**/
|
|
|
|
|
|
buildCPPointData(controlPointList) {
|
|
|
|
|
|
return controlPointList.map(({ size, color, point: { x, y } }) => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
value: [x, y],
|
|
|
|
|
|
itemStyle: {
|
|
|
|
|
|
color: 'transparent',
|
|
|
|
|
|
borderColor: color,
|
|
|
|
|
|
borderWidth: size / 2
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2023-09-13 19:42:28 +08:00
|
|
|
|
|
2023-09-12 19:42:36 +08:00
|
|
|
|
// 确定对Baseline Control Points 的操作
|
2023-09-14 19:49:32 +08:00
|
|
|
|
handleAccept() {
|
|
|
|
|
|
this.channelBaseLineChart = this._channelBaseLineChart
|
|
|
|
|
|
this.channelBaseCPChart = this._channelBaseCPChart
|
|
|
|
|
|
|
|
|
|
|
|
this.handleSwitchOperation()
|
2023-09-25 14:55:51 +08:00
|
|
|
|
|
2023-09-14 19:49:32 +08:00
|
|
|
|
this.$bus.$emit('accept')
|
|
|
|
|
|
},
|
2023-09-04 19:40:13 +08:00
|
|
|
|
|
|
|
|
|
|
// 右下角添加当前选中的nuclide
|
2023-09-08 18:43:49 +08:00
|
|
|
|
async handleAddNuclide() {
|
2023-09-04 19:40:13 +08:00
|
|
|
|
const nuclides = this.selectedTableItem.nuclides
|
|
|
|
|
|
const possibleNuclide = this.model.possibleNuclide
|
2023-09-08 18:43:49 +08:00
|
|
|
|
if (!nuclides.includes(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
|
|
|
|
|
|
}
|
2023-09-04 19:40:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
// 右下角删除当前选中的nuclide
|
2023-09-08 18:43:49 +08:00
|
|
|
|
async handleDelNuclide() {
|
|
|
|
|
|
if (!this.model.identifiedNuclide) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
const nuclides = this.selectedTableItem.nuclides
|
|
|
|
|
|
if (this.selectedTableItem._deleting) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
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
|
2023-09-04 19:40:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-09-11 18:59:08 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 推入操作
|
|
|
|
|
|
* @param {*} operator 操作符
|
|
|
|
|
|
* @param {*} operand 操作数
|
|
|
|
|
|
*/
|
|
|
|
|
|
pushOperationStack(operator, operand) {
|
|
|
|
|
|
this.operationStack.push({
|
|
|
|
|
|
operator,
|
|
|
|
|
|
operand
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 弹出操作
|
|
|
|
|
|
*/
|
|
|
|
|
|
popOperationStack() {
|
|
|
|
|
|
const { operator, operand } = this.operationStack.pop()
|
|
|
|
|
|
const { index } = operand
|
|
|
|
|
|
switch (operator) {
|
|
|
|
|
|
case Operators.ADD:
|
|
|
|
|
|
this._channelBaseCPChart.splice(index, 1)
|
2023-09-14 19:49:32 +08:00
|
|
|
|
this.buildGraphicRectByData()
|
2023-09-11 18:59:08 +08:00
|
|
|
|
break
|
|
|
|
|
|
case Operators.MODIFY:
|
2023-09-14 19:49:32 +08:00
|
|
|
|
const { xAxis, yAxis } = operand
|
|
|
|
|
|
|
|
|
|
|
|
// 恢复点的y轴位置
|
|
|
|
|
|
this._channelBaseCPChart[index].point.y = yAxis
|
|
|
|
|
|
this.buildGraphicRectByData()
|
|
|
|
|
|
|
|
|
|
|
|
// 恢复基线位置
|
|
|
|
|
|
const baseLineEditSeries = findSeriesByName(this.option.series, 'BaseLine_Edit')
|
|
|
|
|
|
baseLineEditSeries.data[xAxis - 1] = [xAxis, yAxis]
|
|
|
|
|
|
|
|
|
|
|
|
this._channelBaseLineChart.pointlist[xAxis - 1].y = yAxis
|
2023-09-11 18:59:08 +08:00
|
|
|
|
break
|
|
|
|
|
|
case Operators.REMOVE:
|
2023-09-14 19:49:32 +08:00
|
|
|
|
const {
|
|
|
|
|
|
point: { x, y }
|
|
|
|
|
|
} = operand
|
|
|
|
|
|
this._channelBaseCPChart.splice(index, 0, {
|
|
|
|
|
|
point: {
|
|
|
|
|
|
x,
|
|
|
|
|
|
y
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
this.buildGraphicRectByData()
|
2023-09-11 18:59:08 +08:00
|
|
|
|
break
|
2023-09-12 19:42:36 +08:00
|
|
|
|
case Operators.SLOPE_CHANGE:
|
|
|
|
|
|
const { slope } = operand
|
|
|
|
|
|
const { yslope } = this._baseCtrls
|
|
|
|
|
|
yslope[index] = slope
|
|
|
|
|
|
break
|
2023-09-11 18:59:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 清理操作栈
|
|
|
|
|
|
*/
|
|
|
|
|
|
clearOperationStack() {
|
|
|
|
|
|
this.operationStack = []
|
2023-07-11 19:35:18 +08:00
|
|
|
|
}
|
2023-09-08 18:43:49 +08:00
|
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
|
|
|
|
curRow() {
|
|
|
|
|
|
const [selectedKey] = this.selectedKeys
|
|
|
|
|
|
const findIndex = this.list.findIndex(item => item.index == selectedKey)
|
|
|
|
|
|
return findIndex
|
2023-09-11 18:59:08 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
isOperationStackEmpty() {
|
|
|
|
|
|
return this.operationStack.length == 0
|
2023-09-08 18:43:49 +08:00
|
|
|
|
}
|
2023-07-11 19:35:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
|
.interactive-analysis-tools {
|
|
|
|
|
|
display: flex;
|
2023-09-11 18:59:08 +08:00
|
|
|
|
margin-top: 5px;
|
2023-07-11 19:35:18 +08:00
|
|
|
|
|
|
|
|
|
|
&-left {
|
|
|
|
|
|
width: 75%;
|
|
|
|
|
|
margin-right: 20px;
|
|
|
|
|
|
|
|
|
|
|
|
.chart {
|
|
|
|
|
|
height: 331px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.thumbnail {
|
|
|
|
|
|
height: 50px;
|
2023-09-04 19:40:13 +08:00
|
|
|
|
margin: 10px 10px 35px 40px;
|
2023-07-11 19:35:18 +08:00
|
|
|
|
background-color: #255369;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.table {
|
|
|
|
|
|
.title {
|
|
|
|
|
|
color: #0cebc9;
|
|
|
|
|
|
font-size: 20px;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
margin-bottom: 10px;
|
2023-08-28 19:52:35 +08:00
|
|
|
|
user-select: none;
|
2023-07-12 19:56:41 +08:00
|
|
|
|
|
|
|
|
|
|
span {
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
margin: 0 5px;
|
|
|
|
|
|
}
|
2023-07-11 19:35:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.custom-table {
|
|
|
|
|
|
&.has-data {
|
|
|
|
|
|
::v-deep {
|
|
|
|
|
|
.ant-table-body {
|
|
|
|
|
|
height: 288px;
|
|
|
|
|
|
background-color: #06282a;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
::v-deep {
|
|
|
|
|
|
.ant-table-placeholder {
|
|
|
|
|
|
height: 289px;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.operators {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
margin-top: 10px;
|
|
|
|
|
|
gap: 10px;
|
|
|
|
|
|
|
|
|
|
|
|
.ant-btn {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&-right {
|
|
|
|
|
|
.peak-box {
|
|
|
|
|
|
height: 326px;
|
|
|
|
|
|
|
|
|
|
|
|
&-item:not(:last-child) {
|
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.symbol {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
|
|
|
|
.ant-btn {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
|
|
|
|
|
|
&:first-child {
|
|
|
|
|
|
margin-right: 10px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.base-line {
|
|
|
|
|
|
margin-top: 136px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.reset-btn-box {
|
|
|
|
|
|
margin-top: 20px;
|
|
|
|
|
|
margin-bottom: 30px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.identify-box {
|
|
|
|
|
|
.tolerance {
|
|
|
|
|
|
::v-deep {
|
|
|
|
|
|
.ant-form-item {
|
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
|
|
|
|
|
|
|
&-control-wrapper {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&-control {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.ant-input-number {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.identify-item {
|
|
|
|
|
|
.title {
|
|
|
|
|
|
background-color: #497e9d;
|
|
|
|
|
|
height: 30px;
|
|
|
|
|
|
line-height: 30px;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.content {
|
|
|
|
|
|
height: 80px;
|
|
|
|
|
|
background-color: #275466;
|
|
|
|
|
|
margin: 10px 0;
|
2023-09-04 19:40:13 +08:00
|
|
|
|
padding: 5px;
|
|
|
|
|
|
overflow: auto;
|
|
|
|
|
|
|
|
|
|
|
|
.item {
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
line-height: 26px;
|
|
|
|
|
|
padding: 0 5px;
|
|
|
|
|
|
|
|
|
|
|
|
&.active {
|
|
|
|
|
|
background: #296d81;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-07-11 19:35:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.identify-operators {
|
|
|
|
|
|
display: flex;
|
2023-09-04 19:40:13 +08:00
|
|
|
|
gap: 10px;
|
|
|
|
|
|
.text {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
line-height: 32px;
|
|
|
|
|
|
background-color: #285366;
|
|
|
|
|
|
padding: 0 10px;
|
|
|
|
|
|
}
|
2023-07-11 19:35:18 +08:00
|
|
|
|
|
|
|
|
|
|
.ant-btn {
|
|
|
|
|
|
width: 50px;
|
|
|
|
|
|
padding-left: 5px;
|
|
|
|
|
|
padding-right: 5px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.ant-btn {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-09-12 19:42:36 +08:00
|
|
|
|
|
2023-09-13 19:42:28 +08:00
|
|
|
|
.is-modify,
|
|
|
|
|
|
.is-fitting {
|
2023-09-12 19:42:36 +08:00
|
|
|
|
color: #f00;
|
|
|
|
|
|
}
|
2023-07-11 19:35:18 +08:00
|
|
|
|
</style>
|