Browse Source

列表查询过滤空字符串

test
liwei 3 years ago
parent
commit
6a85dad609
2 changed files with 16 additions and 6 deletions
  1. +11
    -6
      src/mixins/ListMixin.js
  2. +5
    -0
      src/views/system/menu/index.vue

+ 11
- 6
src/mixins/ListMixin.js View File

@ -22,11 +22,16 @@ export const ListMixin = {
// 查询分页列表
getList() {
this.loading = true;
for (let key in this.queryParams) {
if(this.queryParams[key] == ''){
this.queryParams[key]=undefined
}
}
get(this.queryTableDataUrl, { ...this.pagination, ...this.queryParams })
.then(({ code, data: { count = 0, records = [] } }) => {
.then(({ code, data: { count = 0, records = [] } }) => {
if (code === 200) {
this.tableData = records
this.pagination.total = count
this.tableData = records
this.pagination.total = count
this.loading = false
} else {
this.loading = false
@ -68,12 +73,12 @@ export const ListMixin = {
})
.then(() => {
this.msgSuccess("删除成功");
if(this.tableData.length>=1 && this.pagination.pageNumber>1){
this.pagination.pageNumber -=1;
if (this.tableData.length >= 1 && this.pagination.pageNumber > 1) {
this.pagination.pageNumber -= 1;
}
this.getList();
})
.catch(() => {});
.catch(() => { });
},
},
};

+ 5
- 0
src/views/system/menu/index.vue View File

@ -161,6 +161,11 @@ export default {
},
//
getTreeMenu() {
for (let key in this.queryParams) {
if(this.queryParams[key] == ''){
this.queryParams[key]=undefined
}
}
getTreeMenu(this.queryParams).then(({ code, data = [] }) => {
if (code == 200) {
this.tableData = data;


Loading…
Cancel
Save