diff --git a/package.json b/package.json index eb23af6..baa5348 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/store/index.js b/src/store/index.js index 5936c50..b77f9bd 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -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: { diff --git a/src/store/modules/sample.js b/src/store/modules/sample.js new file mode 100644 index 0000000..0630a0c --- /dev/null +++ b/src/store/modules/sample.js @@ -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 diff --git a/src/utils/chartHelper.js b/src/utils/chartHelper.js index 86c1e8f..affe08c 100644 --- a/src/utils/chartHelper.js +++ b/src/utils/chartHelper.js @@ -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 } \ No newline at end of file diff --git a/src/utils/file.js b/src/utils/file.js index f5bcc69..6df6fdd 100644 --- a/src/utils/file.js +++ b/src/utils/file.js @@ -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') { diff --git a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaExtrapolationModal.vue b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaExtrapolationModal.vue index 0777afb..7140185 100644 --- a/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaExtrapolationModal.vue +++ b/src/views/spectrumAnalysis/components/Modals/BetaGammaModals/BetaGammaExtrapolationModal.vue @@ -51,7 +51,7 @@ class="custom-tool-tip" :style="{ top: customToolTip.top + 'px', - left: customToolTip.left + 'px' + left: customToolTip.left + 'px', }" >
Channel: {{ customToolTip.channel }}
@@ -62,7 +62,7 @@ class="custom-tool-tip" :style="{ top: customToolTip2.top + 'px', - left: customToolTip2.left + 'px' + left: customToolTip2.left + 'px', }" >
Channel: {{ customToolTip2.channel }}
@@ -89,10 +89,18 @@
Gamma Window Setting
Gamma Window Begin:
- + Channel
Gamma Window End:
- + Channel
@@ -100,9 +108,19 @@
Parameter Setting
Min of Energy:
- keV + + keV
Half Life:
- Day + + Day
@@ -137,7 +155,7 @@ > @@ -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) - } - } + }, + }, } \ No newline at end of file diff --git a/src/views/spectrumAnalysis/components/Modals/KorsumModal.vue b/src/views/spectrumAnalysis/components/Modals/KorsumModal.vue index 31bd776..e355886 100644 --- a/src/views/spectrumAnalysis/components/Modals/KorsumModal.vue +++ b/src/views/spectrumAnalysis/components/Modals/KorsumModal.vue @@ -10,8 +10,8 @@ class="korsum-input-formula" :labelCol="{ style: { - width: '110px' - } + width: '110px', + }, }" > @@ -64,9 +64,7 @@ - - Input - + Input @@ -125,7 +123,15 @@ :class="outputTableList.length ? 'has-data' : ''" :scroll="{ y: 584 }" :pagination="false" - > + > + +
@@ -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) => , - 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) => , + 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())) + }, + }, } diff --git a/src/views/spectrumAnalysis/components/Modals/LoadFromDBModal.vue b/src/views/spectrumAnalysis/components/Modals/LoadFromDBModal.vue index 8465ffd..b126a86 100644 --- a/src/views/spectrumAnalysis/components/Modals/LoadFromDBModal.vue +++ b/src/views/spectrumAnalysis/components/Modals/LoadFromDBModal.vue @@ -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) } - } - } + }, + }, } diff --git a/src/views/spectrumAnalysis/components/SubOperators/GraphAssistance.vue b/src/views/spectrumAnalysis/components/SubOperators/GraphAssistance/GraphAssistance.vue similarity index 60% rename from src/views/spectrumAnalysis/components/SubOperators/GraphAssistance.vue rename to src/views/spectrumAnalysis/components/SubOperators/GraphAssistance/GraphAssistance.vue index a388db6..1fb81bd 100644 --- a/src/views/spectrumAnalysis/components/SubOperators/GraphAssistance.vue +++ b/src/views/spectrumAnalysis/components/SubOperators/GraphAssistance/GraphAssistance.vue @@ -4,14 +4,14 @@
@@ -21,72 +21,60 @@ @@ -122,10 +110,6 @@ export default { } } -.no-change { - background-color: @primary-color; -} - .ant-switch { &::after { background-color: #fff; diff --git a/src/views/spectrumAnalysis/components/SubOperators/GraphAssistance/TwoLabelSwitch.vue b/src/views/spectrumAnalysis/components/SubOperators/GraphAssistance/TwoLabelSwitch.vue new file mode 100644 index 0000000..23e8136 --- /dev/null +++ b/src/views/spectrumAnalysis/components/SubOperators/GraphAssistance/TwoLabelSwitch.vue @@ -0,0 +1,54 @@ + + + + + \ No newline at end of file diff --git a/src/views/spectrumAnalysis/gamma-analysis.vue b/src/views/spectrumAnalysis/gamma-analysis.vue index c3ca71d..d7b0d48 100644 --- a/src/views/spectrumAnalysis/gamma-analysis.vue +++ b/src/views/spectrumAnalysis/gamma-analysis.vue @@ -14,8 +14,8 @@ Graph Assistance @@ -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) + // Channel和Energy的切换 + 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, diff --git a/src/views/spectrumAnalysis/index.vue b/src/views/spectrumAnalysis/index.vue index 2f2a253..b57630d 100644 --- a/src/views/spectrumAnalysis/index.vue +++ b/src/views/spectrumAnalysis/index.vue @@ -198,7 +198,7 @@