diff --git a/magic-boot-ui/src/components/MagicBoot/mb-search.vue b/magic-boot-ui/src/components/MagicBoot/mb-search.vue new file mode 100644 index 0000000..2f67465 --- /dev/null +++ b/magic-boot-ui/src/components/MagicBoot/mb-search.vue @@ -0,0 +1,86 @@ + + + + + diff --git a/magic-boot-ui/src/components/MagicBoot/mb-table.vue b/magic-boot-ui/src/components/MagicBoot/mb-table.vue index 4453d42..f720352 100644 --- a/magic-boot-ui/src/components/MagicBoot/mb-table.vue +++ b/magic-boot-ui/src/components/MagicBoot/mb-table.vue @@ -102,16 +102,24 @@ export default { total: 0, list: [], listLoading: false, - tableKey: 0 + tableKey: 0, + newWhere: {} } }, watch: { data() { this.listCurrent = 1 this.handlerData() + }, + where: { + handler(){ + this.newWhere = this.$common.renderWhere(this.where) + }, + deep: true } }, created() { + this.newWhere = this.$common.renderWhere(this.where) }, mounted() { if (this.data) { @@ -125,15 +133,15 @@ export default { getList() { this.listLoading = true if (this.page) { - this.where.current = this.listCurrent - this.where.size = this.limit + this.newWhere.current = this.listCurrent + this.newWhere.size = this.limit } else { - this.where.size = 99999999 + this.newWhere.size = 99999999 } request({ url: this.url, method: this.method, - params: this.where + params: this.newWhere }).then(res => { const { data } = res this.total = data.total @@ -150,7 +158,7 @@ export default { } else { order = null } - this.where.orderBy = order + this.newWhere.orderBy = order this.reloadList() }, selectionChange(columns) { @@ -158,7 +166,7 @@ export default { }, reloadList() { if (this.url) { - this.where.current = 1 + this.newWhere.current = 1 this.listCurrent = 1 this.getList() } diff --git a/magic-boot-ui/src/scripts/common.js b/magic-boot-ui/src/scripts/common.js index e65d4df..673322b 100644 --- a/magic-boot-ui/src/scripts/common.js +++ b/magic-boot-ui/src/scripts/common.js @@ -60,8 +60,21 @@ const formatJson = (list, filterVal) => { })) } +common.renderWhere = (where) => { + var newWhere = {} + for(var key in where) { + if(where[key] instanceof Object){ + newWhere[key] = where[key].value + }else{ + newWhere[key] = where[key] + } + } + return newWhere +} + common.exportExcel = (options) => { - const where = options.where || {} + var where = options.where || {} + where = common.renderWhere(where) where.current = 1 where.size = 99999999 const url = options.url diff --git a/magic-boot-ui/src/views/system/dict/dict-items.vue b/magic-boot-ui/src/views/system/dict/dict-items.vue index 61dc558..b1b1265 100644 --- a/magic-boot-ui/src/views/system/dict/dict-items.vue +++ b/magic-boot-ui/src/views/system/dict/dict-items.vue @@ -1,21 +1,13 @@