mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-05 20:23:16 +08:00
Merge pull request #7402 from wandji20/wb-SCI-10553
Fix Card selector issues [SCI-10553]
This commit is contained in:
commit
b80aa87c17
3 changed files with 12 additions and 2 deletions
|
@ -6,6 +6,7 @@
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
class="sci-checkbox"
|
class="sci-checkbox"
|
||||||
|
:checked="cardSelected"
|
||||||
@change="itemSelected"
|
@change="itemSelected"
|
||||||
/>
|
/>
|
||||||
<label :for="params.id" class="sci-checkbox-label"></label>
|
<label :for="params.id" class="sci-checkbox-label"></label>
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
class="sci-checkbox"
|
class="sci-checkbox"
|
||||||
|
:checked="cardSelected"
|
||||||
@change="itemSelected"
|
@change="itemSelected"
|
||||||
/>
|
/>
|
||||||
<label :for="params.id" class="sci-checkbox-label"></label>
|
<label :for="params.id" class="sci-checkbox-label"></label>
|
||||||
|
@ -49,6 +50,7 @@
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
class="sci-checkbox"
|
class="sci-checkbox"
|
||||||
|
:checked="cardSelected"
|
||||||
@change="itemSelected"
|
@change="itemSelected"
|
||||||
/>
|
/>
|
||||||
<label :for="params.id" class="sci-checkbox-label"></label>
|
<label :for="params.id" class="sci-checkbox-label"></label>
|
||||||
|
|
|
@ -1,11 +1,18 @@
|
||||||
export default {
|
export default {
|
||||||
|
computed: {
|
||||||
|
cardSelected() {
|
||||||
|
const item = this.dtComponent.selectedRows.find((i) => (i.code === this.params.code));
|
||||||
|
|
||||||
|
return !!item;
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
itemSelected() {
|
itemSelected() {
|
||||||
const item = this.dtComponent.selectedRows.find((i) => (i.id === this.params.id));
|
const item = this.dtComponent.selectedRows.find((i) => (i.code === this.params.code));
|
||||||
|
|
||||||
if (item) {
|
if (item) {
|
||||||
this.dtComponent.selectedRows = this.dtComponent.selectedRows
|
this.dtComponent.selectedRows = this.dtComponent.selectedRows
|
||||||
.filter((i) => (i.id !== this.params.id));
|
.filter((i) => (i.code !== this.params.code));
|
||||||
} else {
|
} else {
|
||||||
this.dtComponent.selectedRows.push(this.params);
|
this.dtComponent.selectedRows.push(this.params);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue