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