Browse Source

获取结构物列表用户列表提交

master
peng.peng 2 years ago
parent
commit
a2e757a170
  1. 42
      api/app/lib/controllers/organization/user.js
  2. 3
      api/app/lib/routes/organization/user.js
  3. 2
      web/client/src/sections/issueHandle/components/isuue-handle-mdal.js

42
api/app/lib/controllers/organization/user.js

@ -235,7 +235,7 @@ async function creatUser(ctx, next) {
delete: false, delete: false,
phone: data.phone, phone: data.phone,
post: data.post, post: data.post,
structure:data.structure structure: data.structure
}) })
ctx.status = 204; ctx.status = 204;
@ -276,7 +276,7 @@ async function updateUser(ctx, next) {
delete: false, delete: false,
phone: data.phone, phone: data.phone,
post: data.post, post: data.post,
structure:data.structure structure: data.structure
}, { }, {
where: { where: {
id: id 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 = { module.exports = {
getDepMessage, getDepMessage,
@ -387,5 +422,6 @@ module.exports = {
updateUser, updateUser,
deleteUser, deleteUser,
resetPwd, resetPwd,
updateUserPassword updateUserPassword,
getStructuresUsers
} }

3
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 }; app.fs.api.logAttr['PUT/user/password/:userId'] = { content: '修改用户密码', visible: false };
router.put('/user/password/:userId', user.updateUserPassword); router.put('/user/password/:userId', user.updateUserPassword);
app.fs.api.logAttr['GET/structures/users'] = { content: '获取结构物列表用户列表', visible: false };
router.get('/structures/users', user.getStructuresUsers);
}; };

2
web/client/src/sections/issueHandle/components/isuue-handle-mdal.js

@ -36,7 +36,6 @@ export default (props) => {
approvePerson: user, approvePerson: user,
approveDate: moment() approveDate: moment()
}, editData) }, editData)
return true;
} }
const renderPlanInfo = () => { const renderPlanInfo = () => {
@ -147,6 +146,7 @@ export default (props) => {
onFinish={async (values) => { onFinish={async (values) => {
if (editData?.patrolRecordIssueHandles[0]?.state === 2) { if (editData?.patrolRecordIssueHandles[0]?.state === 2) {
approveHandle(values) approveHandle(values)
return true;
} else { } else {
values.startTime = values?.dateRange[0]; values.startTime = values?.dateRange[0];
values.endTime = values?.dateRange[1]; values.endTime = values?.dateRange[1];

Loading…
Cancel
Save