2023-07-13 19:18:23 +08:00
|
|
|
<template>
|
|
|
|
<custom-modal v-model="visible" title="Spectrum Comments" :okHandler="handleOk" :footer="isAdd ? undefined : null">
|
2023-08-28 19:52:35 +08:00
|
|
|
<a-spin :spinning="isLoading">
|
|
|
|
<a-textarea v-model="comments" :rows="8" :disabled="!isAdd"></a-textarea>
|
|
|
|
</a-spin>
|
2023-07-13 19:18:23 +08:00
|
|
|
</custom-modal>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2023-08-28 19:52:35 +08:00
|
|
|
import { getAction } from '@/api/manage'
|
2023-07-13 19:18:23 +08:00
|
|
|
import ModalMixin from '@/mixins/ModalMixin'
|
|
|
|
export default {
|
|
|
|
mixins: [ModalMixin],
|
|
|
|
props: {
|
|
|
|
isAdd: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true
|
2023-08-28 19:52:35 +08:00
|
|
|
},
|
|
|
|
sampleId: {
|
|
|
|
type: Number
|
2023-07-13 19:18:23 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2023-08-28 19:52:35 +08:00
|
|
|
isLoading: false,
|
2023-07-13 19:18:23 +08:00
|
|
|
comments: ''
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
// ModalMixin 中的生命周期方法
|
|
|
|
beforeModalOpen() {
|
2023-08-28 19:52:35 +08:00
|
|
|
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)
|
|
|
|
}
|
2023-07-13 19:18:23 +08:00
|
|
|
},
|
|
|
|
handleOk() {
|
|
|
|
console.log('%c [ ]-26', 'font-size:13px; background:pink; color:#bf2c9f;', this.comments)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style></style>
|