fix: 修复Sample菜单下的Sample列表存在的问题
This commit is contained in:
parent
0c06c5af79
commit
e7533a7fe2
|
@ -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))
|
||||
},
|
||||
|
||||
// 获取台站和探测器列表
|
||||
|
|
|
@ -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])
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user