diff --git a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/components/EditSlopeModal.vue b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/components/EditSlopeModal.vue index 5b5e4e1..4dc3de0 100644 --- a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/components/EditSlopeModal.vue +++ b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/components/EditSlopeModal.vue @@ -37,7 +37,7 @@ export default { }, handleOK() { if (this.allowNaN || this.value) { - this.$emit('change', this.value || 0, this.index, this.prevValue) + this.$emit('change', this.value, this.index, this.prevValue) this.visible = false } else { this.$message.warn('Input value invalid.') diff --git a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue index 88d85dd..f65cb81 100644 --- a/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue +++ b/src/views/spectrumAnalysis/components/Modals/AnalyzeInteractiveToolModal/index.vue @@ -206,6 +206,7 @@ import SampleDataMixin from '@/views/spectrumAnalysis/SampleDataMixin' import GeneralCommentModal from './components/GeneralCommentModal.vue' import EditSlopeModal from './components/EditSlopeModal.vue' import Response from './Response.json' +import { isNullOrUndefined } from '@/utils/util' // 初始配置 const initialOption = { @@ -414,7 +415,7 @@ const nuclideIdentifyModal = { } // 操作类型 -export const Operators = { +const Operators = { ADD: 1, // 新增 REMOVE: 2, // 移除 MODIFY: 3, // 改变 @@ -693,6 +694,7 @@ export default { if (!peaksBetweenChannel.length) { this.$message.warn(`There are 0 peak between channel ${left} and ${right}`) + this.isFitting = false return } @@ -1377,9 +1379,9 @@ export default { xctrlList.forEach((xctrl, index) => { const yctrl = yctrlList[index] const yslope = yslopeList[index] - if (yslope != 0) { - plusGraphic.push(this.buildGraphicPlus(xctrl + 2, yctrl + 2 * yslope)) + if (!isNullOrUndefined(yslope)) { plusGraphic.push(this.buildGraphicPlus(xctrl - 2, yctrl - 2 * yslope)) + plusGraphic.push(this.buildGraphicPlus(xctrl + 2, yctrl + 2 * yslope)) } }) this.option.graphic[1].children = plusGraphic @@ -1396,11 +1398,11 @@ export default { $action: 'replace', position: [xPix, yPix], style: { - x: -10, - y: -10, text: '+', fill: '#0f0', - font: 'bolder 20px "Microsoft YaHei", sans-serif' + font: 'bolder 20px "Microsoft YaHei", sans-serif', + textAlign: 'center', + textVerticalAlign: 'middle' }, zlevel: 101 } diff --git a/src/views/spectrumAnalysis/components/Modals/AnalyzeSettingModal.vue b/src/views/spectrumAnalysis/components/Modals/AnalyzeSettingModal.vue index cc39cab..2b14225 100644 --- a/src/views/spectrumAnalysis/components/Modals/AnalyzeSettingModal.vue +++ b/src/views/spectrumAnalysis/components/Modals/AnalyzeSettingModal.vue @@ -43,10 +43,10 @@ - Update Calibration + Update Calibration - Keep Calibration Peak Search Peaks + Keep Calibration Peak Search Peaks @@ -175,6 +175,8 @@ export default { edit_riskLevelK, dateTime_Act, dateTime_Conc, + checkBox_updateCal, + checkBox_keepPeak, } = this.model const param = { @@ -192,11 +194,14 @@ export default { riskLevelK: edit_riskLevelK, refTime_act: dateTime_Act, refTime_conc: dateTime_Conc, + updateCalibration: checkBox_updateCal, + keepCalPeakSearchPeaks: checkBox_keepPeak, } const { success, message } = await postAction('/gamma/configureSave', param) if (success) { this.$message.success('Save Success') + this.$emit('senInfo', checkBox_updateCal ? '1' : '0') } else { this.$message.error(message) } diff --git a/src/views/spectrumAnalysis/components/Modals/LoadFromFileModal.vue b/src/views/spectrumAnalysis/components/Modals/LoadFromFileModal.vue index d4a4e3f..9d50107 100644 --- a/src/views/spectrumAnalysis/components/Modals/LoadFromFileModal.vue +++ b/src/views/spectrumAnalysis/components/Modals/LoadFromFileModal.vue @@ -319,6 +319,9 @@ export default { canUseFilePicker, } }, + created() { + this.handleReset() + }, methods: { // 初始化为10*4的表格 getInitialList() { @@ -386,6 +389,7 @@ export default { if (!isFileInDirectory) { this.$message.warn('File and Directory Not in Same') this.directoryHanlder = undefined + this.useFilePicker(column, record, rowIndex) return } @@ -679,10 +683,6 @@ export default { handleCancel() { this.visible = false }, - - beforeModalOpen() { - this.handleReset() - }, }, } diff --git a/src/views/spectrumAnalysis/components/Modals/ReProcessingModal/index.vue b/src/views/spectrumAnalysis/components/Modals/ReProcessingModal/index.vue index 23904cb..b9f09c5 100644 --- a/src/views/spectrumAnalysis/components/Modals/ReProcessingModal/index.vue +++ b/src/views/spectrumAnalysis/components/Modals/ReProcessingModal/index.vue @@ -1,52 +1,52 @@ @@ -121,11 +129,18 @@ import ReProcessingModal from './components/Modals/ReProcessingModal/index.vue' import { GammaOptions, graphAssistance } from './settings' +import store from '@/store/' +import Vue from 'vue' +import { ACCESS_TOKEN } from '@/store/mutation-types' + export default { props: { sample: { type: Object, }, + updateFlag: { + type: String, + }, }, components: { CustomChart, @@ -141,6 +156,7 @@ export default { }, data() { return { + abc: false, isLoading: false, isLoadingNuclide: false, option: cloneDeep(GammaOptions.option), @@ -191,10 +207,16 @@ export default { compareFileListModalVisible: false, // Compare 弹窗 reprocessingModalVisible: false, // 重新分析弹窗 isProcessing: false, // 正在处理 + websock: null, + lockReconnect: false, + bAnalyed: false, //是否重新分析 + checkBox_updateCal: false, //update复选框状态 + newCheckBox_updateCal: false, //update复选框状态 + currStep: '', } }, created() { - this.option.title.text = '{a|Channel:0} {a|Energy:0} {a|Counts:0} {a|Detectability:0}' + this.setChartBottomTitle(0, 0, 0) this.option.tooltip.formatter = this.tooltipFormatter this.$bus.$on('colorChange', this.handleColorChange) @@ -210,8 +232,55 @@ export default { }, mounted() { this.option.brush = { toolbox: [] } + this.initWebSocket() }, methods: { + initWebSocket: function () { + console.log('qweqwerq') + // WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https + var userId = store.getters.userInfo.id + var url = + window._CONFIG['domianURL'].replace('https://', 'wss://').replace('http://', 'ws://') + '/websocket/' + userId + //console.log(url); + //update-begin-author:taoyan date:2022-4-22 for: v2.4.6 的 websocket 服务端,存在性能和安全问题。 #3278 + let token = Vue.ls.get(ACCESS_TOKEN) + this.websock = new WebSocket(url, [token]) + //update-end-author:taoyan date:2022-4-22 for: v2.4.6 的 websocket 服务端,存在性能和安全问题。 #3278 + this.websock.onopen = this.websocketOnopen + this.websock.onerror = this.websocketOnerror + this.websock.onmessage = this.websocketOnmessage + this.websock.onclose = this.websocketOnclose + }, + websocketOnopen: function () { + // console.log('WebSocket连接成功1231') + //心跳检测重置 + //this.heartCheck.reset().start(); + }, + websocketOnerror: function (e) { + this.reconnect() + }, + websocketOnmessage: function (e) { + // console.log('-----接收消息1231-------', e.data) + var data = eval('(' + e.data + ')') //解析对象 + // console.log(data) + if (data.cmd === 'analysis-process') { + this.currStep = data.msgTxt + } + }, + websocketOnclose: function (e) { + this.reconnect() + }, + reconnect() { + var that = this + if (that.lockReconnect) return + that.lockReconnect = true + //没连接上会一直重连,设置延迟避免请求过多 + setTimeout(function () { + console.info('尝试重连...') + that.initWebSocket() + that.lockReconnect = false + }, 20000) + }, // 获取样品详情 async getSampleDetail() { const { dbName, sampleId } = this.sample @@ -234,7 +303,7 @@ export default { ) console.log('%c [ result ]-243', 'font-size:13px; background:pink; color:#bf2c9f;', result) if (success) { - this.dataProsess(result) + this.dataProsess(result, 'db') } else { this.$message.error(message) } @@ -262,7 +331,7 @@ export default { ) console.log('%c [ result ]-243', 'font-size:13px; background:pink; color:#bf2c9f;', result) if (success) { - this.dataProsess(result) + this.dataProsess(result, 'file') } else { this.$message.error(message) } @@ -284,7 +353,7 @@ export default { return cancelToken }, - dataProsess(result) { + dataProsess(result, flag) { this.isLoading = false const { @@ -304,7 +373,12 @@ export default { shapeChannelData, shapeEnergyData, } = result - + if (flag && (flag == 'dab' || flag == 'file')) { + this.bAnalyed = result.bAnalyed + this.checkBox_updateCal = result.checkBox_updateCal + this.newCheckBox_updateCal = '2' + console.log(this.checkBox_updateCal) + } this.detailedInfomation = DetailedInformation this.qcFlags = QCFlag @@ -458,7 +532,7 @@ export default { } return `
Channel: ${channel}
-
Energy: ${energy}
` +
${energy ? `Energy: ${energy}` : ''}
` }, // Graph Assistance 操作 @@ -643,19 +717,37 @@ export default { const spectrumLineSeries = findSeriesByName(this.option.series, 'Spectrum') spectrumLineSeries.markLine.data[0].xAxis = xAxis - const channel = this.isEnergy() ? this.getChannelByEnergy(xAxis) : parseInt(xAxis.toFixed()) - const energy = this.isEnergy() - ? xAxis.toFixed(2) - : this.energyData.all.pointlist && this.energyData.all.pointlist[channel - 1].x.toFixed(2) - const counts = this.isEnergy() - ? this.energyData.all.pointlist[channel - 1] - : this.channelData.all.pointlist[channel - 1] - this.option.title.text = `{a|Channel:${channel}} {a|Energy:${energy}} {a|Counts:${counts.y}} {a|Detectability:0}` + const { channel, energy, counts } = this.getEnergyAndCountsByXAxis(xAxis) + this.setChartBottomTitle(channel, energy, counts) this.getSelPosNuclide(channel) } }, + // 设置图表底部的标题 + setChartBottomTitle(channel, energy, counts) { + this.option.title.text = `{a|Channel:${channel}} {a|Energy:${energy}} {a|Counts:${counts}} {a|Detectability:0}` + }, + + // 根据xAixs值找channel、energy和counts + getEnergyAndCountsByXAxis(xAxis) { + let channel, energy, counts + if (this.isEnergy()) { + channel = this.getChannelByEnergy(xAxis) + energy = xAxis.toFixed(2) + counts = this.energyData.all.pointlist[channel - 1] + } else { + channel = parseInt(xAxis.toFixed()) + energy = this.energyData.all.pointlist && this.energyData.all.pointlist[channel - 1].x.toFixed(2) + counts = this.channelData.all.pointlist[channel - 1] + } + return { + channel, + energy, + counts: counts.y, + } + }, + // 双击还原 handleChartDblClick() { this.handleResetChart() @@ -789,6 +881,8 @@ export default { if (find) { this.getSelPosNuclide(find) + const { channel, energy, counts } = this.getEnergyAndCountsByXAxis(find) + this.setChartBottomTitle(channel, energy, counts) } }, @@ -1107,6 +1201,8 @@ export default { // 重新分析 async reProcessing() { + this.abc = true + this.reprocessingModalVisible = true if (this.isProcessing) { return } @@ -1135,8 +1231,13 @@ export default { } } catch (error) { console.error(error) + } finally { + this.isLoading = false } - // this.reprocessingModalVisible = true + }, + haCndleCloseModal() { + this.reprocessingModalVisible = false + this.abc = false }, /** @@ -1352,6 +1453,13 @@ export default { }, immediate: true, }, + updateFlag: { + handler(val) { + console.log('dfad', val) + this.newCheckBox_updateCal = val + }, + immediate: true, + }, }, } diff --git a/src/views/spectrumAnalysis/index.vue b/src/views/spectrumAnalysis/index.vue index af0d00d..6634a8c 100644 --- a/src/views/spectrumAnalysis/index.vue +++ b/src/views/spectrumAnalysis/index.vue @@ -30,7 +30,7 @@
- + @@ -78,7 +78,11 @@ - + @@ -374,6 +378,7 @@ export default { xe133mFlag: null, xe135Flag: null, }, + updateFlag: '2', } }, created() { @@ -391,6 +396,10 @@ export default { }, methods: { + getUpdateFlag(val) { + console.log('qerq', val) + this.updateFlag = val + }, getcommentsInfo(val) { this.params_toDB.comment = val.spectrumAnalysisCommentInfo },