Browse Source

审批人修改

master
wenlele 1 year ago
parent
commit
fd210e8f35
  1. 7
      api/app/lib/controllers/resourceConsumption/index.js
  2. 4
      api/app/lib/index.js
  3. 2
      web/client/src/sections/resourceConsumption/containers/approve.js
  4. 6
      web/client/src/sections/resourceConsumption/containers/myApplication.js

7
api/app/lib/controllers/resourceConsumption/index.js

@ -16,6 +16,11 @@ function getApproveList (opts) {
distinct: true,
include: [{
model: models.User,
as:'applyUser',
attributes: ['id', 'name']
},{
model: models.User,
as:'approveUser',
attributes: ['id', 'name']
},]
}
@ -23,7 +28,7 @@ function getApproveList (opts) {
option.where.resourceName = { $iLike: `%${resourceName}%` }
}
if (applyBy) {
option.include[0].where = { '$user.name$': { $iLike: `%${applyBy}%` } }
option.include[0].where = { '$applyUser.name$': { $iLike: `%${applyBy}%` } }
}
if (applyById) {
option.where.applyBy = applyById

4
api/app/lib/index.js

@ -85,5 +85,7 @@ module.exports.models = function (dc) {
BusinessMetadataDatabase.belongsTo(User, { foreignKey: 'createBy', targetKey: 'id' });
BusinessMetadataFile.belongsTo(User, { foreignKey: 'createBy', targetKey: 'id' });
BusinessMetadataRestapi.belongsTo(User, { foreignKey: 'createBy', targetKey: 'id' });
ResourceConsumption.belongsTo(User, { foreignKey: 'applyBy', targetKey: 'id' });
ResourceConsumption.belongsTo(User, { foreignKey: 'applyBy', targetKey: 'id' ,as:"applyUser"});
ResourceConsumption.belongsTo(User, { foreignKey: 'approveBy', targetKey: 'id',as:'approveUser' });
};

2
web/client/src/sections/resourceConsumption/containers/approve.js

@ -40,7 +40,7 @@ function Approve ({ loading, clientHeight, actions, dispatch, }) {
}, {
title: '申请人',
dataIndex: 'applyBy',
render: (text, record) => record?.user?.name
render: (text, record) => record?.applyUser?.name
}, {
title: '需求描述',
dataIndex: 'requirements',

6
web/client/src/sections/resourceConsumption/containers/myApplication.js

@ -35,9 +35,9 @@ function MyApplication ({ loading, clientHeight, actions, dispatch, user }) {
title: '资源名称',
dataIndex: 'resourceName',
}, {
title: '申请人',
dataIndex: 'applyBy',
render: (text, record) => record?.user?.name
title: '审批人',
dataIndex: 'approveBy',
render: (text, record) => record?.approveUser?.name
}, {
title: '需求描述',
dataIndex: 'requirements',

Loading…
Cancel
Save