Files
gin-vue-admin/web/src/components/mixins/infoList.js
QM303176530 41c4b8f0a5 代码生成器支持直接使用字典
修复查询涉及sql关键字时sql语句报错问题
2020-07-18 14:39:03 +08:00

37 lines
1.1 KiB
JavaScript

import { getDict } from "@/utils/dictionary";
export default {
data() {
return {
page: 1,
total: 10,
pageSize: 10,
tableData: [],
searchInfo: {}
}
},
methods: {
filterDict(value,type){
const rowLabel = this[type+"Options"]&&this[type+"Options"].filter(item=>item.value == value)
return rowLabel&&rowLabel[0]&&rowLabel[0].label
},
async getDict(type){
const dicts = await getDict(type)
this[type+"Options"] = dicts
},
handleSizeChange(val) {
this.pageSize = val
this.getTableData()
},
handleCurrentChange(val) {
this.page = val
this.getTableData()
},
async getTableData(page = this.page, pageSize = this.pageSize) {
const table = await this.listApi({ page, pageSize, ...this.searchInfo })
this.tableData = table.data.list
this.total = table.data.total
this.page = table.data.page
this.pageSize = table.data.pageSize
}
}
}