From a2e757a170e5116dcbda3cca47ad4eef71c872e8 Mon Sep 17 00:00:00 2001 From: "peng.peng" Date: Wed, 1 Mar 2023 09:47:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=BB=93=E6=9E=84=E7=89=A9?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=94=A8=E6=88=B7=E5=88=97=E8=A1=A8=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/organization/user.js | 42 +++++++++++++++++-- api/app/lib/routes/organization/user.js | 3 ++ .../components/isuue-handle-mdal.js | 2 +- 3 files changed, 43 insertions(+), 4 deletions(-) diff --git a/api/app/lib/controllers/organization/user.js b/api/app/lib/controllers/organization/user.js index 92c0bf1..95bb780 100644 --- a/api/app/lib/controllers/organization/user.js +++ b/api/app/lib/controllers/organization/user.js @@ -235,7 +235,7 @@ async function creatUser(ctx, next) { delete: false, phone: data.phone, post: data.post, - structure:data.structure + structure: data.structure }) ctx.status = 204; @@ -276,7 +276,7 @@ async function updateUser(ctx, next) { delete: false, phone: data.phone, post: data.post, - structure:data.structure + structure: data.structure }, { where: { id: id @@ -376,6 +376,41 @@ async function updateUserPassword(ctx, next) { } } +async function getStructuresUsers(ctx, next) { + try { + const models = ctx.fs.dc.models; + + let userRes = await models.User.findAll({ + where: { + delete: false + }, + attributes: ['id', 'name', 'username', 'structure'], + order: [['id', 'asc']] + }) + + let structs = await models.Project.findAll({ + where: {}, + attributes: ['id', 'name',], + order: [['id', 'asc']], + }) + const rslt = []; + structs.map(s => { + rslt.push({ + id: s.id, + name: s.name, + users: userRes.filter(x => x.structure && x.structure.find(v => v == s.id)).map(d => { return { id: d.id, name: d.name } }) + }); + }) + ctx.status = 200; + ctx.body = rslt + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = { + "message": "获取用户信息失败" + } + } +} module.exports = { getDepMessage, @@ -387,5 +422,6 @@ module.exports = { updateUser, deleteUser, resetPwd, - updateUserPassword + updateUserPassword, + getStructuresUsers } \ No newline at end of file diff --git a/api/app/lib/routes/organization/user.js b/api/app/lib/routes/organization/user.js index 5b63e32..dab39b4 100644 --- a/api/app/lib/routes/organization/user.js +++ b/api/app/lib/routes/organization/user.js @@ -38,4 +38,7 @@ module.exports = function (app, router, opts) { */ app.fs.api.logAttr['PUT/user/password/:userId'] = { content: '修改用户密码', visible: false }; router.put('/user/password/:userId', user.updateUserPassword); + + app.fs.api.logAttr['GET/structures/users'] = { content: '获取结构物列表用户列表', visible: false }; + router.get('/structures/users', user.getStructuresUsers); }; \ No newline at end of file diff --git a/web/client/src/sections/issueHandle/components/isuue-handle-mdal.js b/web/client/src/sections/issueHandle/components/isuue-handle-mdal.js index dbe1bee..76905cf 100644 --- a/web/client/src/sections/issueHandle/components/isuue-handle-mdal.js +++ b/web/client/src/sections/issueHandle/components/isuue-handle-mdal.js @@ -36,7 +36,6 @@ export default (props) => { approvePerson: user, approveDate: moment() }, editData) - return true; } const renderPlanInfo = () => { @@ -147,6 +146,7 @@ export default (props) => { onFinish={async (values) => { if (editData?.patrolRecordIssueHandles[0]?.state === 2) { approveHandle(values) + return true; } else { values.startTime = values?.dateRange[0]; values.endTime = values?.dateRange[1];