update:
1. update category and pricelist
This commit is contained in:
@@ -48,7 +48,7 @@ export const remove = (ids) => {
|
||||
|
||||
export const add = (row) => {
|
||||
return request({
|
||||
url: '/kiosk/price-list/submit',
|
||||
url: '/kiosk/price-list/save',
|
||||
method: 'post',
|
||||
data: row
|
||||
})
|
||||
@@ -56,7 +56,7 @@ export const add = (row) => {
|
||||
|
||||
export const update = (row) => {
|
||||
return request({
|
||||
url: '/kiosk/price-list/submit',
|
||||
url: '/kiosk/price-list/update',
|
||||
method: 'post',
|
||||
data: row
|
||||
})
|
||||
|
||||
@@ -44,15 +44,16 @@
|
||||
v-model="formSub"
|
||||
:table-loading="loadingSub"
|
||||
ref="crudSub"
|
||||
@row-update="rowUpdate"
|
||||
@row-save="rowSave"
|
||||
@row-del="rowDel"
|
||||
@row-update="rowUpdateSub"
|
||||
@row-save="rowSaveSub"
|
||||
@row-del="rowDelSub"
|
||||
:before-open="beforeOpenSub"
|
||||
@search-change="searchChangeSub"
|
||||
@search-reset="searchResetSub"
|
||||
@selection-change="selectionChangeSub"
|
||||
@current-change="currentChangeSub"
|
||||
@size-change="sizeChangeSub"
|
||||
@refresh-change="refreshChangeSub"
|
||||
@on-load="onLoadSub">
|
||||
</avue-crud>
|
||||
</basic-container>
|
||||
@@ -66,7 +67,7 @@ import option from '@/option/kiosk/category';
|
||||
import { mapGetters } from 'vuex';
|
||||
import 'nprogress/nprogress.css';
|
||||
import optionSub from '@/option/kiosk/priceList';
|
||||
import { getSubList } from '@/api/kiosk/priceList';
|
||||
import { getSubList, add as addSub, update as updateSub, remove as removeSub } from '@/api/kiosk/priceList';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -83,8 +84,6 @@ export default {
|
||||
selectionList: [],
|
||||
option: option,
|
||||
data: [],
|
||||
treeDeptId: -1,
|
||||
treeParentId: 0,
|
||||
subVisible: false,
|
||||
direction: 'rtl',
|
||||
categoryId: 0,
|
||||
@@ -99,7 +98,7 @@ export default {
|
||||
currentPage: 1,
|
||||
total: 0
|
||||
},
|
||||
optionSub: optionSub,
|
||||
optionSub: optionSub
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
@@ -149,6 +148,20 @@ export default {
|
||||
window.console.log(error);
|
||||
});
|
||||
},
|
||||
rowSaveSub(row, done, loading) {
|
||||
row.categoryId = this.categoryId;
|
||||
addSub(row).then(() => {
|
||||
this.onLoadSub(this.page);
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: 'Success!'
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
loading();
|
||||
window.console.log(error);
|
||||
});
|
||||
},
|
||||
rowUpdate(row, index, done, loading) {
|
||||
update(row).then(() => {
|
||||
this.onLoad(this.page);
|
||||
@@ -162,6 +175,19 @@ export default {
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
rowUpdateSub(row, index, done, loading) {
|
||||
updateSub(row).then(() => {
|
||||
this.onLoadSub(this.page);
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: 'Success!'
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
loading();
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
rowDel(row) {
|
||||
this.$confirm('Confirmation for delete?', {
|
||||
confirmButtonText: 'Confirm',
|
||||
@@ -179,6 +205,23 @@ export default {
|
||||
});
|
||||
});
|
||||
},
|
||||
rowDelSub(row) {
|
||||
this.$confirm('Confirmation for delete?', {
|
||||
confirmButtonText: 'Confirm',
|
||||
cancelButtonText: 'Cancel',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
return removeSub(row.id);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoadSub(this.page);
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: 'Success!'
|
||||
});
|
||||
});
|
||||
},
|
||||
handleDelete() {
|
||||
if (this.selectionList.length === 0) {
|
||||
this.$message.warning('Please select one or more');
|
||||
@@ -235,6 +278,9 @@ export default {
|
||||
refreshChange() {
|
||||
this.onLoad(this.page, this.query);
|
||||
},
|
||||
refreshChangeSub() {
|
||||
this.onLoadSub(this.pageSub, this.querySub);
|
||||
},
|
||||
onLoad(page, params = {}) {
|
||||
this.loading = true;
|
||||
|
||||
@@ -261,8 +307,7 @@ export default {
|
||||
|
||||
let values = {
|
||||
...params,
|
||||
categoryId: this.categoryId,
|
||||
deptId: this.treeDeptId,
|
||||
categoryId: this.categoryId
|
||||
};
|
||||
getSubList(page.currentPage, page.pageSize, Object.assign(values, this.querySub)).then(res => {
|
||||
this.dataSub = res.data.data;
|
||||
@@ -299,7 +344,7 @@ export default {
|
||||
},
|
||||
sizeChangeSub(pageSize) {
|
||||
this.pageSub.pageSize = pageSize;
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user