bata QC results 弹窗查询接口参数调整

bata  View Sample Infomation 弹窗查询接口参数调整
This commit is contained in:
任珮宇 2023-10-26 17:34:33 +08:00
parent dee3c57090
commit ad19436f82
3 changed files with 89 additions and 84 deletions

View File

@ -254,7 +254,7 @@ export default {
this.$emit('getFiles', { this.$emit('getFiles', {
detFileName: result.detBg.fileName, detFileName: result.detBg.fileName,
gasFileName: result.gasBg.fileName, gasFileName: result.gasBg.fileName,
qcFileName: result.qc.fileName || '', qcFileName: (result.qc && result.qc.fileName) || '',
}) })
} else { } else {
this.$message.error(message) this.$message.error(message)

View File

@ -12,49 +12,49 @@
<script> <script>
import { getAction, getFileAction } from '@/api/manage' import { getAction, getFileAction } from '@/api/manage'
import ModalMixin from '@/mixins/ModalMixin' import ModalMixin from '@/mixins/ModalMixin'
import { saveAs } from 'file-saver'; import { saveAs } from 'file-saver'
import SampleDataMixin from '@/views/spectrumAnalysis/SampleDataMixin' import SampleDataMixin from '@/views/spectrumAnalysis/SampleDataMixin'
const columns = [ const columns = [
{ {
title: 'QC Flags', title: 'QC Flags',
dataIndex: 'qcFlags', dataIndex: 'qcFlags',
align: 'center' align: 'center',
}, },
{ {
title: 'Evaluation Metrics', title: 'Evaluation Metrics',
dataIndex: 'evaluationMetrics', dataIndex: 'evaluationMetrics',
align: 'center' align: 'center',
}, },
{ {
title: 'Value', title: 'Value',
dataIndex: 'value', dataIndex: 'value',
align: 'center' align: 'center',
}, },
{ {
title: 'Status', title: 'Status',
dataIndex: 'status', dataIndex: 'status',
align: 'center', align: 'center',
scopedSlots: { scopedSlots: {
customRender: 'status' customRender: 'status',
}, },
customCell: record => { customCell: (record) => {
return { return {
style: { style: {
backgroundColor: record.status.toLowerCase() == 'pass' ? '#008000 !important' : '#f00 !important' backgroundColor: record.status.toLowerCase() == 'pass' ? '#008000 !important' : '#f00 !important',
} },
} }
} },
} },
] ]
export default { export default {
mixins: [ModalMixin, SampleDataMixin], mixins: [ModalMixin, SampleDataMixin],
props: { // props: {
sampleId: { // sampleId: {
type: Number // type: Number
} // }
}, // },
data() { data() {
this.columns = columns this.columns = columns
return { return {
@ -62,15 +62,20 @@ export default {
isLoading: false, isLoading: false,
text: '', text: '',
fileName: '', fileName: '',
fileName_excel: '' fileName_excel: '',
} }
}, },
methods: { methods: {
async getData() { async getData() {
const { sampleId, inputFileName: fileName, dbName, detFileName, gasFileName } = this.newSampleData
try { try {
this.isLoading = true this.isLoading = true
const res = await getAction('/spectrumAnalysis/viewQCResult', { const res = await getAction('/spectrumAnalysis/viewQCResult', {
sampleId: this.sampleId sampleId,
dbName,
sampleFileName: fileName,
gasFileName,
detFileName,
}) })
if (res.success) { if (res.success) {
const result = res.result const result = res.result
@ -79,42 +84,42 @@ export default {
qcFlags: 'Collection Time (h)', qcFlags: 'Collection Time (h)',
evaluationMetrics: result.collectTimeEvaluationMetrics, evaluationMetrics: result.collectTimeEvaluationMetrics,
value: result.collectTimeValue, value: result.collectTimeValue,
status: result.collectTimeStatus status: result.collectTimeStatus,
}) })
this.list.push({ this.list.push({
qcFlags: 'Acquisition Time (h)', qcFlags: 'Acquisition Time (h)',
evaluationMetrics: result.acquisitionTimeEvaluationMetrics, evaluationMetrics: result.acquisitionTimeEvaluationMetrics,
value: result.acquisitionTimeValue, value: result.acquisitionTimeValue,
status: result.acquisitionTimeStatus status: result.acquisitionTimeStatus,
}) })
this.list.push({ this.list.push({
qcFlags: 'Xenon Volume (ml)', qcFlags: 'Xenon Volume (ml)',
evaluationMetrics: result.xenonVolumeEvaluationMetrics, evaluationMetrics: result.xenonVolumeEvaluationMetrics,
value: result.xenonVolumeValue, value: result.xenonVolumeValue,
status: result.xenonVolumeStatus status: result.xenonVolumeStatus,
}) })
this.list.push({ this.list.push({
qcFlags: 'Gas Bg', qcFlags: 'Gas Bg',
evaluationMetrics: result.gasBgValueAndStatus, evaluationMetrics: result.gasBgValueAndStatus,
value: result.gasBgValueAndStatus ? 'Match' : 'UnMatch', value: result.gasBgValueAndStatus ? 'Match' : 'UnMatch',
status: result.gasBgValueAndStatus ? 'Pass' : 'Failed' status: result.gasBgValueAndStatus ? 'Pass' : 'Failed',
}) })
this.list.push({ this.list.push({
qcFlags: 'Det Bg', qcFlags: 'Det Bg',
evaluationMetrics: result.detBgValueAndStatus, evaluationMetrics: result.detBgValueAndStatus,
value: result.detBgValueAndStatus ? 'Match' : 'UnMatch', value: result.detBgValueAndStatus ? 'Match' : 'UnMatch',
status: result.detBgValueAndStatus ? 'Pass' : 'Failed' status: result.detBgValueAndStatus ? 'Pass' : 'Failed',
}) })
this.list.push({ this.list.push({
qcFlags: 'MDC for Xe133(mBq/m3)', qcFlags: 'MDC for Xe133(mBq/m3)',
evaluationMetrics: result.xe133MDCEvaluationMetrics, evaluationMetrics: result.xe133MDCEvaluationMetrics,
value: result.xe133MDCValue, value: result.xe133MDCValue,
status: result.xe133MDCStatus status: result.xe133MDCStatus,
}) })
} else { } else {
this.$message.error(res.message) this.$message.error(res.message)
@ -131,73 +136,73 @@ export default {
this.getData() this.getData()
}, },
SaveText() { SaveText() {
this.fileName="" this.fileName = ''
this.text = `#QC RESULT\n${this.columns[0].title} ${this.columns[1].title} ${this.columns[2].title} ${this.columns[3].title}\n` this.text = `#QC RESULT\n${this.columns[0].title} ${this.columns[1].title} ${this.columns[2].title} ${this.columns[3].title}\n`
this.list.forEach(item => { this.list.forEach((item) => {
let str = "" let str = ''
str += `${item.qcFlags} ` str += `${item.qcFlags} `
str += `${item.evaluationMetrics} ` str += `${item.evaluationMetrics} `
str += `${item.value} ` str += `${item.value} `
str += `${item.status} \n` str += `${item.status} \n`
this.text+=str this.text += str
}) })
let strData = new Blob([this.text], { type: 'text/plain;charset=utf-8' }); let strData = new Blob([this.text], { type: 'text/plain;charset=utf-8' })
let _this = this let _this = this
this.$confirm({ this.$confirm({
title: 'Please enter file name', title: 'Please enter file name',
content: h => <a-input v-model={_this.fileName} />, content: (h) => <a-input v-model={_this.fileName} />,
okText: 'Cancle', okText: 'Cancle',
cancelText: 'Save', cancelText: 'Save',
okButtonProps: {style: {backgroundColor: "#b98326", color: "#fff", borderColor: "transparent"}}, okButtonProps: { style: { backgroundColor: '#b98326', color: '#fff', borderColor: 'transparent' } },
cancelButtonProps: {style: {color: "#fff", backgroundColor: "#31aab0", borderColor: "transparent"}}, cancelButtonProps: { style: { color: '#fff', backgroundColor: '#31aab0', borderColor: 'transparent' } },
onOk() { onOk() {
console.log('Cancel'); console.log('Cancel')
}, },
onCancel() { onCancel() {
if (_this.fileName) { if (_this.fileName) {
saveAs(strData, `${_this.fileName}.txt`) saveAs(strData, `${_this.fileName}.txt`)
} }
}, },
}); })
}, },
// Excel // Excel
handleExportToExcel() { handleExportToExcel() {
this.fileName_excel = "" this.fileName_excel = ''
const { sampleId, inputFileName: fileName } = this.sampleData const { sampleId, inputFileName: fileName } = this.sampleData
if (this.list.length>0) { if (this.list.length > 0) {
let _this = this let _this = this
this.$confirm({ this.$confirm({
title: 'Please enter file name', title: 'Please enter file name',
content: h => <a-input v-model={_this.fileName_excel} />, content: (h) => <a-input v-model={_this.fileName_excel} />,
okText: 'Cancle', okText: 'Cancle',
cancelText: 'Save', cancelText: 'Save',
okButtonProps: {style: {backgroundColor: "#b98326", color: "#fff", borderColor: "transparent"}}, okButtonProps: { style: { backgroundColor: '#b98326', color: '#fff', borderColor: 'transparent' } },
cancelButtonProps: {style: {color: "#fff", backgroundColor: "#31aab0", borderColor: "transparent"}}, cancelButtonProps: { style: { color: '#fff', backgroundColor: '#31aab0', borderColor: 'transparent' } },
onOk() { onOk() {
console.log('Cancel'); console.log('Cancel')
}, },
onCancel() { onCancel() {
if (_this.fileName_excel) { if (_this.fileName_excel) {
let params = { let params = {
sampleId: sampleId || "", sampleId: sampleId || '',
fileName fileName,
} }
getFileAction('/spectrumAnalysis/exportQCResult', params).then(res => { getFileAction('/spectrumAnalysis/exportQCResult', params).then((res) => {
if (res.code && res.code == 500) { if (res.code && res.code == 500) {
this.$message.warning("This operation fails. Contact your system administrator") this.$message.warning('This operation fails. Contact your system administrator')
} else { } else {
const blob = new Blob([res], { type: "application/vnd.ms-excel" }) const blob = new Blob([res], { type: 'application/vnd.ms-excel' })
saveAs(blob, `${_this.fileName_excel}`) saveAs(blob, `${_this.fileName_excel}`)
} }
}) })
} }
}, },
}); })
} else { } else {
this.$message.warning("No downloadable data") this.$message.warning('No downloadable data')
} }
} },
} },
} }
</script> </script>
<style lang="less" scoped></style> <style lang="less" scoped></style>

View File

@ -17,21 +17,21 @@
<script> <script>
import { getAction, getFileAction } from '@/api/manage' import { getAction, getFileAction } from '@/api/manage'
import ModalMixin from '@/mixins/ModalMixin' import ModalMixin from '@/mixins/ModalMixin'
import { saveAs } from 'file-saver'; import { saveAs } from 'file-saver'
import SampleDataMixin from '@/views/spectrumAnalysis/SampleDataMixin' import SampleDataMixin from '@/views/spectrumAnalysis/SampleDataMixin'
export default { export default {
mixins: [ModalMixin, SampleDataMixin], mixins: [ModalMixin, SampleDataMixin],
props: { props: {
sampleId: { sampleId: {
type: Number type: Number,
} },
}, },
data() { data() {
return { return {
content: '', content: '',
isLoading: true, isLoading: true,
fileName: '', fileName: '',
fileName_excel: '' fileName_excel: '',
} }
}, },
methods: { methods: {
@ -40,13 +40,13 @@ export default {
this.content = '' this.content = ''
this.isLoading = true this.isLoading = true
const res = await getAction('/spectrumAnalysis/viewSampleInformation', { const res = await getAction('/spectrumAnalysis/viewSampleInformation', {
sampleId: this.sampleId sampleId: this.sampleId,
sampleFileName: this.newSampleData.inputFileName,
}) })
if(res.success) { if (res.success) {
this.content = res.result this.content = res.result
} } else {
else { this.content = ''
this.content = ""
this.$message.error(res.message) this.$message.error(res.message)
} }
} catch (error) { } catch (error) {
@ -57,74 +57,74 @@ export default {
}, },
beforeModalOpen() { beforeModalOpen() {
if (this.sampleId) { // if (this.sampleId) {
this.getContent() this.getContent()
} // }
}, },
saveText() { saveText() {
this.fileName="" this.fileName = ''
if (this.content) { if (this.content) {
let strData = new Blob([this.content], { type: 'text/plain;charset=utf-8' }); let strData = new Blob([this.content], { type: 'text/plain;charset=utf-8' })
// saveAs(strData, `Beta-View Sample Infomation.txt`) // saveAs(strData, `Beta-View Sample Infomation.txt`)
let _this = this let _this = this
this.$confirm({ this.$confirm({
title: 'Please enter file name', title: 'Please enter file name',
content: h => <a-input v-model={_this.fileName} />, content: (h) => <a-input v-model={_this.fileName} />,
okText: 'Cancle', okText: 'Cancle',
cancelText: 'Save', cancelText: 'Save',
okButtonProps: {style: {backgroundColor: "#b98326", color: "#fff", borderColor: "transparent"}}, okButtonProps: { style: { backgroundColor: '#b98326', color: '#fff', borderColor: 'transparent' } },
cancelButtonProps: {style: {color: "#fff", backgroundColor: "#31aab0", borderColor: "transparent"}}, cancelButtonProps: { style: { color: '#fff', backgroundColor: '#31aab0', borderColor: 'transparent' } },
onOk() { onOk() {
console.log('Cancel'); console.log('Cancel')
}, },
onCancel() { onCancel() {
if (_this.fileName) { if (_this.fileName) {
saveAs(strData, `${_this.fileName}.txt`) saveAs(strData, `${_this.fileName}.txt`)
} }
}, },
}); })
} else { } else {
this.$message.warning("No data can be saved!") this.$message.warning('No data can be saved!')
} }
}, },
// Excel // Excel
handleExportToExcel() { handleExportToExcel() {
this.fileName_excel = "" this.fileName_excel = ''
const { sampleId, inputFileName: fileName } = this.sampleData const { sampleId, inputFileName: fileName } = this.sampleData
if (this.content) { if (this.content) {
let _this = this let _this = this
this.$confirm({ this.$confirm({
title: 'Please enter file name', title: 'Please enter file name',
content: h => <a-input v-model={_this.fileName_excel} />, content: (h) => <a-input v-model={_this.fileName_excel} />,
okText: 'Cancle', okText: 'Cancle',
cancelText: 'Save', cancelText: 'Save',
okButtonProps: {style: {backgroundColor: "#b98326", color: "#fff", borderColor: "transparent"}}, okButtonProps: { style: { backgroundColor: '#b98326', color: '#fff', borderColor: 'transparent' } },
cancelButtonProps: {style: {color: "#fff", backgroundColor: "#31aab0", borderColor: "transparent"}}, cancelButtonProps: { style: { color: '#fff', backgroundColor: '#31aab0', borderColor: 'transparent' } },
onOk() { onOk() {
console.log('Cancel'); console.log('Cancel')
}, },
onCancel() { onCancel() {
if (_this.fileName_excel) { if (_this.fileName_excel) {
let params = { let params = {
sampleId: sampleId || "", sampleId: sampleId || '',
fileName fileName,
} }
getFileAction('/spectrumAnalysis/exportSampleInformation', params).then(res => { getFileAction('/spectrumAnalysis/exportSampleInformation', params).then((res) => {
if (res.code && res.code == 500) { if (res.code && res.code == 500) {
this.$message.warning("This operation fails. Contact your system administrator") this.$message.warning('This operation fails. Contact your system administrator')
} else { } else {
const blob = new Blob([res], { type: "application/vnd.ms-excel" }) const blob = new Blob([res], { type: 'application/vnd.ms-excel' })
saveAs(blob, `${_this.fileName_excel}`) saveAs(blob, `${_this.fileName_excel}`)
} }
}) })
} }
}, },
}); })
} else { } else {
this.$message.warning("No downloadable data") this.$message.warning('No downloadable data')
} }
} },
} },
} }
</script> </script>