From adcd42b62a8fcf09fad91851445cf9b80b1a2b97 Mon Sep 17 00:00:00 2001 From: smallchill Date: Thu, 16 May 2019 23:45:41 +0800 Subject: [PATCH] :tada: 2.3.1.RELEASE --- .../resources/templates/saber/crud.vue.vm | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/blade-core-develop/src/main/resources/templates/saber/crud.vue.vm b/blade-core-develop/src/main/resources/templates/saber/crud.vue.vm index 24dad04..daa36aa 100644 --- a/blade-core-develop/src/main/resources/templates/saber/crud.vue.vm +++ b/blade-core-develop/src/main/resources/templates/saber/crud.vue.vm @@ -12,13 +12,15 @@ @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange" + @current-change="currentChange" + @size-change="sizeChange" @on-load="onLoad"> @@ -69,10 +71,10 @@ ...mapGetters(["permission"]), permissionList() { return { - addBtn: this.permission.$!{table.entityPath}_add, - viewBtn: this.permission.$!{table.entityPath}_view, - delBtn: this.permission.$!{table.entityPath}_delete, - editBtn: this.permission.$!{table.entityPath}_edit + addBtn: this.vaildData(this.permission.$!{cfg.entityKey}_add), + viewBtn: this.vaildData(this.permission.$!{cfg.entityKey}_view), + delBtn: this.vaildData(this.permission.$!{cfg.entityKey}_delete), + editBtn: this.vaildData(this.permission.$!{cfg.entityKey}_edit) }; }, ids() { @@ -84,7 +86,7 @@ } }, methods: { - rowSave(row, loading) { + rowSave(row, loading, done) { add(row).then(() => { loading(); this.onLoad(this.page); @@ -92,9 +94,12 @@ type: "success", message: "操作成功!" }); + }, error => { + done(); + console.log(error); }); }, - rowUpdate(row, index, loading) { + rowUpdate(row, index, loading, done) { update(row).then(() => { loading(); this.onLoad(this.page); @@ -102,6 +107,9 @@ type: "success", message: "操作成功!" }); + }, error => { + done(); + console.log(error); }); }, rowDel(row) { @@ -152,7 +160,6 @@ this.$refs.crud.toggleSelection(); }); }, - beforeOpen(done, type) { if (["edit", "view"].includes(type)) { getDetail(this.form.id).then(res => { @@ -161,6 +168,12 @@ } done(); }, + currentChange(currentPage){ + this.page.currentPage = currentPage; + }, + sizeChange(pageSize){ + this.page.pageSize = pageSize; + }, onLoad(page, params = {}) { getList(page.currentPage, page.pageSize, params).then(res => { const data = res.data.data;