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, addBtn: true,
editBtn: true, editBtn: true,
delBtn: true, delBtn: true,
selection: false, selection: true,
dialogClickModal: false, dialogClickModal: false,
// menuWidth: 150, // menuWidth: 150,
column: [ column: [

View File

@@ -55,6 +55,13 @@
@size-change="sizeChangeSub" @size-change="sizeChangeSub"
@refresh-change="refreshChangeSub" @refresh-change="refreshChangeSub"
@on-load="onLoadSub"> @on-load="onLoadSub">
<template #menu-left>
<el-button type="danger"
icon="el-icon-delete"
plain
@click="handleDeleteSub">Delete
</el-button>
</template>
</avue-crud> </avue-crud>
</basic-container> </basic-container>
</el-drawer> </el-drawer>
@@ -67,7 +74,13 @@ import option from '@/option/kiosk/category';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import 'nprogress/nprogress.css'; import 'nprogress/nprogress.css';
import optionSub from '@/option/kiosk/priceList'; 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 { export default {
data() { data() {
@@ -82,6 +95,7 @@ export default {
total: 0 total: 0
}, },
selectionList: [], selectionList: [],
selectionListSub: [],
option: option, option: option,
data: [], data: [],
subVisible: false, subVisible: false,
@@ -92,7 +106,6 @@ export default {
querySub: {}, querySub: {},
loadingSub: false, loadingSub: false,
dataSub: [], dataSub: [],
selectionListSub: [],
pageSub: { pageSub: {
pageSize: 30, pageSize: 30,
currentPage: 1, currentPage: 1,
@@ -132,7 +145,14 @@ export default {
ids.push(ele.id); ids.push(ele.id);
}); });
return ids.join(','); return ids.join(',');
} },
idsSub() {
let ids = [];
this.selectionListSub.forEach(ele => {
ids.push(ele.id);
});
return ids.join(',');
},
}, },
methods: { methods: {
rowSave(row, done, loading) { rowSave(row, done, loading) {
@@ -245,6 +265,28 @@ export default {
this.$refs.crud.toggleSelection(); 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) { beforeOpen(done, type) {
if (['edit', 'view'].includes(type)) { if (['edit', 'view'].includes(type)) {
getDetail(this.form.id).then(res => { getDetail(this.form.id).then(res => {
@@ -315,8 +357,7 @@ export default {
this.pageSub.total = data.total; this.pageSub.total = data.total;
this.dataSub = data.records; this.dataSub = data.records;
this.loadingSub = false; this.loadingSub = false;
this.selectionListSub = []; this.selectionClearSub();
this.$refs.crudSub.toggleSelection();
}); });
}, },
handleSubClose(hide) { handleSubClose(hide) {
@@ -343,6 +384,10 @@ export default {
selectionChangeSub(list) { selectionChangeSub(list) {
this.selectionListSub = list; this.selectionListSub = list;
}, },
selectionClearSub() {
this.selectionListSub = [];
this.$refs.crudSub.toggleSelection();
},
currentChangeSub(currentPage) { currentChangeSub(currentPage) {
this.pageSub.currentPage = currentPage; this.pageSub.currentPage = currentPage;
}, },