明树Git Lab

Commit 6994c29c authored by zfp1's avatar zfp1

update

parent 40ae8d31
Pipeline #106376 passed with stage
in 4 seconds
...@@ -182,15 +182,15 @@ async function getTzmbzrsInfo(req, res, next) { ...@@ -182,15 +182,15 @@ async function getTzmbzrsInfo(req, res, next) {
async function getProTzmbzrs(req, res, next) { async function getProTzmbzrs(req, res, next) {
try { try {
if(!req.body.projectId) { if (!req.body.projectId) {
return res.sendError(errorMessage.paramsError); return res.sendError(errorMessage.paramsError);
} }
let mbzrss = await DB.TzTzmbzrs.findAll({ let mbzrss = await DB.TzTzmbzrs.findAll({
where: {projectId: req.body.projectId, del: 0}, where: { projectId: req.body.projectId, del: 0 },
attributes: ['zrslx'], attributes: ['zrslx'],
raw: true raw: true
}); });
mbzrss = _.compact(mbzrss.map(o => {return o.zrslx})); mbzrss = _.compact(mbzrss.map(o => { return o.zrslx }));
return res.sendData(mbzrss); return res.sendData(mbzrss);
} catch (error) { } catch (error) {
next(error); next(error);
...@@ -418,15 +418,27 @@ async function getTzkzInfo(req, res, next) { ...@@ -418,15 +418,27 @@ async function getTzkzInfo(req, res, next) {
let newTze = []; let newTze = [];
for (let index = 0; index < keyindexs.length; index++) { for (let index = 0; index < keyindexs.length; index++) {
const element = keyindexs[index]; const element = keyindexs[index];
let obj ={ let obj = {
tables: tzeGroupByObj[element], tables: tzeGroupByObj[element],
bqsj: tzeGroupByObj[element] && tzeGroupByObj[element][0] && tzeGroupByObj[element][0].bqsj , bqsj: tzeGroupByObj[element] && tzeGroupByObj[element][0] && tzeGroupByObj[element][0].bqsj,
sqsj:tzeGroupByObj[element] && tzeGroupByObj[element][0] && tzeGroupByObj[element][0].sqsj, sqsj: tzeGroupByObj[element] && tzeGroupByObj[element][0] && tzeGroupByObj[element][0].sqsj,
key: tzeGroupByObj[element] && tzeGroupByObj[element][0] && tzeGroupByObj[element][0].key, key: tzeGroupByObj[element] && tzeGroupByObj[element][0] && tzeGroupByObj[element][0].key,
}; };
newTze.push(obj); newTze.push(obj);
} }
tzkz.tzkztzekzs = _.reverse(newTze); tzkz.tzkztzekzs = _.reverse(newTze);
//工期
let tzkzgqs = await DB.TzTzkzGq.findAll({
where: { projectId: tzkz.projectId, sourceId: tzkz.id },
raw: true
});
tzkz.tzkzgqs = tzkzgqs || [];
//环保
let tzkzaqzlhbs = await DB.TzTzkzAqzlhb.findAll({
where: { projectId: tzkz.projectId, sourceId: tzkz.id },
raw: true
});
tzkz.tzkzaqzlhbs = tzkzaqzlhbs || [];
return res.sendData(tzkz); return res.sendData(tzkz);
} catch (error) { } catch (error) {
next(error); next(error);
...@@ -1011,7 +1023,7 @@ async function createXmtc(req, res, next) { ...@@ -1011,7 +1023,7 @@ async function createXmtc(req, res, next) {
req.body.tcwj = (req.body.tcwj || []).map(o => { return o && o.id || o }); req.body.tcwj = (req.body.tcwj || []).map(o => { return o && o.id || o });
let ret = await DB.TzXmtc.create(req.body); let ret = await DB.TzXmtc.create(req.body);
let tccwzbs = (req.body.tccwzbs || []).map(o => { o.projectId = req.body.projectId;o.sourceId = ret.id; return o; }); let tccwzbs = (req.body.tccwzbs || []).map(o => { o.projectId = req.body.projectId; o.sourceId = ret.id; return o; });
delete req.body.tccwzbs; delete req.body.tccwzbs;
await DB.TzXmtcCwzb.bulkCreate(tccwzbs); await DB.TzXmtcCwzb.bulkCreate(tccwzbs);
return res.sendData(ret); return res.sendData(ret);
......
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