This commit is contained in:
xiaoguangbin 2023-12-12 09:01:23 +08:00
commit 580c4fdfb7
4 changed files with 258 additions and 82 deletions

View File

@ -16,14 +16,14 @@
@change="handleTableChange" @change="handleTableChange"
:selectedRowKeys.sync="selectedRowKeys" :selectedRowKeys.sync="selectedRowKeys"
:selectionRows.sync="selectionRows" :selectionRows.sync="selectionRows"
:multiple="true" :multiple="loadType == 'db'"
:scroll="{ y: 'calc(100vh - 550px)' }" :scroll="{ y: 'calc(100vh - 550px)' }"
> >
</custom-table> </custom-table>
<!-- 底部操作栏 --> <!-- 底部操作栏 -->
<template slot="custom-footer"> <template slot="custom-footer">
<a-space> <a-space>
<a-radio-group v-model="queryParam.dbName"> <a-radio-group v-if="loadType == 'db'" v-model="queryParam.dbName">
<a-radio value="auto">From Auto DB</a-radio> <a-radio value="auto">From Auto DB</a-radio>
<a-radio value="man">From Interactive DB</a-radio> <a-radio value="man">From Interactive DB</a-radio>
</a-radio-group> </a-radio-group>
@ -38,6 +38,7 @@ import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getAction } from '../../../../api/manage' import { getAction } from '../../../../api/manage'
import moment from 'moment' import moment from 'moment'
import { cloneDeep } from 'lodash' import { cloneDeep } from 'lodash'
import SampleDataMixin from '../../SampleDataMixin'
const columns = [ const columns = [
{ {
@ -112,19 +113,17 @@ const columns = [
] ]
export default { export default {
props: { mixins: [JeecgListMixin, SampleDataMixin],
value: {
type: Boolean,
},
},
mixins: [JeecgListMixin],
data() { data() {
this.columns = columns this.columns = cloneDeep(columns)
this.disableMixinCreated = true this.disableMixinCreated = true
return { return {
visible: false,
loadType: 'db',
queryParam: { queryParam: {
menuTypes: 'G,B', menuTypes: 'G,B',
sampleType: '', sampleType: '',
stationName: '',
startDate: moment().add(-30, 'd').format('YYYY-MM-DD'), startDate: moment().add(-30, 'd').format('YYYY-MM-DD'),
endDate: moment().format('YYYY-MM-DD'), endDate: moment().format('YYYY-MM-DD'),
dbName: 'auto', dbName: 'auto',
@ -136,9 +135,6 @@ export default {
stationList: [], stationList: [],
detectorList: [], detectorList: [],
url: {
list: '/spectrumAnalysis/getDBSpectrumList',
},
sampleTypeOption: [ sampleTypeOption: [
{ {
label: 'P', label: 'P',
@ -159,6 +155,12 @@ export default {
this.getStationAndDetectorList() this.getStationAndDetectorList()
}, },
methods: { methods: {
searchQuery() {
this.loadData(1)
this.selectedRowKeys = []
this.selectionRows = []
},
loadData(arg) { loadData(arg) {
const params = this.getQueryParams() // const params = this.getQueryParams() //
const { startDate, endDate, menuTypes } = params const { startDate, endDate, menuTypes } = params
@ -218,6 +220,33 @@ export default {
}) })
}, },
//
show(loadType) {
this.loadType = loadType
this.visible = true
this.columns = cloneDeep(columns)
if (loadType != 'db') {
this.columns.splice(10, 1)
const { inputFileName, sampleType } = this.sampleData
this.queryParam.menuTypes = 'G'
if (!this.queryParam.checkboxGroup.includes('AllUsers')) {
this.queryParam.checkboxGroup.push('AllUsers')
}
this.queryParam.detectorsName = undefined
this.queryParam.sampleType = sampleType
this.queryParam.dbName = 'auto'
this.dataSource = []
const index = inputFileName.indexOf('_')
setTimeout(() => {
// AllUsersgetStationAndDetectorListstationName
this.queryParam.stationName = inputFileName.slice(0, index)
}, 100)
}
},
/** /**
* 加载 * 加载
*/ */
@ -228,7 +257,10 @@ export default {
} }
this.selectedRowKeys = [] this.selectedRowKeys = []
this.visible = false this.visible = false
this.$emit('loadSample', cloneDeep(this.selectionRows)) this.$emit('loadSample', {
sampleList: cloneDeep(this.selectionRows),
loadType: this.loadType,
})
}, },
// //
@ -264,13 +296,10 @@ export default {
}, },
}, },
computed: { computed: {
visible: { url() {
get() { return {
return this.value list: this.loadType == 'db' ? '/spectrumAnalysis/getDBSpectrumList' : '/gamma/loadSampleData',
}, }
set(val) {
this.$emit('input', val)
},
}, },
formItems() { formItems() {
return [ return [
@ -294,6 +323,7 @@ export default {
}, },
], ],
allowClear: true, allowClear: true,
disabled: this.loadType !== 'db',
}, },
style: { style: {
width: '18%', width: '18%',
@ -364,6 +394,7 @@ export default {
showSearch: true, showSearch: true,
filterOption: this.filterOption, filterOption: this.filterOption,
allowClear: true, allowClear: true,
disabled: this.loadType !== 'db',
}, },
style: { style: {
width: '19%', width: '19%',
@ -390,6 +421,7 @@ export default {
showSearch: true, showSearch: true,
filterOption: this.filterOption, filterOption: this.filterOption,
allowClear: true, allowClear: true,
disabled: this.loadType !== 'db',
}, },
style: { style: {
width: '19%', width: '19%',
@ -402,6 +434,7 @@ export default {
props: { props: {
options: this.sampleTypeOption, options: this.sampleTypeOption,
allowClear: true, allowClear: true,
disabled: this.loadType !== 'db',
}, },
style: { style: {
width: '14%', width: '14%',
@ -483,7 +516,7 @@ export default {
name: 'checkboxGroup', name: 'checkboxGroup',
props: { props: {
options: [ options: [
{ label: 'All User', value: 'AllUsers' }, { label: 'All User', value: 'AllUsers', disabled: true },
{ label: 'Collect Stop', value: 'CollectStopB' }, { label: 'Collect Stop', value: 'CollectStopB' },
{ label: 'Acq.Start', value: 'AcqStartB' }, { label: 'Acq.Start', value: 'AcqStartB' },
], ],

View File

@ -6,7 +6,7 @@
<div v-if="item.children" :key="index"> <div v-if="item.children" :key="index">
<a-menu class="multi-level-menu-sub-menu"> <a-menu class="multi-level-menu-sub-menu">
<template v-for="child in item.children"> <template v-for="child in item.children">
<a-menu-item v-if="child.show !== false" :key="child.key" @click="handleSubMenuClick(item, child)"> <a-menu-item v-if="child.show !== false" :key="child.key" v-bind="child.attrs" @click="handleSubMenuClick(item, child)">
{{ child.title }} {{ child.title }}
</a-menu-item> </a-menu-item>
</template> </template>

View File

@ -1601,6 +1601,89 @@ export default {
} }
}, },
// DB
async handleDBFileSelect(sampleId, isStrip, isOperating) {
if (this.isLoading) {
this.$message.warn('Sample is Loading')
return
}
this.handleResetChart()
this.clearCompareLine()
if (isOperating) {
return
}
const { inputFileName: fileName } = this.sample
const hide = this.$message.loading(isStrip ? 'Stripping...' : 'Comparing...', 0)
try {
let param = {
fileName,
sampleId,
},
url = '/gamma/CompareDB'
// Strip
if (isStrip) {
const ratio = await this.$refs.stripModal.getRatio()
param = {
fileName,
sampleId,
ratioRate: ratio || 1,
}
url = '/gamma/StripDB'
}
const { success, result, message } = await getAction(url, param)
if (success) {
if (isStrip) {
const { reference: referenceLine, result: compareLine } = result
this.channelCompareLine = compareLine[0]
this.energyCompareLine = compareLine[1]
this.redrawLineBySeriesName(
'Compare',
this.energyCompareLine,
this.channelCompareLine,
true,
this.channelCompareLine.color
)
this.channelStripReferenceLine = referenceLine[0]
this.energyStripReferenceLine = referenceLine[1]
this.redrawLineBySeriesName(
'StripReference',
this.energyStripReferenceLine,
this.channelStripReferenceLine,
true,
this.channelStripReferenceLine.color
)
this.$nextTick(() => {
this.thumbnailOption.yAxis.max = getAxisMax(this.getChart(), 'yAxis')
})
} else {
const [channelData, energyData] = result
this.channelCompareLine = channelData
this.energyCompareLine = energyData
this.redrawLineBySeriesName('Compare', energyData, channelData, true, channelData.color)
this.$nextTick(() => {
this.thumbnailOption.yAxis.max = getAxisMax(this.getChart(), 'yAxis')
})
}
this.$emit('compareSuccess', isStrip)
} else {
this.$message.error(message)
}
} catch (error) {
console.error(error)
} finally {
hide()
}
},
// Compare 线 // Compare 线
clearCompareLine() { clearCompareLine() {
const compareLine = findSeriesByName(this.option.series, 'Compare') const compareLine = findSeriesByName(this.option.series, 'Compare')

View File

@ -71,7 +71,7 @@
<!-- 频谱分析部分结束 --> <!-- 频谱分析部分结束 -->
<!-- 从数据库加载开始 --> <!-- 从数据库加载开始 -->
<load-from-db-modal v-model="loadFromDbModalVisible" @loadSample="handleLoadSampleFromDB" /> <load-from-db-modal ref="loadFromDBModalRef" @loadSample="handleLoadSampleFromDB" />
<!-- 从数据库加载结束 --> <!-- 从数据库加载结束 -->
<!-- 从文件加载开始 --> <!-- 从文件加载开始 -->
@ -340,7 +340,6 @@ export default {
sampleList: [], sampleList: [],
loadFromDbModalVisible: false, //
loadFromFileModalVisible: false, // loadFromFileModalVisible: false, //
ftransltModalVisible: false, // Ftransit ftransltModalVisible: false, // Ftransit
@ -511,11 +510,27 @@ export default {
* 从数据库加载-选择完成 * 从数据库加载-选择完成
* @param {any[]} sampleList * @param {any[]} sampleList
*/ */
handleLoadSampleFromDB(sampleList) { handleLoadSampleFromDB({ sampleList, loadType }) {
const ids = this.sampleList.map((item) => item.sampleId) // Sampleid if (loadType == 'db') {
const willAddList = sampleList.filter((item) => !ids.includes(item.sampleId)) const ids = this.sampleList.map((item) => item.sampleId) // Sampleid
this.callInitValue(willAddList) const willAddList = sampleList.filter((item) => !ids.includes(item.sampleId))
this.sampleList = this.sampleList.concat(willAddList) this.callInitValue(willAddList)
this.sampleList = this.sampleList.concat(willAddList)
} else if (loadType == 'compare') {
const sample = sampleList[0]
this.isStriping = false
this.$refs.gammaAnalysisRef.handleDBFileSelect(sample.sampleId, false, this.isComparing)
if (this.isComparing) {
this.isComparing = false
}
} else if (loadType == 'strip') {
const sample = sampleList[0]
this.isComparing = false
this.$refs.gammaAnalysisRef.handleDBFileSelect(sample.sampleId, true, this.isStriping)
if (this.isStriping) {
this.isStriping = false
}
}
}, },
handleLoadSampleFromFile(sampleList) { handleLoadSampleFromFile(sampleList) {
let arr = sampleList.filter((item) => { let arr = sampleList.filter((item) => {
@ -991,65 +1006,110 @@ export default {
title: 'SAMPLE', title: 'SAMPLE',
children: [ children: [
{ {
type: 'a-menu', type: 'MultiLevelMenu',
children: [ attrs: {
{ children: [
type: 'a-menu-item', {
title: 'Load From DB', title: 'Load From DB',
handler: () => (this.loadFromDbModalVisible = true), key: 'loadFromDB',
},
{
type: 'a-menu-item',
title: 'Load From File',
handler: () => (this.loadFromFileModalVisible = true),
},
{
type: 'a-menu-item',
title: 'Compare',
show: this.isGamma,
handler: () => {
this.isStriping = false
this.$refs.gammaAnalysisRef.showCompareModal(false, this.isComparing)
if (this.isComparing) {
this.isComparing = false
}
}, },
attrs: { {
style: { title: 'Load From File',
color: this.isComparing ? 'red' : '#fff', key: 'loadFromFile',
},
{
title: 'Compare',
key: 'compare',
show: this.isGamma,
children: [
{
title: 'From File',
key: 'compareFromFile',
},
{
title: 'From DB',
key: 'compareFromDB',
},
],
attrs: {
style: {
color: this.isComparing ? 'red' : '#fff',
},
}, },
}, },
{
title: 'Strip',
key: 'strip',
show: this.isGamma,
children: [
{
title: 'From File',
key: 'stripFromFile',
},
{
title: 'From DB',
key: 'stripFromDB',
},
],
attrs: {
style: {
color: this.isStriping ? 'red' : '#fff',
},
},
},
{
title: 'Ftransit',
key: 'fTransit',
},
{
title: 'Clean All',
key: 'cleanAll',
},
],
},
on: {
menuClick: ({ key }) => {
switch (key) {
case 'loadFromDB':
this.$refs.loadFromDBModalRef.show('db')
break
case 'loadFromFile':
this.loadFromFileModalVisible = true
break
case 'fTransit':
this.ftransltModalVisible = true
break
case 'cleanAll':
this.handleCleanAll()
break
}
}, },
{ submenuClick: ({ child: { key } }) => {
type: 'a-menu-item', switch (key) {
title: 'Strip', case 'compareFromFile':
show: this.isGamma,
handler: () => {
this.isComparing = false
this.$refs.gammaAnalysisRef.showCompareModal(true, this.isStriping)
if (this.isStriping) {
this.isStriping = false this.isStriping = false
} this.$refs.gammaAnalysisRef.showCompareModal(false, this.isComparing)
}, if (this.isComparing) {
attrs: { this.isComparing = false
style: { }
color: this.isStriping ? 'red' : '#fff', break
}, case 'compareFromDB':
}, this.$refs.loadFromDBModalRef.show('compare')
break
case 'stripFromFile':
this.isComparing = false
this.$refs.gammaAnalysisRef.showCompareModal(true, this.isStriping)
if (this.isStriping) {
this.isStriping = false
}
break
case 'stripFromDB':
this.$refs.loadFromDBModalRef.show('strip')
break
}
}, },
{ },
type: 'a-menu-item',
title: 'Ftransit',
handler: () => (this.ftransltModalVisible = true),
},
{
type: 'a-menu-item',
title: 'Clean All',
handler: () => {
this.handleCleanAll()
},
},
],
}, },
{ {
type: 'a-divider', type: 'a-divider',