diff --git a/src/components/ColorPicker/index.vue b/src/components/ColorPicker/index.vue index 6ae501e..0377e47 100644 --- a/src/components/ColorPicker/index.vue +++ b/src/components/ColorPicker/index.vue @@ -5,7 +5,7 @@
- +
@@ -17,7 +17,7 @@ export default { props: { value: { type: Object, - default: () => ({ rgba: { r: 255, g: 255, b: 255, a: 1 } }) + default: () => ({ rgba: { r: 255, g: 255, b: 255 } }) } }, components: { diff --git a/src/style.less b/src/style.less index effa50f..65f481d 100644 --- a/src/style.less +++ b/src/style.less @@ -30,13 +30,6 @@ @input-bg: @formInputBgColor; @input-border-color: @formInputBorderColor; -.ant-btn:hover, -.ant-btn:active, -.ant-btn:focus { - color: #fff !important; - border-color: transparent; -} - @font-face { font-family: MicrogrammaD-MediExte; src: url(~@/assets/fonts/MicrogrammaDMedExt.ttf); diff --git a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/components/EditSlopeModal.vue b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/components/EditSlopeModal.vue new file mode 100644 index 0000000..5b5e4e1 --- /dev/null +++ b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/components/EditSlopeModal.vue @@ -0,0 +1,60 @@ + + + + + diff --git a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue index 2cabc60..bdf0976 100644 --- a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue +++ b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue @@ -81,13 +81,19 @@ (R)emove CP
- (M)odify CP + (M)odify CP
Edit (S)lope
- Undo + Undo
Replot @@ -179,6 +185,10 @@ + + + + @@ -191,9 +201,10 @@ import NuclideReviewModal from './components/NuclideReviewModal.vue' import ModalMixin from '@/mixins/ModalMixin' import { getAction, postAction } from '@/api/manage' import { cloneDeep } from 'lodash' -import { findSeriesByName, getXAxisAndYAxisByPosition, rangeNumber } from '@/utils/chartHelper' +import { buildLineSeries, findSeriesByName, getXAxisAndYAxisByPosition, rangeNumber } from '@/utils/chartHelper' import SampleDataMixin from '@/views/spectrumAnalysis/SampleDataMixin' import GeneralCommentModal from './components/GeneralCommentModal.vue' +import EditSlopeModal from './components/EditSlopeModal.vue' // 初始配置 const initialOption = { @@ -388,7 +399,8 @@ const thumbnailOption = { export const Operators = { ADD: 1, // 新增 REMOVE: 2, // 移除 - MODIFY: 3 // 改变 + MODIFY: 3, // 改变 + SLOPE_CHANGE: 4 // 改变slope } export default { @@ -399,7 +411,8 @@ export default { PeakCommentModal, FitPeaksAndBaseLineModal, NuclideReviewModal, - GeneralCommentModal + GeneralCommentModal, + EditSlopeModal }, data() { this.columns = columns @@ -416,6 +429,7 @@ export default { channelPeakChart: [], energy: [], list: [], + BaseCtrls: {}, sampleId: -1, peakCommentModalVisible: false, // Comment 弹窗是否显示 @@ -460,6 +474,7 @@ export default { sampleId: this.sampleId, fileName: this.fileName }) + if (success) { this.isLoading = false const { @@ -469,7 +484,8 @@ export default { channelCountChart, channelPeakChart, energy, - table + table, + BaseCtrls } = result console.log('%c [ ]-374', 'font-size:13px; background:pink; color:#bf2c9f;', result) @@ -479,34 +495,37 @@ export default { this.channelCountChart = channelCountChart this.channelPeakChart = channelPeakChart this.energy = energy + this.BaseCtrls = BaseCtrls const series = [] // 推入BaseLine - series.push({ - ...this.buildSeriesOption( + series.push( + buildLineSeries( 'BaseLine', channelBaseLineChart.pointlist.map(({ x, y }) => [x, y]), - `rgb(${channelBaseLineChart.color})` - ), - markLine: { - silent: true, - symbol: 'none', - label: { - show: false - }, - lineStyle: { - color: 'red', - width: 1 - }, - data: [{ xAxis: -1 }] - }, - zlevel: 10 - }) + `rgb(${channelBaseLineChart.color})`, + { + markLine: { + silent: true, + symbol: 'none', + label: { + show: false + }, + lineStyle: { + color: 'red', + width: 1 + }, + data: [{ xAxis: -1 }] + }, + zlevel: 10 + } + ) + ) // 推入Count series.push( - this.buildSeriesOption( + buildLineSeries( 'CountChart', channelCountChart.pointlist.map(({ x, y }) => [x, y]), `rgb(${channelCountChart.color})` @@ -517,7 +536,7 @@ export default { const peakSeries = [] channelPeakChart.forEach((item, index) => { peakSeries.push( - this.buildSeriesOption( + buildLineSeries( 'Peak_' + (index + 1), item.pointlist.map(({ x, y }) => [x, y]), `rgb(${item.color})` @@ -546,7 +565,7 @@ export default { zlevel: 20 }) - this.thumbnailOption.series = this.buildSeriesOption( + this.thumbnailOption.series = buildLineSeries( 'BarChart', barChart.map(({ x, y }) => [x, y]), '#fff', @@ -565,29 +584,6 @@ export default { } }, - // 构建series - buildSeriesOption(name, data, color, extra = {}) { - return { - name, - type: 'line', - data, - itemStyle: { - color - }, - lineStyle: { - width: 1 - }, - symbol: 'none', - symbolSize: 1, - emphasis: { - disabled: true - }, - silent: true, - animation: false, - ...extra - } - }, - beforeModalOpen() { const { sampleId, inputFileName } = this.sampleData this.sampleId = sampleId @@ -644,6 +640,8 @@ export default { this.selectedKeys = [selectedRow.index] this.getSelPosNuclide(selectedRow) + + this.selectedTableItem = selectedRow } }, @@ -690,7 +688,6 @@ export default { const { success, result, message } = await getAction('/gamma/getSelPosNuclide', { sampleId: this.sampleId, channel: parseInt(row.peakCentroid), - nuclides: row.nuclides.join(','), fileName: this.fileName }) if (success) { @@ -773,30 +770,32 @@ export default { const series = [] // 推入BaseLine - series.push({ - ...this.buildSeriesOption( + series.push( + buildLineSeries( 'BaseLine', channelBaseLineChart.pointlist.map(({ x, y }) => [x, y]), - `rgb(${channelBaseLineChart.color})` - ), - markLine: { - silent: true, - symbol: 'none', - label: { - show: false - }, - lineStyle: { - color: 'red', - width: 1 - }, - data: [{ xAxis: -1 }] - }, - zlevel: 10 - }) + `rgb(${channelBaseLineChart.color})`, + { + markLine: { + silent: true, + symbol: 'none', + label: { + show: false + }, + lineStyle: { + color: 'red', + width: 1 + }, + data: [{ xAxis: -1 }] + }, + zlevel: 10 + } + ) + ) // 推入旧的Count series.push( - this.buildSeriesOption( + buildLineSeries( 'CountChart', this.channelCountChart.pointlist.map(({ x, y }) => [x, y]), `rgb(${this.channelCountChart.color})` @@ -807,7 +806,7 @@ export default { const peakSeries = [] channelPeakChart.forEach((item, index) => { peakSeries.push( - this.buildSeriesOption( + buildLineSeries( 'Peak_' + (index + 1), item.pointlist.map(({ x, y }) => [x, y]), `rgb(${item.color})` @@ -836,7 +835,7 @@ export default { zlevel: 20 }) - this.thumbnailOption.series = this.buildSeriesOption( + this.thumbnailOption.series = buildLineSeries( 'BarChart', barChart.map(({ x, y }) => [x, y]), '#fff', @@ -856,30 +855,32 @@ export default { const series = [] // 推入旧的BaseLine - series.push({ - ...this.buildSeriesOption( + series.push( + buildLineSeries( 'BaseLine', this.channelBaseLineChart.pointlist.map(({ x, y }) => [x, y]), - `rgb(${this.channelBaseLineChart.color})` - ), - markLine: { - silent: true, - symbol: 'none', - label: { - show: false - }, - lineStyle: { - color: 'red', - width: 1 - }, - data: [{ xAxis: -1 }] - }, - zlevel: 10 - }) + `rgb(${this.channelBaseLineChart.color})`, + { + markLine: { + silent: true, + symbol: 'none', + label: { + show: false + }, + lineStyle: { + color: 'red', + width: 1 + }, + data: [{ xAxis: -1 }] + }, + zlevel: 10 + } + ) + ) // 推入旧的Count series.push( - this.buildSeriesOption( + buildLineSeries( 'CountChart', this.channelCountChart.pointlist.map(({ x, y }) => [x, y]), `rgb(${this.channelCountChart.color})` @@ -890,7 +891,7 @@ export default { const peakSeries = [] channelPeakChart.forEach((item, index) => { peakSeries.push( - this.buildSeriesOption( + buildLineSeries( 'Peak_' + (index + 1), item.pointlist.map(({ x, y }) => [x, y]), `rgb(${item.color})` @@ -978,30 +979,32 @@ export default { this.channelPeakChart = channelPeakChart const series = [] // 推入旧的BaseLine - series.push({ - ...this.buildSeriesOption( + series.push( + buildLineSeries( 'BaseLine', this.channelBaseLineChart.pointlist.map(({ x, y }) => [x, y]), - `rgb(${this.channelBaseLineChart.color})` - ), - markLine: { - silent: true, - symbol: 'none', - label: { - show: false - }, - lineStyle: { - color: 'red', - width: 1 - }, - data: [{ xAxis: -1 }] - }, - zlevel: 10 - }) + `rgb(${this.channelBaseLineChart.color})`, + { + markLine: { + silent: true, + symbol: 'none', + label: { + show: false + }, + lineStyle: { + color: 'red', + width: 1 + }, + data: [{ xAxis: -1 }] + }, + zlevel: 10 + } + ) + ) // 推入旧的Count series.push( - this.buildSeriesOption( + buildLineSeries( 'CountChart', this.channelCountChart.pointlist.map(({ x, y }) => [x, y]), `rgb(${this.channelCountChart.color})` @@ -1012,7 +1015,7 @@ export default { const peakSeries = [] channelPeakChart.forEach((item, index) => { peakSeries.push( - this.buildSeriesOption( + buildLineSeries( 'Peak_' + (index + 1), item.pointlist.map(({ x, y }) => [x, y]), `rgb(${item.color})` @@ -1186,11 +1189,9 @@ export default { // 切换到Base Line 和 Control Point 操作 if (this.btnGroupType == 1) { this.btnGroupType = 2 - this.clearOperationStack() - const originalCPSeries = findSeriesByName(this.option.series, 'BaseLine') - const baseLineEditSeries = this.buildSeriesOption('BaseLine_Edit', cloneDeep(originalCPSeries.data), '#fff', { + const baseLineEditSeries = buildLineSeries('BaseLine_Edit', cloneDeep(originalCPSeries.data), '#fff', { zlevel: 21 }) @@ -1203,6 +1204,7 @@ export default { }) this._channelBaseCPChart = cloneDeep(this.channelBaseCPChart) + this._baseCtrls = cloneDeep(this.BaseCtrls) } // 切换回 Peak 操作 else { @@ -1214,6 +1216,9 @@ export default { this.resetChartOpts() }) } + + this.isModifying = false + this.clearOperationStack() }, buildGraphicPoint(chart, x, y) { @@ -1274,6 +1279,8 @@ export default { // 在当前选中的红线位置新增控制点 handleAddCP() { + this.setGraphicDraggable(false) + const xAxises = this.channelBaseCPChart.map(({ point: { x } }) => x) const min = xAxises[0] const max = xAxises[xAxises.length - 1] @@ -1317,6 +1324,8 @@ export default { // 移除控制点 handleRemoveCP() { + this.setGraphicDraggable(false) + // find nearest control-point const chart = this.$refs.chartRef.getChartInstance() const controlPointList = this.option.graphic @@ -1352,23 +1361,57 @@ export default { // 编辑斜率 handleEditSlope() { - // if (m_baseCtrl.XCtrl.empty()) { - // this.$message.warn('No control points to be edited') - // return - // } - // // find nearest control-point - // let i = 1, - // n = m_baseCtrl.XCtrl.size() - // for (; i < n; ++i) { - // if (m_baseCtrl.XCtrl[i] >= m_curChan) { - // if (m_baseCtrl.XCtrl[i] - m_curChan > m_curChan - m_baseCtrl.XCtrl[i - 1]) --i - // break - // } - // } - // if (i == n) i = n - 1 + this.setGraphicDraggable(false) + + const { xctrl, yslope } = this._baseCtrls + if (!xctrl.length) { + this.$message.warn('No control points to be edited') + return + } + // find nearest control-point + let i = 1, + n = xctrl.length + for (; i < n; ++i) { + const currXCtrl = xctrl[i] + const prevXCtrl = xctrl[i - 1] + if (currXCtrl >= this.currChannel) { + if (currXCtrl - this.currChannel > this.currChannel - prevXCtrl) { + --i + } + break + } + } + if (i == n) i = n - 1 + + this.$refs.editSlopeModal.open({ + index: i, + value: yslope[i], + allowNaN: !(i == 0 || i == n - 1) + }) }, - // 确定对Control Point 的操作 + // 确认编辑斜率 + handleSlopeChange(slope, index, prevSlope) { + if (slope === prevSlope) { + return + } + + const { yslope } = this._baseCtrls + yslope[index] = slope + this.pushOperationStack(Operators.SLOPE_CHANGE, { + index, + slope: prevSlope + }) + }, + + // 撤销 + handleUndo() { + this.setGraphicDraggable(false) + + this.popOperationStack() + }, + + // 确定对Baseline Control Points 的操作 handleAccept() {}, // 右下角添加当前选中的nuclide @@ -1464,6 +1507,11 @@ export default { const { point } = operand this.option.graphic.splice(index, 0, point) break + case Operators.SLOPE_CHANGE: + const { slope } = operand + const { yslope } = this._baseCtrls + yslope[index] = slope + break } }, @@ -1655,4 +1703,8 @@ export default { width: 100%; } } + +.is-modify { + color: #f00; +} diff --git a/src/views/spectrumAnalysis/components/Modals/AnalyzeSettingModal.vue b/src/views/spectrumAnalysis/components/Modals/AnalyzeSettingModal.vue index 31cfdf1..dca474c 100644 --- a/src/views/spectrumAnalysis/components/Modals/AnalyzeSettingModal.vue +++ b/src/views/spectrumAnalysis/components/Modals/AnalyzeSettingModal.vue @@ -156,6 +156,7 @@ export default { .analysis-settings { &-item { display: flex; + margin-top: 5px; &:not(:first-child) { margin-top: 20px; diff --git a/src/views/spectrumAnalysis/components/Modals/ColorConfigModal.vue b/src/views/spectrumAnalysis/components/Modals/ColorConfigModal.vue index 1f7a205..5ae36b7 100644 --- a/src/views/spectrumAnalysis/components/Modals/ColorConfigModal.vue +++ b/src/views/spectrumAnalysis/components/Modals/ColorConfigModal.vue @@ -73,21 +73,21 @@ export default { this.configList = configList return { config: { - spectrumLine: { rgba: { r: 255, g: 255, b: 0, a: 1 } }, - baseline: { rgba: { r: 0, g: 246, b: 255, a: 1 } }, - lcLine: { rgba: { r: 255, g: 0, b: 0, a: 1 } }, - scacLine: { rgba: { r: 244, g: 112, b: 247, a: 1 } }, - peakLine: { rgba: { r: 255, g: 127, b: 39, a: 1 } }, - compareLine: { rgba: { r: 0, g: 255, b: 0, a: 1 } }, - spectSumLine: { rgba: { r: 0, g: 0, b: 255, a: 1 } }, - spectCutLine: { rgba: { r: 34, g: 90, b: 106, a: 1 } }, - fitBaseLine: { rgba: { r: 255, g: 255, b: 255, a: 1 } } + spectrumLine: { rgba: { r: 255, g: 255, b: 0 } }, + baseline: { rgba: { r: 0, g: 246, b: 255 } }, + lcLine: { rgba: { r: 255, g: 0, b: 0 } }, + scacLine: { rgba: { r: 244, g: 112, b: 247 } }, + peakLine: { rgba: { r: 255, g: 127, b: 39 } }, + compareLine: { rgba: { r: 0, g: 255, b: 0 } }, + spectSumLine: { rgba: { r: 0, g: 0, b: 255 } }, + spectCutLine: { rgba: { r: 34, g: 90, b: 106 } }, + fitBaseLine: { rgba: { r: 255, g: 255, b: 255 } } } } }, methods: { - combineRGBA({ rgba: { r, g, b, a } }) { - return `rgba(${r}, ${g}, ${b}, ${a})` + combineRGBA({ rgba: { r, g, b} }) { + return `rgb(${r}, ${g}, ${b})` } } } diff --git a/src/views/spectrumAnalysis/components/SubOperators/ButtonWithSwitchIcon.vue b/src/views/spectrumAnalysis/components/SubOperators/ButtonWithSwitchIcon.vue index 76e932a..69e2203 100644 --- a/src/views/spectrumAnalysis/components/SubOperators/ButtonWithSwitchIcon.vue +++ b/src/views/spectrumAnalysis/components/SubOperators/ButtonWithSwitchIcon.vue @@ -3,8 +3,8 @@ - - + + Peak Information @@ -17,6 +17,9 @@ export default { methods: { handleClick(direction) { this.$emit('change', direction) + }, + handleBtnClick() { + this.$emit('click') } } } @@ -25,6 +28,7 @@ export default { diff --git a/src/views/spectrumAnalysis/components/SubOperators/NuclearLibrary.vue b/src/views/spectrumAnalysis/components/SubOperators/NuclearLibrary.vue index ebae3b1..e9a13da 100644 --- a/src/views/spectrumAnalysis/components/SubOperators/NuclearLibrary.vue +++ b/src/views/spectrumAnalysis/components/SubOperators/NuclearLibrary.vue @@ -1,41 +1,17 @@