feat: 对接Comments -> Add
This commit is contained in:
parent
90017662ed
commit
2ffa1abbce
|
@ -7,7 +7,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { getAction } from '@/api/manage'
|
||||
import { getAction, putAction } from '@/api/manage'
|
||||
import ModalMixin from '@/mixins/ModalMixin'
|
||||
import SampleDataMixin from '../../SampleDataMixin'
|
||||
|
||||
|
@ -16,13 +16,13 @@ export default {
|
|||
props: {
|
||||
isAdd: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
default: true,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isLoading: false,
|
||||
comments: ''
|
||||
comments: '',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -30,18 +30,20 @@ export default {
|
|||
beforeModalOpen() {
|
||||
if (this.isAdd) {
|
||||
this.comments = ''
|
||||
this.getTotalComment()
|
||||
} else {
|
||||
this.getInfo()
|
||||
}
|
||||
},
|
||||
|
||||
// View接口
|
||||
async getInfo() {
|
||||
try {
|
||||
this.isLoading = true
|
||||
const { sampleId, inputFileName: fileName } = this.sampleData
|
||||
const { success, result, message } = await getAction('/gamma/viewComment', {
|
||||
sampleId,
|
||||
fileName
|
||||
fileName,
|
||||
})
|
||||
this.isLoading = false
|
||||
if (success) {
|
||||
|
@ -53,10 +55,35 @@ export default {
|
|||
console.error(error)
|
||||
}
|
||||
},
|
||||
handleOk() {
|
||||
console.log('%c [ ]-26', 'font-size:13px; background:pink; color:#bf2c9f;', this.comments)
|
||||
}
|
||||
}
|
||||
|
||||
// Add 获取 Comment 接口
|
||||
async getTotalComment() {
|
||||
try {
|
||||
this.isLoading = true
|
||||
const { inputFileName: fileName } = this.sampleData
|
||||
const { success, result, message } = await getAction('/gamma/viewGeneralComment', {
|
||||
fileName,
|
||||
})
|
||||
this.isLoading = false
|
||||
if (success) {
|
||||
this.comments = result
|
||||
} else {
|
||||
this.$message.error(message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
},
|
||||
|
||||
async handleOk() {
|
||||
const { inputFileName: fileName } = this.sampleData
|
||||
const { success, message } = await putAction(`/gamma/addComment?fileName=${fileName}&comment=${this.comments}`)
|
||||
if (!success) {
|
||||
this.$message.error(message)
|
||||
throw new Error(message)
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user