feat: 增加自建台站的Comments
This commit is contained in:
parent
b345fc1c04
commit
2481346c70
|
@ -622,8 +622,11 @@ export default {
|
|||
throw new Error('Please Analyse Spectrum First')
|
||||
}
|
||||
const { inputFileName: fileName } = this.sample
|
||||
const sampleData = getSampleData(fileName)
|
||||
|
||||
const { success, message, result } = await getAction('/selfStation/saveToDB', {
|
||||
fileName,
|
||||
comment: sampleData.data.comment
|
||||
})
|
||||
if (success) {
|
||||
Object.entries(result).forEach(([k, v]) => {
|
||||
|
|
|
@ -0,0 +1,108 @@
|
|||
<template>
|
||||
<custom-modal v-model="visible" :width="800" title="Comments">
|
||||
<a-spin :spinning="isLoading">
|
||||
<div class="comment">
|
||||
<title-over-border title="Spectrum Comment">
|
||||
<a-textarea v-model="comments.spectrumCommentInfo" :rows="8" :disabled="true"></a-textarea>
|
||||
</title-over-border>
|
||||
<title-over-border title="Other Analyser's Comment">
|
||||
<a-textarea v-model="comments.spectrumOtherCommentInfo" :rows="8" :disabled="true"></a-textarea>
|
||||
</title-over-border>
|
||||
<title-over-border title="Spectrum Analysis Comment">
|
||||
<a-textarea v-model="comments.spectrumAnalysisCommentInfo" :rows="8" :disabled="!isAdd"></a-textarea>
|
||||
</title-over-border>
|
||||
</div>
|
||||
</a-spin>
|
||||
<a-space slot="custom-footer" :size="20">
|
||||
<a-button v-if="isAdd" type="primary" @click="handleOk">Commit Comment Indormations</a-button>
|
||||
<a-button type="primary" @click="visible = false">Cancel</a-button>
|
||||
</a-space>
|
||||
</custom-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getAction } from '@/api/manage'
|
||||
import SampleDataMixin from '@/views/spectrumAnalysis/SampleDataMixin'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import TitleOverBorder from '../../TitleOverBorder.vue'
|
||||
import { getSampleData, updateSampleData } from '@/utils/SampleStore'
|
||||
|
||||
const InitialComments = {
|
||||
spectrumAnalysisCommentInfo: '',
|
||||
spectrumCommentInfo: '',
|
||||
spectrumOtherCommentInfo: '',
|
||||
}
|
||||
export default {
|
||||
components: { TitleOverBorder },
|
||||
mixins: [SampleDataMixin],
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
isAdd: false,
|
||||
comments: cloneDeep(InitialComments),
|
||||
isLoading: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open(isAdd = false) {
|
||||
const { inputFileName: sampleFileName } = this.sampleData
|
||||
if (!getSampleData(sampleFileName)) {
|
||||
this.$message.warn('Has No Data Yet!')
|
||||
return
|
||||
}
|
||||
this.visible = true
|
||||
this.isAdd = isAdd
|
||||
this.getCommets()
|
||||
},
|
||||
|
||||
async getCommets() {
|
||||
this.comments = cloneDeep(InitialComments)
|
||||
|
||||
try {
|
||||
this.isLoading = true
|
||||
const { sampleId, inputFileName: sampleFileName } = this.sampleData
|
||||
const res = await getAction('/selfStation/viewComment', {
|
||||
sampleId,
|
||||
sampleFileName,
|
||||
})
|
||||
if (res.success) {
|
||||
this.comments = res.result
|
||||
const sampleData = getSampleData(sampleFileName)
|
||||
if (sampleData.data.comment) {
|
||||
// 如果之前有值,用之前的
|
||||
this.comments.spectrumAnalysisCommentInfo = sampleData.data.comment
|
||||
}
|
||||
} else {
|
||||
this.$message.error(res.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
this.isLoading = false
|
||||
}
|
||||
},
|
||||
handleOk() {
|
||||
this.$message.success('Commit successful')
|
||||
this.visible = false
|
||||
const { inputFileName } = this.sampleData
|
||||
updateSampleData({
|
||||
inputFileName,
|
||||
key: 'comment',
|
||||
data: this.comments.spectrumAnalysisCommentInfo,
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.comment {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.title-over-border {
|
||||
&:not(:first-child) {
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -250,6 +250,7 @@
|
|||
<CalibrationModal :sampleList="sampleList" ref="newCalibrationModalRef" />
|
||||
<self-station-nuclide-library-modal ref="selfStationNuclideLibraryModalRef" />
|
||||
<self-station-config-user-library-modal ref="selfStationConfigUserLibraryModalRef" />
|
||||
<self-station-comments-modal ref="selfStationCommentsRef" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
|
@ -310,6 +311,7 @@ import BetaAnalyzeInteractiveToolModal from './components/Modals/SelfStation/Bet
|
|||
import SelfStationAnalyzeSettingModal from './components/Modals/SelfStation/SelfStationAnalyzeSettingModal.vue'
|
||||
import SelfStationNuclideLibraryModal from './components/Modals/SelfStation/SelfStationNuclideLibraryModal.vue'
|
||||
import SelfStationConfigUserLibraryModal from './components/Modals/SelfStation/SelfStationConfigUserLibraryModal.vue'
|
||||
import SelfStationCommentsModal from './components/Modals/SelfStation/SelfStationCommentsModal.vue'
|
||||
|
||||
// 分析类型
|
||||
const ANALYZE_TYPE = {
|
||||
|
@ -369,6 +371,7 @@ export default {
|
|||
SelfStationAnalyzeSettingModal,
|
||||
SelfStationNuclideLibraryModal,
|
||||
SelfStationConfigUserLibraryModal,
|
||||
SelfStationCommentsModal,
|
||||
},
|
||||
|
||||
provide() {
|
||||
|
@ -907,7 +910,11 @@ export default {
|
|||
// 保存自建台站谱到数据库
|
||||
async saveSelfStationToDBRequest(fileName) {
|
||||
try {
|
||||
const { result, success, message } = await getAction('/selfStation/saveToDB', { fileName })
|
||||
const sampleData = getSampleData(fileName)
|
||||
const { result, success, message } = await getAction('/selfStation/saveToDB', {
|
||||
fileName,
|
||||
comment: sampleData.data.comment,
|
||||
})
|
||||
if (success) {
|
||||
Object.entries(result).forEach(([k, v]) => {
|
||||
// 更新缓存中的DetailedInfomation数据
|
||||
|
@ -1072,10 +1079,14 @@ export default {
|
|||
this.isGammaCommentsAdd = false
|
||||
}
|
||||
// 如果是beta-gamma
|
||||
else {
|
||||
else if (this.isBetaGamma) {
|
||||
this.betaGammaCommentsModalVisible = true
|
||||
this.isBetaGammaCommentsAdd = false
|
||||
}
|
||||
// 如果是beta
|
||||
else {
|
||||
this.$refs.selfStationCommentsRef.open()
|
||||
}
|
||||
},
|
||||
|
||||
// 添加Comments
|
||||
|
@ -1086,10 +1097,14 @@ export default {
|
|||
this.isGammaCommentsAdd = true
|
||||
}
|
||||
// 如果是beta-gamma
|
||||
else {
|
||||
else if (this.isBetaGamma) {
|
||||
this.betaGammaCommentsModalVisible = true
|
||||
this.isBetaGammaCommentsAdd = true
|
||||
}
|
||||
// 如果是beta
|
||||
else {
|
||||
this.$refs.selfStationCommentsRef.open(true)
|
||||
}
|
||||
},
|
||||
|
||||
// 查看软件操作帮助文档
|
||||
|
@ -1593,13 +1608,13 @@ export default {
|
|||
{
|
||||
type: 'a-menu-item',
|
||||
title: 'View Comments',
|
||||
show: this.isBetaGamma,
|
||||
show: this.isBetaGamma || this.isBeta,
|
||||
handler: this.handleViewComments,
|
||||
},
|
||||
{
|
||||
type: 'a-menu-item',
|
||||
title: 'Add Comments',
|
||||
show: this.isBetaGamma,
|
||||
show: this.isBetaGamma || this.isBeta,
|
||||
handler: this.handleAddComments,
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user