diff --git a/src/components/CustomChart/index.vue b/src/components/CustomChart/index.vue index c38f28c..8dac754 100644 --- a/src/components/CustomChart/index.vue +++ b/src/components/CustomChart/index.vue @@ -6,7 +6,7 @@ import * as echarts from 'echarts' import 'echarts-gl' const events = ['click', 'brushEnd'] -const zrEvents = ['mousemove', 'mousedown', 'mouseup', 'click', 'dblclick'] +const zrEvents = ['mousemove', 'mousedown', 'mouseup', 'click', 'dblclick', 'contextmenu'] export default { props: { option: { diff --git a/src/utils/file.js b/src/utils/file.js index 88867ca..f5bcc69 100644 --- a/src/utils/file.js +++ b/src/utils/file.js @@ -1,6 +1,11 @@ import { Modal } from 'ant-design-vue' import { saveAs } from 'file-saver' import JSZip from 'jszip' +import Vue from 'vue' +import signMd5Utils from '@/utils/encryption/signMd5Utils' +import Axios from 'axios' +import { ACCESS_TOKEN, TENANT_ID } from '@/store/mutation-types' +import { message } from 'ant-design-vue' /** * 弹窗填入文件名保存文件 @@ -85,3 +90,52 @@ export const zipFile = async (fileList, zipName) => { const content = await zip.generateAsync({ type: 'blob' }) return new File([content], zipName, { type: content.type }) } + +/** + * 根据响应头获取文件名 + * @param {String} contentDisposition + */ +export function getFileNameByHeaderContentDisposition(contentDisposition) { + const patt = new RegExp('file[Nn]ame=([^;]+\\.[^\\.;]+);*') + contentDisposition = decodeURI(contentDisposition) + const result = patt.exec(contentDisposition) + let fileName = result[1] + fileName = fileName.replace(/"/g, '') + return fileName +} + +export const fetchAndDownload = async (url, data) => { + const apiBaseUrl = window._CONFIG['domianURL'] || '/jeecg-boot' + const sign = signMd5Utils.getSign(url, data) + const response = await Axios({ + baseURL: apiBaseUrl, + method: 'post', + url, + 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) + } + }) + const { status, headers, data: responseData } = response + if (status == 200) { + if (typeof responseData == 'object') { + const { message: msg } = responseData + message.error(msg) + throw new Error(msg) + } else { + const disposition = headers['content-disposition'] + const fileName = getFileNameByHeaderContentDisposition(disposition) + if (typeof responseData == 'string') { + const blob = new Blob([responseData], { type: headers['content-type'] }) + saveAs(blob, fileName) + return fileName + } + } + } else { + message.error('This operation fails. Contact your system administrator') + throw new Error('This operation fails. Contact your system administrator') + } +} diff --git a/src/views/spectrumAnalysis/beta-gamma-analysis.vue b/src/views/spectrumAnalysis/beta-gamma-analysis.vue index 7fb98b8..e87c043 100644 --- a/src/views/spectrumAnalysis/beta-gamma-analysis.vue +++ b/src/views/spectrumAnalysis/beta-gamma-analysis.vue @@ -251,7 +251,6 @@ export default { if (success) { this.sampleDetail = result this.changeChartByType('sample') - this.isLoading = false this.$emit('getFiles', { detFileName: result.detBg.fileName, gasFileName: result.gasBg.fileName, @@ -262,6 +261,8 @@ export default { } } catch (error) { console.error(error) + } finally { + this.isLoading = false } }, async getSampleDetail_file() { @@ -334,6 +335,7 @@ export default { } = this.sampleDetail[this.spectraType] const { XeData, // 右下角Result Display + savedAnalysisResult, } = this.sampleDetail this.spectrumData = spectrumData @@ -350,9 +352,9 @@ export default { this.betaProjectedData = betaProjectedData this.betaEnergyData = betaEnergyData - this.resultDisplay = XeData + this.resultDisplay = this.resultDisplay.length > 0 ? this.resultDisplay : XeData - this.$emit('sendInfo', this.resultDisplay, this.spectrumData.stationCode) + this.$emit('sendInfo', this.resultDisplay, this.spectrumData.stationCode, savedAnalysisResult) this.qcFlags = { AcqTimeBtn, @@ -434,6 +436,7 @@ export default { watch: { sample: { handler(newVal, oldVal) { + this.resultDisplay = [] if (newVal.sampleId) { this.getSampleDetail() } else { @@ -445,8 +448,8 @@ export default { }, analyseCurrentSpectrum: { handler(newVal, oldVal) { - this.currResultDisplay = newVal.XeData - this.resultDisplay = newVal.XeData + // this.currResultDisplay = newVal.XeData + this.resultDisplay = newVal.XeData || [] }, immediate: true, deep: true, diff --git a/src/views/spectrumAnalysis/clearSampleCache.js b/src/views/spectrumAnalysis/clearSampleCache.js new file mode 100644 index 0000000..f5a8de3 --- /dev/null +++ b/src/views/spectrumAnalysis/clearSampleCache.js @@ -0,0 +1,17 @@ +import { deleteAction } from '@/api/manage' +/** + * 发起请求清理后端对sample的缓存 + * @param {Array} sampleList + */ +export const clearSampleCache = (sampleList) => { + sampleList.forEach(sample => { + const { inputFileName: fileName, sampleFileName, qcFileName } = sample + let url = '/gamma/delPHDCache', + params = { fileName } + if (sample.sampleType == 'B') { + url = '/spectrumAnalysis/deleteSpectrumCacheData' + params = { sampleFileName , qcFileName } + } + deleteAction(url, params) + }) +} \ No newline at end of file diff --git a/src/views/spectrumAnalysis/components/BetaGammaSpectrumChart.vue b/src/views/spectrumAnalysis/components/BetaGammaSpectrumChart.vue index 0315866..5b3bd3f 100644 --- a/src/views/spectrumAnalysis/components/BetaGammaSpectrumChart.vue +++ b/src/views/spectrumAnalysis/components/BetaGammaSpectrumChart.vue @@ -24,8 +24,8 @@ @brushEnd="handleBrushEnd" />
- -
{{ currCount + 1 }}
+ +
{{ currCount }}
0
@@ -322,8 +322,7 @@ export default { return { active: 0, - maxCount: 15, // count的最大值 - currCount: 15, + currCount: 50, twoDOption, threeDSurfaceOption, @@ -359,7 +358,7 @@ export default { this.emitRangeChange([0, 256, 0, 256]) this.reDrawRect() - this.rangeScatter() + this.buildScatterList() }, // 点击ROI @@ -439,26 +438,33 @@ export default { this.reDrawRect() - this.rangeScatter() + this.buildScatterList() } this.clearBrush(chart) }, - /** - * 因scatterGL 不受axis中max和min的控制,手动处理溢出部分 - */ - rangeScatter() { + // 构造scatter列表 + buildScatterList() { const { xAxis: { min: minX, max: maxX }, yAxis: { min: minY, max: maxY } } = this.twoDOption - const data = this.histogramDataList + this.twoDOption.series.data = this.histogramDataDList .filter(({ b, g, c }) => c && b >= minX && b <= maxX && g >= minY && g <= maxY) - .map(({ b, g, c }) => [b, g, c]) + .map(({ b, g, c }) => this.buildScatterItem(b, g, c)) + }, - this.twoDOption.series.data = data + // 构造一个scatter 的点 + buildScatterItem(xAxis, yAxis, count) { + const { r, g, b } = this.interpolateColor(1 - (count / this.currCount)) + return { + value: [xAxis, yAxis], + itemStyle: { + color: `rgb(${r}, ${g}, ${b})` + } + } }, // 通知上层范围改变 @@ -482,7 +488,7 @@ export default { } this.reDrawRect() - this.rangeScatter() + this.buildScatterList() }, // 重绘矩形框区域 @@ -713,7 +719,10 @@ export default { }, // 颜色插值算法 - interpolateColor(color1, color2, percentage) { + interpolateColor(percentage) { + const color1 = { r: 255, g: 0, b: 0 }, + color2 = { r: 255, g: 255, b: 255 } + const r = color1.r + (color2.r - color1.r) * percentage const g = color1.g + (color2.g - color1.g) * percentage const b = color1.b + (color2.b - color1.b) * percentage @@ -723,10 +732,9 @@ export default { watch: { // 2D 图表 histogramDataList: { - handler(newVal) { + handler() { this.active = 0 - this.twoDOption.series.data = newVal.filter(item => item.c).map(item => [item.b, item.g, item.c]) // 设置2D Scatter数据 - this.rangeScatter() + this.buildScatterList() }, immediate: true }, @@ -759,18 +767,8 @@ export default { }, currCount: { - handler(val) { - if (val <= this.maxCount) { - const { r, g, b } = this.interpolateColor( - { r: 255, g: 0, b: 0 }, - { r: 255, g: 255, b: 255 }, - val / this.maxCount - ) - - this.twoDOption.series.itemStyle.color = `rgb(${r}, ${g}, ${b})` - } else { - this.twoDOption.series.itemStyle.color = '#fff' - } + handler() { + this.buildScatterList() }, immediate: true } diff --git a/src/views/spectrumAnalysis/components/ColorPalette.vue b/src/views/spectrumAnalysis/components/ColorPalette.vue index 80ce3ff..b470f9a 100644 --- a/src/views/spectrumAnalysis/components/ColorPalette.vue +++ b/src/views/spectrumAnalysis/components/ColorPalette.vue @@ -23,16 +23,19 @@ diff --git a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue index 2a42fd6..0c6f33b 100644 --- a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue +++ b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue @@ -476,7 +476,8 @@ export default { isAccepting: false, isReploting: false, - operationStack: [] // 操作记录 + operationStack: [], // 操作记录 + replotNeeded: false } }, created() { @@ -563,6 +564,7 @@ export default { this.btnGroupType = 1 this.opts.notMerge = false this.isFitting = false + this.replotNeeded = false this.$nextTick(() => { this.option.brush = { toolbox: [] } this.selectedKeys = [] @@ -611,13 +613,12 @@ export default { } } - const selectedRow = this.list[index] - - this.selectedKeys = [selectedRow.index] - - this.getSelPosNuclide(selectedRow) - - this.selectedTableItem = selectedRow + if (this.list.length) { + const selectedRow = this.list[index] + this.selectedKeys = [selectedRow.index] + this.getSelPosNuclide(selectedRow) + this.selectedTableItem = selectedRow + } // 如果点击了Fit按钮 if (this.isFitting) { @@ -1027,6 +1028,7 @@ export default { if (this.btnGroupType == 1) { this.btnGroupType = 2 this.baseCtrls_Copy = cloneDeep(this.BaseCtrls) + this.replotNeeded = false // 供编辑的白色基线 const baseLineEditSeries = buildLineSeries( @@ -1100,6 +1102,7 @@ export default { // 重新生成基线 redrawBaseLine() { + this.replotNeeded = true try { console.time('updateBaseLine') const res = updateBaseLine(JSON.stringify(this.baseCtrls_Copy)) @@ -1117,7 +1120,7 @@ export default { // 重绘Peaks redrawPeaks(peakList) { - this.option.series = this.option.series.filter((item) => { + this.option.series = this.option.series.filter(item => { return !item.name.includes('Peak_') }) this.option.series.push(...this.buildPeaks(peakList)) @@ -1257,13 +1260,16 @@ export default { // 将原先的基线和控制点移动到新位置 async handleReplot() { + if (!this.replotNeeded) { + return + } try { const { inputFileName: fileName } = this.sampleData this.isReploting = true const { success, result, message } = await postAction('/gamma/replotBaseLine', { ...this.baseCtrls_Copy, fileName, - replotNeeded: true + replotNeeded: this.replotNeeded }) if (success) { const { chartData, peakSet, shapeData } = result @@ -1295,6 +1301,7 @@ export default { }) this.BaseCtrls = cloneDeep(this.baseCtrls_Copy) + this.replotNeeded = false } else { this.$message.error(message) } diff --git a/src/views/spectrumAnalysis/components/Modals/ArrRrrModal.vue b/src/views/spectrumAnalysis/components/Modals/ArrRrrModal.vue index ba28f60..64ff88d 100644 --- a/src/views/spectrumAnalysis/components/Modals/ArrRrrModal.vue +++ b/src/views/spectrumAnalysis/components/Modals/ArrRrrModal.vue @@ -52,16 +52,43 @@ export default { url = '/spectrumAnalysis/viewRRR' break } + console.log(this.extraData) try { this.content = '' this.isLoading = true - const { sampleId, inputFileName: fileName } = this.sampleData - const method = this.type == 4? postAction : getAction - const res = await method(url, { + console.log(this.sampleData) + const { sampleId, - fileName, - ...this.extraData, - }) + inputFileName: fileName, + dbName, + detFileName, + gasFileName, + qcFileName, + sampleFileName, + } = this.sampleData + // const method = this.type == 4 ? postAction : getAction + let res = null + if (this.type == 4) { + let params = { + dbName, + sampleId, + sampleData: this.extraData.sampleData, + gasBgData: this.extraData.GasBgData, + detBgData: this.extraData.DetBgData, + qcData: this.extraData.QCData, + sampleFileName, + gasFileName, + detFileName, + qcFileName, + } + res = await postAction(url, params) + } else { + res = await getAction(url, { + sampleId, + fileName, + ...this.extraData, + }) + } if (typeof res == 'string') { this.content = res diff --git a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/index.vue b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/index.vue index 2ac1900..eb43c15 100644 --- a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/index.vue +++ b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaEnergyCalibrationModal/index.vue @@ -110,6 +110,8 @@ export default { item.mdc = item.mdc.toFixed(6) }) this.$emit('sendXeData', res.result.XeData) + this.$message.success('Analyse Success!') + this.visible = false } else { this.$message.warning(res.message) } diff --git a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaExtrapolationModal.vue b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaExtrapolationModal.vue index 4e4e193..0777afb 100644 --- a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaExtrapolationModal.vue +++ b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaExtrapolationModal.vue @@ -30,9 +30,21 @@
-
Gamma Spectrum:Sample
+
+
Gamma Spectrum:Sample
+
+ Total Counts: + {{ totalCount[0] }} + {{ totalCount[1] }} +
+
- +
Channel: {{ customToolTip.channel }}
Energy: {{ customToolTip.energy }}
+
+
Channel: {{ customToolTip2.channel }}
+
Energy: {{ customToolTip2.energy }}
+
@@ -66,33 +89,35 @@
Gamma Window Setting
Gamma Window Begin:
- Channel + + Channel
Gamma Window End:
- Channel + + Channel
Parameter Setting
Min of Energy:
- keV + keV
Half Life:
- Day + Day
Function of Fitting
- - Linear - 2-polynomial + + Linear + 2-polynomial
- Analyse + Analyse Exit
@@ -110,8 +135,10 @@ :class="tableList.length ? 'has-data' : ''" :scroll="{ y: 101 }" > - @@ -117,28 +108,60 @@ @@ -229,63 +252,5 @@ export default { .spectrum-transfer { margin-top: 20px; - - .title-container { - display: flex; - - .title { - flex: 1; - text-align: center; - background-color: #225a6a; - height: 32px; - line-height: 32px; - } - } - - .data-type { - width: 166px; - padding: 0 8px; - position: relative; - text-align: center; - z-index: 1; - line-height: 32px; - - &-select { - top: 100%; - left: 0; - position: absolute; - padding: 8px; - width: 100%; - } - } - - .ant-transfer { - margin-top: 8px; - display: flex; - align-items: flex-end; - - ::v-deep { - .ant-transfer { - &-list { - flex: 1; - - &-header { - display: none; - } - } - - &-operation { - width: 150px; - - .ant-btn { - width: 100%; - height: 32px; - margin-bottom: 20px; - text-align: center; - } - } - } - } - } } diff --git a/src/views/spectrumAnalysis/components/Modals/FtransltModal/components/SpectrumTransferCom.vue b/src/views/spectrumAnalysis/components/Modals/FtransltModal/components/SpectrumTransferCom.vue new file mode 100644 index 0000000..28d2fbb --- /dev/null +++ b/src/views/spectrumAnalysis/components/Modals/FtransltModal/components/SpectrumTransferCom.vue @@ -0,0 +1,255 @@ + + + + + \ No newline at end of file diff --git a/src/views/spectrumAnalysis/components/Modals/FtransltModal/index.vue b/src/views/spectrumAnalysis/components/Modals/FtransltModal/index.vue index 9323783..7f5a87b 100644 --- a/src/views/spectrumAnalysis/components/Modals/FtransltModal/index.vue +++ b/src/views/spectrumAnalysis/components/Modals/FtransltModal/index.vue @@ -1,5 +1,5 @@