feat: 添加所有菜单和事件,增加Load From File 弹窗及其逻辑

This commit is contained in:
Xu Zhimeng 2023-07-03 19:38:12 +08:00
parent 005a057f47
commit e1a2e89c2b
11 changed files with 442 additions and 72 deletions

View File

@ -0,0 +1,30 @@
<template>
<a-modal v-model="visible" title="Load From Database" class="load-from-db-modal">
从数据库加载
</a-modal>
</template>
<script>
export default {
props: {
value: {
type: Boolean
}
},
computed: {
visible: {
get() {
return this.value
},
set(val) {
this.$emit('input', val)
}
}
}
}
</script>
<style lang="less" scoped>
.load-from-db-modal {
}
</style>

View File

@ -0,0 +1,76 @@
<template>
<a-modal v-model="visible" title="Select File" :footer="null">
<a-table :data-source="list" :columns="columns" :loading="loading" :pagination="false">
<template slot="operator" slot-scope="record">
<a-icon type="check" style="cursor: pointer;" @click="handleSelect(record)"></a-icon>
</template>
</a-table>
</a-modal>
</template>
<script>
const columns = [
{
title: 'File Name',
dataIndex: 'fileName',
ellipsis: true
},
{
title: 'Action',
width: 80,
align: 'center',
scopedSlots: {
customRender: 'operator'
}
}
]
export default {
props: {
value: {
type: Boolean
}
},
data() {
this.columns = columns
return {
loading: false,
list: []
}
},
methods: {
async getList() {
try {
this.loading = true
const res = await ''
console.log('%c [ res ]-13', 'font-size:13px; background:pink; color:#bf2c9f;', res)
this.loading = false
this.list = [{ fileName: '文件1' }, { fileName: '文件2' }]
} catch (error) {
console.error(error)
}
},
//
handleSelect(fileInfo) {
console.log('%c [ ]-56', 'font-size:13px; background:pink; color:#bf2c9f;', fileInfo)
this.$emit('select', fileInfo)
this.visible = false
}
},
computed: {
visible: {
get() {
if (this.value) {
this.getList()
}
return this.value
},
set(val) {
this.$emit('input', val)
}
}
}
}
</script>
<style></style>

View File

@ -0,0 +1,156 @@
<template>
<a-modal v-model="visible" :width="1400" title="Load Data From File">
<a-table :data-source="list" :columns="columns" :pagination="false">
<template slot="status" slot-scope="text">
<span class="status"></span>
</template>
</a-table>
<!-- 底部按钮 -->
<template slot="footer">
<a-space>
<a-button type="primary" @click="handleReset">Reset</a-button>
<a-button type="primary" @click="handleLoad">Load</a-button>
<a-button type="primary" @click="handleCancel">Cancel</a-button>
</a-space>
</template>
<!-- 底部按钮结束 -->
<ftp-file-modal v-model="ftpFileModalVisible" @select="handleSelect" />
</a-modal>
</template>
<script>
import FtpFileModal from './FtpFileModal.vue'
export default {
components: { FtpFileModal },
props: {
value: {
type: Boolean
}
},
data() {
return {
list: this.getInitialList(),
ftpFileModalVisible: false
}
},
methods: {
getInitialList() {
return new Array(10).fill(0).map(() => ({
sampleData: '',
gasBkData: '',
detBkData: '',
qcData: ''
}))
},
/**
* 从ftp中选择文件
* @param rowData 选中的行的数据
* @param { string } dataKey 选中的数据的那一列的key
*/
selectFileFromFtp(rowData, dataKey) {
this.currRowData = rowData
this.currDataKey = dataKey
this.ftpFileModalVisible = true
},
handleSelect(fileInfo) {
this.currRowData[this.currDataKey] = fileInfo.fileName
},
handleReset() {
this.list = this.getInitialList()
},
handleLoad() {},
handleCancel() {}
},
computed: {
visible: {
get() {
return this.value
},
set(val) {
this.$emit('input', val)
}
},
columns() {
return [
{
title: 'SampleData',
dataIndex: 'sampleData',
customCell: record => {
return {
on: {
click: () => {
this.selectFileFromFtp(record, 'sampleData')
}
}
}
}
},
{
title: 'GasBkData',
dataIndex: 'gasBkData',
customCell: record => {
return {
on: {
click: () => {
this.selectFileFromFtp(record, 'gasBkData')
}
}
}
}
},
{
title: 'DetBkData',
dataIndex: 'detBkData',
customCell: record => {
return {
on: {
click: () => {
this.selectFileFromFtp(record, 'detBkData')
}
}
}
}
},
{
title: 'QCData',
dataIndex: 'qcData',
customCell: record => {
return {
on: {
click: () => {
this.selectFileFromFtp(record, 'qcData')
}
}
}
}
},
{
title: 'Status',
align: 'center',
scopedSlots: {
customRender: 'status'
}
}
]
}
}
}
</script>
<style lang="less" scoped>
.status {
display: inline-block;
width: 25px;
height: 25px;
border-radius: 50%;
background-color: #00e170;
}
</style>

View File

@ -24,7 +24,7 @@
<!-- 顶部操作栏结束 --> <!-- 顶部操作栏结束 -->
<!-- 二级交互栏 --> <!-- 二级交互栏 -->
<div class="spectrum-analysis-sub-operators"> <div class="spectrum-analysis-SubOperators">
<pop-over-with-icon placement="bottomLeft"> <pop-over-with-icon placement="bottomLeft">
Detailed-Information Detailed-Information
<detailed-infomation slot="content" /> <detailed-infomation slot="content" />
@ -70,19 +70,29 @@
<resize-observer @notify="handleResize" /> <resize-observer @notify="handleResize" />
</div> </div>
<!-- 频谱分析部分结束 --> <!-- 频谱分析部分结束 -->
<!-- 从数据库加载开始 -->
<load-from-db-modal v-model="loadFromDbModalVisible" />
<!-- 从数据库加载结束 -->
<!-- 从文件加载开始 -->
<load-from-file-modal v-model="loadFromFileModalVisible" />
<!-- 从文件加载结束 -->
</div> </div>
</template> </template>
<script> <script>
import ButtonWithSwitchIcon from './components/sub-operators/ButtonWithSwitchIcon.vue' import ButtonWithSwitchIcon from './components/SubOperators/ButtonWithSwitchIcon.vue'
import DetailedInfomation from './components/sub-operators/DetailedInfomation.vue' import DetailedInfomation from './components/SubOperators/DetailedInfomation.vue'
import GraphAssistance from './components/sub-operators/GraphAssistance.vue' import GraphAssistance from './components/SubOperators/GraphAssistance.vue'
import NuclearLibrary from './components/sub-operators/NuclearLibrary.vue' import NuclearLibrary from './components/SubOperators/NuclearLibrary.vue'
import PopOverWithIcon from './components/sub-operators/PopOverWithIcon.vue' import PopOverWithIcon from './components/SubOperators/PopOverWithIcon.vue'
import QcFlags from './components/sub-operators/QcFlags.vue' import QcFlags from './components/SubOperators/QcFlags.vue'
import GammaAnalysis from './gamma-analysis.vue' import GammaAnalysis from './gamma-analysis.vue'
import BetaGammaAnalysis from './beta-gamma-analysis.vue' import BetaGammaAnalysis from './beta-gamma-analysis.vue'
import Spectra from './components/sub-operators/Spectra.vue' import Spectra from './components/SubOperators/Spectra.vue'
import SpectraListInMenu from './components/SpectraListInMenu.vue' import SpectraListInMenu from './components/SpectraListInMenu.vue'
import LoadFromDbModal from './components/LoadFromDBModal.vue'
import LoadFromFileModal from './components/LoadFromFileModal/Index.vue'
// //
const ANALYZE_TYPE = { const ANALYZE_TYPE = {
@ -100,7 +110,9 @@ export default {
DetailedInfomation, DetailedInfomation,
NuclearLibrary, NuclearLibrary,
Spectra, Spectra,
SpectraListInMenu SpectraListInMenu,
LoadFromDbModal,
LoadFromFileModal
}, },
data() { data() {
this.ANALYZE_TYPE = ANALYZE_TYPE this.ANALYZE_TYPE = ANALYZE_TYPE
@ -113,23 +125,120 @@ export default {
spectraList: [ spectraList: [
{ id: 1, name: 'AUX01 003-20151223 1855 S FULL 40183.7.PHD' }, { id: 1, name: 'AUX01 003-20151223 1855 S FULL 40183.7.PHD' },
{ id: 2, name: 'AUX02 003-20151223 1855 S FULL 40183.7.PHD' } { id: 2, name: 'AUX02 003-20151223 1855 S FULL 40183.7.PHD' }
] ],
loadFromDbModalVisible: false,
loadFromFileModalVisible: false
} }
}, },
methods: { methods: {
// //
handleLoadFromDb() { handleLoadFromDb() {
console.log('%c [ handleLoadFromDb ]-46', 'font-size:13px; background:pink; color:#bf2c9f;') this.loadFromDbModalVisible = true
}, },
// //
handleLoadFromFile() { handleLoadFromFile() {
console.log('%c [ handleLoadFromFile ]-46', 'font-size:13px; background:pink; color:#bf2c9f;') this.loadFromFileModalVisible = true
}, },
// //
handleCleanAll() { handleCleanAll() {
console.log('%c [ handleCleanAll ]-118', 'font-size:13px; background:pink; color:#bf2c9f;') this.spectraList = []
},
//
saveResultsToFile() {
console.log('%c [ saveResultsToFile ]-152', 'font-size:13px; background:pink; color:#bf2c9f;')
},
//
saveResultsToDB() {
console.log('%c [ saveResultsToDB ]-157', 'font-size:13px; background:pink; color:#bf2c9f;')
},
// IMS2.0PHD
savePHDToFile() {
console.log('%c [ savePHDToFile ]-162', 'font-size:13px; background:pink; color:#bf2c9f;')
},
// β-γ
handleAnalyzeCurrSample() {
console.log('%c [ handleAnalyzeCurrSample ]-152', 'font-size:13px; background:pink; color:#bf2c9f;')
},
//
handleAnalyzeAllSample() {
console.log('%c [ handleAnalyzeAllSample ]-156', 'font-size:13px; background:pink; color:#bf2c9f;')
},
//
handleEnergy() {
console.log('%c [ handleEnergy ]-163', 'font-size:13px; background:pink; color:#bf2c9f;')
},
//
handleResolution() {
console.log('%c [ handleResolution ]-167', 'font-size:13px; background:pink; color:#bf2c9f;')
},
//
handleEfficiency() {
console.log('%c [ handleEfficiency ]-167', 'font-size:13px; background:pink; color:#bf2c9f;')
},
// Nuclide Library
handleNuclideLib() {
console.log('%c [ handleNuclideLib ]-178', 'font-size:13px; background:pink; color:#bf2c9f;')
},
handleConfigUserLib() {
console.log('%c [ handleConfigUserLib ]-182', 'font-size:13px; background:pink; color:#bf2c9f;')
},
//
handleViewARR() {
console.log('%c [ handleViewARR ]-186', 'font-size:13px; background:pink; color:#bf2c9f;')
},
//
handleViewRRR() {
console.log('%c [ handleViewRRR ]-192', 'font-size:13px; background:pink; color:#bf2c9f;')
},
//
handleViewSpectrum() {
console.log('%c [ handleViewSpectrum ]-198', 'font-size:13px; background:pink; color:#bf2c9f;')
},
//
handleViewComments() {
console.log('%c [ viewComments ]-162', 'font-size:13px; background:pink; color:#bf2c9f;')
},
//
handleAddComments() {
console.log('%c [ handleAddComments ]-167', 'font-size:13px; background:pink; color:#bf2c9f;')
},
//
handleAutoAnalysisLog() {
console.log('%c [ handleAutoAnalysisLog ]-211', 'font-size:13px; background:pink; color:#bf2c9f;')
},
//
handleGammaViewerLog() {
console.log('%c [ handleGammaViewerLog ]-211', 'font-size:13px; background:pink; color:#bf2c9f;')
},
//
handleHelp() {
console.log('%c [ handleHelp ]-221', 'font-size:13px; background:pink; color:#bf2c9f;')
},
// 线
handleLineColorConfig() {
console.log('%c [ handleLineColorConfig ]-225', 'font-size:13px; background:pink; color:#bf2c9f;')
}, },
// peak info // peak info
@ -199,16 +308,19 @@ export default {
type: 'a-menu', type: 'a-menu',
children: [ children: [
{ {
title: 'Load From DB', type: 'a-menu-item',
handler: this.handleLoadFromDb title: 'Save Results to File',
handler: this.saveResultsToFile
}, },
{ {
title: 'Load From File', type: 'a-menu-item',
handler: this.handleLoadFromFile title: 'Save Results to DB',
handler: this.saveResultsToDB
}, },
{ {
title: 'Clean All', type: 'a-menu-item',
handler: this.handleCleanAll title: 'Save PHD to File',
handler: this.savePHDToFile
} }
] ]
} }
@ -221,16 +333,14 @@ export default {
type: 'a-menu', type: 'a-menu',
children: [ children: [
{ {
title: 'Load From DB', type: 'a-menu-item',
handler: this.handleLoadFromDb title: 'Analyze Current Sample',
handler: this.handleAnalyzeCurrSample
}, },
{ {
title: 'Load From File', type: 'a-menu-item',
handler: this.handleLoadFromFile title: 'Analyze All Sample',
}, handler: this.handleAnalyzeAllSample
{
title: 'Clean All',
handler: this.handleCleanAll
} }
] ]
} }
@ -243,16 +353,19 @@ export default {
type: 'a-menu', type: 'a-menu',
children: [ children: [
{ {
title: 'Load From DB', type: 'a-menu-item',
handler: this.handleLoadFromDb title: 'Energy',
handler: this.handleEnergy
}, },
{ {
title: 'Load From File', type: 'a-menu-item',
handler: this.handleLoadFromFile title: 'Resolution',
handler: this.handleResolution
}, },
{ {
title: 'Clean All', type: 'a-menu-item',
handler: this.handleCleanAll title: 'Efficiency',
handler: this.handleEfficiency
} }
] ]
} }
@ -265,16 +378,14 @@ export default {
type: 'a-menu', type: 'a-menu',
children: [ children: [
{ {
title: 'Load From DB', type: 'a-menu-item',
handler: this.handleLoadFromDb title: 'Nuclide Library',
handler: this.handleNuclideLib
}, },
{ {
title: 'Load From File', type: 'a-menu-item',
handler: this.handleLoadFromFile title: 'Config User Library',
}, handler: this.handleConfigUserLib
{
title: 'Clean All',
handler: this.handleCleanAll
} }
] ]
} }
@ -287,16 +398,14 @@ export default {
type: 'a-menu', type: 'a-menu',
children: [ children: [
{ {
title: 'Load From DB', type: 'a-menu-item',
handler: this.handleLoadFromDb title: 'View Comments',
handler: this.handleViewComments
}, },
{ {
title: 'Load From File', type: 'a-menu-item',
handler: this.handleLoadFromFile title: 'Add Comments',
}, handler: this.handleAddComments
{
title: 'Clean All',
handler: this.handleCleanAll
} }
] ]
} }
@ -309,16 +418,19 @@ export default {
type: 'a-menu', type: 'a-menu',
children: [ children: [
{ {
title: 'Load From DB', type: 'a-menu-item',
handler: this.handleLoadFromDb title: 'View ARR',
handler: this.handleViewARR
}, },
{ {
title: 'Load From File', type: 'a-menu-item',
handler: this.handleLoadFromFile title: 'View RRR',
handler: this.handleViewRRR
}, },
{ {
title: 'Clean All', type: 'a-menu-item',
handler: this.handleCleanAll title: 'View Spectrum',
handler: this.handleViewSpectrum
} }
] ]
} }
@ -331,16 +443,14 @@ export default {
type: 'a-menu', type: 'a-menu',
children: [ children: [
{ {
title: 'Load From DB', type: 'a-menu-item',
handler: this.handleLoadFromDb title: 'Automatic Analysis Log',
handler: this.handleAutoAnalysisLog
}, },
{ {
title: 'Load From File', type: 'a-menu-item',
handler: this.handleLoadFromFile title: 'GammaViewer Log',
}, handler: this.handleGammaViewerLog
{
title: 'Clean All',
handler: this.handleCleanAll
} }
] ]
} }
@ -353,16 +463,14 @@ export default {
type: 'a-menu', type: 'a-menu',
children: [ children: [
{ {
title: 'Load From DB', type: 'a-menu-item',
handler: this.handleLoadFromDb title: 'Help',
handler: this.handleHelp
}, },
{ {
title: 'Load From File', type: 'a-menu-item',
handler: this.handleLoadFromFile title: 'Line Color Config',
}, handler: this.handleLineColorConfig
{
title: 'Clean All',
handler: this.handleCleanAll
} }
] ]
} }
@ -428,7 +536,7 @@ export default {
// //
// //
&-sub-operators { &-SubOperators {
flex-shrink: 0; flex-shrink: 0;
margin-top: 15px; margin-top: 15px;
display: flex; display: flex;