Merge branch 'feature-analysis-RLR-renpy' of http://git.hivekion.com:3000/xiaoguangbin/AnalysisSystemForRadionuclide_vue into master-dev

This commit is contained in:
orgin 2023-10-13 14:54:29 +08:00
commit f43c9f8c2a
14 changed files with 699 additions and 487 deletions

2
public/index.html vendored
View File

@ -251,7 +251,7 @@
<div class="loader-section section-right"></div>
</div>
</div>
<script src="/qtw.js"></script>
</body>
</html>

1
public/qtw.js vendored Normal file

File diff suppressed because one or more lines are too long

BIN
public/qtw.wasm vendored Normal file

Binary file not shown.

2
src/utils/WasmHelper.js Normal file
View File

@ -0,0 +1,2 @@
const { UpdateBaseLine } = Module;
export { UpdateBaseLine as updateBaseLine };

View File

@ -8,7 +8,7 @@ export function getXAxisAndYAxisByPosition(chart, offsetX, offsetY, seriesIndex
if (
chart.containPixel(
{
seriesIndex: 0
seriesIndex
},
pointInPixel
)

View File

@ -323,7 +323,6 @@ export default {
histogramDataDList, // Beta-Gamma Spectrum: Sample 3D
Boundary, // 2d
XeData, // Result Display
spectrumData,
AcqTimeBtn, // QC Flags
@ -333,6 +332,9 @@ export default {
GasBgBtn, // QC Flags
DetBgBtn, // QC Flags
} = this.sampleDetail[this.spectraType]
const {
XeData, // Result Display
} = this.sampleDetail
this.spectrumData = spectrumData

View File

@ -37,7 +37,7 @@ export default {
},
handleOK() {
if (this.allowNaN || this.value) {
this.$emit('change', this.value || 0, this.index, this.prevValue)
this.$emit('change', this.value, this.index, this.prevValue)
this.visible = false
} else {
this.$message.warn('Input value invalid.')

View File

@ -0,0 +1,149 @@
<template>
<div class="rect-list" :class="isMoving ? 'draggable' : ''" @mousemove="handleMouseMove" @mouseup="handleMouseUp">
<div
class="rect-list-item"
:class="draggable && !isMoving ? 'draggable' : ''"
v-for="(item, index) in list"
:key="index"
@mousedown="handleMouseDown(item, index)"
>
<div
class="plus"
:class="isMoving ? 'will-change' : ''"
v-if="item.yslope"
:style="getPosition(item.xAxis - 2, item.yAxis - 2 * item.yslope)"
>
+
</div>
<div class="rect" :class="isMoving ? 'will-change' : ''" :style="getPosition(item.xAxis, item.yAxis)"></div>
<div
class="plus"
:class="isMoving ? 'will-change' : ''"
v-if="item.yslope"
:style="getPosition(item.xAxis + 2, item.yAxis + 2 * item.yslope)"
>
+
</div>
</div>
</div>
</template>
<script>
import { getXAxisAndYAxisByPosition } from '@/utils/chartHelper'
export default {
props: {
chartRef: {
type: Object,
},
baseControls: {
type: Object,
},
draggable: {
type: Boolean,
},
},
data() {
return {
list: [],
isMoving: false,
}
},
methods: {
init() {
this.chart = this.chartRef.getChartInstance()
const { xctrl: xctrlList, yctrl: yctrlList, yslope: yslopeList } = this.baseControls
this.list = xctrlList.map((xAxis, index) => {
const yAxis = yctrlList[index]
const yslope = yslopeList[index]
return {
xAxis,
yAxis,
yslope,
}
})
},
clear() {
this.list = []
},
getPosition(xAxis, yAxis) {
const [xPix, yPix] = this.chart.convertToPixel('grid', [xAxis, yAxis])
return {
position: 'absolute',
left: xPix + 'px',
top: yPix + 'px',
}
},
handleMouseDown(item, index) {
this.isMoving = true
this.currItem = item
this.prevYAxis = item.yAxis
this.currItemIndex = index
},
handleMouseMove(event) {
if (this.isMoving) {
const { offsetX, offsetY } = event
const position = getXAxisAndYAxisByPosition(this.chart, offsetX, offsetY)
if (position) {
this.currItem.yAxis = position[1]
this.$emit('move', this.list.map((item) => item.yAxis))
}
}
},
handleMouseUp() {
if (this.isMoving) {
this.isMoving = false
this.$emit('moveEnd', this.prevYAxis, this.currItemIndex)
}
},
},
}
</script>
<style lang="less" scoped>
.rect-list {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
pointer-events: none;
overflow: hidden;
&.draggable {
pointer-events: all;
}
&-item {
user-select: none;
pointer-events: none;
&.draggable {
pointer-events: all;
}
}
.rect {
width: 10px;
height: 10px;
border: 2px solid red;
transform: translate(-50%, -50%);
}
.plus {
font-size: 20px;
color: #0f0;
width: 12px;
height: 12px;
line-height: 12px;
transform: translate(-50%, -50%);
}
}
.will-change {
will-change: top;
}
</style>

View File

@ -13,6 +13,14 @@
@brushEnd="handleBrushEnd"
@zr:click="handleChartClick"
/>
<rect-list
ref="rectListRef"
:chartRef="$refs.chartRef"
:baseControls="baseCtrls_Copy"
:draggable="isModifying"
@move="handleMove"
@moveEnd="handleMoveEnd"
/>
</div>
<!-- 缩略图 -->
<div class="thumbnail">
@ -118,9 +126,7 @@
</a-form-model-item>
</a-form-model>
<div class="identify-item">
<div class="title">
Possible Nuclide
</div>
<div class="title">Possible Nuclide</div>
<a-spin :spinning="!!(selectedTableItem && selectedTableItem._loading)">
<div class="content">
<template v-if="selectedTableItem && selectedTableItem._possible">
@ -138,9 +144,7 @@
</a-spin>
</div>
<div class="identify-item">
<div class="title">
Nuclide Identified
</div>
<div class="title">Nuclide Identified</div>
<div class="content">
<template v-if="selectedTableItem">
<div
@ -206,6 +210,9 @@ import SampleDataMixin from '@/views/spectrumAnalysis/SampleDataMixin'
import GeneralCommentModal from './components/GeneralCommentModal.vue'
import EditSlopeModal from './components/EditSlopeModal.vue'
import Response from './Response.json'
import { updateBaseLine } from '@/utils/WasmHelper'
import RectList from './components/RectList.vue'
import { isNullOrUndefined } from '@/utils/util'
//
const initialOption = {
@ -290,19 +297,7 @@ const initialOption = {
animation: false
},
series: [],
brush: {},
graphic: [
{
type: 'group',
id: 1,
children: []
},
{
type: 'group',
id: 2,
children: []
}
]
brush: {}
}
const columns = [
@ -414,7 +409,7 @@ const nuclideIdentifyModal = {
}
//
export const Operators = {
const Operators = {
ADD: 1, //
REMOVE: 2, //
MODIFY: 3, //
@ -430,7 +425,8 @@ export default {
FitPeaksAndBaseLineModal,
NuclideReviewModal,
GeneralCommentModal,
EditSlopeModal
EditSlopeModal,
RectList
},
data() {
this.columns = columns
@ -448,6 +444,7 @@ export default {
energy: [],
list: [],
BaseCtrls: {},
baseCtrls_Copy: {},
FitBaseLine: '#fff',
sampleId: -1,
@ -478,7 +475,7 @@ export default {
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>`
<div class="energy">${isNullOrUndefined(energy) ? '' : `Energy: ${energy.toFixed(2)}`}</div>`
}
},
methods: {
@ -495,7 +492,7 @@ export default {
fileName: this.fileName
})
// const { success, result, message } = Response
// const { success, result, message } = cloneDeep(Response)
if (success) {
this.isLoading = false
@ -524,70 +521,18 @@ export default {
const series = []
// BaseLine
series.push(
buildLineSeries(
'BaseLine',
channelBaseLineChart.pointlist.map(({ x, y }) => [x, y]),
channelBaseLineChart.color,
{
markLine: {
silent: true,
symbol: 'none',
label: {
show: false
},
lineStyle: {
color: 'red',
width: 1
},
data: [{ xAxis: -1 }]
},
zlevel: 10
}
)
)
series.push(this.buildBaseLine(channelBaseLineChart))
// Count
series.push(
buildLineSeries(
'CountChart',
channelCountChart.pointlist.map(({ x, y }) => [x, y]),
channelCountChart.color
)
)
series.push(this.buildCountLine(channelCountChart))
// Peak
const peakSeries = []
channelPeakChart.forEach((item, index) => {
peakSeries.push(
buildLineSeries(
'Peak_' + (index + 1),
item.pointlist.map(({ x, y }) => [x, y]),
item.color
)
)
})
series.push(...peakSeries)
series.push(...this.buildPeaks(channelPeakChart))
// 线
series.push({
name: 'BaseLine_Ctrl_Point',
type: 'scatter',
data: this.buildCPPointData(channelBaseCPChart),
silent: true,
animation: false,
zlevel: 20
})
series.push(this.buildCtrlPoint(channelBaseCPChart))
this.thumbnailOption.series = buildLineSeries(
'BarChart',
barChart.map(({ x, y }) => [x, y]),
'#fff',
{
silent: true
}
)
this.thumbnailOption.series = this.buildBarChart(barChart)
this.list = table
this.option.series = series
@ -608,13 +553,7 @@ export default {
this.option.brush = { toolbox: [] }
this.selectedKeys = []
})
this.removeGraphics()
},
// graphic
removeGraphics() {
this.option.graphic[0].children = []
this.option.graphic[1].children = []
this.clearRect()
},
beforeModalOpen() {
@ -693,6 +632,7 @@ export default {
if (!peaksBetweenChannel.length) {
this.$message.warn(`There are 0 peak between channel ${left} and ${right}`)
this.isFitting = false
return
}
@ -791,11 +731,8 @@ export default {
// Insert
handleInsert() {
this.isFitting = false
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) {
const { rg_high, rg_low } = this.BaseCtrls
if (!this.currChannel || this.currChannel <= rg_low + 1 || this.currChannel >= rg_high - 1) {
this.$message.warn("Couldn't insert peak, maybe out of range")
return
}
@ -817,7 +754,7 @@ export default {
table
} = result
this.$bus.$emit('refresh', {
this.$bus.$emit('gammaRefresh', {
allData,
channelPeakChart,
shadowChannelChart,
@ -832,79 +769,18 @@ export default {
const series = []
// BaseLine
series.push(
buildLineSeries(
'BaseLine',
channelBaseLineChart.pointlist.map(({ x, y }) => [x, y]),
channelBaseLineChart.color,
{
markLine: {
silent: true,
symbol: 'none',
label: {
show: false
},
lineStyle: {
color: 'red',
width: 1
},
data: [{ xAxis: -1 }]
},
zlevel: 10
}
)
)
series.push(this.buildBaseLine(channelBaseLineChart))
// Count
series.push(
buildLineSeries(
'CountChart',
this.channelCountChart.pointlist.map(({ x, y }) => [x, y]),
this.channelCountChart.color
)
)
series.push(this.buildCountLine(channelCountChart))
// Peak
const peakSeries = []
channelPeakChart.forEach((item, index) => {
peakSeries.push(
buildLineSeries(
'Peak_' + (index + 1),
item.pointlist.map(({ x, y }) => [x, y]),
item.color
)
)
})
series.push(...peakSeries)
series.push(...this.buildPeaks(channelPeakChart))
// 线
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
})
series.push(this.buildCtrlPoint(channelBaseCPChart))
this.thumbnailOption.series = buildLineSeries(
'BarChart',
barChart.map(({ x, y }) => [x, y]),
'#fff',
{
silent: true
}
)
this.thumbnailOption.series = this.buildBarChart(barChart)
this.list = table
this.option.series = series
@ -917,70 +793,16 @@ export default {
const series = []
// BaseLine
series.push(
buildLineSeries(
'BaseLine',
this.channelBaseLineChart.pointlist.map(({ x, y }) => [x, y]),
this.channelBaseLineChart.color,
{
markLine: {
silent: true,
symbol: 'none',
label: {
show: false
},
lineStyle: {
color: 'red',
width: 1
},
data: [{ xAxis: -1 }]
},
zlevel: 10
}
)
)
series.push(this.buildBaseLine(this.channelBaseLineChart))
// Count
series.push(
buildLineSeries(
'CountChart',
this.channelCountChart.pointlist.map(({ x, y }) => [x, y]),
this.channelCountChart.color
)
)
series.push(this.buildCountLine(this.channelCountChart))
// Peak
const peakSeries = []
channelPeakChart.forEach((item, index) => {
peakSeries.push(
buildLineSeries(
'Peak_' + (index + 1),
item.pointlist.map(({ x, y }) => [x, y]),
item.color
)
)
})
series.push(...peakSeries)
series.push(...this.buildPeaks(channelPeakChart))
// 线
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
})
series.push(this.buildCtrlPoint(this.channelBaseCPChart))
this.list = table
this.option.series = series
@ -1035,7 +857,7 @@ export default {
table
} = result
this.$bus.$emit('refresh', {
this.$bus.$emit('gammaRefresh', {
allData,
channelPeakChart,
shadowChannelChart,
@ -1047,61 +869,16 @@ export default {
this.channelPeakChart = channelPeakChart
const series = []
// BaseLine
series.push(
buildLineSeries(
'BaseLine',
this.channelBaseLineChart.pointlist.map(({ x, y }) => [x, y]),
this.channelBaseLineChart.color,
{
markLine: {
silent: true,
symbol: 'none',
label: {
show: false
},
lineStyle: {
color: 'red',
width: 1
},
data: [{ xAxis: -1 }]
},
zlevel: 10
}
)
)
series.push(this.buildBaseLine(this.channelBaseLineChart))
// Count
series.push(
buildLineSeries(
'CountChart',
this.channelCountChart.pointlist.map(({ x, y }) => [x, y]),
this.channelCountChart.color
)
)
series.push(this.buildCountLine(this.channelCountChart))
// Peak
const peakSeries = []
channelPeakChart.forEach((item, index) => {
peakSeries.push(
buildLineSeries(
'Peak_' + (index + 1),
item.pointlist.map(({ x, y }) => [x, y]),
item.color
)
)
})
series.push(...peakSeries)
series.push(...this.buildPeaks(channelPeakChart))
// 线
series.push({
name: 'BaseLine_Ctrl_Point',
type: 'scatter',
data: this.buildCPPointData(this.channelBaseCPChart),
silent: true,
animation: false,
zlevel: 20
})
series.push(this.buildCtrlPoint(this.channelBaseCPChart))
this.list = table
this.option.series = series
@ -1217,8 +994,7 @@ export default {
this.thumbnailOption.yAxis.max = y2
if (this.btnGroupType == 2) {
this.buildGraphicRectByData()
this.buildGraphicPlusByData()
this.buildRect()
}
}
this.clearBrush(chart)
@ -1236,8 +1012,7 @@ export default {
this.thumbnailOption.yAxis.max = 'dataMax'
if (this.btnGroupType == 2) {
this.buildGraphicRectByData()
this.buildGraphicPlusByData()
this.buildRect()
}
},
@ -1246,14 +1021,12 @@ export default {
// Base Line Control Point
if (this.btnGroupType == 1) {
this.btnGroupType = 2
this._channelBaseCPChart = cloneDeep(this.channelBaseCPChart)
this._channelBaseLineChart = cloneDeep(this.channelBaseLineChart)
this._baseCtrls = cloneDeep(this.BaseCtrls)
this.baseCtrls_Copy = cloneDeep(this.BaseCtrls)
// 线
const baseLineEditSeries = buildLineSeries(
'BaseLine_Edit',
this._channelBaseLineChart.pointlist.map(({ x, y }) => [x, y]),
this.baseCtrls_Copy.baseline.map((val, index) => [index + 1, val]),
this.FitBaseLine,
{
zlevel: 21
@ -1261,15 +1034,16 @@ export default {
)
this.option.series.push(baseLineEditSeries)
this.buildGraphicRectByData()
this.buildGraphicPlusByData()
this.$nextTick(() => {
this.buildRect()
})
}
// Peak
else {
this.btnGroupType = 1
this.opts.notMerge = true
this.option.series.splice(this.option.series.length - 1, 1) // 线
this.removeGraphics()
this.clearRect()
const baseLineSeries = findSeriesByName(this.option.series, 'BaseLine')
baseLineSeries.data = this.channelBaseLineChart.pointlist.map(({ x, y }) => [x, y]) // 线
@ -1288,121 +1062,46 @@ export default {
},
//
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)
})
})
buildRect() {
this.$refs.rectListRef.init()
},
//
buildGraphicRect(xAxis, yAxis) {
const chart = this.$refs.chartRef.getChartInstance()
const [xPix, yPix] = chart.convertToPixel('grid', [xAxis, yAxis])
const that = this
return {
type: 'rect',
id: Math.random().toString(),
$action: 'replace',
position: [xPix, yPix],
shape: {
x: -4,
y: -4,
width: 8,
height: 8
},
style: {
stroke: 'red',
fill: 'transparent',
lineWidth: 2
},
draggable: this.isModifying,
ondrag: function() {
const [xPixel] = chart.convertToPixel('grid', [xAxis, yAxis])
// x
this.position[0] = xPixel
that.redrawBaseLine()
},
ondragend: ({ offsetY }) => {
this.setGraphicDraggable(false)
const _channelBaseCPChart = this._channelBaseCPChart
const rectIndex = _channelBaseCPChart.findIndex(item => item.point.x == xAxis)
//
const [, rectYAxis] = getXAxisAndYAxisByPosition(chart, xPix, offsetY)
const willModifyPoint = this._channelBaseCPChart[rectIndex].point
this.pushOperationStack(Operators.MODIFY, {
index: rectIndex,
xAxis: willModifyPoint.x,
yAxis: willModifyPoint.y
})
//
willModifyPoint.y = rectYAxis
this.buildGraphicRectByData()
// 线
const baseLineEditSeries = findSeriesByName(this.option.series, 'BaseLine_Edit')
baseLineEditSeries.data[xAxis - 1][1] = rectYAxis
this._channelBaseLineChart.pointlist[xAxis - 1].y = rectYAxis
},
zlevel: 100
clearRect() {
const rectListRef = this.$refs.rectListRef
if (rectListRef) {
rectListRef.clear()
}
},
//
handleMove(yctrl) {
this.baseCtrls_Copy.yctrl = yctrl
this.redrawBaseLine()
},
//
handleMoveEnd(prevYAxis, index) {
this.isModifying = false
this.pushOperationStack(Operators.MODIFY, {
index,
prevYAxis
})
},
// 线
redrawBaseLine() {
console.log('%c [ 重新生成基线 ]-1355', 'font-size:13px; background:pink; color:#bf2c9f;')
},
try {
console.time('updateBaseLine')
const res = updateBaseLine(JSON.stringify(this.baseCtrls_Copy))
console.timeEnd('updateBaseLine')
const parsed = JSON.parse(res)
const { baseline } = parsed
const baseLineEditSeries = findSeriesByName(this.option.series, 'BaseLine_Edit')
baseLineEditSeries.data = baseline.map((val, index) => [index + 1, val])
// +
buildGraphicPlusByData() {
this.option.graphic[1].children.forEach(item => {
item.$action = 'remove'
})
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'
},
zlevel: 101
this.baseCtrls_Copy.baseline = baseline
} catch (error) {
console.error(error)
}
},
@ -1410,9 +1109,6 @@ export default {
* 设置小方块可拖拽
*/
setGraphicDraggable(draggable) {
this.option.graphic[0].children.forEach(item => {
item.draggable = draggable
})
this.isModifying = draggable
},
@ -1425,16 +1121,13 @@ export default {
return
}
const chart = this.$refs.chartRef.getChartInstance()
const controlPointList = this.option.graphic[0].children
const { xctrl, yctrl, baseline, yslope } = this.baseCtrls_Copy
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) {
for (; i < xctrl.length; ++i) {
const currCP = xctrl[i]
if (currCP >= this.currChannel) {
if (currCP == this.currChannel) {
this.$message.warn(`The new control point in channel ${this.currChannel} exists, can't introduce twice`)
return
}
@ -1443,11 +1136,11 @@ export default {
}
// 线
const yAxis = this._channelBaseLineChart.pointlist[this.currChannel - 1].y
this._channelBaseCPChart.splice(i, 0, { point: { x: this.currChannel, y: yAxis } })
this.buildGraphicRectByData()
const yAxis = baseline[this.currChannel - 1]
xctrl.splice(i, 0, this.currChannel)
yctrl.splice(i, 0, yAxis)
yslope.splice(i, 0, 0)
this.buildRect()
this.pushOperationStack(Operators.ADD, { index: i })
},
@ -1455,28 +1148,34 @@ export default {
handleRemoveCP() {
this.setGraphicDraggable(false)
const { xctrl, yctrl, yslope } = this.baseCtrls_Copy
// find nearest control-point
const controlPointList = this._channelBaseCPChart
let i = 1
for (; i < controlPointList.length; ++i) {
const { x: currXAxis } = controlPointList[i].point
for (; i < xctrl.length; ++i) {
const currXAxis = xctrl[i]
if (currXAxis >= this.currChannel) {
const { x: prevX } = controlPointList[i - 1].point
const prevX = xctrl[i - 1]
if (currXAxis - this.currChannel > this.currChannel - prevX) --i
break
}
}
if (i == 0 || i >= controlPointList.length - 1) {
if (i == 0 || i >= xctrl.length - 1) {
this.$message.warn("Can't remove first/last control point")
return
}
const [point] = controlPointList.splice(i, 1)
this.buildGraphicRectByData()
const [removeXAxis] = xctrl.splice(i, 1)
const [removeYAxis] = yctrl.splice(i, 1)
const [removeYSlope] = yslope.splice(i, 1)
this.buildRect()
this.redrawBaseLine()
this.pushOperationStack(Operators.REMOVE, {
index: i,
point: point.point
removeXAxis,
removeYAxis,
removeYSlope
})
},
@ -1489,7 +1188,7 @@ export default {
handleEditSlope() {
this.setGraphicDraggable(false)
const { xctrl, yslope } = this._baseCtrls
const { xctrl, yslope } = this.baseCtrls_Copy
if (!xctrl.length) {
this.$message.warn('No control points to be edited')
return
@ -1522,14 +1221,14 @@ export default {
return
}
const { yslope } = this._baseCtrls
const { yslope } = this.baseCtrls_Copy
yslope[index] = slope
this.pushOperationStack(Operators.SLOPE_CHANGE, {
index,
slope: prevSlope
})
this.buildGraphicPlusByData()
this.redrawBaseLine()
this.buildRect()
},
//
@ -1540,11 +1239,25 @@ export default {
// 线
handleReplot() {
const { xctrl, yctrl, yslope, baseline } = this.baseCtrls_Copy
const baseLineSeries = findSeriesByName(this.option.series, 'BaseLine')
baseLineSeries.data = this._channelBaseLineChart.pointlist.map(({ x, y }) => [x, y])
baseLineSeries.data = baseline.map((val, index) => [index + 1, val])
const baseLineCP = findSeriesByName(this.option.series, 'BaseLine_Ctrl_Point')
baseLineCP.data = this.buildCPPointData(this._channelBaseCPChart)
//
const firstCP = this.channelBaseCPChart[0]
const { color, size } = firstCP
const baseCPPoints = xctrl.map((xAxis, index) => {
return {
size,
color,
point: {
x: xAxis,
y: yctrl[index]
}
}
})
baseLineCP.data = this.buildCPPointData(baseCPPoints)
},
/**
@ -1566,8 +1279,26 @@ export default {
// Baseline Control Points
handleAccept() {
this.channelBaseLineChart = this._channelBaseLineChart
this.channelBaseCPChart = this._channelBaseCPChart
this.BaseCtrls = cloneDeep(this.baseCtrls_Copy)
const { baseline, xctrl, yctrl } = this.BaseCtrls
this.channelBaseLineChart.pointlist = baseline.map((val, index) => {
return {
x: index + 1,
y: val
}
})
this.channelBaseCPChart = xctrl.map((val, index) => {
return {
color: this.channelBaseCPChart[0].color,
name: index.toString(),
point: {
x: val,
y: yctrl[index]
},
size: 4
}
})
this.handleSwitchOperation()
@ -1636,6 +1367,74 @@ export default {
}
},
// baseline
buildBaseLine(channelBaseLineChart) {
return buildLineSeries(
'BaseLine',
channelBaseLineChart.pointlist.map(({ x, y }) => [x, y]),
channelBaseLineChart.color,
{
markLine: {
silent: true,
symbol: 'none',
label: {
show: false
},
lineStyle: {
color: 'red',
width: 1
},
data: [{ xAxis: -1 }]
},
zlevel: 10
}
)
},
// count
buildCountLine(channelCountChart) {
return buildLineSeries(
'CountChart',
channelCountChart.pointlist.map(({ x, y }) => [x, y]),
channelCountChart.color
)
},
// Peaks
buildPeaks(channelPeakChart) {
return channelPeakChart.map((item, index) => {
return buildLineSeries(
'Peak_' + (index + 1),
item.pointlist.map(({ x, y }) => [x, y]),
item.color
)
})
},
// 线
buildCtrlPoint(channelBaseCPChart) {
return {
name: 'BaseLine_Ctrl_Point',
type: 'scatter',
data: this.buildCPPointData(channelBaseCPChart),
silent: true,
animation: false,
zlevel: 20
}
},
//
buildBarChart(barChart) {
return buildLineSeries(
'BarChart',
barChart.map(({ x, y }) => [x, y]),
'#fff',
{
silent: true
}
)
},
/**
* 推入操作
* @param {*} operator 操作符
@ -1654,42 +1453,34 @@ export default {
popOperationStack() {
const { operator, operand } = this.operationStack.pop()
const { index } = operand
const { xctrl, yctrl, yslope } = this.baseCtrls_Copy
switch (operator) {
case Operators.ADD:
this._channelBaseCPChart.splice(index, 1)
this.buildGraphicRectByData()
xctrl.splice(index, 1)
yctrl.splice(index, 1)
yslope.splice(index, 1)
break
case Operators.MODIFY:
const { xAxis, yAxis } = operand
const { prevYAxis } = 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
yctrl[index] = prevYAxis
break
case Operators.REMOVE:
const {
point: { x, y }
} = operand
this._channelBaseCPChart.splice(index, 0, {
point: {
x,
y
}
})
this.buildGraphicRectByData()
const { removeXAxis, removeYAxis, removeYSlope } = operand
xctrl.splice(index, 0, removeXAxis)
yctrl.splice(index, 0, removeYAxis)
yslope.splice(index, 0, removeYSlope)
break
case Operators.SLOPE_CHANGE:
const { slope } = operand
const { yslope } = this._baseCtrls
yslope[index] = slope
break
}
this.buildRect()
// 线
this.redrawBaseLine()
},
/**
@ -1724,6 +1515,7 @@ export default {
.chart {
height: 331px;
position: relative;
}
.thumbnail {

View File

@ -43,10 +43,10 @@
<a-input v-model="model.edit_cal_high" disabled></a-input>
</a-form-model-item>
<a-form-model-item>
<a-checkbox v-model="model.checkBox_updateCal" disabled> Update Calibration </a-checkbox>
<a-checkbox v-model="model.checkBox_updateCal"> Update Calibration </a-checkbox>
</a-form-model-item>
<a-form-model-item>
<a-checkbox v-model="model.checkBox_keepPeak" disabled> Keep Calibration Peak Search Peaks </a-checkbox>
<a-checkbox v-model="model.checkBox_keepPeak"> Keep Calibration Peak Search Peaks </a-checkbox>
</a-form-model-item>
</a-form-model>
</title-over-border>
@ -175,6 +175,8 @@ export default {
edit_riskLevelK,
dateTime_Act,
dateTime_Conc,
checkBox_updateCal,
checkBox_keepPeak,
} = this.model
const param = {
@ -192,11 +194,14 @@ export default {
riskLevelK: edit_riskLevelK,
refTime_act: dateTime_Act,
refTime_conc: dateTime_Conc,
updateCalibration: checkBox_updateCal,
keepCalPeakSearchPeaks: checkBox_keepPeak,
}
const { success, message } = await postAction('/gamma/configureSave', param)
if (success) {
this.$message.success('Save Success')
this.$emit('senInfo', checkBox_updateCal ? '1' : '0')
} else {
this.$message.error(message)
}

View File

@ -319,6 +319,9 @@ export default {
canUseFilePicker,
}
},
created() {
this.handleReset()
},
methods: {
// 10*4
getInitialList() {
@ -386,6 +389,7 @@ export default {
if (!isFileInDirectory) {
this.$message.warn('File and Directory Not in Same')
this.directoryHanlder = undefined
this.useFilePicker(column, record, rowIndex)
return
}
@ -664,6 +668,7 @@ export default {
this.isUploadingZip = false
}
} else {
this.isUploadingZip = false
this.$message.error(message)
}
} catch (error) {
@ -679,10 +684,6 @@ export default {
handleCancel() {
this.visible = false
},
beforeModalOpen() {
this.handleReset()
},
},
}
</script>

View File

@ -1,52 +1,52 @@
<template>
<custom-modal v-model="visible" :width="400" title="Processing Monitor" :footer="null">
<div class="processing">
<div>
<div v-if="calibrationUpdatesFlag" style="margin-bottom: 20px">
<!-- 标题 -->
<div class="processing-title">Calibration Updates</div>
<!-- 列表 -->
<div class="processing-list">
<div class="processing-list-item">
<status :status="0" />
<status :status="status_ener1" />
<div class="description">Energy - Mariscotti Centroids</div>
</div>
<div class="processing-list-item">
<status :status="0" />
<status :status="status_reso" />
<div class="description">Resolution</div>
</div>
<div class="processing-list-item">
<status :status="0" />
<status :status="status_ener2" />
<div class="description">Energy - Fitted Centroids</div>
</div>
</div>
</div>
<div style="margin-top: 20px;">
<div>
<!-- 标题 -->
<div class="processing-title">Spectrum Analysis</div>
<!-- 列表 -->
<div class="processing-list">
<div class="processing-list-item">
<status :status="0" />
<status :status="status_peak" />
<div class="description">Peak Search</div>
</div>
<div class="processing-list-item">
<status :status="0" />
<status :status="status_base" />
<div class="description">Baseline Fitting</div>
</div>
<div class="processing-list-item">
<status :status="1" />
<status :status="status_net" />
<div class="description">Net Area Fitting</div>
</div>
<div class="processing-list-item">
<status :status="2" />
<status :status="status_nucl" />
<div class="description">Nuclide Identification</div>
</div>
<div class="processing-list-item">
<status :status="2" />
<status :status="status_acti" />
<div class="description">Activity and MDA</div>
</div>
<div class="processing-list-item">
<status :status="2" />
<status :status="status_qc" />
<div class="description">QC Test</div>
</div>
</div>
@ -59,12 +59,24 @@
import Status from './components/status.vue'
export default {
components: {
Status
Status,
},
props: {
value: {
type: Boolean
}
type: Boolean,
},
bAnalyed: {
type: Boolean,
},
checkBoxFlag: {
type: Boolean,
},
newCheckBoxFlag: {
type: String,
},
currStep: {
type: String,
},
},
computed: {
visible: {
@ -73,9 +85,125 @@ export default {
},
set(val) {
this.$emit('input', val)
},
},
},
watch: {
newCheckBoxFlag: {
handler(val) {
console.log('flag', val)
if (val === '0') {
this.calibrationUpdatesFlag = false
this.status_peak = 1
this.status_base = 2
this.status_net = 2
this.status_nucl = 2
this.status_acti = 2
this.status_qc = 2
} else if (val === '1') {
this.calibrationUpdatesFlag = true
this.status_ener1 = 1
this.status_reso = 1
this.status_ener2 = 1
this.status_peak = 2
this.status_base = 2
this.status_net = 2
this.status_nucl = 2
this.status_acti = 2
this.status_qc = 2
} else {
this.calibrationUpdatesFlag = this.checkBoxFlag
this.status_peak = this.checkBoxFlag ? 2 : 1
this.status_ener1 = 1
this.status_reso = 1
this.status_ener2 = 1
this.status_base = 2
this.status_net = 2
this.status_nucl = 2
this.status_acti = 2
this.status_qc = 2
}
},
immediate: true,
},
currStep: {
handler(val) {
if (val === '0' && this.calibrationUpdatesFlag) {
this.status_ener1 = 0
this.status_reso = 0
this.status_ener2 = 0
this.status_peak = 1
} else if (val === '1') {
this.status_ener1 = 0
this.status_reso = 0
this.status_ener2 = 0
this.status_peak = 0
this.status_base = 1
} else if (val === '2') {
this.status_ener1 = 0
this.status_reso = 0
this.status_ener2 = 0
this.status_peak = 0
this.status_base = 0
this.status_net = 1
} else if (val === '3') {
this.status_ener1 = 0
this.status_reso = 0
this.status_ener2 = 0
this.status_peak = 0
this.status_base = 0
this.status_net = 0
this.status_nucl = 1
} else if (val === '4') {
this.status_ener1 = 0
this.status_reso = 0
this.status_ener2 = 0
this.status_peak = 0
this.status_base = 0
this.status_net = 0
this.status_nucl = 0
this.status_acti = 1
} else if (val === '5') {
this.status_ener1 = 0
this.status_reso = 0
this.status_ener2 = 0
this.status_peak = 0
this.status_base = 0
this.status_net = 0
this.status_nucl = 0
this.status_acti = 0
this.status_qc = 1
} else if (val === '6') {
this.status_ener1 = 0
this.status_reso = 0
this.status_ener2 = 0
this.status_peak = 0
this.status_base = 0
this.status_net = 0
this.status_nucl = 0
this.status_acti = 0
this.status_qc = 0
setTimeout(() => {
this.$emit('closeModal')
}, 500)
}
},
},
},
data() {
return {
calibrationUpdatesFlag: true,
status_ener1: 1,
status_reso: 1,
status_ener2: 1,
status_peak: 2,
status_base: 2,
status_net: 2,
status_nucl: 2,
status_acti: 2,
status_qc: 2,
}
},
}
</script>

View File

@ -91,7 +91,15 @@
<compare-file-list-modal v-model="compareFileListModalVisible" @compareWithFile="handleCompareWithFile" />
<!-- ReProcessing 弹窗开始 -->
<re-processing-modal v-model="reprocessingModalVisible" />
<re-processing-modal
v-if="abc"
v-model="reprocessingModalVisible"
:bAnalyed="bAnalyed"
:currStep="currStep"
:checkBoxFlag="checkBox_updateCal"
:newCheckBoxFlag="newCheckBox_updateCal"
@closeModal="haCndleCloseModal"
/>
<!-- ReProcessing 弹窗结束 -->
</div>
</template>
@ -121,11 +129,18 @@ import ReProcessingModal from './components/Modals/ReProcessingModal/index.vue'
import { GammaOptions, graphAssistance } from './settings'
import store from '@/store/'
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
export default {
props: {
sample: {
type: Object,
},
updateFlag: {
type: String,
},
},
components: {
CustomChart,
@ -141,6 +156,7 @@ export default {
},
data() {
return {
abc: false,
isLoading: false,
isLoadingNuclide: false,
option: cloneDeep(GammaOptions.option),
@ -191,10 +207,16 @@ export default {
compareFileListModalVisible: false, // Compare
reprocessingModalVisible: false, //
isProcessing: false, //
websock: null,
lockReconnect: false,
bAnalyed: false, //
checkBox_updateCal: false, //update
newCheckBox_updateCal: false, //update
currStep: '',
}
},
created() {
this.option.title.text = '{a|Channel:0} {a|Energy:0} {a|Counts:0} {a|Detectability:0}'
this.setChartBottomTitle(0, 0, 0)
this.option.tooltip.formatter = this.tooltipFormatter
this.$bus.$on('colorChange', this.handleColorChange)
@ -210,8 +232,55 @@ export default {
},
mounted() {
this.option.brush = { toolbox: [] }
this.initWebSocket()
},
methods: {
initWebSocket: function () {
console.log('qweqwerq')
// WebSocketwshttpwsshttps
var userId = store.getters.userInfo.id
var url =
window._CONFIG['domianURL'].replace('https://', 'wss://').replace('http://', 'ws://') + '/websocket/' + userId
//console.log(url);
//update-begin-author:taoyan date:2022-4-22 for: v2.4.6 websocket #3278
let token = Vue.ls.get(ACCESS_TOKEN)
this.websock = new WebSocket(url, [token])
//update-end-author:taoyan date:2022-4-22 for: v2.4.6 websocket #3278
this.websock.onopen = this.websocketOnopen
this.websock.onerror = this.websocketOnerror
this.websock.onmessage = this.websocketOnmessage
this.websock.onclose = this.websocketOnclose
},
websocketOnopen: function () {
// console.log('WebSocket1231')
//
//this.heartCheck.reset().start();
},
websocketOnerror: function (e) {
this.reconnect()
},
websocketOnmessage: function (e) {
// console.log('-----1231-------', e.data)
var data = eval('(' + e.data + ')') //
// console.log(data)
if (data.cmd === 'analysis-process') {
this.currStep = data.msgTxt
}
},
websocketOnclose: function (e) {
this.reconnect()
},
reconnect() {
var that = this
if (that.lockReconnect) return
that.lockReconnect = true
//
setTimeout(function () {
console.info('尝试重连...')
that.initWebSocket()
that.lockReconnect = false
}, 20000)
},
//
async getSampleDetail() {
const { dbName, sampleId } = this.sample
@ -234,12 +303,14 @@ export default {
)
console.log('%c [ result ]-243', 'font-size:13px; background:pink; color:#bf2c9f;', result)
if (success) {
this.dataProsess(result)
this.dataProsess(result, 'db')
} else {
this.$message.error(message)
this.isLoading = false
}
} catch (error) {
console.error(error)
this.isLoading = false
}
},
@ -262,12 +333,14 @@ export default {
)
console.log('%c [ result ]-243', 'font-size:13px; background:pink; color:#bf2c9f;', result)
if (success) {
this.dataProsess(result)
this.dataProsess(result, 'file')
} else {
this.$message.error(message)
this.isLoading = false
}
} catch (error) {
console.error(error)
this.isLoading = false
}
},
@ -284,7 +357,7 @@ export default {
return cancelToken
},
dataProsess(result) {
dataProsess(result, flag) {
this.isLoading = false
const {
@ -304,7 +377,12 @@ export default {
shapeChannelData,
shapeEnergyData,
} = result
if (flag && (flag == 'dab' || flag == 'file')) {
this.bAnalyed = result.bAnalyed
this.checkBox_updateCal = result.checkBox_updateCal
this.newCheckBox_updateCal = '2'
console.log(this.checkBox_updateCal)
}
this.detailedInfomation = DetailedInformation
this.qcFlags = QCFlag
@ -458,7 +536,7 @@ export default {
}
return `<div class="channel">Channel: ${channel}</div>
<div class="energy">Energy: ${energy}</div>`
<div class="energy">${energy ? `Energy: ${energy}` : ''}</div>`
},
// Graph Assistance
@ -643,19 +721,37 @@ export default {
const spectrumLineSeries = findSeriesByName(this.option.series, 'Spectrum')
spectrumLineSeries.markLine.data[0].xAxis = xAxis
const channel = this.isEnergy() ? this.getChannelByEnergy(xAxis) : parseInt(xAxis.toFixed())
const energy = this.isEnergy()
? xAxis.toFixed(2)
: this.energyData.all.pointlist && this.energyData.all.pointlist[channel - 1].x.toFixed(2)
const counts = this.isEnergy()
? this.energyData.all.pointlist[channel - 1]
: this.channelData.all.pointlist[channel - 1]
this.option.title.text = `{a|Channel:${channel}} {a|Energy:${energy}} {a|Counts:${counts.y}} {a|Detectability:0}`
const { channel, energy, counts } = this.getEnergyAndCountsByXAxis(xAxis)
this.setChartBottomTitle(channel, energy, counts)
this.getSelPosNuclide(channel)
}
},
//
setChartBottomTitle(channel, energy, counts) {
this.option.title.text = `{a|Channel:${channel}} {a|Energy:${energy}} {a|Counts:${counts}} {a|Detectability:0}`
},
// xAixschannelenergycounts
getEnergyAndCountsByXAxis(xAxis) {
let channel, energy, counts
if (this.isEnergy()) {
channel = this.getChannelByEnergy(xAxis)
energy = xAxis.toFixed(2)
counts = this.energyData.all.pointlist[channel - 1]
} else {
channel = parseInt(xAxis.toFixed())
energy = this.energyData.all.pointlist && this.energyData.all.pointlist[channel - 1].x.toFixed(2)
counts = this.channelData.all.pointlist[channel - 1]
}
return {
channel,
energy,
counts: counts.y,
}
},
//
handleChartDblClick() {
this.handleResetChart()
@ -789,6 +885,8 @@ export default {
if (find) {
this.getSelPosNuclide(find)
const { channel, energy, counts } = this.getEnergyAndCountsByXAxis(find)
this.setChartBottomTitle(channel, energy, counts)
}
},
@ -1059,13 +1157,17 @@ export default {
handleRefresh(data) {
this.handleResetState()
data.DetailedInformation = this.detailedInfomation
this.clearCompareLine()
this.dataProsess(data)
},
// Accept
handleAccept() {
console.log('%c [ 分析工具Accept时刷新部分数据 ]-1046', 'font-size:13px; background:pink; color:#bf2c9f;')
handleAccept(data) {
console.log('%c [ handleAccept ]-1088', 'font-size:13px; background:pink; color:#bf2c9f;', data)
this.handleResetState()
// data.DetailedInformation = this.detailedInfomation
this.clearCompareLine()
// this.dataProsess(data)
},
//
@ -1118,11 +1220,10 @@ export default {
try {
this.isLoading = true
this.handleResetState()
const { inputFileName: fileName } = this.sample
const { success, result, message } = await postAction(`/gamma/Reprocessing?fileName=${fileName}`)
if (success) {
this.handleResetState()
result.DetailedInformation = this.detailedInfomation
this.dataProsess(result)
} else {
@ -1135,8 +1236,13 @@ export default {
}
} catch (error) {
console.error(error)
} finally {
this.isLoading = false
}
// this.reprocessingModalVisible = true
},
haCndleCloseModal() {
this.reprocessingModalVisible = false
this.abc = false
},
/**
@ -1341,6 +1447,16 @@ export default {
},
},
watch: {
currStep: {
handler(val) {
console.log('dfad', val)
if (val && val == '0') {
this.abc = true
this.reprocessingModalVisible = true
}
},
immediate: true,
},
sample: {
handler(newVal, oldVal) {
console.log('newValnewVal', newVal)
@ -1352,6 +1468,13 @@ export default {
},
immediate: true,
},
updateFlag: {
handler(val) {
console.log('dfad', val)
this.newCheckBox_updateCal = val
},
immediate: true,
},
},
}
</script>

View File

@ -30,7 +30,7 @@
<!-- 频谱分析部分 -->
<div class="spectrum-analysis-main">
<!-- Gamma 分析 -->
<gamma-analysis v-if="isGamma" ref="gammaAnalysisRef" :sample="sampleData" />
<gamma-analysis v-if="isGamma" ref="gammaAnalysisRef" :sample="sampleData" :updateFlag="updateFlag" />
<!-- Gamma 分析 -->
<!-- Beta-Gamma 分析 -->
@ -78,7 +78,11 @@
<!-- Save Setting 弹窗结束 -->
<!-- 分析-设置弹窗开始 -->
<analyze-setting-modal v-model="analyzeConfigureModalVisible" :sampleId="sampleData.sampleId" />
<analyze-setting-modal
v-model="analyzeConfigureModalVisible"
:sampleId="sampleData.sampleId"
@senInfo="getUpdateFlag"
/>
<!-- 分析-设置弹窗结束 -->
<!-- 分析工具弹窗开始 -->
@ -374,6 +378,7 @@ export default {
xe133mFlag: null,
xe135Flag: null,
},
updateFlag: '2',
}
},
created() {
@ -391,6 +396,10 @@ export default {
},
methods: {
getUpdateFlag(val) {
console.log('qerq', val)
this.updateFlag = val
},
getcommentsInfo(val) {
this.params_toDB.comment = val.spectrumAnalysisCommentInfo
},