Merge branch 'feature/spectrum-analysis' into feature-analysis-RLR-renpy

This commit is contained in:
Xu Zhimeng 2023-09-22 17:26:38 +08:00
commit fc63d2c568
12 changed files with 256 additions and 49 deletions

View File

@ -6,7 +6,7 @@ import * as echarts from 'echarts'
import 'echarts-gl' import 'echarts-gl'
const events = ['click', 'brushEnd'] const events = ['click', 'brushEnd']
const zrEvents = ['mousemove', 'mousedown', 'mouseup', 'click'] const zrEvents = ['mousemove', 'mousedown', 'mouseup', 'click', 'dblclick']
export default { export default {
props: { props: {
option: { option: {

10
src/utils/number.js Normal file
View File

@ -0,0 +1,10 @@
import { isNullOrUndefined } from './util'
/**
* 保留小数
* @param { string | number } num 数字
* @param { number } digit 保留位数
*/
export const toFixed = (num, digit) => {
return isNullOrUndefined(num) ? '' : Number(num).toFixed(digit)
}

View File

@ -16,6 +16,7 @@
:options="SampleType" :options="SampleType"
@change="changeChartByType" @change="changeChartByType"
style="width: 246px" style="width: 246px"
class="sample-select"
></custom-select> ></custom-select>
</div> </div>
@ -437,6 +438,15 @@ export default {
} }
} }
.sample-select {
::v-deep {
.ant-select-selection {
background-color: transparent !important;
color: #ade6ee;
}
}
}
&-main { &-main {
height: calc(100% - 51px); height: calc(100% - 51px);
display: flex; display: flex;

View File

@ -1,5 +1,5 @@
<template> <template>
<custom-modal v-model="visible" :width="1000" :title="type == 1 || type == 3 ? 'ARR' : 'RRR'"> <custom-modal v-model="visible" :width="1200" :title="type == 1 || type == 3 ? 'ARR' : 'RRR'">
<a-spin :spinning="isLoading"> <a-spin :spinning="isLoading">
<pre>{{ content }}</pre> <pre>{{ content }}</pre>
</a-spin> </a-spin>
@ -112,7 +112,7 @@ export default {
<style lang="less" scoped> <style lang="less" scoped>
pre { pre {
height: 450px; height: calc(100vh - 350px);
padding: 5px; padding: 5px;
overflow: auto; overflow: auto;
background-color: #285367; background-color: #285367;

View File

@ -52,7 +52,16 @@
<!-- 表格结束 --> <!-- 表格结束 -->
<div class="operators"> <div class="operators">
<div> <div>
<a-button type="primary">Call</a-button> <label>
<a-button type="primary" :loading="isCalling" @click="handleCall">Call</a-button>
<input
ref="fileInput"
type="file"
accept=".ent"
style="display: none;"
@change="handleFileChange"
/>
</label>
<a-button type="primary" :loading="isSaving" @click="handleSave">Save</a-button> <a-button type="primary" :loading="isSaving" @click="handleSave">Save</a-button>
</div> </div>
<div> <div>
@ -241,6 +250,7 @@ export default {
return { return {
isLoading: false, isLoading: false,
isCalling: false,
isSaving: false, isSaving: false,
equation: '', equation: '',
@ -491,6 +501,43 @@ export default {
} }
}, },
// call
handleCall() {
this.$refs.fileInput.click()
},
async handleFileChange(event) {
const { files } = event.target
if (files.length) {
const file = files[0]
const { inputFileName: fileName } = this.sampleData
const formData = new FormData()
formData.append('file', file)
formData.append('sampleFileName', fileName)
formData.append('width', 922)
formData.append('currentText', this.currSelectedDataSource)
try {
this.isCalling = true
const { success, result, message } = await postAction('/gamma/callDataEfficiency', formData)
if (success) {
const { ECutAnalysis_Low, G_energy_span } = result
this.ECutAnalysis_Low = ECutAnalysis_Low
this.G_energy_span = G_energy_span
this.handleResult(result)
} else {
this.$message.error(message)
}
} catch (error) {
console.error(error)
} finally {
this.isCalling = false
}
}
event.target.value = ''
},
// //
async handleApply() { async handleApply() {
try { try {

View File

@ -52,7 +52,16 @@
<!-- 表格结束 --> <!-- 表格结束 -->
<div class="operators"> <div class="operators">
<div> <div>
<a-button type="primary">Call</a-button> <label>
<a-button type="primary" :loading="isCalling" @click="handleCall">Call</a-button>
<input
ref="fileInput"
type="file"
accept=".ent"
style="display: none;"
@change="handleFileChange"
/>
</label>
<a-button type="primary" :loading="isSaving" @click="handleSave">Save</a-button> <a-button type="primary" :loading="isSaving" @click="handleSave">Save</a-button>
</div> </div>
<div> <div>
@ -203,6 +212,7 @@ export default {
this.columns = columns this.columns = columns
return { return {
isLoading: false, isLoading: false,
isCalling: false,
isSaving: false, isSaving: false,
equation: '', equation: '',
@ -450,6 +460,43 @@ export default {
} }
}, },
// call
handleCall() {
this.$refs.fileInput.click()
},
async handleFileChange(event) {
const { files } = event.target
if (files.length) {
const file = files[0]
const { inputFileName: fileName } = this.sampleData
const formData = new FormData()
formData.append('file', file)
formData.append('sampleFileName', fileName)
formData.append('width', 922)
formData.append('currentText', this.currSelectedDataSource)
try {
this.isCalling = true
const { success, result, message } = await postAction('/gamma/callDataEnergy', formData)
if (success) {
const { rg_high, rg_low } = result
this.rg_high = rg_high
this.rg_low = rg_low
this.handleResult(result)
} else {
this.$message.error(message)
}
} catch (error) {
console.error(error)
} finally {
this.isCalling = false
}
}
event.target.value = ''
},
// //
async handleApply() { async handleApply() {
try { try {

View File

@ -17,6 +17,7 @@
:selectedRowKeys.sync="selectedRowKeys" :selectedRowKeys.sync="selectedRowKeys"
:selectionRows.sync="selectionRows" :selectionRows.sync="selectionRows"
:multiple="true" :multiple="true"
:scroll="{ y: 'calc(100vh - 550px)' }"
> >
</custom-table> </custom-table>
<!-- 底部操作栏 --> <!-- 底部操作栏 -->
@ -51,7 +52,8 @@ const columns = [
{ {
title: 'Detector', title: 'Detector',
align: 'left', align: 'left',
dataIndex: 'detectorsName' dataIndex: 'detectorsName',
width: 130
}, },
{ {
title: 'Sample', title: 'Sample',
@ -71,12 +73,14 @@ const columns = [
{ {
title: 'Col.Stop', title: 'Col.Stop',
align: 'left', align: 'left',
dataIndex: 'collectStop' dataIndex: 'collectStop',
width: 170
}, },
{ {
title: 'Acq.Start', title: 'Acq.Start',
align: 'left', align: 'left',
dataIndex: 'acquisitionStart' dataIndex: 'acquisitionStart',
width: 170
}, },
{ {
title: 'Acq.real', title: 'Acq.real',

View File

@ -47,7 +47,7 @@
:columns="daughterColumns" :columns="daughterColumns"
:list="daughterList" :list="daughterList"
:pagination="false" :pagination="false"
:scroll="{ y: 123 }" :scroll="{ y: 84 }"
rowKey="daughters" rowKey="daughters"
@rowDblClick="handleParentDBClick($event.daughters)" @rowDblClick="handleParentDBClick($event.daughters)"
></custom-table> ></custom-table>
@ -77,7 +77,7 @@
:columns="mainColumns" :columns="mainColumns"
:dataSource="nuclLinesLibs" :dataSource="nuclLinesLibs"
:pagination="false" :pagination="false"
:scroll="{ y: 175 }" :scroll="{ y: 330 }"
> >
<template slot="keyLine" slot-scope="text"> <template slot="keyLine" slot-scope="text">
<span v-if="text == 1" class="green-check-mark"> </span> <span v-if="text == 1" class="green-check-mark"> </span>
@ -115,6 +115,7 @@ import ModalMixin from '@/mixins/ModalMixin'
import TitleOverBorder from '../TitleOverBorder.vue' import TitleOverBorder from '../TitleOverBorder.vue'
import { getAction } from '@/api/manage' import { getAction } from '@/api/manage'
import SampleDataMixin from '../../SampleDataMixin' import SampleDataMixin from '../../SampleDataMixin'
import { toFixed } from '@/utils/number'
// //
const daughterColumns = [ const daughterColumns = [
@ -151,22 +152,34 @@ const mainColumns = [
{ {
title: 'Energy(keV)', title: 'Energy(keV)',
dataIndex: 'energy', dataIndex: 'energy',
width: 100 width: 100,
customRender: text => {
return toFixed(text, 3)
}
}, },
{ {
title: 'Energy Uncert(%)', title: 'Energy Uncert(%)',
dataIndex: 'energyUncert', dataIndex: 'energyUncert',
width: 120 width: 120,
customRender: text => {
return text ? toFixed(text * 100, 6) : ''
}
}, },
{ {
title: 'Yield', title: 'Yield',
dataIndex: 'yield', dataIndex: 'yield',
width: 80 width: 80,
customRender: text => {
return toFixed(text, 3)
}
}, },
{ {
title: 'Yield Uncert(%)', title: 'Yield Uncert(%)',
dataIndex: 'yieldUncert', dataIndex: 'yieldUncert',
width: 120 width: 120,
customRender: text => {
return toFixed(text, 3)
}
}, },
{ {
title: 'KeyLine', title: 'KeyLine',
@ -295,7 +308,7 @@ export default {
&-list { &-list {
padding: 5px; padding: 5px;
width: 150px; width: 150px;
height: 516px; height: 632px;
overflow: auto; overflow: auto;
background-color: #275466; background-color: #275466;
@ -339,7 +352,7 @@ export default {
} }
.content { .content {
height: 150px; height: 111px;
} }
.parents { .parents {
@ -364,7 +377,7 @@ export default {
&.has-data { &.has-data {
::v-deep { ::v-deep {
.ant-table-body { .ant-table-body {
height: 123px; height: 84px;
background-color: #06282a; background-color: #06282a;
} }
} }
@ -373,7 +386,7 @@ export default {
::v-deep { ::v-deep {
.ant-table { .ant-table {
&-placeholder { &-placeholder {
height: 124px; height: 85px;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
@ -400,7 +413,7 @@ export default {
&.has-data { &.has-data {
::v-deep { ::v-deep {
.ant-table-body { .ant-table-body {
height: 175px; height: 330px;
background-color: #06282a; background-color: #06282a;
} }
} }
@ -409,7 +422,7 @@ export default {
::v-deep { ::v-deep {
.ant-table { .ant-table {
&-placeholder { &-placeholder {
height: 176px; height: 331px;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;

View File

@ -52,7 +52,16 @@
<!-- 表格结束 --> <!-- 表格结束 -->
<div class="operators"> <div class="operators">
<div> <div>
<a-button type="primary">Call</a-button> <label>
<a-button type="primary" :loading="isCalling" @click="handleCall">Call</a-button>
<input
ref="fileInput"
type="file"
accept=".ent"
style="display: none;"
@change="handleFileChange"
/>
</label>
<a-button type="primary" :loading="isSaving" @click="handleSave">Save</a-button> <a-button type="primary" :loading="isSaving" @click="handleSave">Save</a-button>
</div> </div>
<div> <div>
@ -203,6 +212,7 @@ export default {
this.columns = columns this.columns = columns
return { return {
isLoading: false, isLoading: false,
isCalling: false,
isSaving: false, isSaving: false,
equation: '', equation: '',
@ -448,6 +458,43 @@ export default {
} }
}, },
// call
handleCall() {
this.$refs.fileInput.click()
},
async handleFileChange(event) {
const { files } = event.target
if (files.length) {
const file = files[0]
const { inputFileName: fileName } = this.sampleData
const formData = new FormData()
formData.append('file', file)
formData.append('sampleFileName', fileName)
formData.append('width', 922)
formData.append('currentText', this.currSelectedDataSource)
try {
this.isCalling = true
const { success, result, message } = await postAction('/gamma/callDataResolution', formData)
if (success) {
const { ECutAnalysis_Low, G_energy_span } = result
this.ECutAnalysis_Low = ECutAnalysis_Low
this.G_energy_span = G_energy_span
this.handleResult(result)
} else {
this.$message.error(message)
}
} catch (error) {
console.error(error)
} finally {
this.isCalling = false
}
}
event.target.value = ''
},
// //
async handleApply() { async handleApply() {
try { try {

View File

@ -2,15 +2,12 @@
<custom-modal v-model="visible" :width="750" title="Sample Infomation"> <custom-modal v-model="visible" :width="750" title="Sample Infomation">
<a-spin :spinning="isLoading"> <a-spin :spinning="isLoading">
<div class="sample-infomation"> <div class="sample-infomation">
<a-form-model :labelCol="{ style: { width: '150px', textAlign: 'left' } }">
<a-row> <a-row>
<a-col :span="12" v-for="(item, index) in columns" :key="index"> <a-col class="sample-infomation-item" :span="12" v-for="(item, index) in columns" :key="index">
<a-form-model-item :label="item.title"> <div class="label">{{ item.title }}:</div>
{{ data[item.key] }} <div class="value">{{ data[item.key] }}</div>
</a-form-model-item>
</a-col> </a-col>
</a-row> </a-row>
</a-form-model>
</div> </div>
</a-spin> </a-spin>
<div slot="custom-footer" style="text-align: center;"> <div slot="custom-footer" style="text-align: center;">
@ -25,7 +22,7 @@
<script> <script>
import { getAction, getFileAction } from '@/api/manage' import { getAction, getFileAction } from '@/api/manage'
import ModalMixin from '@/mixins/ModalMixin' import ModalMixin from '@/mixins/ModalMixin'
import { saveAs } from 'file-saver'; import { saveAs } from 'file-saver'
import SampleDataMixin from '../../SampleDataMixin' import SampleDataMixin from '../../SampleDataMixin'
const columns = [ const columns = [
@ -125,7 +122,7 @@ export default {
}, },
// Excel // Excel
handleExportToExcel() { handleExportToExcel() {
this.fileName = "" this.fileName = ''
const { sampleId, inputFileName: fileName } = this.sampleData const { sampleId, inputFileName: fileName } = this.sampleData
if (Object.keys(this.data).length > 0) { if (Object.keys(this.data).length > 0) {
let _this = this let _this = this
@ -134,10 +131,10 @@ export default {
content: h => <a-input v-model={_this.fileName} />, content: h => <a-input v-model={_this.fileName} />,
okText: 'Cancle', okText: 'Cancle',
cancelText: 'Save', cancelText: 'Save',
okButtonProps: {style: {backgroundColor: "#b98326", color: "#fff", borderColor: "transparent"}}, okButtonProps: { style: { backgroundColor: '#b98326', color: '#fff', borderColor: 'transparent' } },
cancelButtonProps: {style: {color: "#fff", backgroundColor: "#31aab0", borderColor: "transparent"}}, cancelButtonProps: { style: { color: '#fff', backgroundColor: '#31aab0', borderColor: 'transparent' } },
onOk() { onOk() {
console.log('Cancel'); console.log('Cancel')
}, },
onCancel() { onCancel() {
if (_this.fileName) { if (_this.fileName) {
@ -147,17 +144,17 @@ export default {
} }
getFileAction('/gamma/exportSampleInformation', params).then(res => { getFileAction('/gamma/exportSampleInformation', params).then(res => {
if (res.code && res.code == 500) { if (res.code && res.code == 500) {
this.$message.warning("This operation fails. Contact your system administrator") this.$message.warning('This operation fails. Contact your system administrator')
} else { } else {
const blob = new Blob([res], { type: "application/vnd.ms-excel" }) const blob = new Blob([res], { type: 'application/vnd.ms-excel' })
saveAs(blob, `${_this.fileName}`) saveAs(blob, `${_this.fileName}`)
} }
}) })
} }
}, }
}); })
} else { } else {
this.$message.warning("No downloadable data") this.$message.warning('No downloadable data')
} }
} }
} }
@ -169,8 +166,14 @@ export default {
background-color: #143644; background-color: #143644;
padding: 20px; padding: 20px;
.ant-form-item { &-item {
margin-bottom: 0; display: flex;
height: 30px;
.label {
width: 150px;
color: #5b9cba;
}
} }
} }
</style> </style>

View File

@ -48,6 +48,7 @@
:option="option" :option="option"
:opts="opts" :opts="opts"
@zr:click="handleChartClick" @zr:click="handleChartClick"
@zr:dblclick="handleChartDblClick"
@zr:mousedown="handleMouseDown" @zr:mousedown="handleMouseDown"
@zr:mouseup="handleMouseUp" @zr:mouseup="handleMouseUp"
@brushEnd="handleBrushEnd" @brushEnd="handleBrushEnd"
@ -637,10 +638,10 @@ export default {
this.thumbnailOption.series[0].symbol = 'none' this.thumbnailOption.series[0].symbol = 'none'
break break
case 'Scatter': case 'Scatter':
this.option.series[0].type = 'scatter' this.option.series[0].type = 'scatterGL'
this.option.series[0].symbol = 'circle' this.option.series[0].symbol = 'circle'
this.thumbnailOption.series[0].type = 'scatter' this.thumbnailOption.series[0].type = 'scatterGL'
this.thumbnailOption.series[0].symbol = 'circle' this.thumbnailOption.series[0].symbol = 'circle'
break break
} }
@ -752,6 +753,11 @@ export default {
} }
}, },
//
handleChartDblClick() {
this.handleReset()
},
// Nuclide Library // Nuclide Library
async getSelPosNuclide(channel) { async getSelPosNuclide(channel) {
this.currChannel = channel this.currChannel = channel

View File

@ -235,6 +235,7 @@ import BetaGammaEnergyCalibrationModal from './components/Modals/BetaGammaModals
import StripModal from './components/Modals/StripModal.vue' import StripModal from './components/Modals/StripModal.vue'
import AutomaticAnalysisLogModal from './components/Modals/BetaGammaModals/AutomaticAnalysisLogModal.vue' import AutomaticAnalysisLogModal from './components/Modals/BetaGammaModals/AutomaticAnalysisLogModal.vue'
import BetaGammaExtrapolationModal from './components/Modals/BetaGammaModals/BetaGammaExtrapolationModal.vue' import BetaGammaExtrapolationModal from './components/Modals/BetaGammaModals/BetaGammaExtrapolationModal.vue'
import { getAction } from '@/api/manage'
// //
const ANALYZE_TYPE = { const ANALYZE_TYPE = {
@ -475,11 +476,30 @@ export default {
* 保存结果到数据库 * 保存结果到数据库
* @param { 'all' | 'current' } type * @param { 'all' | 'current' } type
*/ */
handleSaveResultsToDB(type) { async handleSaveResultsToDB(type) {
console.log('%c [ saveResultsToDB ]-157', 'font-size:13px; background:pink; color:#bf2c9f;', type) if (this.isBetaGamma) {
if (type === 'current') { if (type === 'current') {
this.handleSaveResultsToDB_Cuurrent() this.handleSaveResultsToDB_Cuurrent()
} }
} else if (this.isGamma) {
if (type == 'current') {
const hideLoading = this.$message.loading('Saving...', 0)
try {
const { success, message } = await getAction('/gamma/saveToDB', {
fileName: this.sampleData.inputFileName
})
if (success) {
this.$message.success('Save Success')
} else {
this.$message.error(message)
}
} catch (error) {
console.error(error)
} finally {
hideLoading()
}
}
}
}, },
handleSaveResultsToDB_Cuurrent() { handleSaveResultsToDB_Cuurrent() {
// xeflag params_toDB // xeflag params_toDB