fix: 修复Sample菜单下的Sample列表存在的问题
This commit is contained in:
parent
0c06c5af79
commit
e7533a7fe2
|
@ -37,6 +37,7 @@
|
||||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
||||||
import { getAction } from '../../../../api/manage'
|
import { getAction } from '../../../../api/manage'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
|
import { cloneDeep } from 'lodash'
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
|
@ -201,7 +202,7 @@ export default {
|
||||||
}
|
}
|
||||||
this.selectedRowKeys = []
|
this.selectedRowKeys = []
|
||||||
this.visible = false
|
this.visible = false
|
||||||
this.$emit('loadSample', this.selectionRows)
|
this.$emit('loadSample', cloneDeep(this.selectionRows))
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取台站和探测器列表
|
// 获取台站和探测器列表
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
<template>
|
<template>
|
||||||
<a-menu class="spectra-list-in-menu">
|
<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">
|
<span class="checkbox">
|
||||||
<a-icon v-if="item.checked" type="check" style="color: #0de30d" />
|
<a-icon v-if="item.checked" type="check" style="color: #0de30d" />
|
||||||
</span>
|
</span>
|
||||||
<span class="name">{{ item.inputFileName }}</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-item>
|
||||||
</a-menu>
|
</a-menu>
|
||||||
</template>
|
</template>
|
||||||
|
@ -26,25 +31,25 @@ export default {
|
||||||
this.$forceUpdate()
|
this.$forceUpdate()
|
||||||
},
|
},
|
||||||
|
|
||||||
handleRemove(spectraItem) {
|
handleRemove(spectraItem, index) {
|
||||||
const index = this.list.findIndex(item => item == spectraItem)
|
|
||||||
this.list.splice(index, 1)
|
|
||||||
// 如果删除了一个选中的
|
// 如果删除了一个选中的
|
||||||
if (spectraItem.checked) {
|
if (spectraItem.checked) {
|
||||||
if (index == 0) {
|
// // 如果是倒数第一个,则选中上一个
|
||||||
// 如果是第一个,则选中下一个
|
if (index == this.list.length - 1) {
|
||||||
this.handleClick(this.list[0])
|
|
||||||
} else {
|
|
||||||
// 如果不是第一个,则选中上一个
|
|
||||||
this.handleClick(this.list[index - 1])
|
this.handleClick(this.list[index - 1])
|
||||||
}
|
}
|
||||||
|
// 否则选中下一个
|
||||||
|
else {
|
||||||
|
this.handleClick(this.list[index + 1])
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
this.list.splice(index, 1)
|
||||||
this.$forceUpdate()
|
this.$forceUpdate()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
list(newVal) {
|
list(newVal) {
|
||||||
if (newVal.length) {
|
if (newVal.length && !newVal.find(item => item.checked)) {
|
||||||
this.handleClick(newVal[0])
|
this.handleClick(newVal[0])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -382,12 +382,12 @@ export default {
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.$bus.$on('reanalyse', this.handleReanalyse)
|
this.$bus.$on('reanalyse', this.handleReanalyse)
|
||||||
this.loadSelectedSample({
|
// this.loadSelectedSample({
|
||||||
sampleId: 426530,
|
// sampleId: 426530,
|
||||||
sampleType: 'G',
|
// sampleType: 'G',
|
||||||
dbName: 'auto',
|
// dbName: 'auto',
|
||||||
inputFileName: 'CAX05_001-20230731_1528_S_FULL_37563.6.PHD',
|
// inputFileName: 'CAX05_001-20230731_1528_S_FULL_37563.6.PHD',
|
||||||
})
|
// })
|
||||||
},
|
},
|
||||||
|
|
||||||
destroyed() {
|
destroyed() {
|
||||||
|
@ -679,8 +679,7 @@ export default {
|
||||||
if (spectra) {
|
if (spectra) {
|
||||||
this.loadSelectedSample(spectra)
|
this.loadSelectedSample(spectra)
|
||||||
} else {
|
} else {
|
||||||
this.analysisType = undefined
|
this.handleCleanAll()
|
||||||
this.sampleData = {}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user