Merge branch 'feature-analysis-RLR-renpy' of http://git.hivekion.com:3000/xiaoguangbin/AnalysisSystemForRadionuclide_vue into master-dev

This commit is contained in:
orgin 2023-10-25 19:03:36 +08:00
commit 486b9f5d9f
16 changed files with 823 additions and 540 deletions

View File

@ -57,6 +57,7 @@
"vxe-table": "2.9.13",
"vxe-table-plugin-antd": "1.8.10",
"xe-utils": "2.4.8",
"xlsx": "^0.18.5",
"xss": "^1.0.13"
},
"devDependencies": {

View File

@ -6,6 +6,7 @@ import user from './modules/user'
import permission from './modules/permission'
import enhance from './modules/enhance'
import online from './modules/online'
import sample from './modules/sample'
import getters from './getters'
Vue.use(Vuex)
@ -17,6 +18,7 @@ export default new Vuex.Store({
permission,
enhance,
online,
sample
},
state: {

View File

@ -0,0 +1,30 @@
const sample = {
state: {
sampleList: []
},
mutations: {
SET_SAMPLE_LIST: (state, sampleList) => {
state.sampleList = sampleList
},
ADD_SAMPLE_DATA: (state, sampleData) => {
state.sampleList.push(sampleData)
},
GET_SAMPLE_DATA: (state, inputFileName) => {
const find = state.sampleList.find(item => item.inputFileName == inputFileName)
return find
},
REMOVE_SAMPLE_DATA: (state, inputFileName) => {
const findIndex = state.sampleList.findIndex(item => item.inputFileName == inputFileName)
state.sampleList.splice(findIndex, 1)
},
CLEAR_SAMPLE_DATA: () => {
state.sampleList = []
}
}
}
export default sample

View File

@ -114,5 +114,5 @@ export function rangeNumber(min, max) {
* @returns
*/
export function getAxisMax(chartInstance, axis) {
return chartInstance.getModel().getComponent(axis).axis.scale._extent[1]
return chartInstance.getModel().getComponent(axis).axis.scale.rawExtentInfo._dataMax
}

View File

@ -104,21 +104,28 @@ export function getFileNameByHeaderContentDisposition(contentDisposition) {
return fileName
}
export const fetchAndDownload = async (url, data) => {
export const fetchAndDownload = async (url, data, method='post') => {
const apiBaseUrl = window._CONFIG['domianURL'] || '/jeecg-boot'
const sign = signMd5Utils.getSign(url, data)
const response = await Axios({
const config = {
baseURL: apiBaseUrl,
method: 'post',
method,
url,
data: data,
data,
headers: {
'X-Sign': sign,
'X-TIMESTAMP': signMd5Utils.getTimestamp(),
'X-Access-Token': Vue.ls.get(ACCESS_TOKEN),
'tenant-id': Vue.ls.get(TENANT_ID)
}
})
}
if(method == 'get') {
config.params = data
}
const response = await Axios(config)
const { status, headers, data: responseData } = response
if (status == 200) {
if (typeof responseData == 'object') {

View File

@ -51,7 +51,7 @@
class="custom-tool-tip"
:style="{
top: customToolTip.top + 'px',
left: customToolTip.left + 'px'
left: customToolTip.left + 'px',
}"
>
<div class="channel">Channel: {{ customToolTip.channel }}</div>
@ -62,7 +62,7 @@
class="custom-tool-tip"
:style="{
top: customToolTip2.top + 'px',
left: customToolTip2.left + 'px'
left: customToolTip2.left + 'px',
}"
>
<div class="channel">Channel: {{ customToolTip2.channel }}</div>
@ -89,10 +89,18 @@
<div class="title">Gamma Window Setting</div>
<div class="content">
<div class="label">Gamma Window Begin:</div>
<a-input-number size="small" v-model="model.windowBegin" @change="calculateTotalCount"></a-input-number>
<a-input-number
size="small"
v-model="model.windowBegin"
@change="handleGammaWindowSettingChange"
></a-input-number>
Channel
<div class="label">Gamma Window End:</div>
<a-input-number size="small" v-model="model.windowEnd" @change="calculateTotalCount"></a-input-number>
<a-input-number
size="small"
v-model="model.windowEnd"
@change="handleGammaWindowSettingChange"
></a-input-number>
Channel
</div>
</div>
@ -100,9 +108,19 @@
<div class="title">Parameter Setting</div>
<div class="content">
<div class="label">Min of Energy:</div>
<a-input-number size="small" v-model="model.minEnergy"></a-input-number> keV
<a-input-number
size="small"
v-model="model.minEnergy"
@change="handleParameterSettingChange"
></a-input-number>
keV
<div class="label">Half Life:</div>
<a-input-number size="small" v-model="model.halfLife"></a-input-number> Day
<a-input-number
size="small"
v-model="model.halfLife"
@change="handleParameterSettingChange"
></a-input-number>
Day
</div>
</div>
<div class="setting-item">
@ -137,7 +155,7 @@
>
<template slot="delete" slot-scope="text, record, index">
<a-button type="link" size="small" @click="handleDel(index)">
<a-icon type="delete" style="color: red;"></a-icon>
<a-icon type="delete" style="color: red"></a-icon>
</a-button>
</template>
</a-table>
@ -196,7 +214,7 @@ import { getAction, postAction } from '@/api/manage'
import { useBaseChartSetting } from '../../../useChart'
import TitleOverBorder from '../../TitleOverBorder.vue'
import SampleDataMixin from '@/views/spectrumAnalysis/SampleDataMixin'
import { isNullOrUndefined } from '@/utils/util'
import { isNumber } from 'xe-utils/methods'
const initialGammaChartOption = {
grid: {
@ -204,7 +222,7 @@ const initialGammaChartOption = {
right: 15,
bottom: 10,
left: 10,
containLabel: true
containLabel: true,
},
xAxis: {
min: 0,
@ -212,21 +230,21 @@ const initialGammaChartOption = {
interval: 64,
axisLine: {
lineStyle: {
color: 'rgb(119, 181, 213, 0.5)'
}
color: 'rgb(119, 181, 213, 0.5)',
},
},
splitLine: {
show: true,
lineStyle: {
color: 'rgba(119, 181, 213, .2)'
}
color: 'rgba(119, 181, 213, .2)',
},
},
axisTick: {
show: false
show: false,
},
axisLabel: {
color: '#ade6ee'
}
color: '#ade6ee',
},
},
yAxis: {
min: 0,
@ -235,57 +253,57 @@ const initialGammaChartOption = {
axisLine: {
show: true,
lineStyle: {
color: 'rgb(119, 181, 213, 0.5)'
}
color: 'rgb(119, 181, 213, 0.5)',
},
},
splitLine: {
show: true,
lineStyle: {
color: 'rgba(119, 181, 213, .2)'
}
color: 'rgba(119, 181, 213, .2)',
},
},
axisTick: {
show: false
show: false,
},
axisLabel: {
color: '#ade6ee'
color: '#ade6ee',
},
animation: false
animation: false,
},
series: [
{
type: 'line',
itemStyle: {
color: '#04ADD9'
color: '#04ADD9',
},
symbol: 'none',
data: [],
markLine: {
symbol: 'none',
label: {
show: false
show: false,
},
animation: false,
emphasis: {
disabled: true
disabled: true,
},
lineStyle: {
color: '#f00'
color: '#f00',
},
data: [{ xAxis: -1 }, { xAxis: -1 }]
data: [{ xAxis: -1 }, { xAxis: -1 }],
},
animation: false
animation: false,
},
{
type: 'line',
itemStyle: {
color: '#A8DA56'
color: '#A8DA56',
},
symbol: 'none',
data: [],
animation: false
}
]
animation: false,
},
],
}
const initialBetaChartOption = {
@ -294,7 +312,7 @@ const initialBetaChartOption = {
right: 15,
bottom: 10,
left: 10,
containLabel: true
containLabel: true,
},
xAxis: {
min: 0,
@ -302,21 +320,21 @@ const initialBetaChartOption = {
interval: 64,
axisLine: {
lineStyle: {
color: 'rgb(119, 181, 213, 0.5)'
}
color: 'rgb(119, 181, 213, 0.5)',
},
},
splitLine: {
show: true,
lineStyle: {
color: 'rgba(119, 181, 213, .2)'
}
color: 'rgba(119, 181, 213, .2)',
},
},
axisTick: {
show: false
show: false,
},
axisLabel: {
color: '#ade6ee'
}
color: '#ade6ee',
},
},
yAxis: {
min: 0,
@ -325,57 +343,57 @@ const initialBetaChartOption = {
axisLine: {
show: true,
lineStyle: {
color: 'rgb(119, 181, 213, 0.5)'
}
color: 'rgb(119, 181, 213, 0.5)',
},
},
splitLine: {
show: true,
lineStyle: {
color: 'rgba(119, 181, 213, .2)'
}
color: 'rgba(119, 181, 213, .2)',
},
},
axisTick: {
show: false
show: false,
},
axisLabel: {
color: '#ade6ee'
color: '#ade6ee',
},
animation: false
animation: false,
},
series: [
{
type: 'line',
itemStyle: {
color: '#04ADD9'
color: '#04ADD9',
},
symbol: 'none',
data: [],
markLine: {
symbol: 'none',
label: {
show: false
show: false,
},
animation: false,
emphasis: {
disabled: true
disabled: true,
},
lineStyle: {
color: '#f00'
color: '#f00',
},
data: []
data: [],
},
animation: false
animation: false,
},
{
type: 'line',
itemStyle: {
color: '#A8DA56'
color: '#A8DA56',
},
symbol: 'none',
data: [],
animation: false
}
]
animation: false,
},
],
}
const initialResultChartOption = {
@ -384,23 +402,23 @@ const initialResultChartOption = {
{
type: 'line',
itemStyle: {
color: '#04ADD9'
color: '#04ADD9',
},
symbol: 'none',
data: [],
animation: false
animation: false,
},
{
type: 'scatter',
itemStyle: {
color: 'red'
color: 'red',
},
symbolSize: 6,
data: [],
zlevel: 2,
animation: false
}
]
animation: false,
},
],
}
initialResultChartOption.yAxis.boundaryGap = ['20%', '20%']
@ -411,30 +429,30 @@ const columns = [
customRender: (_, __, index) => {
return index + 1
},
align: 'center'
align: 'center',
},
{
title: 'Eb',
dataIndex: 'eb',
align: 'center'
align: 'center',
},
{
title: 'Nx',
dataIndex: 'nx',
align: 'center'
align: 'center',
},
{
title: 'Ny',
dataIndex: 'ny',
align: 'center'
align: 'center',
},
{
title: 'Delete',
scopedSlots: {
customRender: 'delete'
customRender: 'delete',
},
align: 'center'
}
align: 'center',
},
]
const initialModel = {
@ -442,20 +460,20 @@ const initialModel = {
windowEnd: undefined,
minEnergy: 0.1,
halfLife: 5.243,
fitType: 'liner'
fitType: 'liner',
}
// Function of Fitting
const funcList = {
liner: 'y = ax + b',
poly2: 'y = axx + bx + c'
poly2: 'y = axx + bx + c',
}
export default {
mixins: [ModalMixin, SampleDataMixin],
components: {
CustomChart,
TitleOverBorder
TitleOverBorder,
},
data() {
this.columns = columns
@ -469,14 +487,14 @@ export default {
left: 0,
visible: false,
channel: '',
energy: ''
energy: '',
},
customToolTip2: {
top: 0,
left: 0,
visible: false,
channel: '',
energy: ''
energy: '',
},
totalCount: [0, 0],
@ -490,7 +508,7 @@ export default {
model: cloneDeep(initialModel),
tableList: [],
isAnalysing: false
isAnalysing: false,
}
},
methods: {
@ -502,7 +520,7 @@ export default {
this.resultChartOption = cloneDeep(initialResultChartOption)
this.model = cloneDeep(initialModel)
this.currFunction = funcList[this.model.fitType]
this.handleFuncChange()
this.tableList = []
this.calculateTotalCount()
@ -516,7 +534,7 @@ export default {
const { sampleId, inputFileName: sampleFileName } = this.sampleData
const { success, result, message } = await getAction('/spectrumAnalysis/viewExtrapolation', {
sampleId,
sampleFileName
sampleFileName,
})
if (success) {
this.detail = result
@ -526,7 +544,7 @@ export default {
betaProjectedSeriseData,
gammaChannelEnergy,
gammaOriginSeriseData,
gammaProjectedSeriseData
gammaProjectedSeriseData,
} = result
this.gammaChannelEnergy = gammaChannelEnergy
@ -579,8 +597,8 @@ export default {
//
if (isMouseLeft) {
//
if (!isNullOrUndefined(this.model.windowEnd) && xAxis >= this.model.windowEnd) {
this.clearMarkLineAndToolTip()
if (!isNumber(this.model.windowEnd) && xAxis >= this.model.windowEnd) {
this.reset()
return
}
@ -591,8 +609,8 @@ export default {
}
//
else {
if (!isNullOrUndefined(this.model.windowBegin) && xAxis <= this.model.windowBegin) {
this.clearMarkLineAndToolTip()
if (!isNumber(this.model.windowBegin) && xAxis <= this.model.windowBegin) {
this.reset()
return
}
@ -612,10 +630,11 @@ export default {
currToolTip.energy = parseInt(energy) + 'keV'
this.calculateTotalCount()
this.getTableAndChartData()
}
},
clearMarkLineAndToolTip() {
reset() {
const markLineData = this.gammaSpectrumChartOption.series[0].markLine.data
markLineData[0].xAxis = -1
markLineData[1].xAxis = -1
@ -626,12 +645,18 @@ export default {
this.model.windowBegin = null
this.model.windowEnd = null
this.tableList = []
const [lineSeries, scatterSeries] = this.resultChartOption.series
lineSeries.data = []
scatterSeries.data = []
this.calculateTotalCount()
},
// Total Count
calculateTotalCount() {
if (!this.model.windowBegin || !this.model.windowEnd || this.model.windowBegin >= this.model.windowEnd) {
const { windowBegin, windowEnd } = this.model
if (!isNumber(windowBegin) || !isNumber(windowEnd) || windowBegin >= windowEnd) {
this.totalCount = [0, 0]
return
}
@ -658,56 +683,96 @@ export default {
exportEchartImg(this.$refs.chartRef.getChartInstance())
},
//
async handleAnalyse() {
handleGammaWindowSettingChange() {
this.calculateTotalCount()
this.getTableAndChartData()
},
handleParameterSettingChange() {
this.getTableAndChartData()
},
/**
* 获取表格和图表数据
*/
async getTableAndChartData() {
const { windowBegin, windowEnd, minEnergy, halfLife, fitType } = this.model
if (
isNullOrUndefined(windowBegin) ||
isNullOrUndefined(windowEnd) ||
isNullOrUndefined(minEnergy) ||
isNullOrUndefined(halfLife)
) {
const [lineSeries, scatterSeries] = this.resultChartOption.series
lineSeries.data = []
if (!this.validateSettingValue()) {
scatterSeries.data = []
this.tableList = []
return
}
try {
const { sampleFileName, detFileName } = this.sampleData
const { sampleId, dbName, sampleFileName, detFileName } = this.sampleData
try {
const params = {
sampleId: null,
dbName: '',
sampleId,
dbName,
sampleFileName,
detFileName,
gammaBegin: windowBegin,
gammaEnd: windowEnd,
minEnergy,
halfLife,
fitType //Linear liner 2-Polynomial poly2
fitType, //Linear liner 2-Polynomial poly2
}
const { success, result, message } = await postAction('/spectrumAnalysis/changeDataExtrapolation', params)
if (success) {
const { resultViewScatterDataValue, tableData } = result
scatterSeries.data = resultViewScatterDataValue.map(({ x, y }) => [x, y])
this.resetResultChartPerform()
this.tableList = tableData
} else {
this.$message.error(message)
}
} catch (error) {
console.error(error)
}
},
//
async handleAnalyse() {
const { minEnergy, halfLife, fitType } = this.model
if (!this.validateSettingValue()) {
return
}
try {
const { acquisitionRealTime: acqRealTime, acquisitionStart: acqStartTime } = this.detail
const params = {
eb: this.tableList.map(({ eb }) => eb),
nx: this.tableList.map(({ nx }) => nx),
ny: this.tableList.map(({ ny }) => ny),
acqRealTime,
minEnergy,
halfLife,
acqStartTime,
fitType,
}
this.isAnalysing = true
const { success, result, message } = await postAction('/spectrumAnalysis/analyseExtrapolation', params)
if (success) {
console.log('%c [ ]-679', 'font-size:13px; background:pink; color:#bf2c9f;', result)
const {
functionFit, // Function of Fitting
resultViewLineDataValue, // 线
resultViewScatterDataValue, //
tableData, //
xeAct
xeAct,
} = result
this.currFunction = functionFit
const [lineSeries, scatterSeries] = this.resultChartOption.series
const [lineSeries] = this.resultChartOption.series
lineSeries.data = resultViewLineDataValue.map(({ x, y }) => [x, y])
scatterSeries.data = resultViewScatterDataValue.map(({ x, y }) => [x, y])
this.resetResultChartPerform()
this.xeActivity = {
referenceTime: this.detail.acquisitionStart,
activity: Number.isNaN(xeAct)? xeAct: Number(xeAct).toPrecision(6)
activity: Number.isNaN(xeAct) ? xeAct : Number(xeAct).toPrecision(6),
}
this.tableList = tableData
} else {
this.$message.error(message)
}
@ -718,6 +783,18 @@ export default {
}
},
validateSettingValue() {
const { windowBegin, windowEnd, minEnergy, halfLife } = this.model
if (!isNumber(windowBegin) || !isNumber(windowEnd) || !isNumber(minEnergy) || !isNumber(halfLife)) {
return false
}
return true
},
/**
* 图表最大值最小值等设为按实际情况取值
*/
resetResultChartPerform() {
this.resultChartOption.yAxis.min = undefined
this.resultChartOption.yAxis.max = undefined
@ -731,8 +808,8 @@ export default {
handleDel(index) {
this.tableList.splice(index, 1)
this.resultChartOption.series[1].data.splice(index, 1)
}
}
},
},
}
</script>
<style lang="less" scoped>

View File

@ -80,7 +80,7 @@ export default {
const params = this.getQueryParams() //
const searchName = this.queryParam.searchName
params.name = `${searchName ? `${searchName},` : ''}_S_`
params.name = searchName
this.loading = true
getAction('/spectrumFile/get', params)
.then(res => {

View File

@ -0,0 +1,49 @@
<template>
<div class="editable-cell">
<div v-if="editable" class="editable-cell-input-wrapper">
<a-input ref="myInput" :value="value" @change="handleChange" @blur="handleBlur" />
</div>
<div v-else class="editable-cell-text-wrapper" @dblclick="handleCellClick">
{{ value || ' ' }}
</div>
</div>
</template>
<script>
export default {
props: {
text: Number,
},
data() {
return {
value: this.text,
editable: false,
}
},
methods: {
handleCellClick() {
this.editable = true
this.$nextTick(() => {
this.$refs.myInput.focus()
})
},
handleChange(e) {
this.value = e.target.value
},
handleBlur() {
this.editable = false
this.$emit('change', this.value)
},
},
}
</script>
<style lang="less" scoped>
/deep/.ant-input {
padding: 0;
}
.editable-cell-text-wrapper {
min-height: 32px;
line-height: 32px;
}
</style>

View File

@ -10,8 +10,8 @@
class="korsum-input-formula"
:labelCol="{
style: {
width: '110px'
}
width: '110px',
},
}"
>
<a-form-model-item label="Total Effi = exp(">
@ -64,9 +64,7 @@
<!-- 公式结束 -->
<!-- 标题 -->
<a-button type="primary" class="korsum-input-title" @click="handleInput">
Input
</a-button>
<a-button type="primary" class="korsum-input-title" @click="handleInput"> Input </a-button>
<!-- 标题结束 -->
<!-- 表格开始 -->
@ -125,7 +123,15 @@
:class="outputTableList.length ? 'has-data' : ''"
:scroll="{ y: 584 }"
:pagination="false"
></a-table>
>
<template v-for="(col, i) in outputColumns" :slot="col.dataIndex" slot-scope="text, record, index">
<edit-cell
:text="parseFloat(Number(text).toPrecision(6))"
:key="i"
@change="onCellChange(index, col.dataIndex, $event)"
/>
</template>
</a-table>
</div>
<div class="korsum-output-operation">
@ -148,58 +154,62 @@
import ModalMixin from '@/mixins/ModalMixin'
import TitleOverBorder from '../TitleOverBorder.vue'
import { getAction, postAction } from '@/api/manage'
import * as XLSX from 'xlsx';
import * as XLSX from 'xlsx'
import EditCell from './EditCell.vue'
const columns = [
{
title: 'Energy',
dataIndex: 'energy',
scopedSlots: {
customRender: 'energy'
}
customRender: 'energy',
},
},
{
title: 'Total Efficiency',
dataIndex: 'totalEffi',
scopedSlots: {
customRender: 'totalEffi'
}
customRender: 'totalEffi',
},
},
{
title: 'Peak Efficiency',
dataIndex: 'peakEffi',
scopedSlots: {
customRender: 'peakEffi'
}
customRender: 'peakEffi',
},
},
{
title: 'Uncertainty(%)',
dataIndex: 'uncertain',
scopedSlots: {
customRender: 'uncertain'
}
}
customRender: 'uncertain',
},
},
]
const outputColumns = [
{
title: 'Energy',
dataIndex: 'energy',
customRender: (text) => parseFloat(Number(text).toPrecision(6))
scopedSlots: { customRender: 'energy' },
// customRender: (text) => parseFloat(Number(text).toPrecision(6))
},
{
title: 'Correct Factor',
dataIndex: 'correctFactor',
customRender: (text) => parseFloat(Number(text).toPrecision(6))
scopedSlots: { customRender: 'correctFactor' },
// customRender: (text) => parseFloat(Number(text).toPrecision(6)),
},
{
title: 'Uncertainty(%)',
dataIndex: 'uncertainty',
customRender: (text) => parseFloat(Number(text).toPrecision(6))
}
scopedSlots: { customRender: 'uncertainty' },
// customRender: (text) => parseFloat(Number(text).toPrecision(6)),
},
]
export default {
components: { TitleOverBorder },
components: { TitleOverBorder, EditCell },
mixins: [ModalMixin],
data() {
this.columns = columns
@ -217,7 +227,7 @@ export default {
filterWord: '', //
fileName: '', // save excel name
analyseData: {} //
analyseData: {}, //
}
},
methods: {
@ -245,7 +255,7 @@ export default {
totalEf3: 0.111096,
totalEf4: -0.003896,
totalEf5: -0.000345,
totalEf6: 0.000017
totalEf6: 0.000017,
}
this.efficiency = {
@ -254,7 +264,7 @@ export default {
effciency3: 0.583265,
effciency4: -0.065884,
effciency5: 0.003255,
effciency6: -0.000059
effciency6: -0.000059,
}
this.getInfo()
@ -269,9 +279,9 @@ export default {
const { success, result, message } = await postAction('/gamma/KorSumInput', {
...this.totalEffi,
...this.efficiency,
energys: this.list.map(item => item.energy)
energys: this.list.map((item) => item.energy),
})
console.log(success);
console.log(success)
if (success) {
this.list = result
} else {
@ -285,18 +295,18 @@ export default {
//
async handleAnalyze() {
console.log('%c [ 分析 ]-178', 'font-size:13px; background:pink; color:#bf2c9f;')
try {
try {
this.isLoading = true
const { success, result, message } = await postAction('/gamma/KorSumAnalyse', this.list)
this.isLoading = false
if (success) {
this.analyseData = result
console.log(result);
this.analyseData = result
console.log(result)
} else {
this.$message.error(message)
}
} catch (error) {
this.isLoading = false;
this.isLoading = false
console.error(error)
}
},
@ -308,73 +318,84 @@ export default {
// output
handleOutputItemClick(item) {
if(!this.analyseData) {
this.$message.error("Analyse Fail!")
return false;
if (!this.analyseData) {
this.$message.error('Analyse Fail!')
return false
}
this.selectedItem = item
this.outputTableList = [];
this.outputTableList = []
//
let data = this.analyseData[this.selectedItem]
if(!data || data.energy.length < 1) {
this.$message.error("Analyse Fail!")
return false;
let data = this.analyseData[this.selectedItem]
if (!data || data.energy.length < 1) {
this.$message.error('Analyse Fail!')
return false
}
let result = [];
for(let i = 0; i < data.energy.length; i++ ) {
let result = []
for (let i = 0; i < data.energy.length; i++) {
//
let obj = {
"energy": data.energy[i],
"correctFactor" : data.factor[i],
"uncertainty" : (data.factor[i] - 1) / 10 * 100
energy: data.energy[i],
correctFactor: data.factor[i],
uncertainty: ((data.factor[i] - 1) / 10) * 100,
}
result.push(obj);
result.push(obj)
}
this.outputTableList = result;
this.outputTableList = result
},
onCellChange(idx, label, value) {
console.log(this.outputTableList)
console.log(value)
const dataSource = [...this.outputTableList]
const target = dataSource.find((item, index) => index == idx)
if (target) {
target[label] = value
this.outputTableList = dataSource
}
console.log(this.outputTableList)
},
// excel
handleExport() {
console.log('%c [ 导出到excel ]-246', 'font-size:13px; background:pink; color:#bf2c9f;')
let _this = this
this.$confirm({
title: 'Please enter file name',
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' } },
onOk() {
console.log('Cancel')
},
onCancel() {
console.log(_this.fileName);
if (_this.fileName) {
// saveAs(blob, `${_this.fileName}`)
// 簿
const workbook = XLSX.utils.book_new();
//
const worksheet = XLSX.utils.json_to_sheet(_this.outputTableList);
// 簿
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Excel
XLSX.writeFile(workbook, _this.fileName + ".xlsx");
}
},
})
}
this.$confirm({
title: 'Please enter file name',
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' } },
onOk() {
console.log('Cancel')
},
onCancel() {
console.log(_this.fileName)
if (_this.fileName) {
// saveAs(blob, `${_this.fileName}`)
// 簿
const workbook = XLSX.utils.book_new()
//
const worksheet = XLSX.utils.json_to_sheet(_this.outputTableList)
// 簿
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1')
// Excel
XLSX.writeFile(workbook, _this.fileName + '.xlsx')
}
},
})
},
},
computed: {
outputList() {
return this.nuclideList.filter(item => item.toLowerCase().includes(this.filterWord.toLowerCase()))
}
}
return this.nuclideList.filter((item) => item.toLowerCase().includes(this.filterWord.toLowerCase()))
},
},
}
</script>

View File

@ -43,68 +43,68 @@ const columns = [
{
title: 'SampleID',
align: 'left',
dataIndex: 'sampleId'
dataIndex: 'sampleId',
},
{
title: 'Station',
align: 'left',
dataIndex: 'stationName'
dataIndex: 'stationName',
},
{
title: 'Detector',
align: 'left',
dataIndex: 'detectorsName',
width: 130
width: 130,
},
{
title: 'Sample',
align: 'left',
dataIndex: 'sampleType'
dataIndex: 'sampleType',
},
{
title: 'DataType',
align: 'left',
dataIndex: 'dataType'
dataIndex: 'dataType',
},
{
title: 'Qualifier',
align: 'left',
dataIndex: 'spectralQualifie'
dataIndex: 'spectralQualifie',
},
{
title: 'Col.Stop',
align: 'left',
dataIndex: 'collectStop',
width: 170
width: 170,
},
{
title: 'Acq.Start',
align: 'left',
dataIndex: 'acquisitionStart',
width: 170
width: 170,
},
{
title: 'Acq.real',
align: 'left',
dataIndex: 'acquisitionRealSec'
dataIndex: 'acquisitionRealSec',
},
{
title: 'Acq.live',
align: 'left',
dataIndex: 'acquisitionLiveSec'
dataIndex: 'acquisitionLiveSec',
},
{
title: 'Status',
align: 'left',
dataIndex: 'status'
}
dataIndex: 'status',
},
]
export default {
props: {
value: {
type: Boolean
}
type: Boolean,
},
},
mixins: [JeecgListMixin],
data() {
@ -113,11 +113,10 @@ export default {
return {
queryParam: {
menuTypes: 'G,B',
startDate: moment()
.add(-7, 'd')
.format('YYYY-MM-DD'),
startDate: moment().add(-7, 'd').format('YYYY-MM-DD'),
endDate: moment().format('YYYY-MM-DD'),
dbName: 'auto'
dbName: 'auto',
spectralQualifie: 'FULL',
},
selectedRowKeys: [],
selectionRows: [],
@ -125,8 +124,22 @@ export default {
stationList: [],
detectorList: [],
url: {
list: '/spectrumAnalysis/getDBSpectrumList'
}
list: '/spectrumAnalysis/getDBSpectrumList',
},
sampleTypeOption: [
{
label: 'P',
value: 'P',
},
{
label: 'B',
value: 'B',
},
{
label: 'G',
value: 'G',
},
],
}
},
created() {
@ -165,12 +178,12 @@ export default {
this.loading = true
getAction(this.url.list, params)
.then(res => {
.then((res) => {
if (res.success) {
const result = res.result.records || res.result
result.forEach(item => {
result.forEach((item) => {
const fileName = item.inputFileName
if(fileName) {
if (fileName) {
const arr = fileName.split('/')
item.inputFileName = arr[arr.length - 1]
}
@ -214,11 +227,11 @@ export default {
const { success, result, message } = await getAction('/spectrumAnalysis/getDBSearchList', {
menuTypes: value,
dbName: this.queryParam.dbName,
AllUsers: this.allUsersValue
AllUsers: this.allUsersValue,
})
if (success) {
this.stationList = result.stationCode.map(item => ({ label: item, value: item }))
this.detectorList = result.detectorCode.map(item => ({ label: item, value: item }))
this.stationList = result.stationCode.map((item) => ({ label: item, value: item }))
this.detectorList = result.detectorCode.map((item) => ({ label: item, value: item }))
} else {
this.$message.error(message)
}
@ -234,7 +247,7 @@ export default {
filterOption(input, option) {
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
},
},
computed: {
visible: {
@ -243,7 +256,7 @@ export default {
},
set(val) {
this.$emit('input', val)
}
},
},
formItems() {
return [
@ -255,32 +268,64 @@ export default {
options: [
{
label: 'All',
value: 'G,B'
value: 'G,B',
},
{
label: 'Gamma',
value: 'G'
value: 'G',
},
{
label: 'Beta',
value: 'B'
}
value: 'B',
},
],
allowClear: true
allowClear: true,
},
style: {
width: '18%'
width: '18%',
},
on: {
change: event => {
change: (event) => {
console.log('event', event)
if (!event) {
this.stationList = []
this.detectorList = []
return
}
let arr_B = [
{
label: 'B',
value: 'B',
},
]
let arr_G = [
{
label: 'P',
value: 'P',
},
{
label: 'G',
value: 'G',
},
]
let arr_A = [
{
label: 'P',
value: 'P',
},
{
label: 'B',
value: 'B',
},
{
label: 'G',
value: 'G',
},
]
this.sampleTypeOption = event == 'B' ? arr_B : event == 'G' ? arr_G : arr_A
this.getStationAndDetectorList(event)
}
}
},
},
},
{
label: 'Station',
@ -290,11 +335,11 @@ export default {
options: this.stationList,
showSearch: true,
filterOption: this.filterOption,
allowClear: true
allowClear: true,
},
style: {
width: '19%'
}
width: '19%',
},
},
{
label: 'Detector',
@ -304,36 +349,23 @@ export default {
options: this.detectorList,
showSearch: true,
filterOption: this.filterOption,
allowClear: true
allowClear: true,
},
style: {
width: '19%'
}
width: '19%',
},
},
{
label: 'Sample',
type: 'custom-select',
name: 'sampleType',
props: {
options: [
{
label: 'P',
value: 'P'
},
{
label: 'B',
value: 'B'
},
{
label: 'G',
value: 'G'
}
],
allowClear: true
options: this.sampleTypeOption,
allowClear: true,
},
style: {
width: '14%'
}
width: '14%',
},
},
{
label: 'DataType',
@ -343,34 +375,34 @@ export default {
options: [
{
label: 'S',
value: 'S'
value: 'S',
},
{
label: 'G',
value: 'G'
value: 'G',
},
{
label: 'D',
value: 'D'
value: 'D',
},
{
label: 'Q',
value: 'Q'
value: 'Q',
},
{
label: 'B',
value: 'B'
value: 'B',
},
{
label: 'C',
value: 'C'
}
value: 'C',
},
],
allowClear: true
allowClear: true,
},
style: {
width: '14%'
}
width: '14%',
},
},
{
label: 'Qualifier',
@ -380,30 +412,30 @@ export default {
options: [
{
label: 'FULL',
value: 'FULL'
value: 'FULL',
},
{
label: 'PREL',
value: 'PREL'
}
value: 'PREL',
},
],
allowClear: true
allowClear: true,
},
style: {
width: '16%',
paddingRight: 0
}
paddingRight: 0,
},
},
{
label: 'SampleID',
type: 'a-input',
name: 'sampleId',
props: {
allowClear: true
allowClear: true,
},
style: {
width: '264px'
}
width: '264px',
},
},
{
label: '',
@ -413,13 +445,13 @@ export default {
options: [
{ label: 'All User', value: 'AllUsers' },
{ label: 'Collect Stop', value: 'CollectStopB' },
{ label: 'Acq.Start', value: 'AcqStartB' }
]
{ label: 'Acq.Start', value: 'AcqStartB' },
],
},
style: {
width: '305px',
paddingRight: 0
}
paddingRight: 0,
},
},
{
label: 'From',
@ -429,12 +461,12 @@ export default {
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD',
style: {
minWidth: 'auto'
}
minWidth: 'auto',
},
},
style: {
width: '19%'
}
width: '19%',
},
},
{
label: 'To',
@ -444,15 +476,15 @@ export default {
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD',
style: {
minWidth: 'auto'
}
minWidth: 'auto',
},
},
style: {
paddingRight: 0,
marginRight: '22px',
width: '19%'
}
}
width: '19%',
},
},
]
},
@ -469,7 +501,7 @@ export default {
acqStartValue() {
const checkboxGroup = this.queryParam.checkboxGroup
return !!(checkboxGroup && checkboxGroup.includes('AcqStartB'))
}
},
},
watch: {
// All User station detector
@ -479,8 +511,8 @@ export default {
this.detectorList = []
this.getStationAndDetectorList(this.queryParam.menuTypes)
}
}
}
},
},
}
</script>

View File

@ -4,14 +4,14 @@
<div class="graph-assistance-item" v-for="(item, index) in items" :key="index">
<!-- 两个Label来回切换的 -->
<template v-if="item.label.length > 1">
<span>{{ item.activeLabel }}</span>
<a-switch class="no-change" v-model="item.checked" @change="handleChangeLabel(item)"></a-switch>
<span>{{ value[item.key] }}</span>
<two-label-switch :items="item.label" v-model="value[item.key]" @change="handleChange(item.key)" />
</template>
<!-- 只有一个Label点击改变状态的 -->
<template v-else>
<span>{{ item.label[0] }}</span>
<a-switch v-model="item.checked" @change="handleChange(item)"></a-switch>
<a-switch v-model="value[item.key]" @change="handleChange(item.key)"></a-switch>
</template>
</div>
</div>
@ -21,72 +21,60 @@
<script>
import { cloneDeep } from 'lodash'
import TwoLabelSwitch from './TwoLabelSwitch.vue'
const items = [
{
label: ['Linear', 'Log10'],
checked: false,
activeLabel: 'Linear'
key: 'chartYAxisType',
},
{
label: ['Cursor'],
checked: true
key: 'Cursor',
},
{
label: ['Lc'],
checked: true
key: 'Lc',
},
{
label: ['Baseline'],
checked: true
key: 'Baseline',
},
{
label: ['Channel', 'Energy'],
checked: false,
activeLabel: 'Channel'
key: 'axisType',
},
{
label: ['Lines', 'Scatter'],
checked: false,
activeLabel: 'Lines'
key: 'spectrumType',
},
{
label: ['SCAC'],
checked: true
}
key: 'SCAC',
},
]
export default {
components: { TwoLabelSwitch },
props: {
value: {
type: Object,
default: () => ({}),
},
},
data() {
return {
items: cloneDeep(items)
items: cloneDeep(items),
}
},
methods: {
handleChangeLabel(item) {
if (item.activeLabel == item.label[0]) {
item.activeLabel = item.label[1]
} else {
item.activeLabel = item.label[0]
}
this.$emit('change', {
type: 'labelChange',
label: item.activeLabel
})
},
handleChange(item) {
this.$emit('change', {
type: 'valueChange',
label: item.label[0],
value: item.checked
})
handleChange(key) {
this.$emit('change', key)
},
handleReset() {
this.$emit('reset')
}
}
},
},
}
</script>
@ -122,10 +110,6 @@ export default {
}
}
.no-change {
background-color: @primary-color;
}
.ant-switch {
&::after {
background-color: #fff;

View File

@ -0,0 +1,54 @@
<template>
<div class="two-label-switch">
<a-switch class="no-change" v-model="checked" @change="handleChange"> </a-switch>
</div>
</template>
<script>
export default {
props: {
value: {
type: String,
},
items: {
type: Array,
default: () => [],
},
},
created() {
if (this.items.length !== 2) {
throw new Error('此组件需要两个值')
}
},
methods: {
handleChange() {
this.$emit('change')
}
},
computed: {
checked: {
set(val) {
this.$emit('input', val == true ? this.items[1] : this.items[0])
},
get() {
return this.value == this.items[1] ? true : false
},
},
},
}
</script>
<style lang="less" scoped>
.two-label-switch {
display: inline-block;
.no-change {
background-color: @primary-color;
}
.ant-switch {
&::after {
background-color: #fff;
}
}
}
</style>

View File

@ -14,8 +14,8 @@
<pop-over-with-icon>
Graph Assistance
<graph-assistance
v-if="!isLoading"
slot="content"
v-model="graphAssistance"
@change="handleGraphAssistanceChange"
@reset="handleResetChart"
/>
@ -114,7 +114,7 @@ import CustomChart from '@/components/CustomChart/index.vue'
import PopOverWithIcon from './components/SubOperators/PopOverWithIcon.vue'
import DetailedInfomation from './components/SubOperators/DetailedInfomation.vue'
import QcFlags from './components/SubOperators/QcFlags.vue'
import GraphAssistance from './components/SubOperators/GraphAssistance.vue'
import GraphAssistance from './components/SubOperators/GraphAssistance/GraphAssistance.vue'
import NuclideLibrary from './components/SubOperators/NuclideLibrary.vue'
import ButtonWithSwitchIcon from './components/SubOperators/ButtonWithSwitchIcon.vue'
import { getAction, postAction } from '@/api/manage'
@ -138,6 +138,9 @@ import store from '@/store/'
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import StripModal from './components/Modals/StripModal.vue'
import { FilePicker } from '@/utils/FilePicker'
import { zipFile } from '@/utils/file'
import { mapMutations } from 'vuex'
export default {
props: {
@ -296,9 +299,6 @@ export default {
const { dbName, sampleId } = this.sample
try {
this.isLoading = true
this.handleResetState()
// const { success, result, message } = Response
this.cancelLastRequest()
const cancelToken = this.createCancelToken()
@ -328,7 +328,6 @@ export default {
const { inputFileName: fileName } = this.sample
try {
this.isLoading = true
this.handleResetState()
// const { success, result, message } = Response
this.cancelLastRequest()
@ -433,106 +432,47 @@ export default {
}
this.resetThumbnailChartDataMax()
const series = []
// Spectrum Line
series.push(
buildLineSeries(
'Spectrum',
this.transformPointListData(shadowChannelChart.pointlist),
shadowChannelChart.color,
{
symbolSize: 2,
markLine: {
silent: true,
symbol: 'none',
label: {
show: false,
},
lineStyle: {
color: 'red',
width: 1,
},
data: [{ xAxis: -1 }],
},
}
)
// Spectrum Line
this.redrawLineBySeriesName('Spectrum', shadowEnergyChart, shadowChannelChart, true, shadowChannelChart.color)
// BaseLine
this.setSeriesData(
this.option.series,
'BaseLine',
this.transformPointListData(channelBaseLine.pointlist),
channelBaseLine.color
)
// Spectrum Line
// LcLine
this.setSeriesData(
this.option.series,
'LcLine',
this.transformPointListData(channelLcLine.pointlist),
channelLcLine.color
)
// ScacLine
this.setSeriesData(
this.option.series,
'ScacLine',
this.transformPointListData(channelScacLine.pointlist),
channelScacLine.color
)
// 线
this.redrawCtrlPointBySeriesName()
// Peak Line
this.redrawPeakLine()
// Spectrum Line
this.setSeriesData(
this.thumbnailOption.series,
'Spectrum',
this.transformPointListData(shadowChannelChart.pointlist),
shadowChannelChart.color
)
// BaseLine
series.push(
buildLineSeries('BaseLine', this.transformPointListData(channelBaseLine.pointlist), channelBaseLine.color, {
zlevel: 2,
})
)
// LcLine线
series.push(
buildLineSeries('LcLine', this.transformPointListData(channelLcLine.pointlist), channelLcLine.color, {
zlevel: 3,
})
)
// Scac线
series.push(
buildLineSeries('ScacLine', this.transformPointListData(channelScacLine.pointlist), channelScacLine.color, {
zlevel: 4,
})
)
// 线
series.push({
name: 'BaseLine_Ctrl_Point',
type: 'scatter',
data: shapeChannelData.map(({ size, color, point: { x, y } }) => {
return {
value: [x, y],
itemStyle: {
color: 'transparent',
borderColor: color,
borderWidth: size / 2,
},
}
}),
emphasis: {
disabled: true,
},
animation: false,
zlevel: 5,
})
// Peak Line
const peakLines = []
channelPeakGroup.forEach((item, index) => {
peakLines.push(
buildLineSeries(`Peak_${index}`, this.transformPointListData(item.pointlist), item.color, {
zlevel: 6,
})
)
})
series.push(...peakLines)
// Compare Line
series.push(
buildLineSeries('Compare', [], '#fff', {
symbolSize: 2,
})
)
this.opts.notMerge = true
this.option.series = series
this.$nextTick(() => {
this.resetChartOpts()
})
},
// chart tooltip
@ -556,63 +496,93 @@ export default {
},
// Graph Assistance
handleGraphAssistanceChange({ type, label, value }) {
handleGraphAssistanceChange(key) {
const value = this.graphAssistance[key]
const spectrumLineSeries = findSeriesByName(this.option.series, 'Spectrum')
const thumbnailSpectrumLineSeries = findSeriesByName(this.thumbnailOption.series, 'Spectrum')
const compareLineSeries = findSeriesByName(this.option.series, 'Compare')
//
if (type == 'labelChange') {
switch (label) {
case 'Linear':
switch (key) {
// 线y
case 'chartYAxisType':
if (value == 'Linear') {
this.option.yAxis.type = 'value'
this.thumbnailOption.yAxis.type = 'value'
this.handleResetChart()
break
case 'Log10':
} else {
this.option.yAxis.type = 'log'
this.thumbnailOption.yAxis.type = 'log'
this.handleResetChart()
break
case 'Channel':
case 'Energy':
this.graphAssistance.axisType = label
this.option.xAxis.name = label
}
this.handleResetChart()
break
this.handleResetChart()
// 线
case 'Cursor':
if (value) {
spectrumLineSeries.markLine.lineStyle.width = 2
} else {
spectrumLineSeries.markLine.lineStyle.width = 0
}
break
this.redrawLineBySeriesName(
'BaseLine',
this.energyData.baseLine,
this.channelData.baseLine,
this.graphAssistance.Baseline
)
this.redrawLineBySeriesName(
'LcLine',
this.energyData.lcLine,
this.channelData.lcLine,
this.graphAssistance.Lc
)
this.redrawLineBySeriesName(
'ScacLine',
this.energyData.scacLine,
this.channelData.scacLine,
this.graphAssistance.SCAC
)
// 线
case 'Baseline':
this.redrawLineBySeriesName('BaseLine', this.energyData.baseLine, this.channelData.baseLine, value)
break
this.redrawLineBySeriesName('Spectrum', this.energyData.spectrumLine, this.channelData.spectrumLine)
this.redrawCtrlPointBySeriesName()
this.redrawPeakLine()
// Lc 线
case 'Lc':
this.redrawLineBySeriesName('LcLine', this.energyData.lcLine, this.channelData.lcLine, value)
break
this.redrawThumbnailChart()
if (this.channelCompareLine) {
this.redrawLineBySeriesName('Compare', this.energyCompareLine, this.channelCompareLine)
// ChannelEnergy
case 'axisType':
// Energy
if (!this.energyData.all.pointlist) {
if (value == 'Energy') {
this.graphAssistance[key] = 'Channel'
}
break
case 'Lines':
this.graphAssistance.spectrumType = 'Lines'
this.$message.warn('Has No Energy Yet')
return
}
this.option.xAxis.name = value
this.handleResetChart()
this.redrawLineBySeriesName(
'BaseLine',
this.energyData.baseLine,
this.channelData.baseLine,
this.graphAssistance.Baseline
)
this.redrawLineBySeriesName(
'LcLine',
this.energyData.lcLine,
this.channelData.lcLine,
this.graphAssistance.Lc
)
this.redrawLineBySeriesName(
'ScacLine',
this.energyData.scacLine,
this.channelData.scacLine,
this.graphAssistance.SCAC
)
this.redrawLineBySeriesName('Spectrum', this.energyData.spectrumLine, this.channelData.spectrumLine)
this.redrawCtrlPointBySeriesName()
this.redrawPeakLine()
this.redrawThumbnailChart()
if (this.channelCompareLine) {
this.redrawLineBySeriesName('Compare', this.energyCompareLine, this.channelCompareLine)
}
break
// Lines Scatter
case 'spectrumType':
if (value == 'Lines') {
spectrumLineSeries.type = 'line'
spectrumLineSeries.symbol = 'none'
@ -627,10 +597,7 @@ export default {
if (this.channelCompareLine) {
this.redrawLineBySeriesName('Compare', this.energyCompareLine, this.channelCompareLine)
}
break
case 'Scatter':
this.graphAssistance.spectrumType = 'Scatter'
} else {
spectrumLineSeries.type = 'scatterGL'
spectrumLineSeries.symbol = 'circle'
@ -643,35 +610,18 @@ export default {
this.$nextTick(() => {
this.rangeScatter()
})
break
}
}
//
else if (type == 'valueChange') {
this.graphAssistance[label] = value
}
break
switch (label) {
case 'Cursor':
// 线
if (value) {
spectrumLineSeries.markLine.lineStyle.width = 2
} else {
spectrumLineSeries.markLine.lineStyle.width = 0
}
break
case 'Baseline':
this.redrawLineBySeriesName('BaseLine', this.energyData.baseLine, this.channelData.baseLine, value)
break
case 'Lc':
this.redrawLineBySeriesName('LcLine', this.energyData.lcLine, this.channelData.lcLine, value)
break
case 'SCAC':
this.redrawLineBySeriesName('ScacLine', this.energyData.scacLine, this.channelData.scacLine, value)
break
}
// SCAC 线
case 'SCAC':
this.redrawLineBySeriesName('ScacLine', this.energyData.scacLine, this.channelData.scacLine, value)
break
}
},
changeSeriesType() {},
handleChangeNuclideVisible() {
this.nuclideLibraryVisible = !this.nuclideLibraryVisible
},
@ -702,18 +652,24 @@ export default {
})
},
clearPeakLine() {
this.opts.notMerge = true
this.option.series.splice(6)
this.$nextTick(() => {
this.resetChartOpts()
})
},
// Peak Line
redrawPeakLine() {
this.option.series = this.option.series.filter((item) => {
return !item.name.includes('Peak_')
})
this.clearPeakLine()
const data = this.isEnergy() ? this.energyData.peakGroup : this.channelData.peakGroup
const peakLines = []
data.forEach((item, index) => {
peakLines.push(
buildLineSeries(`Peak_${index}`, this.transformPointListData(item.pointlist), item.color, {
zlevel: 6,
z: 6,
})
)
})
@ -1171,9 +1127,9 @@ export default {
//
handleRefresh(data) {
this.handleResetState()
data.DetailedInformation = this.detailedInfomation
this.clearCompareLine()
this.redrawPeakLine()
this.dataProcess(data)
},
@ -1219,15 +1175,42 @@ export default {
}
this.handleResetChart()
this.clearCompareLine()
this.compareFileListModalVisible = true
this.isStrip = isStrip
if (FilePicker.canUse()) {
this.chooseFileFromFS()
} else {
this.compareFileListModalVisible = true
}
},
//
async chooseFileFromFS() {
try {
const [fileHandle] = await FilePicker.chooseFile(false, [{ accept: { 'text/phd': ['.phd'] } }])
const file = await fileHandle.getFile()
const zipedFiles = await zipFile([file], 'test.zip')
try {
const formData = new FormData()
formData.append('file', zipedFiles)
const { success, message } = await postAction('/spectrumFile/upload', formData)
if (success) {
this.handleFileSelect(file.name)
} else {
this.$message.error(message)
}
} catch (error) {
console.error(error)
}
} catch (error) {
console.error(error)
}
},
//
async handleFileSelect(selectedFileName) {
const { inputFileName: fileName } = this.sample
const hide = this.$message.loading(this.isStrip ? 'Stripping...' : 'Comparing...', 0)
try {
let param = {
fileName,
@ -1246,7 +1229,6 @@ export default {
url = '/gamma/Strip'
}
this.isLoading = true
const { success, result, message } = await getAction(url, param)
if (success) {
const [channelData, energyData] = result
@ -1254,10 +1236,6 @@ export default {
this.energyCompareLine = energyData
this.redrawLineBySeriesName('Compare', energyData, channelData, true, channelData.color)
if (this.isScatter()) {
lineSeries.type = 'scatterGL'
}
this.$nextTick(() => {
this.thumbnailOption.yAxis.max = getAxisMax(this.getChart(), 'yAxis')
})
@ -1267,7 +1245,7 @@ export default {
} catch (error) {
console.error(error)
} finally {
this.isLoading = false
hide()
}
},
@ -1305,7 +1283,7 @@ export default {
this.dataProcess(result)
} else {
this.isLoading = false
if(showMessage) {
if (showMessage) {
const arr = message.split('\n')
this.$warning({
title: 'Warning',
@ -1386,23 +1364,10 @@ export default {
this.selectedChannel = -1
this.nuclideLibraryList = []
this.closePeakInfomationTooltip()
this.option.series = []
this.clearPeakLine()
this.option.xAxis.name = 'Channel'
this.option.yAxis.type = 'value'
this.thumbnailOption.yAxis.type = 'value'
if (this.option.series.length) {
const spectrumLineSeries = findSeriesByName(this.option.series, 'Spectrum')
spectrumLineSeries.type = 'line'
spectrumLineSeries.symbol = 'none'
spectrumLineSeries.markLine.lineStyle.width = 2
}
const thumbnailSpectrumLineSeries = findSeriesByName(this.thumbnailOption.series, 'Spectrum')
thumbnailSpectrumLineSeries.type = 'line'
thumbnailSpectrumLineSeries.symbol = 'none'
this.graphAssistance = cloneDeep(graphAssistance)
this.option.yAxis.type = 'log'
this.thumbnailOption.yAxis.type = 'log'
},
/**
@ -1524,6 +1489,8 @@ export default {
const arrFunc = isList ? Array.prototype.filter : Array.prototype.find
return arrFunc.call(allData, (item) => item.name == name && item.group == group) || {}
},
...mapMutations(['ADD_SAMPLE_DATA', 'GET_SAMPLE_DATA']),
},
watch: {
currStep: {
@ -1538,10 +1505,17 @@ export default {
sample: {
handler(newVal, oldVal) {
console.log('newValnewVal', newVal)
if (newVal.sampleId) {
this.getSampleDetail()
this.graphAssistance.axisType = 'Channel'
this.handleResetState()
const sampleData = this.GET_SAMPLE_DATA(newVal.inputFileName)
if (sampleData) {
console.log('%c [ ]-1521', 'font-size:13px; background:pink; color:#bf2c9f;', sampleData)
} else {
this.getSampleDetail_file()
if (newVal.sampleId) {
this.getSampleDetail()
} else {
this.getSampleDetail_file()
}
}
},
immediate: true,

View File

@ -198,7 +198,7 @@
</div>
</template>
<script>
import { downloadFile, postAction } from '@/api/manage'
import { postAction } from '@/api/manage'
import GammaAnalysis from './gamma-analysis.vue'
import BetaGammaAnalysis from './beta-gamma-analysis.vue'
import SpectraListInMenu from './components/SpectraListInMenu.vue'
@ -237,6 +237,7 @@ import AutomaticAnalysisLogModal from './components/Modals/BetaGammaModals/Autom
import BetaGammaExtrapolationModal from './components/Modals/BetaGammaModals/BetaGammaExtrapolationModal.vue'
import { getAction } from '@/api/manage'
import { clearSampleCache } from './clearSampleCache'
import { fetchAndDownload } from '@/utils/file'
//
const ANALYZE_TYPE = {
@ -494,7 +495,7 @@ export default {
let params = {
fileName: this.newSampleData.inputFileName,
}
downloadFile(url, `result.${saveFormat}`, params, 'get')
fetchAndDownload(url, params, 'get')
}
if (this.isBetaGamma) {
const url =
@ -520,7 +521,7 @@ export default {
this.params_toDB.qcFileName = this.newSampleData.qcFileName
this.params_toDB.dbName = this.newSampleData.dbName
downloadFile(url, `result.${saveFormat}`, this.params_toDB, 'post')
fetchAndDownload(url, this.params_toDB)
}
},
@ -594,7 +595,7 @@ export default {
let params = {
fileName: this.newSampleData.inputFileName,
}
downloadFile(url, `result.PHD`, params, 'get')
fetchAndDownload(url, params, 'get')
}
},

View File

@ -0,0 +1,46 @@
import { buildLineSeries } from '@/utils/chartHelper'
export const spectrumSeries = buildLineSeries('Spectrum', [], '#fff', {
symbolSize: 2,
markLine: {
silent: true,
symbol: 'none',
label: {
show: false
},
lineStyle: {
color: 'red',
width: 1
},
data: [{ xAxis: -1 }]
},
z: 1
})
export const baseLineSeries = buildLineSeries('BaseLine', [], '#fff', {
z: 2
})
export const lcLineSeries = buildLineSeries('LcLine', [], '#fff', {
z: 3
})
export const scacLineSeries = buildLineSeries('ScacLine', [], '#fff', {
z: 4
})
export const baseLineCtrlPoint = {
name: 'BaseLine_Ctrl_Point',
type: 'scatter',
data: [],
emphasis: {
disabled: true
},
animation: false,
z: 5
}
export const compareLineSeries = buildLineSeries('Compare', [], '#fff', {
symbolSize: 2,
z: 7
})

View File

@ -1,4 +1,5 @@
import { buildLineSeries } from "@/utils/chartHelper"
import { baseLineCtrlPoint, baseLineSeries, compareLineSeries, lcLineSeries, scacLineSeries, spectrumSeries } from "./seriesBuilder"
export const GammaOptions = {
option: {
@ -98,7 +99,7 @@ export const GammaOptions = {
}
}
},
series: [],
series: [spectrumSeries, baseLineSeries, lcLineSeries, scacLineSeries, baseLineCtrlPoint, compareLineSeries],
brush: {}
},
// 缩略图配置
@ -158,10 +159,14 @@ export const GammaOptions = {
}
}
console.log('%c [ ]-162', 'font-size:13px; background:pink; color:#bf2c9f;', GammaOptions.option)
export const graphAssistance = {
chartYAxisType: 'Log10',
Cursor: true,
Baseline: true,
Lc: true,
axisType: 'Channel',
spectrumType: 'Lines',
Baseline: true,
SCAC: true,
Lc: true,
}