scinote-web/app/javascript/vue/shared/datatable/mixins/card_selector.js

22 lines
546 B
JavaScript
Raw Normal View History

2023-12-01 07:01:08 +08:00
export default {
2024-04-01 19:53:45 +08:00
computed: {
cardSelected() {
const item = this.dtComponent.selectedRows.find((i) => (i.code === this.params.code));
2024-04-01 19:53:45 +08:00
return !!item;
}
},
2023-12-01 07:01:08 +08:00
methods: {
itemSelected() {
const item = this.dtComponent.selectedRows.find((i) => (i.code === this.params.code));
2023-12-01 07:01:08 +08:00
if (item) {
this.dtComponent.selectedRows = this.dtComponent.selectedRows
2024-04-01 19:53:45 +08:00
.filter((i) => (i.code !== this.params.code));
2023-12-01 07:01:08 +08:00
} else {
this.dtComponent.selectedRows.push(this.params);
2023-12-01 07:01:08 +08:00
}
2023-12-11 16:18:22 +08:00
},
},
};