feat: Strip功能

This commit is contained in:
Xu Zhimeng 2023-10-17 15:25:53 +08:00
parent f0dc116793
commit d2878ecd36
4 changed files with 91 additions and 56 deletions

View File

@ -12,7 +12,7 @@
@change="handleTableChange"
></custom-table>
<div slot="custom-footer">
<a-button type="primary" :loading="isComparing" @click="handleOk">Compare</a-button>
<a-button type="primary" @click="handleOk">Ok</a-button>
<a-button @click="visible = false">Cancel</a-button>
</div>
</custom-modal>
@ -22,7 +22,6 @@
import { getAction } from '@/api/manage'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import ModalMixin from '@/mixins/ModalMixin'
import SampleDataMixin from '../../SampleDataMixin'
const columns = [
{
@ -56,7 +55,7 @@ const formItems = [
]
export default {
mixins: [ModalMixin, JeecgListMixin, SampleDataMixin],
mixins: [ModalMixin, JeecgListMixin],
data() {
this.columns = columns
this.formItems = formItems
@ -64,8 +63,7 @@ export default {
return {
queryParam: {},
selectedRowKeys: [],
selectionRows: [],
isComparing: false
selectionRows: []
}
},
methods: {
@ -109,27 +107,9 @@ export default {
this.$message.warn('Please Select A File to Compare')
return
}
try {
const { inputFileName: fileName } = this.sampleData
const compareFileName = this.selectionRows[0].name
this.isComparing = true
const { success, result, message } = await getAction('/gamma/Compare', {
fileName,
compareFileName
})
if (success) {
this.visible = false
this.$emit('compareWithFile', result)
} else {
this.$message.error(message)
}
} catch (error) {
console.error(error)
} finally {
this.isComparing = false
}
this.$emit('fileSelect', this.selectionRows[0].name)
this.visible = false
}
}
}

View File

@ -1,25 +1,45 @@
<template>
<custom-modal v-model="visible" title="Ratio" :width="240" :okHandler="handleOk">
<custom-modal v-model="visible" title="Ratio" :width="240" @cancel="handleReject">
<a-input-number :min="1" v-model="ratio"></a-input-number>
<div slot="custom-footer">
<a-button type="primary" @click="handleOk">OK</a-button>
<a-button @click="handleCancel">Cancel</a-button>
</div>
</custom-modal>
</template>
<script>
import ModalMixin from '@/mixins/ModalMixin'
export default {
mixins: [ModalMixin],
data() {
return {
visible: false,
ratio: 1
}
},
methods: {
getRatio() {
this.visible = true
this.ratio = 1
return new Promise((resolve, reject) => {
this.resolve = resolve
this.reject = reject
})
},
handleOk() {
console.log('%c [ ]-14', 'font-size:13px; background:pink; color:#bf2c9f;', this.ratio)
if(!this.ratio) {
this.$message.warn('Ratio Cannot Be Null')
throw new Error('Ratio Empty')
}
this.resolve(this.ratio)
this.visible = false
},
handleCancel() {
this.resolve()
this.visible = false
},
handleReject() {
this.reject('cancel')
}
}
}

View File

@ -89,7 +89,12 @@
:nuclide="nuclideReview.nuclide"
/>
<compare-file-list-modal v-model="compareFileListModalVisible" @compareWithFile="handleCompareWithFile" />
<compare-file-list-modal v-model="compareFileListModalVisible" @fileSelect="handleFileSelect" />
<!-- Strip 弹窗开始 -->
<strip-modal ref="stripModal" />
<!-- Strip 弹窗结束 -->
<!-- ReProcessing 弹窗开始 -->
<re-processing-modal
v-if="abc"
@ -132,6 +137,7 @@ import { GammaOptions, graphAssistance } from './settings'
import store from '@/store/'
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import StripModal from './components/Modals/StripModal.vue'
export default {
props: {
@ -153,6 +159,7 @@ export default {
NuclideReviewModal,
CompareFileListModal,
ReProcessingModal,
StripModal,
},
data() {
return {
@ -205,6 +212,8 @@ export default {
currChannel: -1,
compareFileListModalVisible: false, // Compare
isStrip: false,
reprocessingModalVisible: false, //
isProcessing: false, //
websock: null,
@ -1196,7 +1205,7 @@ export default {
},
//
showCompareModal() {
showCompareModal(isStrip) {
if (this.isLoading) {
this.$message.warn('Sample is Loading')
return
@ -1204,21 +1213,55 @@ export default {
this.handleResetChart()
this.clearCompareLine()
this.compareFileListModalVisible = true
this.isStrip = isStrip
},
//
handleCompareWithFile([channelData, energyData]) {
this.channelCompareLine = channelData
this.energyCompareLine = energyData
this.redrawLineBySeriesName('Compare', energyData, channelData, true, channelData.color)
async handleFileSelect(selectedFileName) {
const { inputFileName: fileName } = this.sample
if (this.isScatter()) {
lineSeries.type = 'scatterGL'
try {
let param = {
fileName,
compareFileName: selectedFileName,
},
url = '/gamma/Compare'
// Strip
if (this.isStrip) {
const ratio = await this.$refs.stripModal.getRatio()
param = {
fileName,
stripFileName: selectedFileName,
ratioRate: ratio || 1,
}
url = '/gamma/Strip'
}
this.isLoading = true
const { success, result, message } = await getAction(url, param)
if (success) {
const [channelData, energyData] = result
this.channelCompareLine = channelData
this.energyCompareLine = energyData
this.redrawLineBySeriesName('Compare', energyData, channelData, true, channelData.color)
if (this.isScatter()) {
lineSeries.type = 'scatterGL'
}
this.$nextTick(() => {
this.thumbnailOption.yAxis.max = getAxisMax(this.getChart(), 'yAxis')
})
} else {
this.$message.error(message)
}
} catch (error) {
console.error(error)
} finally {
this.isLoading = false
}
this.$nextTick(() => {
this.thumbnailOption.yAxis.max = getAxisMax(this.getChart(), 'yAxis')
})
},
// Compare 线

View File

@ -57,10 +57,6 @@
<load-from-file-modal v-model="loadFromFileModalVisible" @loadFormFile="handleLoadSampleFromFile" />
<!-- 从文件加载结束 -->
<!-- Strip 弹窗开始 -->
<strip-modal v-model="stripModalVisible" />
<!-- Strip 弹窗结束 -->
<!-- Ftransit 弹窗开始 -->
<ftranslt-modal v-model="ftransltModalVisible" />
<!-- Ftransit 弹窗结束 -->
@ -231,7 +227,6 @@ import BetaGammaRlrModal from './components/Modals/BetaGammaModals/BetaGammaRLRM
import StatisticsParamerHistoryModal from './components/Modals/BetaGammaModals/StatisticsParamerHistoryModal.vue'
import FtransltModal from './components/Modals/FtransltModal/index.vue'
import BetaGammaEnergyCalibrationModal from './components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/index.vue'
import StripModal from './components/Modals/StripModal.vue'
import AutomaticAnalysisLogModal from './components/Modals/BetaGammaModals/AutomaticAnalysisLogModal.vue'
import BetaGammaExtrapolationModal from './components/Modals/BetaGammaModals/BetaGammaExtrapolationModal.vue'
import { getAction } from '@/api/manage'
@ -277,7 +272,6 @@ export default {
StatisticsParamerHistoryModal,
FtransltModal,
BetaGammaEnergyCalibrationModal,
StripModal,
AutomaticAnalysisLogModal,
BetaGammaExtrapolationModal,
},
@ -303,7 +297,6 @@ export default {
loadFromDbModalVisible: false, //
loadFromFileModalVisible: false, //
stripModalVisible: false, // Strip
ftransltModalVisible: false, // Ftransit
sampleData: {}, //
@ -723,13 +716,13 @@ export default {
type: 'a-menu-item',
title: 'Compare',
show: this.isGamma,
handler: () => this.$refs.gammaAnalysisRef.showCompareModal(),
handler: () => this.$refs.gammaAnalysisRef.showCompareModal(false),
},
{
type: 'a-menu-item',
title: 'Strip',
show: this.isGamma,
handler: () => (this.stripModalVisible = true),
handler: () => this.$refs.gammaAnalysisRef.showCompareModal(true),
},
{
type: 'a-menu-item',
@ -933,6 +926,7 @@ export default {
},
{
title: 'NUCLIDELIBRARY',
show: !this.isBetaGamma,
children: [
{
type: 'a-menu',
@ -940,13 +934,11 @@ export default {
{
type: 'a-menu-item',
title: 'Nuclide Library',
show: this.isGamma,
handler: () => (this.nuclideLibraryModalVisible = true),
},
{
type: 'a-menu-item',
title: 'Config User Library',
show: this.isGamma,
handler: () => (this.configUserLibModalVisible = true),
},
],