2023-07-17 19:37:46 +08:00
|
|
|
<template>
|
2023-07-20 14:11:37 +08:00
|
|
|
<custom-modal v-model="visible" :width="750" title="QC Results">
|
2023-08-30 13:36:53 +08:00
|
|
|
<a-spin :spinning="isLoading">
|
|
|
|
<a-table :columns="columns" :dataSource="list" :pagination="false" />
|
|
|
|
</a-spin>
|
2023-07-17 19:37:46 +08:00
|
|
|
<a-button slot="custom-footer" type="primary">Export to Excel</a-button>
|
|
|
|
</custom-modal>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2023-08-30 13:36:53 +08:00
|
|
|
import { getAction } from '@/api/manage'
|
2023-07-17 19:37:46 +08:00
|
|
|
import ModalMixin from '@/mixins/ModalMixin'
|
|
|
|
|
|
|
|
const columns = [
|
|
|
|
{
|
|
|
|
title: 'Name',
|
2023-08-30 13:36:53 +08:00
|
|
|
dataIndex: 'name',
|
|
|
|
customCell: (record) => {
|
|
|
|
return {
|
|
|
|
style: {
|
|
|
|
backgroundColor: record.flag == 'FAIL'? 'red': ''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-07-17 19:37:46 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Pass/Fail',
|
2023-08-30 13:36:53 +08:00
|
|
|
dataIndex: 'flag',
|
|
|
|
customCell: (record) => {
|
|
|
|
return {
|
|
|
|
style: {
|
|
|
|
backgroundColor: record.flag == 'FAIL'? 'red': ''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-07-17 19:37:46 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Value',
|
2023-08-30 13:36:53 +08:00
|
|
|
dataIndex: 'value',
|
|
|
|
customCell: (record) => {
|
|
|
|
return {
|
|
|
|
style: {
|
|
|
|
backgroundColor: record.flag == 'FAIL'? 'red': ''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-07-17 19:37:46 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Standard',
|
2023-08-30 13:36:53 +08:00
|
|
|
dataIndex: 'standard',
|
|
|
|
customCell: (record) => {
|
|
|
|
return {
|
|
|
|
style: {
|
|
|
|
backgroundColor: record.flag == 'FAIL'? 'red': ''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-07-17 19:37:46 +08:00
|
|
|
}
|
|
|
|
]
|
|
|
|
export default {
|
|
|
|
mixins: [ModalMixin],
|
2023-08-30 13:36:53 +08:00
|
|
|
props: {
|
|
|
|
sampleId: {
|
|
|
|
type: Number
|
|
|
|
}
|
|
|
|
},
|
2023-07-17 19:37:46 +08:00
|
|
|
data() {
|
|
|
|
this.columns = columns
|
|
|
|
return {
|
2023-08-30 13:36:53 +08:00
|
|
|
isLoading: false,
|
|
|
|
list: []
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async getData() {
|
|
|
|
try {
|
|
|
|
this.isLoading = true
|
|
|
|
const { success, result, message } = await getAction('/gamma/viewQCResult', {
|
|
|
|
sampleId: this.sampleId
|
|
|
|
})
|
|
|
|
if (success) {
|
|
|
|
this.list = result
|
|
|
|
} else {
|
|
|
|
this.$message.error(message)
|
2023-07-17 19:37:46 +08:00
|
|
|
}
|
2023-08-30 13:36:53 +08:00
|
|
|
} catch (error) {
|
|
|
|
console.error(error)
|
|
|
|
} finally {
|
|
|
|
this.isLoading = false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
beforeModalOpen() {
|
|
|
|
this.getData()
|
2023-07-17 19:37:46 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<style lang="less" scoped></style>
|