明树Git Lab

Commit 7c11039d authored by zfp1's avatar zfp1

update

parent 6b0c978e
Pipeline #112129 passed with stage
in 3 seconds
...@@ -636,7 +636,7 @@ async function xiangmujuecegengxin(body, projectLzType) { ...@@ -636,7 +636,7 @@ async function xiangmujuecegengxin(body, projectLzType) {
await DB.ProjectBjtj.destroy({ where: { projectId: projectInfo.id, id: { [Op.notIn]: pnids4 } } }); await DB.ProjectBjtj.destroy({ where: { projectId: projectInfo.id, id: { [Op.notIn]: pnids4 } } });
await DB.ProjectBjtj.bulkCreate(newprojectBjtjs); await DB.ProjectBjtj.bulkCreate(newprojectBjtjs);
console.log(newprojectBjtjs, pnids4, pns4); console.log(newprojectBjtjs, pnids4, pns4);
await Promise.all(pns4.map(item => { return DB.ProjectBjtj.update(item, { where: { id: item.id } }) })).catch(err => {console.log(err)}); await Promise.all(pns4.map(item => { return DB.ProjectBjtj.update(item, { where: { id: item.id } }) })).catch(err => { console.log(err) });
// 处理 projectFxgl // 处理 projectFxgl
let projectFxgls = body.projectFxgls || []; let projectFxgls = body.projectFxgls || [];
let pnids5 = [], pns5 = [], newprojectFxgls = []; let pnids5 = [], pns5 = [], newprojectFxgls = [];
...@@ -1303,6 +1303,18 @@ async function listProject(req, res, next) { ...@@ -1303,6 +1303,18 @@ async function listProject(req, res, next) {
} }
async function getXmCompanyUser(req, res, next) { async function getXmCompanyUser(req, res, next) {
let mak = null;
if (req.user.roles && req.user.roles.length) {
for (let i = 0; i < req.user.roles.length; i++) {
const element = req.user.roles[i];
if((element.key || element) == "admin") {
mak = true;
}
}
}
if(mak) {
return { type: 1 } //集团用户
}
let userDepart = await DB.UserDepart.findOne({ where: { userId: req.user.id }, raw: true }); let userDepart = await DB.UserDepart.findOne({ where: { userId: req.user.id }, raw: true });
if (!(userDepart && userDepart.departId)) { if (!(userDepart && userDepart.departId)) {
return { type: 0 } return { type: 0 }
...@@ -1620,15 +1632,15 @@ async function getCompanyProjectApprover(req, res, next) { ...@@ -1620,15 +1632,15 @@ async function getCompanyProjectApprover(req, res, next) {
async function updateSnap(req, res, next) { async function updateSnap(req, res, next) {
try { try {
let {lixiang, juece, zaijuece} = req.body; let { lixiang, juece, zaijuece } = req.body;
if(lixiang && lixiang.id) { if (lixiang && lixiang.id) {
await DB.ProjectLixiang.update({lixiang}, {where: {projectId: lixiang.id}}); await DB.ProjectLixiang.update({ lixiang }, { where: { projectId: lixiang.id } });
} }
if(juece && juece.id) { if (juece && juece.id) {
await DB.ProjectLixiang.update({juece}, {where: {projectId: juece.id}}); await DB.ProjectLixiang.update({ juece }, { where: { projectId: juece.id } });
} }
if(zaijuece && zaijuece.id) { if (zaijuece && zaijuece.id) {
await DB.ProjectLixiang.update({zaijuece}, {where: {projectId: zaijuece.id}}); await DB.ProjectLixiang.update({ zaijuece }, { where: { projectId: zaijuece.id } });
} }
return res.sendData({}) return res.sendData({})
} catch (error) { } catch (error) {
......
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