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

user

parent b0b840e8
Pipeline #9122 passed with stage
in 5 seconds
...@@ -47,12 +47,8 @@ class UserController extends Controller { ...@@ -47,12 +47,8 @@ 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') {
where.dd_id = user.id;
where.dd_name = user.name;
Object.keys(ctx.query).forEach(key => { Object.keys(ctx.query).forEach(key => {
if (ctx.query[key] && this.indexRule.hasOwnProperty(key)) { if (ctx.query[key] && this.indexRule.hasOwnProperty(key)) {
if (key === 'status') { if (key === 'status') {
...@@ -64,9 +60,12 @@ class UserController extends Controller { ...@@ -64,9 +60,12 @@ class UserController extends Controller {
} }
} }
}); });
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