处理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> <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" /> <img slot="closeIcon" src="@/assets/images/global/close.png" />
<div slot="title"> <div slot="title">
<div class="custom-modal-title"> <div class="custom-modal-title">
@ -76,6 +76,9 @@ export default {
}, },
onCancel() { onCancel() {
this.visible = false this.visible = false
},
handleCancel() {
this.$emit("cancel")
} }
}, },
computed: { computed: {

View File

@ -6,6 +6,7 @@
<script> <script>
import TableWithOperators from './TableWithOperators.vue' import TableWithOperators from './TableWithOperators.vue'
import { cloneDeep } from 'lodash'
const columns = [ const columns = [
{ {
title: 'Index', title: 'Index',
@ -73,11 +74,33 @@ export default {
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() { data() {
this.columns = columns this.columns = columns
return { 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> </script>

View File

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

View File

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