Commit 459d00cf authored by 姜登's avatar 姜登

user

parent b0b840e8
Pipeline #9122 passed with stage
in 5 seconds
...@@ -47,26 +47,25 @@ class UserController extends Controller { ...@@ -47,26 +47,25 @@ class UserController extends Controller {
const { ctx, service } = this; const { ctx, service } = this;
const Op = ctx.app.Sequelize.Op; const Op = ctx.app.Sequelize.Op;
ctx.validate(this.indexRule, ctx.query); ctx.validate(this.indexRule, ctx.query);
const { type } = ctx.query;
const user = await service.user.getUserInfo(); const user = await service.user.getUserInfo();
const where = {}; const where = {};
if (type !== 'all') { Object.keys(ctx.query).forEach(key => {
where.dd_id = user.id; if (ctx.query[key] && this.indexRule.hasOwnProperty(key)) {
where.dd_name = user.name; if (key === 'status') {
Object.keys(ctx.query).forEach(key => { where[key] = ctx.query[key];
if (ctx.query[key] && this.indexRule.hasOwnProperty(key)) { } else {
if (key === 'status') { where[key] = {
where[key] = ctx.query[key]; [Op.like]: `%${ctx.query[key]}%`,
} else { };
where[key] = {
[Op.like]: `%${ctx.query[key]}%`,
};
}
} }
}); }
});
if (user.department[0].name === '战略合作组' || user.department[0].name === '数据项目组') {
where.dd_id = user.department[0].id;
where.dd_name = user.name;
} }
const accountData = await service.user.fetchAccount(where, ctx.pagination); const accountData = await service.user.fetchAccount(where, ctx.pagination);
const total = await service.user.count({ dd_id: user.id, dd_name: user.name, ...where }); const total = await service.user.count(where);
ctx.success({ data: accountData, total, ...ctx.pagination }); ctx.success({ data: accountData, total, ...ctx.pagination });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment