diff --git a/src/components/CustomTable/index.vue b/src/components/CustomTable/index.vue index 50bb3f0..88fe877 100644 --- a/src/components/CustomTable/index.vue +++ b/src/components/CustomTable/index.vue @@ -11,7 +11,7 @@ :loading="loading" :pagination="pagination" :customRow="multiple && mouseMoveSelect ? customMouseMoveSelectRow : customRow" - :rowClassName="() => (canSelect ? 'custom-table-row' : '')" + :rowClassName="(record, index) => innerRowClassName(record, index)" @change="handleTableChange" > @@ -25,55 +25,58 @@ export default { props: { list: { type: Array, - default: () => [], + default: () => [] }, columns: { type: Array, - default: () => [], + default: () => [] }, size: { type: String, - default: 'middle', + default: 'middle' }, rowKey: { type: String, - default: 'id', + default: 'id' }, loading: { - type: Boolean, + type: Boolean }, pagination: { - type: [Object, Boolean], + type: [Object, Boolean] }, selectedRowKeys: { - type: Array, + type: Array }, selectionRows: { - type: Array, + type: Array }, canSelect: { type: Boolean, - default: true, + default: true }, canDeselect: { type: Boolean, - default: true, + default: true }, // 多选 multiple: { type: Boolean, - default: false, + default: false }, // 鼠标移动选择 mouseMoveSelect: { type: Boolean, - default: true, + default: true }, + customRowClassName: { + type: Function + } }, data() { return { innerSelectedRowKeys: [], - innerSelectedRows: [], + innerSelectedRows: [] } }, mounted() { @@ -85,6 +88,14 @@ export default { } }, methods: { + innerRowClassName(record, index) { + let className = '' + if (this.customRowClassName) { + className = this.customRowClassName({ record, index }) + } + return (this.canSelect ? 'custom-table-row' : '') + ' ' + className + }, + // 实现单击选中/反选功能 customRow(record, index) { const key = record[this.rowKey] @@ -98,7 +109,7 @@ export default { // 反选 if (this.innerSelectedRowKeys.includes(key)) { if (this.multiple || this.canDeselect) { - const findIndex = this.innerSelectedRowKeys.findIndex((k) => k == key) + const findIndex = this.innerSelectedRowKeys.findIndex(k => k == key) this.innerSelectedRowKeys.splice(findIndex, 1) } } @@ -116,8 +127,8 @@ export default { }, dblclick: () => { this.$emit('rowDblClick', record, index) - }, - }, + } + } } }, @@ -134,7 +145,7 @@ export default { mouseenter: () => { if (this.mouseMoveStartIndex !== undefined) { const indexes = [this.mouseMoveStartIndex, index].sort((a, b) => a - b) - this.innerSelectedRowKeys = this.list.slice(indexes[0], indexes[1] + 1).map((item) => item[this.rowKey]) + this.innerSelectedRowKeys = this.list.slice(indexes[0], indexes[1] + 1).map(item => item[this.rowKey]) } }, mouseup: () => { @@ -143,8 +154,8 @@ export default { this.innerSelectedRowKeys = [key] } this.mouseMoveStartIndex = undefined - }, - }, + } + } } }, @@ -158,7 +169,7 @@ export default { const tableBodyEle = tableEle.querySelector('.ant-table-body') const prevEle = tableBodyEle.querySelector(`.ant-table-row:nth-child(${index + 1})`) tableBodyEle.scrollTop = prevEle.offsetTop - }, + } }, watch: { selectedRowKeys(val) { @@ -166,17 +177,17 @@ export default { }, innerSelectedRowKeys() { this.$emit('update:selectedRowKeys', this.innerSelectedRowKeys) - this.innerSelectedRows = this.innerSelectedRowKeys.map((key) => { - return this.list.find((item) => item[this.rowKey] === key) + this.innerSelectedRows = this.innerSelectedRowKeys.map(key => { + return this.list.find(item => item[this.rowKey] === key) }) this.$emit('update:selectionRows', this.innerSelectedRows) - }, + } }, computed: { scopedSlotsKeys() { return Object.keys(this.$scopedSlots) - }, - }, + } + } } \ No newline at end of file + +.is-changed { + color: #f00; +} + diff --git a/src/views/spectrumAnalysis/components/Modals/SelfStation/BetaAnalyzeInteractiveToolModal/index.vue b/src/views/spectrumAnalysis/components/Modals/SelfStation/BetaAnalyzeInteractiveToolModal/index.vue index 5b2bd5d..e359364 100644 --- a/src/views/spectrumAnalysis/components/Modals/SelfStation/BetaAnalyzeInteractiveToolModal/index.vue +++ b/src/views/spectrumAnalysis/components/Modals/SelfStation/BetaAnalyzeInteractiveToolModal/index.vue @@ -54,12 +54,15 @@ :selectedRowKeys.sync="selectedKeys" rowKey="index" :canDeselect="false" + :custom-row-class-name="rowClassName" @rowClick="handleTableRowClick" >
- ROI{{ _ }} + + ROI{{ index + 1 }} + Nuclide Review Window Add Peak Comment @@ -127,6 +130,7 @@
Reset Chart + Apply
@@ -243,7 +247,7 @@ const initialOption = { top: 40, left: 80, right: 30, - bottom: 30, + bottom: 30 }, title: { text: '', @@ -254,39 +258,39 @@ const initialOption = { rich: { a: { padding: [0, 20, 0, 0], - fontSize: 16, - }, - }, - }, + fontSize: 16 + } + } + } }, tooltip: { trigger: 'axis', axisPointer: { lineStyle: { color: '#3CAEBB', - width: 1, - }, + width: 1 + } }, formatter: undefined, - className: 'figure-chart-option-tooltip', + className: 'figure-chart-option-tooltip' }, xAxis: { axisLine: { lineStyle: { - color: '#ade6ee', - }, + color: '#ade6ee' + } }, splitLine: { - show: false, + show: false }, axisLabel: { textStyle: { - color: '#ade6ee', - }, + color: '#ade6ee' + } }, min: 1, max: 'dataMax', - animation: false, + animation: false }, yAxis: { type: 'log', @@ -295,31 +299,31 @@ const initialOption = { nameGap: 40, nameTextStyle: { color: '#8FD4F8', - fontSize: 16, + fontSize: 16 }, axisLine: { show: true, lineStyle: { - color: '#ade6ee', - }, + color: '#ade6ee' + } }, splitLine: { show: true, lineStyle: { - color: 'rgba(173, 230, 238, .2)', - }, + color: 'rgba(173, 230, 238, .2)' + } }, axisLabel: { textStyle: { - color: '#ade6ee', - }, + color: '#ade6ee' + } }, min: 0.1, max: 'dataMax', - animation: false, + animation: false }, series: [], - brush: {}, + brush: {} } const columns = [ @@ -328,62 +332,62 @@ const columns = [ customRender: (_, __, index) => { return index + 1 }, - width: 60, + width: 60 }, { title: 'Energy (keV)', dataIndex: 'energy', width: 120, - customRender: (text) => { + customRender: text => { return text.toFixed(3) - }, + } }, { title: 'Centroid (C)', dataIndex: 'peakCentroid', width: 120, - customRender: (text) => { + customRender: text => { return text.toFixed(3) - }, + } }, { title: 'FWHM (keV)', dataIndex: 'fwhm', width: 120, - customRender: (text) => { + customRender: text => { return text.toFixed(3) - }, + } }, { title: 'Area', dataIndex: 'area', width: 120, - customRender: (text) => { + customRender: text => { return text.toFixed(3) - }, + } }, { title: 'Detectability', dataIndex: 'significance', width: 120, - customRender: (text) => { + customRender: text => { return text == 'Infinity' ? 'inf' : text.toFixed(3) - }, + } }, { title: '#Cmnt', dataIndex: 'comments', - width: 120, + width: 120 }, { title: 'Nuclides', dataIndex: 'nuclides', width: 120, ellipsis: true, - customRender: (text) => { + customRender: text => { return text && text.join(';') - }, - }, + } + } ] // 缩略图配置 @@ -392,48 +396,48 @@ const thumbnailOption = { top: 0, left: 0, right: 0, - bottom: 0, + bottom: 0 }, xAxis: { type: 'category', axisLine: { lineStyle: { - color: '#fff', - }, + color: '#fff' + } }, splitLine: { - show: false, + show: false }, axisLabel: { - show: false, + show: false }, axisTick: { - show: false, + show: false }, min: 1, - max: 'dataMax', + max: 'dataMax' }, yAxis: { type: 'value', axisLine: { - show: false, + show: false }, splitLine: { - show: false, + show: false }, axisLabel: { - show: false, + show: false }, max: 0, - min: 0, + min: 0 }, - series: null, + series: null } const nuclideIdentifyModal = { possibleNuclide: '', tolerance: 0.5, - identifiedNuclide: '', + identifiedNuclide: '' } // 操作类型 @@ -441,9 +445,12 @@ const Operators = { ADD: 1, // 新增 REMOVE: 2, // 移除 MODIFY: 3, // 改变 - SLOPE_CHANGE: 4, // 改变slope + SLOPE_CHANGE: 4 // 改变slope } +// 核素名称 +const nuclideNames = ['Xe131M', 'Xe131M', 'Xe133', 'Xe135'] + export default { mixins: [SampleDataMixin], components: { @@ -454,13 +461,13 @@ export default { NuclideReviewModal, GeneralCommentModal, EditSlopeModal, - RectList, + RectList }, props: { colorConfig: { type: Object, - default: () => ({}), - }, + default: () => ({}) + } }, data() { return { @@ -469,7 +476,7 @@ export default { columns, searchParam: { energy: '', - tolerance: '', + tolerance: '' }, option: cloneDeep(initialOption), opts: { notMerge: false }, @@ -515,10 +522,13 @@ export default { replotNeeded: false, currROIIndex: 0, + + isApplying: false } }, created() { - this.option.tooltip.formatter = (params) => { + this.nuclideNames = nuclideNames + this.option.tooltip.formatter = params => { const channel = parseInt(params[0].value[0]) const energy = this.energy.pointlist ? this.energy.pointlist[channel - 1].x : 0 return `
Channel: ${channel}
@@ -531,6 +541,13 @@ export default { this.$bus.$off('selfAnalyzeSampleTypeChange', this.selfAnalyzeSampleTypeChange) }, methods: { + rowClassName({ record }) { + const nuclides = record.nuclides || [] + return -1 !== nuclides.findIndex(item => item.toLowerCase() == nuclideNames[this.currROIIndex].toLowerCase()) + ? 'has-nuclide' + : '' + }, + // 主页面的SampleType修改 selfAnalyzeSampleTypeChange(sampleType) { this.sampleType = sampleType @@ -582,7 +599,7 @@ export default { this.channelBaseLineChart = {} this.channelCountChart = { color: 'yellow', - pointlist: currROIItem, + pointlist: currROIItem } this.channelPeakChart = [] this.energy = [] @@ -599,7 +616,7 @@ export default { baseline: [], baseStack: [], replotUsed: false, - stepCounts: [], + stepCounts: [] } this.list = [] @@ -693,7 +710,7 @@ export default { left = channel } - const peaksBetweenChannel = this.list.filter((peak) => { + const peaksBetweenChannel = this.list.filter(peak => { const centroidId = peak.peakCentroid return centroidId >= left && centroidId <= right }) @@ -753,7 +770,7 @@ export default { */ adjustArea() { const { - xAxis: { max, min }, + xAxis: { max, min } } = this.option // 找到最高点在这个范围内的峰 @@ -775,7 +792,7 @@ export default { if (find.x >= min && find.x <= max) { peaks.push({ max: peakMaxY, - min: Math.min(pointlist[0].y, pointlist[pointlist.length - 1].y), + min: Math.min(pointlist[0].y, pointlist[pointlist.length - 1].y) }) } } @@ -784,7 +801,7 @@ export default { const peaksMin = Math.min(...peaks.map(({ min }) => min)) const { - yAxis: { max: yAxisMax, min: yAxisMin }, + yAxis: { max: yAxisMax, min: yAxisMin } } = this.option if (peaksMax > yAxisMax) { @@ -842,7 +859,7 @@ export default { sampleId, channel: Math.round(row.peakCentroid), fileName, - gammaROINum: this.currROIIndex + 1, + gammaROINum: this.currROIIndex + 1 }) if (success) { const { possible } = result @@ -867,7 +884,7 @@ export default { sampleId, fileName, ...this.searchParam, - gammaROINum: this.currROIIndex + 1, + gammaROINum: this.currROIIndex + 1 }) if (success) { const { list } = result @@ -922,7 +939,7 @@ export default { shadowEnergyChart, shapeChannelData, shapeEnergyData, - table, + table } = result this.$bus.$emit( @@ -936,7 +953,7 @@ export default { shapeEnergyData, peak: table, barChart: this.barChart, - BaseCtrls: cloneDeep(this.BaseCtrls), + BaseCtrls: cloneDeep(this.BaseCtrls) }, this.currROIIndex ) @@ -986,8 +1003,8 @@ export default { content: 'Are you sure to delete this peak?', cancelButtonProps: { props: { - type: 'warn', - }, + type: 'warn' + } }, onOk: async () => { // this.list.splice(findIndex, 1) @@ -1009,7 +1026,7 @@ export default { const { success, result, message } = await getAction('/selfStation/deletePeak', { fileName, curRow: this.curRow, - gammaROINum: this.currROIIndex + 1, + gammaROINum: this.currROIIndex + 1 }) if (success) { const { @@ -1019,7 +1036,7 @@ export default { shadowEnergyChart, shapeChannelData, shapeEnergyData, - table, + table } = result this.$bus.$emit( @@ -1033,7 +1050,7 @@ export default { shapeEnergyData, peak: table, barChart: this.barChart, - BaseCtrls: cloneDeep(this.BaseCtrls), + BaseCtrls: cloneDeep(this.BaseCtrls) }, this.currROIIndex ) @@ -1069,7 +1086,7 @@ export default { } catch (error) { console.error(error) } - }, + } }) }, @@ -1136,8 +1153,8 @@ export default { key: 'brush', brushOption: { // 参见 brush 组件的 brushType。如果设置为 false 则关闭“可刷选状态”。 - brushType: 'rect', - }, + brushType: 'rect' + } }) }, @@ -1152,12 +1169,12 @@ export default { // 清理刷选的范围 chart.dispatchAction({ type: 'brush', - areas: [], + areas: [] }) // 改为不可刷选状态 chart.dispatchAction({ - type: 'takeGlobalCursor', + type: 'takeGlobalCursor' }) }, @@ -1168,8 +1185,8 @@ export default { if (areas) { const range = areas.range const [[minX, maxX], [minY, maxY]] = range - const point1 = chart.convertFromPixel({ seriesIndex: 0 }, [minX, minY]).map((num) => parseInt(num.toFixed())) - const point2 = chart.convertFromPixel({ seriesIndex: 0 }, [maxX, maxY]).map((num) => parseInt(num.toFixed())) + const point1 = chart.convertFromPixel({ seriesIndex: 0 }, [minX, minY]).map(num => parseInt(num.toFixed())) + const point2 = chart.convertFromPixel({ seriesIndex: 0 }, [maxX, maxY]).map(num => parseInt(num.toFixed())) const xAxisMax = chart.getModel().getComponent('xAxis').axis.scale._extent[1] const yAxisMax = this.option.yAxis.max let [x1, y2, x2, y1] = [...point1, ...point2] // 根据解析出的数据确定真实的范围 @@ -1221,6 +1238,28 @@ export default { } }, + // 应用 + async handleApply() { + try { + this.isApplying = true + const { sampleId, inputFileName: fileName } = this.sampleData + const { success, message, result } = await getAction('/selfStation/recalculateActivity', { + fileName, + sampleId + }) + if (success) { + const { XeData } = result + this.$bus.$emit('selfUpdateXeData', XeData) + } else { + this.$message.error(message || 'Apply failed!') + } + } catch (error) { + console.log(error) + } finally { + this.isApplying = false + } + }, + // 切换操作 handleSwitchOperation() { // 切换到Base Line 和 Control Point 操作 @@ -1235,7 +1274,7 @@ export default { this.baseCtrls_Copy.baseline.map((val, index) => [index + 1, val]), this.colorConfig.Color_Fitbase || '#fff', { - zlevel: 21, + zlevel: 21 } ) this.option.series.push(baseLineEditSeries) @@ -1249,7 +1288,7 @@ export default { this.btnGroupType = 1 this.opts.notMerge = true const baseLineEditSeries = findSeriesByName(this.option.series, 'BaseLine_Edit') - const index = this.option.series.findIndex((item) => item == baseLineEditSeries) + const index = this.option.series.findIndex(item => item == baseLineEditSeries) this.option.series.splice(index, 1) this.clearRect() @@ -1295,7 +1334,7 @@ export default { this.isModifying = false this.pushOperationStack(Operators.MODIFY, { index, - prevYAxis, + prevYAxis }) }, @@ -1319,7 +1358,7 @@ export default { // 重绘Peaks redrawPeaks(peakList) { - this.option.series = this.option.series.filter((item) => { + this.option.series = this.option.series.filter(item => { return !item.name.includes('Peak_') }) this.option.series.push(...this.buildPeaks(peakList)) @@ -1395,7 +1434,7 @@ export default { index: i, removeXAxis, removeYAxis, - removeYSlope, + removeYSlope }) }, @@ -1431,7 +1470,7 @@ export default { this.$refs.editSlopeModal.open({ index: i, value: yslope[i], - allowNaN: !(i == 0 || i == n - 1), + allowNaN: !(i == 0 || i == n - 1) }) }, @@ -1445,7 +1484,7 @@ export default { yslope[index] = slope this.pushOperationStack(Operators.SLOPE_CHANGE, { index, - slope: prevSlope, + slope: prevSlope }) this.redrawBaseLine() this.buildRect() @@ -1469,7 +1508,7 @@ export default { ...this.baseCtrls_Copy, fileName, replotNeeded: this.replotNeeded, - gammaROINum: this.currROIIndex + 1, + gammaROINum: this.currROIIndex + 1 }) if (success) { const { chartData, peakSet, shapeData } = result @@ -1488,8 +1527,8 @@ export default { color, point: { x: xAxis, - y: yctrl[index], - }, + y: yctrl[index] + } } }) baseLineCP.data = this.buildCPPointData(baseCPPoints) @@ -1522,8 +1561,8 @@ export default { itemStyle: { color: 'transparent', borderColor: color, - borderWidth: size / 2, - }, + borderWidth: size / 2 + } } }) }, @@ -1536,7 +1575,7 @@ export default { const { success, result, message } = await postAction('/selfStation/acceptBaseLine', { ...this.baseCtrls_Copy, fileName, - gammaROINum: this.currROIIndex + 1, + gammaROINum: this.currROIIndex + 1 }) if (success) { this.BaseCtrls = cloneDeep(this.baseCtrls_Copy) @@ -1550,7 +1589,7 @@ export default { shadowEnergyChart, shapeChannelData, shapeData, - shapeEnergyData, + shapeEnergyData } = result this.channelBaseLineChart = channelBaseLineChart @@ -1572,7 +1611,7 @@ export default { 'selfAccept', { ...result, - BaseCtrls: cloneDeep(this.baseCtrls_Copy), + BaseCtrls: cloneDeep(this.baseCtrls_Copy) }, this.currROIIndex ) @@ -1626,7 +1665,7 @@ export default { if (this.selectedTableItem._deleting) { return } - const findIndex = nuclides.findIndex((nuclide) => nuclide == this.model.identifiedNuclide) + const findIndex = nuclides.findIndex(nuclide => nuclide == this.model.identifiedNuclide) if (-1 !== findIndex) { try { this.$set(this.selectedTableItem, '_deleting', true) @@ -1636,7 +1675,7 @@ export default { nuclideName: this.model.identifiedNuclide, fileName, list_identify: nuclides, - gammaROINum: this.currROIIndex + 1, + gammaROINum: this.currROIIndex + 1 }) if (success) { const { identify, table } = result @@ -1664,15 +1703,15 @@ export default { silent: true, symbol: 'none', label: { - show: false, + show: false }, lineStyle: { color: 'red', - width: 1, + width: 1 }, - data: [{ xAxis: -1 }], + data: [{ xAxis: -1 }] }, - zlevel: 10, + zlevel: 10 } ) }, @@ -1697,7 +1736,7 @@ export default { data: this.buildCPPointData(channelBaseCPChart), silent: true, animation: false, - zlevel: 20, + zlevel: 20 } }, @@ -1708,18 +1747,18 @@ export default { type: 'bar', data: barChart.map(({ x, y }) => [x, y]), itemStyle: { - color: '#fff', + color: '#fff' }, lineStyle: { - width: 1, + width: 1 }, symbol: 'none', symbolSize: 1, emphasis: { - disabled: true, + disabled: true }, animation: false, - silent: true, + silent: true } }, @@ -1731,7 +1770,7 @@ export default { pushOperationStack(operator, operand) { this.operationStack.push({ operator, - operand, + operand }) }, @@ -1780,19 +1819,19 @@ export default { handleFullScreenChange(isFullScreen) { this.columns[7].width = isFullScreen ? 180 : 120 - }, + } }, computed: { curRow() { const [selectedKey] = this.selectedKeys - const findIndex = this.list.findIndex((item) => item.index == selectedKey) + const findIndex = this.list.findIndex(item => item.index == selectedKey) return findIndex }, isOperationStackEmpty() { return this.operationStack.length == 0 - }, - }, + } + } } @@ -1894,6 +1933,8 @@ export default { .reset-btn-box { margin-top: 20px; margin-bottom: 30px; + display: flex; + gap: 10px; } .identify-box { @@ -2055,4 +2096,8 @@ export default { } } } + +.ant-table-tbody tr.has-nuclide { + color: yellow; +}