WIP: Compare和Strip从数据库对比功能
This commit is contained in:
parent
96bf95741c
commit
044195a799
|
@ -16,14 +16,14 @@
|
|||
@change="handleTableChange"
|
||||
:selectedRowKeys.sync="selectedRowKeys"
|
||||
:selectionRows.sync="selectionRows"
|
||||
:multiple="true"
|
||||
:multiple="loadType == 'db'"
|
||||
:scroll="{ y: 'calc(100vh - 550px)' }"
|
||||
>
|
||||
</custom-table>
|
||||
<!-- 底部操作栏 -->
|
||||
<template slot="custom-footer">
|
||||
<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="man">From Interactive DB</a-radio>
|
||||
</a-radio-group>
|
||||
|
@ -38,6 +38,7 @@ import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
|||
import { getAction } from '../../../../api/manage'
|
||||
import moment from 'moment'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import SampleDataMixin from '../../SampleDataMixin'
|
||||
|
||||
const columns = [
|
||||
{
|
||||
|
@ -112,19 +113,17 @@ const columns = [
|
|||
]
|
||||
|
||||
export default {
|
||||
props: {
|
||||
value: {
|
||||
type: Boolean,
|
||||
},
|
||||
},
|
||||
mixins: [JeecgListMixin],
|
||||
mixins: [JeecgListMixin, SampleDataMixin],
|
||||
data() {
|
||||
this.columns = columns
|
||||
this.columns = cloneDeep(columns)
|
||||
this.disableMixinCreated = true
|
||||
return {
|
||||
visible: false,
|
||||
loadType: 'db',
|
||||
queryParam: {
|
||||
menuTypes: 'G,B',
|
||||
sampleType: '',
|
||||
stationName: '',
|
||||
startDate: moment().add(-30, 'd').format('YYYY-MM-DD'),
|
||||
endDate: moment().format('YYYY-MM-DD'),
|
||||
dbName: 'auto',
|
||||
|
@ -136,9 +135,6 @@ export default {
|
|||
|
||||
stationList: [],
|
||||
detectorList: [],
|
||||
url: {
|
||||
list: '/spectrumAnalysis/getDBSpectrumList',
|
||||
},
|
||||
sampleTypeOption: [
|
||||
{
|
||||
label: 'P',
|
||||
|
@ -159,6 +155,12 @@ export default {
|
|||
this.getStationAndDetectorList()
|
||||
},
|
||||
methods: {
|
||||
searchQuery() {
|
||||
this.loadData(1)
|
||||
this.selectedRowKeys = []
|
||||
this.selectionRows = []
|
||||
},
|
||||
|
||||
loadData(arg) {
|
||||
const params = this.getQueryParams() //查询条件
|
||||
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(() => {
|
||||
// 防止AllUsers变化时触发getStationAndDetectorList方法导致stationName置空
|
||||
this.queryParam.stationName = inputFileName.slice(0, index)
|
||||
}, 100)
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 加载
|
||||
*/
|
||||
|
@ -228,7 +257,10 @@ export default {
|
|||
}
|
||||
this.selectedRowKeys = []
|
||||
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: {
|
||||
visible: {
|
||||
get() {
|
||||
return this.value
|
||||
},
|
||||
set(val) {
|
||||
this.$emit('input', val)
|
||||
},
|
||||
url() {
|
||||
return {
|
||||
list: this.loadType == 'db' ? '/spectrumAnalysis/getDBSpectrumList' : '/gamma/loadSampleData',
|
||||
}
|
||||
},
|
||||
formItems() {
|
||||
return [
|
||||
|
@ -294,6 +323,7 @@ export default {
|
|||
},
|
||||
],
|
||||
allowClear: true,
|
||||
disabled: this.loadType !== 'db',
|
||||
},
|
||||
style: {
|
||||
width: '18%',
|
||||
|
@ -364,6 +394,7 @@ export default {
|
|||
showSearch: true,
|
||||
filterOption: this.filterOption,
|
||||
allowClear: true,
|
||||
disabled: this.loadType !== 'db',
|
||||
},
|
||||
style: {
|
||||
width: '19%',
|
||||
|
@ -390,6 +421,7 @@ export default {
|
|||
showSearch: true,
|
||||
filterOption: this.filterOption,
|
||||
allowClear: true,
|
||||
disabled: this.loadType !== 'db',
|
||||
},
|
||||
style: {
|
||||
width: '19%',
|
||||
|
@ -402,6 +434,7 @@ export default {
|
|||
props: {
|
||||
options: this.sampleTypeOption,
|
||||
allowClear: true,
|
||||
disabled: this.loadType !== 'db',
|
||||
},
|
||||
style: {
|
||||
width: '14%',
|
||||
|
@ -483,7 +516,7 @@ export default {
|
|||
name: 'checkboxGroup',
|
||||
props: {
|
||||
options: [
|
||||
{ label: 'All User', value: 'AllUsers' },
|
||||
{ label: 'All User', value: 'AllUsers', disabled: true },
|
||||
{ label: 'Collect Stop', value: 'CollectStopB' },
|
||||
{ label: 'Acq.Start', value: 'AcqStartB' },
|
||||
],
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<div v-if="item.children" :key="index">
|
||||
<a-menu class="multi-level-menu-sub-menu">
|
||||
<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 }}
|
||||
</a-menu-item>
|
||||
</template>
|
||||
|
|
|
@ -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 线
|
||||
clearCompareLine() {
|
||||
const compareLine = findSeriesByName(this.option.series, 'Compare')
|
||||
|
|
|
@ -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: [],
|
||||
|
||||
loadFromDbModalVisible: false, // 从数据库加载弹窗
|
||||
loadFromFileModalVisible: false, // 从文件加载弹窗
|
||||
ftransltModalVisible: false, // Ftransit 弹窗
|
||||
|
||||
|
@ -511,11 +510,27 @@ export default {
|
|||
* 从数据库加载-选择完成
|
||||
* @param {any[]} sampleList
|
||||
*/
|
||||
handleLoadSampleFromDB(sampleList) {
|
||||
const ids = this.sampleList.map((item) => item.sampleId) // 当前Sample列表中的所有id
|
||||
const willAddList = sampleList.filter((item) => !ids.includes(item.sampleId))
|
||||
this.callInitValue(willAddList)
|
||||
this.sampleList = this.sampleList.concat(willAddList)
|
||||
handleLoadSampleFromDB({ sampleList, loadType }) {
|
||||
if (loadType == 'db') {
|
||||
const ids = this.sampleList.map((item) => item.sampleId) // 当前Sample列表中的所有id
|
||||
const willAddList = sampleList.filter((item) => !ids.includes(item.sampleId))
|
||||
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) {
|
||||
let arr = sampleList.filter((item) => {
|
||||
|
@ -991,65 +1006,110 @@ export default {
|
|||
title: 'SAMPLE',
|
||||
children: [
|
||||
{
|
||||
type: 'a-menu',
|
||||
children: [
|
||||
{
|
||||
type: 'a-menu-item',
|
||||
title: 'Load From DB',
|
||||
handler: () => (this.loadFromDbModalVisible = true),
|
||||
},
|
||||
{
|
||||
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
|
||||
}
|
||||
type: 'MultiLevelMenu',
|
||||
attrs: {
|
||||
children: [
|
||||
{
|
||||
title: 'Load From DB',
|
||||
key: 'loadFromDB',
|
||||
},
|
||||
attrs: {
|
||||
style: {
|
||||
color: this.isComparing ? 'red' : '#fff',
|
||||
{
|
||||
title: 'Load From File',
|
||||
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
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'a-menu-item',
|
||||
title: 'Strip',
|
||||
show: this.isGamma,
|
||||
handler: () => {
|
||||
this.isComparing = false
|
||||
this.$refs.gammaAnalysisRef.showCompareModal(true, this.isStriping)
|
||||
if (this.isStriping) {
|
||||
submenuClick: ({ child: { key } }) => {
|
||||
switch (key) {
|
||||
case 'compareFromFile':
|
||||
this.isStriping = false
|
||||
}
|
||||
},
|
||||
attrs: {
|
||||
style: {
|
||||
color: this.isStriping ? 'red' : '#fff',
|
||||
},
|
||||
},
|
||||
this.$refs.gammaAnalysisRef.showCompareModal(false, this.isComparing)
|
||||
if (this.isComparing) {
|
||||
this.isComparing = false
|
||||
}
|
||||
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',
|
||||
|
|
Loading…
Reference in New Issue
Block a user