说明
1.程序基于uni-admin管理系统(用户)的模糊查询和筛选查询
2.程序由schema2code自动生成,添加几行代码即可
3.如果内容对各位有帮助请关注一下,创作不易
模糊查询
let newWheres =this.getWhere();
let newWhere=newWheres.length>0?'('+newWheres+') && u_id == $cloudEnv_uid':'u_id == $cloudEnv_uid'
筛选查询
newWhere.u_id=db.getCloudEnv('$cloudEnv_uid')
示例
const dbOrderBy = 'create_date desc' // 排序字段,asc(升序)、desc(降序)
const dbSearchFields = ["title","description","reject_description"] // 模糊搜索字段,支持模糊搜索的字段列表。联表查询格式: 主表字段名.副表字段名,例如用户表关联角色表 role.role_name
export default {
methods: {
// 模糊查询
search() {
let newWheres =this.getWhere();
let newWhere=newWheres.length>0?'('+newWheres+') && u_id == $cloudEnv_uid':'u_id == $cloudEnv_uid'
this.where = newWhere
this.$nextTick(() => {
this.loadData()
})
},
// 筛选查询
filterChange(e, name) {
this._filter[name] = {
type: e.filterType,
value: e.filter
}
let newWhere = filterToWhere(this._filter, db.command)
newWhere.u_id=db.getCloudEnv('$cloudEnv_uid')
if (Object.keys(newWhere).length) {
this.where = newWhere
} else {
this.where = ''
}
this.$nextTick(() => {
this.$refs.udb.loadData()
})
}
}
}
6 个评论
要回复文章请先登录或注册
1***@qq.com
代木
3***@qq.com
hws007
hws007
1***@qq.com