处理打开beta RLR 弹窗直接点击save字段无数据的问题

This commit is contained in:
任珮宇 2023-09-14 11:41:34 +08:00
parent e1c30fd326
commit 56e1c9130e
6 changed files with 180 additions and 47 deletions

View File

@ -7,7 +7,7 @@
<component <component
:is="column.type" :is="column.type"
v-bind="column.attrs" v-bind="column.attrs"
v-model="detail[column.dataIndex]" v-model="currData[column.dataIndex]"
:disabled="column.disabled" :disabled="column.disabled"
v-on="column.on" v-on="column.on"
/> />
@ -18,6 +18,7 @@
</template> </template>
<script> <script>
import { cloneDeep } from 'lodash'
export default { export default {
computed: { computed: {
columns() { columns() {
@ -142,13 +143,24 @@ export default {
type: Object, type: Object,
}, },
}, },
watch: {
detail: {
handler(val, old) {
this.currData = cloneDeep(val)
},
immediate: true,
deep: true,
},
},
data() { data() {
return {} return {
currData: {},
}
}, },
methods: { methods: {
handleValChange(val) { handleValChange(val) {
console.log('valval', val) console.log('valval', val)
this.$emit('valChange', this.detail) this.$emit('valChange', this.currData)
}, },
}, },
} }

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="general-infomation"> <div class="general-infomation">
<a-textarea :rows="14" v-model="detail.text"></a-textarea> <a-textarea :rows="14" v-model="currData.text"></a-textarea>
<div class="form"> <div class="form">
<a-row v-for="(column, index) in columns" :key="index"> <a-row v-for="(column, index) in columns" :key="index">
<a-col class="label" :span="10"> {{ column.label }} </a-col> <a-col class="label" :span="10"> {{ column.label }} </a-col>
@ -8,7 +8,7 @@
<component <component
:is="column.type" :is="column.type"
v-bind="column.attrs" v-bind="column.attrs"
v-model="detail[column.dataIndex]" v-model="currData[column.dataIndex]"
:disabled="column.disabled" :disabled="column.disabled"
v-on="column.on" v-on="column.on"
/> />
@ -19,6 +19,8 @@
</template> </template>
<script> <script>
import { cloneDeep } from 'lodash'
import dateFormat from '@/components/jeecg/JEasyCron/format-date'
export default { export default {
computed: { computed: {
columns() { columns() {
@ -139,13 +141,29 @@ export default {
type: Object, type: Object,
}, },
}, },
watch: {
detail: {
handler(val, old) {
this.currData = cloneDeep(val)
this.currData.laboratory = 'CNL06'
this.currData.receiptDate = dateFormat(new Date(), 'yyyy-MM-dd')
this.currData.receiptTime = dateFormat(new Date(), 'hh:mm:ss')
this.currData.reportTransmissionDate = dateFormat(new Date(), 'yyyy-MM-dd')
this.currData.reportTransmissionTime = dateFormat(new Date(), 'hh:mm:ss')
this.$emit('valChange', this.currData)
},
immediate: true,
deep: true,
},
},
data() { data() {
return {} return {
currData: {},
}
}, },
methods: { methods: {
handleValChange(val) { handleValChange(val) {
console.log('valval', val) this.$emit('valChange', this.currData)
this.$emit('valChange', this.detail)
}, },
}, },
} }

View File

@ -16,6 +16,11 @@
<script> <script>
export default { export default {
props: {
detail: {
type: Object,
},
},
data() { data() {
return { return {
methodsInfo: { methodsInfo: {
@ -25,9 +30,14 @@ export default {
}, },
} }
}, },
mounted() {
this.methodsInfo.samplingHandling = this.detail.samplingHandling
this.methodsInfo.equipmentUsed = this.detail.equipmentUsed
this.methodsInfo.softwareUsed = this.detail.softwareUsed
},
methods: { methods: {
handleValueChange() { handleValueChange() {
this.$emit('valChange', this.transInfo) this.$emit('valChange', this.methodsInfo)
}, },
}, },
} }

View File

@ -1,13 +1,13 @@
<template> <template>
<div> <div>
<a-table :columns="columns" :dataSource="list" :pagination="false"> <a-table :columns="columns" :dataSource="rationsList" :pagination="false">
<template v-for="slotName in slots" :slot="slotName" slot-scope="text, record"> <!-- <template v-for="slotName in slots" :slot="slotName" slot-scope="text, record">
<a-input <a-input
v-model="record[slotName]" v-model="record[slotName]"
:key="slotName" :key="slotName"
@change="(e) => cellChange(e.target.value, record, slotName)" @change="(e) => cellChange(e.target.value, record, slotName)"
></a-input> ></a-input>
</template> </template> -->
</a-table> </a-table>
</div> </div>
</template> </template>
@ -28,57 +28,63 @@ const columns = [
dataIndex: 'nuclide1', dataIndex: 'nuclide1',
align: 'center', align: 'center',
width: 100, width: 100,
scopedSlots: { // scopedSlots: {
customRender: 'nuclide1', // customRender: 'nuclide1',
}, // },
}, },
{ {
title: 'Nuclide2', title: 'Nuclide2',
dataIndex: 'nuclide2', dataIndex: 'nuclide2',
align: 'center', align: 'center',
width: 150, width: 150,
scopedSlots: { // scopedSlots: {
customRender: 'nuclide2', // customRender: 'nuclide2',
}, // },
}, },
{ {
title: 'Isotope ratio', title: 'Isotope ratio',
dataIndex: 'isotopeRatio', dataIndex: 'isotopeRatio',
align: 'center', align: 'center',
width: 100, width: 100,
scopedSlots: { // scopedSlots: {
customRender: 'isotopeRatio', // customRender: 'isotopeRatio',
}, // },
}, },
{ {
title: 'Uncert.Ratio [%]', title: 'Uncert.Ratio [%]',
dataIndex: 'uncertRatio', dataIndex: 'uncertRatio',
align: 'center', align: 'center',
width: 200, width: 200,
scopedSlots: { // scopedSlots: {
customRender: 'uncertRatio', // customRender: 'uncertRatio',
}, // },
}, },
] ]
export default { export default {
props: {
rationsList: {
type: Object,
},
},
data() { data() {
this.columns = columns this.columns = columns
return { return {}
list: [],
}
},
computed: {
slots() {
return columns.filter((item) => item.scopedSlots).map((item) => item.scopedSlots.customRender)
},
},
methods: {
cellChange(val, record, key) {
record[key] = val
this.$emit('valChange', this.list)
},
}, },
// mounted() {
// this.$emit('valChange', this.list)
// },
// computed: {
// slots() {
// return columns.filter((item) => item.scopedSlots).map((item) => item.scopedSlots.customRender)
// },
// },
// methods: {
// cellChange(val, record, key) {
// record[key] = val
// this.$emit('valChange', this.list)
// },
// },
} }
</script> </script>

View File

@ -21,6 +21,11 @@
<script> <script>
export default { export default {
props: {
detail: {
type: Object,
},
},
data() { data() {
return { return {
transInfo: { transInfo: {
@ -29,6 +34,10 @@ export default {
}, },
} }
}, },
mounted() {
this.transInfo.comments = this.detail.comments
this.transInfo.otherComments = this.detail.otherComments
},
methods: { methods: {
handleValueChange() { handleValueChange() {
this.$emit('valChange', this.transInfo) this.$emit('valChange', this.transInfo)

View File

@ -29,7 +29,7 @@
<nuclides :detail="detail" @valChange="getNewVal_nuclidesList" /> <nuclides :detail="detail" @valChange="getNewVal_nuclidesList" />
</template> </template>
<template v-if="activeKey == 4"> <template v-if="activeKey == 4">
<ratios :detail="detail" @valChange="getNewVal_rationsList" /> <ratios :rationsList="rationsList" @valChange="getNewVal_rationsList" />
</template> </template>
<template v-if="activeKey == 5"> <template v-if="activeKey == 5">
<methods :detail="detail" @valChange="getNewVal_methodsInfo" /> <methods :detail="detail" @valChange="getNewVal_methodsInfo" />
@ -65,8 +65,33 @@ import AdditionalInfo from './components/AdditionalInfo.vue'
import Notes from './components/Notes.vue' import Notes from './components/Notes.vue'
import { getAction, postFileAction } from '@/api/manage' import { getAction, postFileAction } from '@/api/manage'
import { saveAs } from 'file-saver' import { saveAs } from 'file-saver'
import dateFormat from '@/components/jeecg/JEasyCron/format-date'
import { TagsInputCell } from '@/components/jeecg/JVxeTable/components/cells/JVxeTagsCell' import { TagsInputCell } from '@/components/jeecg/JVxeTable/components/cells/JVxeTagsCell'
const nameMapper = [
{ name: 'Xe-131m', mapTo: 'xe131m' },
{ name: 'Xe-133m', mapTo: 'xe133m' },
{ name: 'Xe-133', mapTo: 'xe133' },
{ name: 'Xe-135', mapTo: 'xe135' },
]
const columnNameMapper = [
{
name: 'concentration',
mapTo: 'conc',
},
{
name: 'uncertConcentration',
mapTo: 'uncert_conc',
},
{
name: 'mdc',
mapTo: 'MDC',
},
{
name: 'lc',
mapTo: 'LC',
},
]
const tabs = [ const tabs = [
'General Infomation', 'General Infomation',
'Transport Infomation', 'Transport Infomation',
@ -105,8 +130,39 @@ export default {
transInfo: {}, transInfo: {},
methodsInfo: {}, methodsInfo: {},
addInfo: {}, addInfo: {},
nuclidesList: [], nuclidesList: null,
rationsList: [], rationsList: [
{
nuclide1: 'Xe-131m',
nuclide2: 'Xe-133',
isotopeRatio: '',
uncertRatio: '10.0',
},
{
nuclide1: 'Xe-133m',
nuclide2: 'Xe-133',
isotopeRatio: '',
uncertRatio: '10.0',
},
{
nuclide1: 'Xe-133m',
nuclide2: 'Xe-131m',
isotopeRatio: '',
uncertRatio: '10.0',
},
{
nuclide1: 'Xe-135',
nuclide2: 'Xe-133',
isotopeRatio: '',
uncertRatio: '10.0',
},
{
nuclide1: 'Xe-135',
nuclide2: 'Xe-131m',
isotopeRatio: '',
uncertRatio: '10.0',
},
],
fileName: '', fileName: '',
text: text:
'- All dates and times shall be given in UTC \n' + '- All dates and times shall be given in UTC \n' +
@ -150,6 +206,15 @@ export default {
if (success) { if (success) {
this.detail = result this.detail = result
this.detail.text = this.text this.detail.text = this.text
this.detail.comments = ''
this.detail.otherComments = 'good.'
this.detail.stableXeMeasStartDate = dateFormat(new Date(), 'yyyy-MM-dd')
this.detail.stableXeMeasStartTime = dateFormat(new Date(), 'hh:mm:ss')
this.detail.nuclidesList = this.getList()
this.detail.samplingHandling = 'Sample was transfered by a transfer setup from archive bottle to cell.'
this.detail.equipmentUsed = 'transfer setup, GC(Agilent6890) and HPGe detector.'
this.detail.softwareUsed = 'Gammavision'
console.log(this.detail)
this.isLoading = false this.isLoading = false
} else { } else {
this.$message.error(message) this.$message.error(message)
@ -182,6 +247,19 @@ export default {
handleCancel() { handleCancel() {
this.visible = false this.visible = false
}, },
getList() {
return nameMapper.map((item) => {
const obj = { name: item.name }
columnNameMapper.forEach((it) => {
const key = `${item.mapTo}_${it.mapTo}`
obj[it.name] = this.detail[key]
obj.activity = ''
obj.uncertActivity = ''
obj.mda = ''
})
return obj
})
},
handleOk() { handleOk() {
let params = { let params = {
laboratory: this.newDetail.laboratory || '', laboratory: this.newDetail.laboratory || '',
@ -194,8 +272,8 @@ export default {
receiptTime: this.newDetail.receiptTime || '', receiptTime: this.newDetail.receiptTime || '',
reportTransmissionDate: this.newDetail.reportTransmissionDate || '', reportTransmissionDate: this.newDetail.reportTransmissionDate || '',
reportTransmissionTime: this.newDetail.reportTransmissionTime || '', reportTransmissionTime: this.newDetail.reportTransmissionTime || '',
comments: this.transInfo.comments || '', comments: this.transInfo.comments || this.detail.comments,
otherComments: this.transInfo.otherComments || '', otherComments: this.transInfo.otherComments || this.detail.otherComments,
pressureInTheArchiveBottle: this.newDetail.pressureInTheArchiveBottle || '', pressureInTheArchiveBottle: this.newDetail.pressureInTheArchiveBottle || '',
volumeOfArchiveBottle: this.newDetail.volumeOfArchiveBottle || '', volumeOfArchiveBottle: this.newDetail.volumeOfArchiveBottle || '',
gasComposition: this.newDetail.gasComposition || '', gasComposition: this.newDetail.gasComposition || '',
@ -208,11 +286,11 @@ export default {
acq_start_date: this.newDetail.acq_start_date || this.detail.acq_start_date, acq_start_date: this.newDetail.acq_start_date || this.detail.acq_start_date,
acq_start_time: this.newDetail.acq_start_time || this.detail.acq_start_time, acq_start_time: this.newDetail.acq_start_time || this.detail.acq_start_time,
acq_live_time: this.newDetail.acq_live_time || this.detail.acq_live_time, acq_live_time: this.newDetail.acq_live_time || this.detail.acq_live_time,
nuclides: this.nuclidesList, nuclides: this.nuclidesList || this.detail.nuclidesList,
rations: this.rationsList, rations: this.rationsList,
samplingHandling: this.methodsInfo.samplingHandling || '', samplingHandling: this.methodsInfo.samplingHandling || this.detail.samplingHandling,
equipmentUsed: this.methodsInfo.equipmentUsed || '', equipmentUsed: this.methodsInfo.equipmentUsed || this.detail.equipmentUsed,
softwareUsed: this.methodsInfo.softwareUsed || '', softwareUsed: this.methodsInfo.softwareUsed || this.detail.softwareUsed,
xeTransfer: this.addInfo.xeTransfer || '', xeTransfer: this.addInfo.xeTransfer || '',
uncertaintyOfXe: this.addInfo.uncertaintyOfXe || '', uncertaintyOfXe: this.addInfo.uncertaintyOfXe || '',
commentsInfo: this.addInfo.commentsInfo || '', commentsInfo: this.addInfo.commentsInfo || '',