fix: 优化部分样式及功能,,增加Gamma的Save to DB 功能,完成Gamma Calibration弹窗中的Call功能

This commit is contained in:
Xu Zhimeng 2023-09-21 19:41:16 +08:00
parent acb93dd817
commit a921c64f6b
12 changed files with 268 additions and 68 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

@ -11,7 +11,13 @@
QC Flags
<beta-gamma-qc-flags slot="content" :data="qcFlags" @click="handleQcFlagClick" />
</pop-over-with-icon>
<custom-select v-model="spectraType" :options="SampleType" @change="changeChartByType" style="width: 246px;"></custom-select>
<custom-select
class="sample-select"
v-model="spectraType"
:options="SampleType"
@change="changeChartByType"
style="width: 246px;"
></custom-select>
</div>
<!-- 二级交互栏结束 -->
@ -353,12 +359,11 @@ export default {
// 线Energy
reanalyse([type, data]) {
const energy = data.map(item => [item.y])
if(type == 'gamma') {
if (type == 'gamma') {
this.gammaEnergyData = energy
} else {
this.betaEnergyData = energy
}
}
},
watch: {
@ -386,6 +391,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>
@ -113,7 +113,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

@ -50,6 +50,7 @@
:option="option"
:opts="opts"
@zr:click="handleChartClick"
@zr:dblclick="handleChartDblClick"
@zr:mousedown="handleMouseDown"
@zr:mouseup="handleMouseUp"
@brushEnd="handleBrushEnd"
@ -614,10 +615,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
}
@ -727,6 +728,11 @@ export default {
}
},
//
handleChartDblClick() {
this.handleReset()
},
// Nuclide Library
async getSelPosNuclide(channel) {
this.currChannel = channel

View File

@ -104,10 +104,7 @@
<!-- Resolution Calibration 弹窗结束 -->
<!-- SpectrumComments 弹窗开始 -->
<spectrum-comments-modal
v-model="gammaCommentsModalVisible"
:isAdd="isGammaCommentsAdd"
/>
<spectrum-comments-modal v-model="gammaCommentsModalVisible" :isAdd="isGammaCommentsAdd" />
<!-- SpectrumComments 弹窗结束 -->
<!-- Color Config 弹窗开始 -->
@ -127,11 +124,7 @@
<!-- Nuclide Library 弹窗结束 -->
<!-- Arr RRR 弹窗开始 -->
<arr-rrr-modal
v-model="arrOrRRRModalVisible"
:type="arrOrRRRModalType"
:extraData="this.arrOrRRRModalExtraData"
/>
<arr-rrr-modal v-model="arrOrRRRModalVisible" :type="arrOrRRRModalType" :extraData="this.arrOrRRRModalExtraData" />
<!-- Arr 弹窗结束 -->
<!-- Spectrum 弹窗开始 -->
@ -153,10 +146,7 @@
<automatic-analysis-log-modal v-model="autoAnalysisMogModalVisible" :type="autoAnalysisMogModalType" />
<!-- Beta-Gamma 的Comments 弹窗 -->
<beta-gamma-comments-modal
v-model="betaGammaCommentsModalVisible"
:isAdd="isBetaGammaCommentsAdd"
/>
<beta-gamma-comments-modal v-model="betaGammaCommentsModalVisible" :isAdd="isBetaGammaCommentsAdd" />
<!-- Beta-Gamma 的Comments 结束 -->
<!-- Beta-Gamma 的Energy Calibration开始 -->
@ -190,9 +180,7 @@
<!-- Beta-Gamma RLR 弹窗 结束 -->
<!-- Beta-Gamma Statistics Paramer History 弹窗 -->
<statistics-paramer-history-modal
v-model="statisticsParamerHistoryModalVisible"
/>
<statistics-paramer-history-modal v-model="statisticsParamerHistoryModalVisible" />
<!-- Beta-Gamma Statistics Paramer History 弹窗 结束 -->
</div>
</template>
@ -235,6 +223,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 = {
@ -384,10 +373,10 @@ export default {
},
handleLoadSampleFromFile(sampleList) {
let arr = sampleList.filter(item => {
return Object.keys(item).length>4
return Object.keys(item).length > 4
})
arr.forEach(item => {
item.sampleId = ""
item.sampleId = ''
item.inputFileName = item.sampleFileName
item.sampleType = item.sampleSystemType
})
@ -424,8 +413,28 @@ export default {
* 保存结果到数据库
* @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) {
} 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()
}
}
}
},
/**
@ -906,7 +915,7 @@ export default {
type: 'a-menu-item',
title: 'Automatic Analysis Log',
handler: () => {
this.autoAnalysisMogModalType = this.isGamma?1:this.isBetaGamma?2:1
this.autoAnalysisMogModalType = this.isGamma ? 1 : this.isBetaGamma ? 2 : 1
this.autoAnalysisMogModalVisible = true
}
},