fix: admin records filter by user_id instead of keyword search
- RecordView passes user_id as separate filter param, not as keyword - Admin records endpoint forwards user_id to DAO - treatmentDao.listAdmin supports exact user_id match filter - Added visible filter tag with clear button in RecordView
这个提交包含在:
@@ -105,9 +105,13 @@ async function updateDevice(deviceId, battery, temperature) {
|
||||
* @param {number} opts.offset
|
||||
* @returns {Promise<{records: Array, total: number}>}
|
||||
*/
|
||||
async function listAdmin({ keyword, dateFrom, dateTo, pageSize, offset }) {
|
||||
async function listAdmin({ keyword, userId, dateFrom, dateTo, pageSize, offset }) {
|
||||
const conditions = []
|
||||
const params = {}
|
||||
if (userId) {
|
||||
conditions.push('r.user_id = :user_id')
|
||||
params.user_id = userId
|
||||
}
|
||||
if (keyword) {
|
||||
conditions.push('u.nickname LIKE :kw')
|
||||
params.kw = '%' + keyword + '%'
|
||||
|
||||
@@ -227,6 +227,7 @@ router.get('/records', requireAdmin, wrap(async (req, res) => {
|
||||
const { page, pageSize, offset } = pageParams(req.query)
|
||||
const { records, total } = await treatmentDao.listAdmin({
|
||||
keyword: req.query.keyword,
|
||||
userId: req.query.user_id,
|
||||
dateFrom: req.query.date_from,
|
||||
dateTo: req.query.date_to,
|
||||
pageSize,
|
||||
|
||||
在新工单中引用
屏蔽一个用户