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'
const events = ['click', 'brushEnd']
const zrEvents = ['mousemove', 'mousedown', 'mouseup', 'click']
const zrEvents = ['mousemove', 'mousedown', 'mouseup', 'click', 'dblclick']
export default {
props: {
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"
@change="changeChartByType"
style="width: 246px"
class="sample-select"
></custom-select>
</div>
@ -437,6 +438,15 @@ export default {
}
}
.sample-select {
::v-deep {
.ant-select-selection {
background-color: transparent !important;
color: #ade6ee;
}
}
}
&-main {
height: calc(100% - 51px);
display: flex;

View File

@ -1,5 +1,5 @@
<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">
<pre>{{ content }}</pre>
</a-spin>
@ -112,7 +112,7 @@ export default {
<style lang="less" scoped>
pre {
height: 450px;
height: calc(100vh - 350px);
padding: 5px;
overflow: auto;
background-color: #285367;

View File

@ -52,7 +52,16 @@
<!-- 表格结束 -->
<div class="operators">
<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>
</div>
<div>
@ -241,6 +250,7 @@ export default {
return {
isLoading: false,
isCalling: false,
isSaving: false,
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() {
try {

View File

@ -52,7 +52,16 @@
<!-- 表格结束 -->
<div class="operators">
<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>
</div>
<div>
@ -203,6 +212,7 @@ export default {
this.columns = columns
return {
isLoading: false,
isCalling: false,
isSaving: false,
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() {
try {

View File

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

View File

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

View File

@ -52,7 +52,16 @@
<!-- 表格结束 -->
<div class="operators">
<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>
</div>
<div>
@ -203,6 +212,7 @@ export default {
this.columns = columns
return {
isLoading: false,
isCalling: false,
isSaving: false,
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() {
try {

View File

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

View File

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

View File

@ -235,6 +235,7 @@ import BetaGammaEnergyCalibrationModal from './components/Modals/BetaGammaModals
import StripModal from './components/Modals/StripModal.vue'
import AutomaticAnalysisLogModal from './components/Modals/BetaGammaModals/AutomaticAnalysisLogModal.vue'
import BetaGammaExtrapolationModal from './components/Modals/BetaGammaModals/BetaGammaExtrapolationModal.vue'
import { getAction } from '@/api/manage'
//
const ANALYZE_TYPE = {
@ -475,10 +476,29 @@ export default {
* 保存结果到数据库
* @param { 'all' | 'current' } type
*/
handleSaveResultsToDB(type) {
console.log('%c [ saveResultsToDB ]-157', 'font-size:13px; background:pink; color:#bf2c9f;', type)
if (type === 'current') {
this.handleSaveResultsToDB_Cuurrent()
async handleSaveResultsToDB(type) {
if (this.isBetaGamma) {
if (type === 'current') {
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() {