fix:gamma 增加 MDC 弹窗

This commit is contained in:
orgin 2023-12-20 10:31:22 +08:00
parent f2b3e58940
commit 92b8b33c9b
2 changed files with 236 additions and 0 deletions

View File

@ -0,0 +1,224 @@
<template>
<custom-modal
v-model="visible"
:width="1231"
title="MDC"
class="nuclide-activity-and-mdc-modal"
>
<!-- 顶部搜索栏
<a-form-model class="search-form">
<a-space class="operators" :size="20">
<a-button type="primary" @click="handleExportToExcel">
<img src="@/assets/images/spectrum/download.png" />
Export to Excel
</a-button>
</a-space>
</a-form-model>-->
<!-- 顶部搜索栏结束 -->
<a-spin :spinning="isLoading">
<custom-table :columns="columns" :list="list" :scroll="{ y: 460 }" :canSelect="false"></custom-table>
</a-spin>
<div slot="custom-footer" style="text-align: center">
<a-space :size="20">
<a-button type="primary" @click="handleExportToExcel">Export to Excel</a-button>
<a-button @click="visible = false">Close</a-button>
</a-space>
</div>
</custom-modal>
</template>
<script>
import { getAction } from '@/api/manage'
import ModalMixin from '@/mixins/ModalMixin'
import SampleDataMixin from '../../SampleDataMixin'
import * as XLSX from 'xlsx'
const columns = [
{
title: 'Nuclide',
dataIndex: 'nuclideName',
},
{
title: 'HalfLife',
dataIndex: 'halflifeView',
},
{
title: 'Energy (keV)',
dataIndex: 'energy',
customRender: (text) => {
return text && text !== 'null' ? parseFloat(Number(text).toPrecision(6)) : text
},
},
{
title: 'Yield (%)',
dataIndex: 'yield',
customRender: (text) => {
return text && text !== 'null' ? parseFloat(Number(text).toPrecision(6)) : text
},
},
{
title: 'Efficiency',
dataIndex: 'efficiency',
customRender: (text) => {
return text && text !== 'null' ? parseFloat(Number(text).toPrecision(6)) : text
},
},
{
title: 'MDC (uBq/m3)',
dataIndex: 'mdc',
customRender: (text) => {
return text
},
},
{
title: 'MDCErr (uBq/m3)',
dataIndex: 'mdcErr',
customRender: (text) => {
return text
},
},
]
export default {
mixins: [ModalMixin, SampleDataMixin],
data() {
this.columns = columns
return {
queryParam: {
activityReferenceTime: undefined,
concentrationReferenceTime: undefined,
},
compareVisible: false,
isLoading: false,
list: [],
compareList: [],
fileName: '',
}
},
methods: {
//
handleComparision() {
this.compareVisible = !this.compareVisible
},
async getInfo() {
this.list = [];
try {
this.isLoading = true
const { sampleId, inputFileName: fileName } = this.sampleData
const { success, result, message } = await getAction('/gamma/viewMDC', {
fileName,
})
if (success) {
this.list = result
} else {
this.$message.error(message)
}
} catch (error) {
console.error(error)
} finally {
this.isLoading = false
}
},
beforeModalOpen() {
this.compareVisible = false
this.getInfo()
},
// Excel
handleExportToExcel() {
const { inputFileName } = this.sampleData
let header = [];
this.columns.forEach(f=>{
header.push(f.dataIndex)
})
let name = inputFileName.split('.')[0]
if (this.list.length > 0) {
let _this = this
// saveAs(blob, `${_this.fileName}`)
// 簿
const workbook = XLSX.utils.book_new()
//
const worksheet = XLSX.utils.json_to_sheet(_this.list,{header, skipHeader:false})
// 簿
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1')
// Excel
XLSX.writeFile(workbook, `${name}_MDC` + '.xlsx')
} else {
this.$message.warning('No downloadable data')
}
},
},
}
</script>
<style lang="less" scoped>
.nuclide-activity-and-mdc-modal {
::v-deep {
.ant-modal-body {
padding: 16px;
}
}
}
.search-form {
display: flex;
justify-content: space-between;
margin-bottom: 15px;
.time-pickers {
display: flex;
.ant-form-item {
margin-bottom: 0;
&:nth-child(2) {
margin-left: 20px;
}
::v-deep {
.ant-form-item {
&-label {
> label {
color: #ade6ee;
}
}
&-control-wrapper {
width: 210px;
}
}
}
}
}
.operators {
.ant-btn {
display: flex;
align-items: center;
img {
margin-right: 10px;
}
}
}
}
.comparison-list {
padding-top: 15px;
border-top: 1px solid rgba(13, 109, 118, 0.5);
&-item {
&-title {
color: #0cebc9;
}
&:last-child {
margin-top: 12px;
}
}
}
</style>

View File

@ -94,6 +94,9 @@
<nuclide-activity-and-mdc-modal v-model="nuclideActivityAndMDCModalVisible" />
<!-- Nuclide Activity and MDC 弹窗结束 -->
<!-- Nuclide Activity and MDC 弹窗开始 -->
<mdc-modal v-model="MDCModalVisible" />
<!-- Nuclide Activity and MDC 弹窗结束 -->
<!-- Save Setting 弹窗开始 -->
<save-setting-modal v-model="saveSettingModalVisible" @save="handleSaveResultsToFile" />
<!-- Save Setting 弹窗结束 -->
@ -240,6 +243,7 @@ import LoadFromDbModal from './components/Modals/LoadFromDBModal.vue'
import LoadFromFileModal from './components/Modals/LoadFromFileModal.vue'
import PeakInfomation from './components/PeakInfomation.vue'
import NuclideActivityAndMdcModal from './components/Modals/NuclideActivityAndMDCModal.vue'
import MdcModal from './components/Modals/MDCModal.vue'
import MultiLevelMenu from './components/MultiLevelMenu.vue'
import SaveSettingModal from './components/Modals/SaveSettingModal.vue'
import AnalyzeSettingModal from './components/Modals/AnalyzeSettingModal.vue'
@ -292,6 +296,7 @@ export default {
LoadFromDbModal,
LoadFromFileModal,
PeakInfomation,
MdcModal,
NuclideActivityAndMdcModal,
MultiLevelMenu,
SaveSettingModal,
@ -379,6 +384,7 @@ export default {
arrOrRRRModalType: 1, // Reports -> ARR RRR
arrOrRRRModalExtraData: {},
MDCModalVisible: false, // Reports -> Radionuclide Activity
nuclideActivityAndMDCModalVisible: false, // Reports -> Radionuclide Activity
spectrumModalVisible: false, // Reports -> Spectrum
sampleInfomationModalVisible: false, // Reports -> Sample Infomation
@ -1466,6 +1472,12 @@ export default {
},
show: this.isGamma,
},
{
type: 'a-menu-item',
title: 'MDC',
handler: () => (this.MDCModalVisible = true),
show: this.isGamma,
},
{
type: 'a-menu-item',
title: 'Radionuclide Activity',