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', {
detFileName: result.detBg.fileName,
gasFileName: result.gasBg.fileName,
qcFileName: result.qc.fileName || '',
qcFileName: (result.qc && result.qc.fileName) || '',
})
} else {
this.$message.error(message)

View File

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

View File

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