1. update category and pricelist
This commit is contained in:
2025-11-14 16:16:47 +08:00
parent 2645f4ab7a
commit 1d41e8237e
2 changed files with 51 additions and 6 deletions

View File

@@ -9,7 +9,7 @@ export default {
addBtn: true,
editBtn: true,
delBtn: true,
selection: false,
selection: true,
dialogClickModal: false,
// menuWidth: 150,
column: [

View File

@@ -55,6 +55,13 @@
@size-change="sizeChangeSub"
@refresh-change="refreshChangeSub"
@on-load="onLoadSub">
<template #menu-left>
<el-button type="danger"
icon="el-icon-delete"
plain
@click="handleDeleteSub">Delete
</el-button>
</template>
</avue-crud>
</basic-container>
</el-drawer>
@@ -67,7 +74,13 @@ import option from '@/option/kiosk/category';
import { mapGetters } from 'vuex';
import 'nprogress/nprogress.css';
import optionSub from '@/option/kiosk/priceList';
import { getSubList, getDetail as getDetailSub, add as addSub, update as updateSub, remove as removeSub } from '@/api/kiosk/priceList';
import {
getSubList,
getDetail as getDetailSub,
add as addSub,
update as updateSub,
remove as removeSub
} from '@/api/kiosk/priceList';
export default {
data() {
@@ -82,6 +95,7 @@ export default {
total: 0
},
selectionList: [],
selectionListSub: [],
option: option,
data: [],
subVisible: false,
@@ -92,7 +106,6 @@ export default {
querySub: {},
loadingSub: false,
dataSub: [],
selectionListSub: [],
pageSub: {
pageSize: 30,
currentPage: 1,
@@ -132,7 +145,14 @@ export default {
ids.push(ele.id);
});
return ids.join(',');
}
},
idsSub() {
let ids = [];
this.selectionListSub.forEach(ele => {
ids.push(ele.id);
});
return ids.join(',');
},
},
methods: {
rowSave(row, done, loading) {
@@ -245,6 +265,28 @@ export default {
this.$refs.crud.toggleSelection();
});
},
handleDeleteSub() {
if (this.selectionListSub.length === 0) {
this.$message.warning('Please select one or more');
return;
}
this.$confirm('Confirmation for Delete?', {
confirmButtonText: 'Confirm',
cancelButtonText: 'Cancel',
type: 'warning'
})
.then(() => {
return removeSub(this.idsSub);
})
.then(() => {
this.onLoadSub(this.pageSub);
this.$message({
type: 'success',
message: 'Success!'
});
this.$refs.crudSub.toggleSelection();
});
},
beforeOpen(done, type) {
if (['edit', 'view'].includes(type)) {
getDetail(this.form.id).then(res => {
@@ -315,8 +357,7 @@ export default {
this.pageSub.total = data.total;
this.dataSub = data.records;
this.loadingSub = false;
this.selectionListSub = [];
this.$refs.crudSub.toggleSelection();
this.selectionClearSub();
});
},
handleSubClose(hide) {
@@ -343,6 +384,10 @@ export default {
selectionChangeSub(list) {
this.selectionListSub = list;
},
selectionClearSub() {
this.selectionListSub = [];
this.$refs.crudSub.toggleSelection();
},
currentChangeSub(currentPage) {
this.pageSub.currentPage = currentPage;
},