fix: 修复Sample菜单下的Sample列表存在的问题

This commit is contained in:
Xu Zhimeng 2023-09-27 15:38:36 +08:00
parent 0c06c5af79
commit e7533a7fe2
3 changed files with 25 additions and 20 deletions

View File

@ -37,6 +37,7 @@
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getAction } from '../../../../api/manage'
import moment from 'moment'
import { cloneDeep } from 'lodash'
const columns = [
{
@ -201,7 +202,7 @@ export default {
}
this.selectedRowKeys = []
this.visible = false
this.$emit('loadSample', this.selectionRows)
this.$emit('loadSample', cloneDeep(this.selectionRows))
},
//

View File

@ -1,11 +1,16 @@
<template>
<a-menu class="spectra-list-in-menu">
<a-menu-item class="spectra-list-in-menu-item" v-for="(item,index) in list" :key="`${item.sampleId}${index}`" @click="handleClick(item)">
<a-menu-item
class="spectra-list-in-menu-item"
v-for="(item, index) in list"
:key="`${item.sampleId}${index}`"
@click="handleClick(item)"
>
<span class="checkbox">
<a-icon v-if="item.checked" type="check" style="color: #0de30d" />
</span>
<span class="name">{{ item.inputFileName }}</span>
<a-icon type="delete" @click.stop="handleRemove(item)" />
<a-icon type="delete" @click.stop="handleRemove(item, index)" />
</a-menu-item>
</a-menu>
</template>
@ -26,25 +31,25 @@ export default {
this.$forceUpdate()
},
handleRemove(spectraItem) {
const index = this.list.findIndex(item => item == spectraItem)
this.list.splice(index, 1)
handleRemove(spectraItem, index) {
//
if (spectraItem.checked) {
if (index == 0) {
//
this.handleClick(this.list[0])
} else {
//
// //
if (index == this.list.length - 1) {
this.handleClick(this.list[index - 1])
}
//
else {
this.handleClick(this.list[index + 1])
}
}
this.list.splice(index, 1)
this.$forceUpdate()
}
},
watch: {
list(newVal) {
if (newVal.length) {
if (newVal.length && !newVal.find(item => item.checked)) {
this.handleClick(newVal[0])
}
}

View File

@ -382,12 +382,12 @@ export default {
},
created() {
this.$bus.$on('reanalyse', this.handleReanalyse)
this.loadSelectedSample({
sampleId: 426530,
sampleType: 'G',
dbName: 'auto',
inputFileName: 'CAX05_001-20230731_1528_S_FULL_37563.6.PHD',
})
// this.loadSelectedSample({
// sampleId: 426530,
// sampleType: 'G',
// dbName: 'auto',
// inputFileName: 'CAX05_001-20230731_1528_S_FULL_37563.6.PHD',
// })
},
destroyed() {
@ -679,8 +679,7 @@ export default {
if (spectra) {
this.loadSelectedSample(spectra)
} else {
this.analysisType = undefined
this.sampleData = {}
this.handleCleanAll()
}
},
},