fix: Compare功能,和Configure的Save对接,及部分主页面的修改

This commit is contained in:
Xu Zhimeng 2023-09-25 14:55:51 +08:00
parent fc63d2c568
commit 3aedc2445d
5 changed files with 339 additions and 52 deletions

View File

@ -407,6 +407,12 @@ const thumbnailOption = {
series: null
}
const nuclideIdentifyModal = {
possibleNuclide: '',
tolerance: 0.5,
identifiedNuclide: ''
}
//
export const Operators = {
ADD: 1, //
@ -442,6 +448,7 @@ export default {
energy: [],
list: [],
BaseCtrls: {},
FitBaseLine: '#fff',
sampleId: -1,
peakCommentModalVisible: false, // Comment
@ -454,11 +461,7 @@ export default {
fitPeaksAndBaselineModalVisible: false, // Fit Peaks And Base Line
nuclideReviewModalVisible: false, // Nuclide Review
model: {
possibleNuclide: '',
tolerance: 0.5,
identifiedNuclide: ''
},
model: cloneDeep(nuclideIdentifyModal),
currChannel: undefined, // currChannelchannel
selectedTableItem: undefined, //
@ -483,6 +486,9 @@ export default {
try {
this.isLoading = true
this.option.series = []
this.thumbnailOption.series = []
this.list = []
this.model = cloneDeep(nuclideIdentifyModal)
const { success, result, message } = await getAction('/gamma/InteractiveTool', {
sampleId: this.sampleId,
@ -501,7 +507,8 @@ export default {
channelPeakChart,
energy,
table,
BaseCtrls
BaseCtrls,
FitBaseLine
} = result
console.log('%c [ ]-374', 'font-size:13px; background:pink; color:#bf2c9f;', result)
@ -512,6 +519,7 @@ export default {
this.channelPeakChart = channelPeakChart
this.energy = energy
this.BaseCtrls = BaseCtrls
this.FitBaseLine = FitBaseLine
const series = []
@ -1246,7 +1254,7 @@ export default {
const baseLineEditSeries = buildLineSeries(
'BaseLine_Edit',
this._channelBaseLineChart.pointlist.map(({ x, y }) => [x, y]),
'#fff',
this.FitBaseLine,
{
zlevel: 21
}
@ -1296,6 +1304,8 @@ export default {
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(),
@ -1312,12 +1322,12 @@ export default {
fill: 'transparent',
lineWidth: 2
},
draggable: false,
draggable: this.isModifying,
ondrag: function() {
const [xPixel] = chart.convertToPixel('grid', [xAxis, yAxis])
// x
this.position[0] = xPixel
this.redrawBaseLine()
that.redrawBaseLine()
},
ondragend: ({ offsetY }) => {
this.setGraphicDraggable(false)
@ -1351,7 +1361,7 @@ export default {
// 线
redrawBaseLine() {
console.log('%c [ 重新生成基线 ]-1355', 'font-size:13px; background:pink; color:#bf2c9f;', )
console.log('%c [ 重新生成基线 ]-1355', 'font-size:13px; background:pink; color:#bf2c9f;')
},
// +
@ -1472,7 +1482,7 @@ export default {
//
handleModifyCP() {
this.setGraphicDraggable(true)
this.setGraphicDraggable(!this.isModifying)
},
//
@ -1560,7 +1570,7 @@ export default {
this.channelBaseCPChart = this._channelBaseCPChart
this.handleSwitchOperation()
this.$bus.$emit('accept')
},

View File

@ -13,44 +13,40 @@
<a-form-model :colon="false" :labelCol="{ style: { width: '160px' } }">
<a-form-model-item label="ECutAnalysis_Low">
<div class="input-with-unit">
<a-input-number v-model="model.edit_ps_low"></a-input-number>
<a-input v-model="model.edit_ps_low"></a-input>
KeV
</div>
</a-form-model-item>
<a-form-model-item label="ECutAnalysis_High">
<div class="input-with-unit">
<a-input-number v-model="model.edit_ps_high"></a-input-number>
<a-input v-model="model.edit_ps_high"></a-input>
KeV
</div>
</a-form-model-item>
<a-form-model-item label="EnergyTolerance">
<div class="input-with-unit">
<a-input-number v-model="model.edit_energy"></a-input-number>
<a-input v-model="model.edit_energy"></a-input>
KeV
</div>
</a-form-model-item>
<a-form-model-item label="PSS_low">
<a-input-number v-model="model.edit_pss_low"></a-input-number>
<a-input v-model="model.edit_pss_low"></a-input>
</a-form-model-item>
</a-form-model>
</title-over-border>
<title-over-border title="Calibration Peak Searching">
<a-form-model :colon="false" :labelCol="{ style: { width: '170px' } }">
<a-form-model-item label="CalibrationPSS_low">
<a-input-number v-model="model.edit_cal_low" disabled></a-input-number>
<a-input v-model="model.edit_cal_low" disabled></a-input>
</a-form-model-item>
<a-form-model-item label="CalibrationPSS_high">
<a-input-number v-model="model.edit_cal_high" disabled></a-input-number>
<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" disabled> 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" disabled> Keep Calibration Peak Search Peaks </a-checkbox>
</a-form-model-item>
</a-form-model>
</title-over-border>
@ -61,13 +57,13 @@
<title-over-border title="Baseline Param">
<a-form-model :colon="false" :labelCol="{ style: { width: '90px' } }">
<a-form-model-item label="k_back">
<a-input-number v-model="model.edit_k_back"></a-input-number>
<a-input v-model="model.edit_k_back"></a-input>
</a-form-model-item>
<a-form-model-item label="k_alpha">
<a-input-number v-model="model.edit_k_alpha"></a-input-number>
<a-input v-model="model.edit_k_alpha"></a-input>
</a-form-model-item>
<a-form-model-item label="k_beta">
<a-input-number v-model="model.edit_k_beta"></a-input-number>
<a-input v-model="model.edit_k_beta"></a-input>
</a-form-model-item>
</a-form-model>
</title-over-border>
@ -75,12 +71,12 @@
<a-form-model :colon="false" :labelCol="{ style: { width: '150px' } }">
<title-over-border title="BaseImprove">
<a-form-model-item label="BaseImprovePSS">
<a-input-number v-model="model.edit_bi_pss"></a-input-number>
<a-input v-model="model.edit_bi_pss"></a-input>
</a-form-model-item>
</title-over-border>
<title-over-border title="LC Computing" style="margin-top: 20px">
<a-form-model-item label="RiskLevelK">
<a-input-number v-model="model.edit_riskLevelK"></a-input-number>
<a-input v-model="model.edit_riskLevelK"></a-input>
</a-form-model-item>
</title-over-border>
</a-form-model>
@ -90,10 +86,20 @@
<!-- 第三行 -->
<div class="analysis-settings-item">
<title-over-border title="Activity Reference Time">
<custom-date-picker show-time v-model="model.dateTime_Act"></custom-date-picker>
<custom-date-picker
show-time
format="YYYY/MM/DD HH:mm:ss"
valueFormat="YYYY/MM/DD HH:mm:ss"
v-model="model.dateTime_Act"
></custom-date-picker>
</title-over-border>
<title-over-border title="Concentration Reference Time">
<custom-date-picker show-time v-model="model.dateTime_Conc"></custom-date-picker>
<custom-date-picker
show-time
format="YYYY/MM/DD HH:mm:ss"
valueFormat="YYYY/MM/DD HH:mm:ss"
v-model="model.dateTime_Conc"
></custom-date-picker>
</title-over-border>
</div>
@ -106,10 +112,11 @@
</template>
<script>
import { getAction } from '@/api/manage'
import { getAction, postAction } from '@/api/manage'
import TitleOverBorder from '../TitleOverBorder.vue'
import ModalMixin from '@/mixins/ModalMixin'
import SampleDataMixin from '../../SampleDataMixin'
import moment from 'moment'
export default {
components: { TitleOverBorder },
@ -117,7 +124,7 @@ export default {
data() {
return {
isLoading: false,
model: {}
model: {},
}
},
methods: {
@ -127,13 +134,18 @@ export default {
const { sampleId, inputFileName: fileName } = this.sampleData
const { success, result, message } = await getAction('/gamma/configure', {
sampleId,
fileName
fileName,
})
this.isLoading = false
if (success) {
this.model = result
if (result.edit_ps_high == -9999) {
result.edit_ps_high = 'inf'
}
console.log('%c [ ]-137', 'font-size:13px; background:pink; color:#bf2c9f;', result)
result.dateTime_Act = moment(result.dateTime_Act).format('YYYY/MM/DD HH:mm:ss')
result.dateTime_Conc = moment(result.dateTime_Conc).format('YYYY/MM/DD HH:mm:ss')
this.model = result
} else {
this.$message.error(message)
}
@ -145,10 +157,56 @@ export default {
beforeModalOpen() {
this.getInfo()
},
handleOk() {
console.log('%c [ handleOk ]-121', 'font-size:13px; background:pink; color:#bf2c9f;')
}
}
async handleOk() {
try {
const { inputFileName: fileName } = this.sampleData
const {
edit_ps_low,
edit_ps_high,
edit_energy,
edit_pss_low,
edit_cal_low,
edit_cal_high,
edit_k_back,
edit_k_alpha,
edit_k_beta,
edit_bi_pss,
edit_riskLevelK,
dateTime_Act,
dateTime_Conc,
} = this.model
const param = {
fileName,
ecutAnalysis_Low: edit_ps_low,
ecutAnalysis_High: edit_ps_high == 'inf' ? -9999 : edit_ps_high,
energyTolerance: edit_energy,
pss_low: edit_pss_low,
calibrationPSS_low: edit_cal_low,
calibrationPSS_high: edit_cal_high,
k_back: edit_k_back,
k_alpha: edit_k_alpha,
k_beta: edit_k_beta,
baseImprovePSS: edit_bi_pss,
riskLevelK: edit_riskLevelK,
refTime_act: dateTime_Act,
refTime_conc: dateTime_Conc,
}
const { success, message } = await postAction('/gamma/configureSave', param)
if (success) {
this.$message.success('Save Success')
} else {
this.$message.error(message)
}
} catch (error) {
console.error(error)
} finally {
throw new Error('Not Close')
}
},
},
}
</script>
@ -198,7 +256,7 @@ export default {
display: flex;
align-items: center;
.ant-input-number {
.ant-input {
margin-right: 10px;
}
}

View File

@ -0,0 +1,138 @@
<template>
<custom-modal v-model="visible" :width="1200" title="File List">
<search-form :items="formItems" v-model="queryParam" @search="searchQuery"></search-form>
<custom-table
:columns="columns"
:list="dataSource"
:loading="loading"
:pagination="ipagination"
:selectedRowKeys.sync="selectedRowKeys"
:selectionRows.sync="selectionRows"
:scroll="{ y: 440 }"
@change="handleTableChange"
></custom-table>
<div slot="custom-footer">
<a-button type="primary" :loading="isComparing" @click="handleOk">Compare</a-button>
<a-button @click="visible = false">Cancel</a-button>
</div>
</custom-modal>
</template>
<script>
import { getAction } from '@/api/manage'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import ModalMixin from '@/mixins/ModalMixin'
import SampleDataMixin from '../../SampleDataMixin'
const columns = [
{
title: 'Name',
dataIndex: 'name',
width: '45%',
align: 'left',
ellipsis: true
},
{
title: 'UpdateDate',
dataIndex: 'updateDate',
align: 'left'
},
{
title: 'Size',
dataIndex: 'size',
align: 'left'
}
]
const formItems = [
{
label: '',
type: 'a-input',
name: 'searchName',
props: {
placeholder: 'search...'
}
}
]
export default {
mixins: [ModalMixin, JeecgListMixin, SampleDataMixin],
data() {
this.columns = columns
this.formItems = formItems
return {
queryParam: {},
selectedRowKeys: [],
selectionRows: [],
isComparing: false
}
},
methods: {
beforeModalOpen() {
this.selectedRowKeys = []
},
loadData(arg) {
// 1
if (arg === 1) {
this.ipagination.current = 1
}
this.onClearSelected()
const params = this.getQueryParams() //
const searchName = this.queryParam.searchName
params.name = `${searchName ? `${searchName},` : ''}_S_`
this.loading = true
getAction('/spectrumFile/get', params)
.then(res => {
if (res.success) {
this.dataSource = res.result.records
this.dataSource.forEach((item, index) => {
item.id = index
})
if (res.result.total) {
this.ipagination.total = res.result.total
} else {
this.ipagination.total = 0
}
} else {
this.$message.warning(res.message)
}
})
.finally(() => {
this.loading = false
})
},
async handleOk() {
if (!this.selectedRowKeys.length) {
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
}
}
}
}
</script>
<style></style>

View File

@ -88,6 +88,8 @@
:channel="currChannel"
:nuclide="nuclideReview.nuclide"
/>
<compare-file-list-modal v-model="compareFileListModalVisible" @compareWithFile="handleCompareWithFile" />
</div>
</template>
@ -105,6 +107,7 @@ import { buildLineSeries, findSeriesByName, getXAxisAndYAxisByPosition, rangeNum
import { cloneDeep } from 'lodash'
import axios from 'axios'
import NuclideReviewModal from './components/Modals/AnalyzeInteractiveToolModal/components/NuclideReviewModal.vue'
import CompareFileListModal from './components/Modals/CompareFileListModal.vue'
//
const initialOption = {
@ -269,6 +272,7 @@ export default {
NuclideLibrary,
ButtonWithSwitchIcon,
NuclideReviewModal,
CompareFileListModal,
},
data() {
return {
@ -302,6 +306,8 @@ export default {
nuclide: '',
},
currChannel: -1,
compareFileListModalVisible: false, // Compare
}
},
created() {
@ -359,8 +365,7 @@ export default {
const { inputFileName: fileName } = this.sample
try {
this.isLoading = true
this.option.series = []
this.thumbnailOption.series = []
this.reset()
// const { success, result, message } = Response
const { success, result, message } = await getAction('/gamma/gammaByFile', {
fileName,
@ -439,11 +444,8 @@ export default {
this.shapeChannelData = shapeChannelData
this.shapeEnergyData = shapeEnergyData
this.option.yAxis.max =
shadowChannelChart.pointlist && Math.ceil(Math.max(...shadowChannelChart.pointlist.map((item) => item.y)) * 1.1)
this.thumbnailOption.yAxis.max =
shadowChannelChart.pointlist && Math.ceil(Math.max(...shadowChannelChart.pointlist.map((item) => item.y)) * 1.1)
this.option.yAxis.max = 'dataMax'
this.resetThumbnailChartDataMax()
const series = []
// Spectrum Line
@ -566,6 +568,13 @@ export default {
)
})
series.push(...peakLines)
series.push(
buildLineSeries('Compare', [], '#fff', {
symbolSize: 2,
})
)
this.option.series = series
this.option.tooltip.formatter = this.tooltipFormatter
@ -590,6 +599,8 @@ export default {
// Graph Assistance
handleGraphAssistanceChange({ type, label, value }) {
const compareLineSeries = findSeriesByName(this.option.series, 'Compare')
//
if (type == 'labelChange') {
switch (label) {
@ -629,6 +640,8 @@ export default {
this.redrawPeakLine()
this.redrawThumbnailChart()
this.redrawLineBySeriesName('Compare', this.energyCompareLine, this.channelCompareLine)
break
case 'Lines':
this.option.series[0].type = 'line'
@ -636,6 +649,9 @@ export default {
this.thumbnailOption.series[0].type = 'line'
this.thumbnailOption.series[0].symbol = 'none'
compareLineSeries.type = 'line'
compareLineSeries.symbol = 'none'
break
case 'Scatter':
this.option.series[0].type = 'scatterGL'
@ -643,6 +659,9 @@ export default {
this.thumbnailOption.series[0].type = 'scatterGL'
this.thumbnailOption.series[0].symbol = 'circle'
compareLineSeries.type = 'scatterGL'
compareLineSeries.symbol = 'circle'
break
}
}
@ -677,7 +696,7 @@ export default {
},
// seriesName线
redrawLineBySeriesName(seriesName, energyData, channelData, isShow = true) {
redrawLineBySeriesName(seriesName, energyData, channelData, isShow = true, color) {
const series = findSeriesByName(this.option.series, seriesName)
if (isShow) {
const data = this.isEnergy() ? energyData : channelData
@ -685,6 +704,9 @@ export default {
} else {
series.data = []
}
if (color) {
series.itemStyle.color = color
}
},
//
@ -1055,7 +1077,7 @@ export default {
this.option.xAxis.min = 1
this.option.xAxis.max = 'dataMax'
this.option.yAxis.min = 1
this.option.yAxis.max = Math.ceil(Math.max(...this.shadowChannelChart.pointlist.map((item) => item.y)) * 1.1)
this.option.yAxis.max = 'dataMax'
this.thumbnailOption.series[0].markLine.data = []
this.thumbnailChartRect = []
@ -1115,6 +1137,9 @@ export default {
this.redrawLineBySeriesName('Spectrum', this.shadowEnergyChart, this.shadowChannelChart)
this.redrawThumbnailChart()
this.clearCompareLine()
this.$nextTick(() => {
this.resetChartOpts()
})
@ -1123,6 +1148,50 @@ export default {
// Accept
handleAccept() {
console.log('%c [ 分析工具Accept时刷新部分数据 ]-1046', 'font-size:13px; background:pink; color:#bf2c9f;')
this.clearCompareLine()
},
//
showCompareModal() {
if (this.isLoading) {
this.$message.warn('Sample is Loading')
return
}
this.clearCompareLine()
this.compareFileListModalVisible = true
},
//
handleCompareWithFile([channelData, energyData]) {
this.channelCompareLine = channelData
this.energyCompareLine = energyData
this.redrawLineBySeriesName('Compare', energyData, channelData, true, channelData.color)
if (this.option.series[0].type == 'scatterGL') {
lineSeries.type = 'scatterGL'
}
this.$nextTick(() => {
const chart = this.$refs.chartRef.getChartInstance()
const yAxisMax = chart.getModel().getComponent('yAxis').axis.scale._extent[1]
this.thumbnailOption.yAxis.max = yAxisMax
})
},
// Compare 线
clearCompareLine() {
const compareLine = findSeriesByName(this.option.series, 'Compare')
if (compareLine) {
compareLine.data = []
this.resetThumbnailChartDataMax()
}
this.channelCompareLine = []
this.energyCompareLine = []
},
// y
resetThumbnailChartDataMax() {
this.thumbnailOption.yAxis.max = 'dataMax'
},
//
@ -1220,11 +1289,17 @@ export default {
this.channelScacLine.color = Color_Scac
this.energyScacLine.color = Color_Scac
if (this.channelCompareLine) {
this.channelCompareLine.color = Color_Compare
this.energyCompareLine.color = Color_Compare
}
this.changeColorBySeriesName('Spectrum', Color_Spec)
this.changePeakLineColor(Color_Peak)
this.changeColorBySeriesName('LcLine', Color_Lc)
this.changeColorBySeriesName('BaseLine', Color_Base)
this.changeColorBySeriesName('ScacLine', Color_Scac)
this.changeColorBySeriesName('Compare', Color_Compare)
const thumbnailChartSeries = findSeriesByName(this.thumbnailOption.series, 'Spectrum')
thumbnailChartSeries.itemStyle.color = Color_Spec

View File

@ -643,8 +643,9 @@ export default {
},
{
type: 'a-menu-item',
title: 'Clean All',
handler: this.handleCleanAll,
title: 'Compare',
show: this.isGamma,
handler: () => this.$refs.gammaAnalysisRef.showCompareModal(),
},
{
type: 'a-menu-item',
@ -658,6 +659,11 @@ export default {
show: this.isGamma,
handler: () => (this.ftransltModalVisible = true),
},
{
type: 'a-menu-item',
title: 'Clean All',
handler: this.handleCleanAll,
},
],
},
{