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

This commit is contained in:
xiaoguangbin 2023-11-02 13:52:09 +08:00
commit ae866d1bdd
3 changed files with 75 additions and 70 deletions

View File

@ -3,9 +3,7 @@
<a-spin :spinning="isLoading"> <a-spin :spinning="isLoading">
<custom-table :columns="columns" :list="list" :canSelect="false"> <custom-table :columns="columns" :list="list" :canSelect="false">
<template v-for="(slot, index) in slots" :slot="slot.slotName" slot-scope="{ record }"> <template v-for="(slot, index) in slots" :slot="slot.slotName" slot-scope="{ record }">
<a-checkbox v-if="slot.isCheckbox" :key="index" v-model="record[slot.dataIndex]"> <a-checkbox v-if="slot.isCheckbox" :key="index" v-model="record[slot.dataIndex]"> Fixed </a-checkbox>
Fixed
</a-checkbox>
<a-input <a-input
v-else v-else
:key="index" :key="index"
@ -18,17 +16,10 @@
</a-spin> </a-spin>
<div slot="custom-footer"> <div slot="custom-footer">
<a-space> <a-space>
<a-button <a-button type="primary" :disabled="isLoading" :loading="isAcceptting" @click="handlePeaks(true)">
type="primary"
:disabled="isCanceling || isLoading"
:loading="isAcceptting"
@click="handlePeaks(true)"
>
Peaks Peaks
</a-button> </a-button>
<a-button :disabled="isAcceptting || isLoading" :loading="isCanceling" @click="handlePeaks(false)" <a-button>Cancel</a-button>
>Cancel</a-button
>
</a-space> </a-space>
</div> </div>
</custom-modal> </custom-modal>
@ -46,106 +37,105 @@ const columns = [
dataIndex: 'lab', dataIndex: 'lab',
width: 100, width: 100,
scopedSlots: { scopedSlots: {
customRender: 'lab' customRender: 'lab',
}, },
isStatic: true isStatic: true,
}, },
{ {
title: 'Nuclide', title: 'Nuclide',
dataIndex: 'nuclide', dataIndex: 'nuclide',
width: 100, width: 100,
scopedSlots: { scopedSlots: {
customRender: 'nuclide' customRender: 'nuclide',
}, },
isStatic: true isStatic: true,
}, },
{ {
title: 'Energy', title: 'Energy',
dataIndex: 'energy', dataIndex: 'energy',
width: 100, width: 100,
scopedSlots: { scopedSlots: {
customRender: 'Energy' customRender: 'Energy',
} },
}, },
{ {
title: 'NetArea', title: 'NetArea',
dataIndex: 'netArea', dataIndex: 'netArea',
width: 100, width: 100,
scopedSlots: { scopedSlots: {
customRender: 'netArea' customRender: 'netArea',
} },
}, },
{ {
title: 'FWHM', title: 'FWHM',
dataIndex: 'fwhm', dataIndex: 'fwhm',
width: 100, width: 100,
scopedSlots: { scopedSlots: {
customRender: 'fwhm' customRender: 'fwhm',
} },
}, },
{ {
title: 'Step', title: 'Step',
dataIndex: 'step', dataIndex: 'step',
width: 100, width: 100,
scopedSlots: { scopedSlots: {
customRender: 'Step' customRender: 'Step',
} },
}, },
{ {
title: 'BWGamma', title: 'BWGamma',
dataIndex: 'bwGamma', dataIndex: 'bwGamma',
width: 100, width: 100,
scopedSlots: { scopedSlots: {
customRender: 'BWGamma' customRender: 'BWGamma',
} },
}, },
{ {
title: 'NetArea', title: 'NetArea',
dataIndex: 'netAreaB', dataIndex: 'netAreaB',
width: 100, width: 100,
scopedSlots: { scopedSlots: {
customRender: 'netAreaB' customRender: 'netAreaB',
}, },
isCheckbox: true isCheckbox: true,
}, },
{ {
title: 'Centroid', title: 'Centroid',
dataIndex: 'centroid', dataIndex: 'centroid',
width: 100, width: 100,
scopedSlots: { scopedSlots: {
customRender: 'Centroid' customRender: 'Centroid',
}, },
isCheckbox: true isCheckbox: true,
}, },
{ {
title: 'FWHM', title: 'FWHM',
dataIndex: 'fwhmB', dataIndex: 'fwhmB',
width: 100, width: 100,
scopedSlots: { scopedSlots: {
customRender: 'fwhmB' customRender: 'fwhmB',
},
isCheckbox: true,
}, },
isCheckbox: true
}
] ]
export default { export default {
mixins: [ModalMixin, SampleDataMixin], mixins: [ModalMixin, SampleDataMixin],
props: { props: {
channel_1: { channel_1: {
type: Number type: Number,
}, },
channel_2: { channel_2: {
type: Number type: Number,
}, },
isInsertPeak: { isInsertPeak: {
type: Boolean type: Boolean,
} },
}, },
data() { data() {
this.columns = columns this.columns = columns
return { return {
list: [], list: [],
isAcceptting: false, isAcceptting: false,
isCanceling: false
} }
}, },
methods: { methods: {
@ -159,7 +149,7 @@ export default {
oldPeak: this.oldPeaks, oldPeak: this.oldPeaks,
newPeak: this.newPeaks, newPeak: this.newPeaks,
flag: this.isInsertPeak ? 'insert' : 'fit', flag: this.isInsertPeak ? 'insert' : 'fit',
tablePeaksList: this.list tablePeaksList: this.list,
}) })
if (success) { if (success) {
this.visible = false this.visible = false
@ -176,12 +166,12 @@ export default {
// //
handleInput(record, index) { handleInput(record, index) {
const find = this.newPeaks.find(item => item.index == record.lab) const find = this.newPeaks.find((item) => item.index == record.lab)
if (find) { if (find) {
const table2NewPeakMap = { const table2NewPeakMap = {
energy: 'energy', energy: 'energy',
netArea: 'area', netArea: 'area',
fwhm: 'fwhm' fwhm: 'fwhm',
} }
find[table2NewPeakMap[index]] = record[index] find[table2NewPeakMap[index]] = record[index]
@ -195,7 +185,7 @@ export default {
let params = { let params = {
left: this.channel_1, left: this.channel_1,
right: this.channel_2, right: this.channel_2,
fileName fileName,
} }
// Insert Peak // Insert Peak
@ -204,7 +194,7 @@ export default {
params = { params = {
sampleId, sampleId,
fileName, fileName,
curChan: Math.ceil(this.channel_1) curChan: Math.ceil(this.channel_1),
} }
} }
@ -212,7 +202,7 @@ export default {
const { success, result, message } = await getAction(url, params) const { success, result, message } = await getAction(url, params)
if (success) { if (success) {
const { newPeaks, oldPeaks, tablePeaksList } = result const { newPeaks, oldPeaks, tablePeaksList } = result
tablePeaksList.forEach(item => { tablePeaksList.forEach((item) => {
item.energy = Number(item.energy).toPrecision(6) item.energy = Number(item.energy).toPrecision(6)
item.netArea = Number(item.netArea).toPrecision(6) item.netArea = Number(item.netArea).toPrecision(6)
item.fwhm = Number(item.fwhm).toPrecision(6) item.fwhm = Number(item.fwhm).toPrecision(6)
@ -232,20 +222,20 @@ export default {
beforeModalOpen() { beforeModalOpen() {
this.getData() this.getData()
} },
}, },
computed: { computed: {
slots() { slots() {
return columns.map(column => { return columns.map((column) => {
return { return {
isCheckbox: column.isCheckbox, isCheckbox: column.isCheckbox,
isStatic: column.isStatic, isStatic: column.isStatic,
dataIndex: column.dataIndex, dataIndex: column.dataIndex,
slotName: column.scopedSlots.customRender slotName: column.scopedSlots.customRender,
} }
}) })
} },
} },
} }
</script> </script>

View File

@ -381,7 +381,7 @@ const thumbnailOption = {
axisLine: { axisLine: {
lineStyle: { lineStyle: {
color: '#fff', color: '#fff',
} },
}, },
splitLine: { splitLine: {
show: false, show: false,
@ -406,12 +406,8 @@ const thumbnailOption = {
axisLabel: { axisLabel: {
show: false, show: false,
}, },
max: (value) => { max: 0,
return (Math.abs(value.min) < value.max ? value.max : -value.min).toFixed(2) min: 0,
},
min: (value) => {
return (Math.abs(value.min) < value.max ? -value.max : value.min).toFixed(2)
},
}, },
series: null, series: null,
} }
@ -461,6 +457,7 @@ export default {
channelBaseLineChart: [], channelBaseLineChart: [],
channelCountChart: [], channelCountChart: [],
channelPeakChart: [], channelPeakChart: [],
barChart: [],
energy: [], energy: [],
list: [], list: [],
BaseCtrls: {}, BaseCtrls: {},
@ -550,10 +547,12 @@ export default {
// 线 // 线
series.push(this.buildCtrlPoint(baseCP)) series.push(this.buildCtrlPoint(baseCP))
this.option.series = series
this.thumbnailOption.series = this.buildBarChart(bar) this.thumbnailOption.series = this.buildBarChart(bar)
const thumbnailYMax = this.getThumbnailYMax(0, bar.length)
this.option.series = series this.thumbnailOption.yAxis.max = thumbnailYMax
this.thumbnailOption.yAxis.min = -thumbnailYMax
}, },
reset() { reset() {
@ -567,6 +566,7 @@ export default {
this.selectedKeys = [] this.selectedKeys = []
}) })
this.clearRect() this.clearRect()
this.handleResetChart()
}, },
beforeModalOpen() { beforeModalOpen() {
@ -1030,8 +1030,11 @@ export default {
this.option.yAxis.min = y1 this.option.yAxis.min = y1
this.option.yAxis.max = y2 this.option.yAxis.max = y2
const thumbnailYMax = this.getThumbnailYMax(x1 - 1, x2)
this.thumbnailOption.xAxis.min = x1 this.thumbnailOption.xAxis.min = x1
this.thumbnailOption.xAxis.max = x2 this.thumbnailOption.xAxis.max = x2
this.thumbnailOption.yAxis.max = thumbnailYMax
this.thumbnailOption.yAxis.min = -thumbnailYMax
if (this.btnGroupType == 2) { if (this.btnGroupType == 2) {
this.buildRect() this.buildRect()
@ -1040,14 +1043,26 @@ export default {
this.clearBrush(chart) this.clearBrush(chart)
}, },
// barChart
getThumbnailYMax(minIndex, maxIndex) {
const slicedArr = this.barChart.slice(minIndex, maxIndex)
const yData = slicedArr.map(({ y }) => y)
const max = Math.max(...yData)
const min = Math.min(...yData)
return Math.max(Math.abs(max), Math.abs(min))
},
handleResetChart() { handleResetChart() {
this.option.xAxis.min = 1 this.option.xAxis.min = 1
this.option.xAxis.max = 'dataMax' this.option.xAxis.max = 'dataMax'
this.option.yAxis.min = 0.1 this.option.yAxis.min = 0.1
this.option.yAxis.max = 'dataMax' this.option.yAxis.max = 'dataMax'
const thumbnailYMax = this.getThumbnailYMax(0, this.barChart.length)
this.thumbnailOption.xAxis.min = 1 this.thumbnailOption.xAxis.min = 1
this.thumbnailOption.xAxis.max = 'dataMax' this.thumbnailOption.xAxis.max = 'dataMax'
this.thumbnailOption.yAxis.max = thumbnailYMax
this.thumbnailOption.yAxis.min = -thumbnailYMax
if (this.btnGroupType == 2) { if (this.btnGroupType == 2) {
this.buildRect() this.buildRect()

View File

@ -433,10 +433,10 @@ export default {
}, },
getStationName(arg, val, flag) { getStationName(arg, val, flag) {
arg.forEach((item) => { arg.forEach((item) => {
item.conc = Number(item.conc).toPrecision(6) item.conc = parseFloat(Number(item.conc).toPrecision(6))
item.concErr = Number(item.concErr).toPrecision(6) item.concErr = parseFloat(Number(item.concErr).toPrecision(6))
item.lc = Number(item.lc).toPrecision(6) item.lc = parseFloat(Number(item.lc).toPrecision(6))
item.mdc = Number(item.mdc).toPrecision(6) item.mdc = parseFloat(Number(item.mdc).toPrecision(6))
}) })
this.resultDisplayFlag = arg this.resultDisplayFlag = arg
this.params_toDB.stationName = val this.params_toDB.stationName = val
@ -725,10 +725,10 @@ export default {
this.analyseCurrentSpectrumData = res.result this.analyseCurrentSpectrumData = res.result
this.resultDisplayFlag = res.result.XeData this.resultDisplayFlag = res.result.XeData
this.resultDisplayFlag.forEach((item) => { this.resultDisplayFlag.forEach((item) => {
item.conc = item.conc.toPrecision(6) item.conc = parseFloat(item.conc.toPrecision(6))
item.concErr = item.concErr.toPrecision(6) item.concErr = parseFloat(item.concErr.toPrecision(6))
item.lc = item.lc.toPrecision(6) item.lc = parseFloat(item.lc.toPrecision(6))
item.mdc = item.mdc.toPrecision(6) item.mdc = parseFloat(item.mdc.toPrecision(6))
}) })
} else { } else {
this.$message.warning(res.message) this.$message.warning(res.message)
@ -750,10 +750,10 @@ export default {
this.analyseCurrentSpectrumData = res.result this.analyseCurrentSpectrumData = res.result
this.resultDisplayFlag = res.result.XeData this.resultDisplayFlag = res.result.XeData
this.resultDisplayFlag.forEach((item) => { this.resultDisplayFlag.forEach((item) => {
item.conc = item.conc.toPrecision(6) item.conc = parseFloat(item.conc.toPrecision(6))
item.concErr = item.concErr.toPrecision(6) item.concErr = parseFloat(item.concErr.toPrecision(6))
item.lc = item.lc.toPrecision(6) item.lc = parseFloat(item.lc.toPrecision(6))
item.mdc = item.mdc.toPrecision(6) item.mdc = parseFloat(item.mdc.toPrecision(6))
}) })
} else { } else {
this.$message.warning(res.message) this.$message.warning(res.message)