处理rlr弹窗中 PeakFit 表格删除数据时的问题,及增加提示消息

This commit is contained in:
renpy 2023-09-01 16:52:28 +08:00
parent e985496675
commit a8a963c43e
4 changed files with 59 additions and 20 deletions

View File

@ -1,5 +1,5 @@
<template>
<a-modal :class="'custom-modal' + (innerFullscreen ? ' fullscreen' : '')" v-bind="_attrs" v-model="visible">
<a-modal :class="'custom-modal' + (innerFullscreen ? ' fullscreen' : '')" v-bind="_attrs" v-model="visible" @cancel="handleCancel">
<img slot="closeIcon" src="@/assets/images/global/close.png" />
<div slot="title">
<div class="custom-modal-title">
@ -76,6 +76,9 @@ export default {
},
onCancel() {
this.visible = false
},
handleCancel() {
this.$emit("cancel")
}
},
computed: {

View File

@ -6,6 +6,7 @@
<script>
import TableWithOperators from './TableWithOperators.vue'
import { cloneDeep } from 'lodash'
const columns = [
{
title: 'Index',
@ -73,11 +74,33 @@ export default {
default: ()=>[]
},
},
watch: {
tableData: {
handler(val, old) {
console.log(val);
this.list = cloneDeep(val)
this.list.forEach((item, index) => {
item.id = this.guid()
})
},
immediate: true,
deep:true
}
},
data() {
this.columns = columns
return {
list: this.tableData
list: []
}
}
},
methods: {
guid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0,
v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
},
},
}
</script>

View File

@ -7,7 +7,7 @@
</div>
<a-table
size="small"
rowKey="id"
:rowKey="(record, index) => { return record.id }"
:class="dataSource.length ? 'has-data' : ''"
:columns="columns"
:dataSource="dataSource"
@ -46,12 +46,11 @@ export default {
isEmpty:false
}
},
mounted() {
this.dataSource.forEach((item, index) => {
item.id = this.guid()
})
this.initList()
},
// mounted() {
// this.dataSource.forEach((item, index) => {
// item.id = this.guid()
// })
// },
methods: {
guid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
@ -152,11 +151,16 @@ export default {
}
},
handleDelete() {
let idx = this.list.findIndex(item => {
return item.id === this.selectedKey
})
console.log(idx);
this.dataSource.splice(idx, 1)
console.log("this.selectedKey", this.selectedKey);
if (this.selectedKey) {
let idx = this.dataSource.findIndex(item => {
return item.id === this.selectedKey
})
this.dataSource.splice(idx, 1)
this.initList()
} else {
this.$message.warning("Please select the data you want to delete.")
}
this.selectedKey = ""
},
onCellChange(id, dataIndex, value) {

View File

@ -1,5 +1,5 @@
<template>
<custom-modal v-model="visible" :width="1280" title="Mini Radionuclide Laboratory Reports" :destroyOnClose="true">
<custom-modal v-model="visible" :width="1280" title="Mini Radionuclide Laboratory Reports" :destroyOnClose="true" @cancel="handleCancel">
<a-spin :spinning="isLoading">
<div class="rlr">
<div class="rlr-tabs">
@ -71,7 +71,7 @@
<div slot="custom-footer" style="text-align: center;">
<a-space :size="20">
<a-button type="primary" @click="handleSave">Save</a-button>
<a-button @click="visible = false">Cancel</a-button>
<a-button @click="handleCancel">Cancel</a-button>
</a-space>
</div>
</custom-modal>
@ -96,6 +96,7 @@ import Mda from './components/MDA.vue'
import Conclusions from './components/Conclusions.vue'
import Comment from './components/Comment.vue'
import { getAction } from '@/api/manage'
import Custom from '@/views/account/settings/Custom.vue'
const tabs = [
'Header',
@ -134,7 +135,8 @@ export default {
GCoincidenceCorrection,
Mda,
Conclusions,
Comment
Comment,
Custom
},
props: {
sampleId: {
@ -150,7 +152,7 @@ export default {
}
},
mounted () {
sessionStorage.setItem("isCellEmpty",false);
sessionStorage.removeItem("isCellEmpty")
},
methods: {
handleSave() {
@ -161,9 +163,13 @@ export default {
this.$message.warning("Please finishi ti edit new inserted row first.")
}
},
handleCancel() {
this.visible = false
sessionStorage.removeItem("isCellEmpty")
},
handleChangeView(index) {
let val = sessionStorage.getItem("isCellEmpty")
if (val=="false") {
if (val=="false"||!val) {
this.activeKey = index
} else {
this.$message.warning("Please finishi ti edit new inserted row first.")
@ -229,4 +235,7 @@ export default {
}
}
}
/deep/.ant-modal-title{
letter-spacing: 1px;
}
</style>