AnalysisSystemForRadionucli.../src/views/spectrumAnalysis/components/Modals/SpectrumCommentsModal.vue

63 lines
1.3 KiB
Vue

<template>
<custom-modal v-model="visible" title="Spectrum Comments" :okHandler="handleOk" :footer="isAdd ? undefined : null">
<a-spin :spinning="isLoading">
<a-textarea v-model="comments" :rows="8" :disabled="!isAdd"></a-textarea>
</a-spin>
</custom-modal>
</template>
<script>
import { getAction } from '@/api/manage'
import ModalMixin from '@/mixins/ModalMixin'
export default {
mixins: [ModalMixin],
props: {
isAdd: {
type: Boolean,
default: true
},
sampleId: {
type: Number
}
},
data() {
return {
isLoading: false,
comments: ''
}
},
methods: {
// ModalMixin 中的生命周期方法
beforeModalOpen() {
if (this.isAdd) {
this.comments = ''
} else {
this.getInfo()
}
},
async getInfo() {
try {
this.isLoading = true
const { success, result, message } = await getAction('/gamma/viewComment', {
sampleId: this.sampleId
})
this.isLoading = false
if (success) {
this.comments = result
} else {
this.$message.error(message)
}
} catch (error) {
console.error(error)
}
},
handleOk() {
console.log('%c [ ]-26', 'font-size:13px; background:pink; color:#bf2c9f;', this.comments)
}
}
}
</script>
<style></style>