From c1d3129441fabcc3667d65eca5f063412ae95986 Mon Sep 17 00:00:00 2001 From: Xu Zhimeng Date: Mon, 23 Oct 2023 11:27:31 +0800 Subject: [PATCH 1/5] =?UTF-8?q?fix:=20=E6=8C=89=E6=96=B0=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=AF=B9=E6=8E=A5Extrapolation=E7=9A=84=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E3=80=81=E5=9B=BE=E8=A1=A8=E7=BB=98=E5=88=B6=E5=92=8C=E5=88=86?= =?UTF-8?q?=E6=9E=90=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BetaGammaExtrapolationModal.vue | 297 +++++++++++------- 1 file changed, 187 insertions(+), 110 deletions(-) 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())) + }, + }, } From 46c4dcd9278ec24e825220efa9f1b3bb5614181a Mon Sep 17 00:00:00 2001 From: Xu Zhimeng Date: Wed, 25 Oct 2023 14:39:14 +0800 Subject: [PATCH 4/5] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96gamma=E9=A1=B5?= =?UTF-8?q?=E5=90=84=E5=9B=BE=E5=BD=A2=E6=9E=84=E5=BB=BA=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8Dlog10=E5=88=B7=E9=80=89=E5=90=8Escat?= =?UTF-8?q?ter=E4=B8=A2=E5=A4=B1=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96GraphAssistance=E7=BB=84=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E9=80=89=E4=B8=ADlog10=EF=BC=8Cfrom=20db?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E9=80=89=E6=8B=A9full?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/index.js | 2 + src/store/modules/sample.js | 30 ++ src/utils/chartHelper.js | 2 +- .../components/Modals/LoadFromDBModal.vue | 3 +- .../{ => GraphAssistance}/GraphAssistance.vue | 64 ++-- .../GraphAssistance/TwoLabelSwitch.vue | 54 +++ src/views/spectrumAnalysis/gamma-analysis.vue | 336 ++++++++---------- src/views/spectrumAnalysis/seriesBuilder.js | 46 +++ src/views/spectrumAnalysis/settings.js | 11 +- 9 files changed, 307 insertions(+), 241 deletions(-) create mode 100644 src/store/modules/sample.js rename src/views/spectrumAnalysis/components/SubOperators/{ => GraphAssistance}/GraphAssistance.vue (60%) create mode 100644 src/views/spectrumAnalysis/components/SubOperators/GraphAssistance/TwoLabelSwitch.vue create mode 100644 src/views/spectrumAnalysis/seriesBuilder.js 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/views/spectrumAnalysis/components/Modals/LoadFromDBModal.vue b/src/views/spectrumAnalysis/components/Modals/LoadFromDBModal.vue index 8465ffd..c3c0723 100644 --- a/src/views/spectrumAnalysis/components/Modals/LoadFromDBModal.vue +++ b/src/views/spectrumAnalysis/components/Modals/LoadFromDBModal.vue @@ -117,7 +117,8 @@ export default { .add(-7, 'd') .format('YYYY-MM-DD'), endDate: moment().format('YYYY-MM-DD'), - dbName: 'auto' + dbName: 'auto', + spectralQualifie: 'FULL' }, selectedRowKeys: [], selectionRows: [], 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 d2b833e..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' @@ -140,6 +140,7 @@ 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: { @@ -298,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() @@ -330,7 +328,6 @@ export default { const { inputFileName: fileName } = this.sample try { this.isLoading = true - this.handleResetState() // const { success, result, message } = Response this.cancelLastRequest() @@ -435,107 +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, { - z: 2, - }) - ) - - // 推入LcLine线 - series.push( - buildLineSeries('LcLine', this.transformPointListData(channelLcLine.pointlist), channelLcLine.color, { - z: 3, - }) - ) - - // 推入Scac线 - series.push( - buildLineSeries('ScacLine', this.transformPointListData(channelScacLine.pointlist), channelScacLine.color, { - z: 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, - z: 5, - }) - - // 推入Peak Line - const peakLines = [] - channelPeakGroup.forEach((item, index) => { - peakLines.push( - buildLineSeries(`Peak_${index}`, this.transformPointListData(item.pointlist), item.color, { - z: 6, - }) - ) - }) - series.push(...peakLines) - - // 推入Compare Line - series.push( - buildLineSeries('Compare', [], '#fff', { - symbolSize: 2, - z: 7, - }) - ) - - this.opts.notMerge = true - this.option.series = series - - this.$nextTick(() => { - this.resetChartOpts() - }) }, // chart 的 tooltip @@ -559,68 +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': - // 如果Energy没有值,则不进行切换 - if (!this.energyData.all.pointlist) { - return + } + this.handleResetChart() + break + + // 红色竖线是否显示 + 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 + + // Lc 线是否显示 + case 'Lc': + this.redrawLineBySeriesName('LcLine', this.energyData.lcLine, this.channelData.lcLine, value) + break + + // Channel和Energy的切换 + case 'axisType': + // 如果Energy没有值,则不进行切换 + if (!this.energyData.all.pointlist) { + if (value == 'Energy') { + this.graphAssistance[key] = 'Channel' } + this.$message.warn('Has No Energy Yet') + return + } - this.graphAssistance.axisType = label - this.option.xAxis.name = label + this.option.xAxis.name = value - this.handleResetChart() + 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( + '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.redrawLineBySeriesName('Spectrum', this.energyData.spectrumLine, this.channelData.spectrumLine) + this.redrawCtrlPointBySeriesName() + this.redrawPeakLine() - this.redrawThumbnailChart() + this.redrawThumbnailChart() - if (this.channelCompareLine) { - this.redrawLineBySeriesName('Compare', this.energyCompareLine, this.channelCompareLine) - } - break - case 'Lines': - this.graphAssistance.spectrumType = 'Lines' + if (this.channelCompareLine) { + this.redrawLineBySeriesName('Compare', this.energyCompareLine, this.channelCompareLine) + } + break + + // Lines 和 Scatter 的切换 + case 'spectrumType': + if (value == 'Lines') { spectrumLineSeries.type = 'line' spectrumLineSeries.symbol = 'none' @@ -635,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' @@ -651,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 }, @@ -710,11 +652,17 @@ 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 = [] @@ -1179,9 +1127,9 @@ export default { // 从分析工具刷新部分数据 handleRefresh(data) { - this.handleResetState() data.DetailedInformation = this.detailedInfomation this.clearCompareLine() + this.redrawPeakLine() this.dataProcess(data) }, @@ -1416,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' }, /** @@ -1554,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: { @@ -1568,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/seriesBuilder.js b/src/views/spectrumAnalysis/seriesBuilder.js new file mode 100644 index 0000000..e011769 --- /dev/null +++ b/src/views/spectrumAnalysis/seriesBuilder.js @@ -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 +}) diff --git a/src/views/spectrumAnalysis/settings.js b/src/views/spectrumAnalysis/settings.js index 3a89271..b039cf6 100644 --- a/src/views/spectrumAnalysis/settings.js +++ b/src/views/spectrumAnalysis/settings.js @@ -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, } \ No newline at end of file From 9e299911528f4a88677f7f0b056c7504e49059a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=BB=E7=8F=AE=E5=AE=87?= Date: Wed, 25 Oct 2023 15:47:28 +0800 Subject: [PATCH 5/5] =?UTF-8?q?SampleType=20=E4=B8=8B=E6=8B=89=E6=A1=86?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E4=B9=8B=E5=90=8E=E8=BF=87=E6=BB=A4Sample?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E6=A1=86=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Modals/LoadFromDBModal.vue | 221 ++++++++++-------- 1 file changed, 126 insertions(+), 95 deletions(-) diff --git a/src/views/spectrumAnalysis/components/Modals/LoadFromDBModal.vue b/src/views/spectrumAnalysis/components/Modals/LoadFromDBModal.vue index c3c0723..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,12 +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', - spectralQualifie: 'FULL' + spectralQualifie: 'FULL', }, selectedRowKeys: [], selectionRows: [], @@ -126,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() { @@ -166,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] } @@ -215,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) } @@ -235,7 +247,7 @@ export default { filterOption(input, option) { return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 - } + }, }, computed: { visible: { @@ -244,7 +256,7 @@ export default { }, set(val) { this.$emit('input', val) - } + }, }, formItems() { return [ @@ -256,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', @@ -291,11 +335,11 @@ export default { options: this.stationList, showSearch: true, filterOption: this.filterOption, - allowClear: true + allowClear: true, }, style: { - width: '19%' - } + width: '19%', + }, }, { label: 'Detector', @@ -305,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', @@ -344,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', @@ -381,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: '', @@ -414,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', @@ -430,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', @@ -445,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%', + }, + }, ] }, @@ -470,7 +501,7 @@ export default { acqStartValue() { const checkboxGroup = this.queryParam.checkboxGroup return !!(checkboxGroup && checkboxGroup.includes('AcqStartB')) - } + }, }, watch: { // All User 变化时重新获取station 和detector @@ -480,8 +511,8 @@ export default { this.detectorList = [] this.getStationAndDetectorList(this.queryParam.menuTypes) } - } - } + }, + }, }