明树Git Lab

Commit bb3d76a2 authored by zfp1's avatar zfp1

update

parent 27516f5e
Pipeline #106430 passed with stage
in 3 seconds
......@@ -134,7 +134,7 @@ async function createYyqtzjc(req, res, next) {
if (!req.body.projectId) {
return res.sendError(errorMessage.paramsError);
}
let ret = await DB.ThTzYyqtzjc.create(req.body);
let ret = await DB.ThYyqtzjc.create(req.body);
//日常自查 投资(成本)分析会
let yyqtzjcTzfxs = req.body.yyqtzjcTzfxs || [];
......@@ -170,9 +170,9 @@ async function createYyqtzjc(req, res, next) {
delete req.body.yyqtzjcZxjcs;
//创建
await DB.ThTzYyqtzjcTzfx.bulkCreate(yyqtzjcTzfxs);
// await DB.ThTzYyqtzjcrcjc.bulkCreate(yyqtzjcrcjcs);
await DB.ThTzYyqtzjcZxjc.bulkCreate(yyqtzjcZxjcs);
await DB.ThYyqtzjcTzfx.bulkCreate(yyqtzjcTzfxs);
// await DB.ThYyqtzjcrcjc.bulkCreate(yyqtzjcrcjcs);
await DB.ThYyqtzjcZxjc.bulkCreate(yyqtzjcZxjcs);
return res.sendData(ret);
} catch (error) {
next(error);
......@@ -188,27 +188,27 @@ async function getYyqtzjcInfo(req, res, next) {
if (_.isEmpty(search)) {
return res.sendError(errorMessage.paramsError);
}
let jsqtzjc = await DB.ThTzYyqtzjc.findOne({ where: search, raw: true });
let jsqtzjc = await DB.ThYyqtzjc.findOne({ where: search, raw: true });
if (!(jsqtzjc && jsqtzjc.id && jsqtzjc.projectId)) {
return res.sendError(errorMessage.resourceNotFound);
}
let newyyqtzjcTzfxs = [], newyyqtzjcrcjcs = [], newyyqtzjcZxjcs = [];
let yyqtzjcTzfxs = await DB.ThTzYyqtzjcTzfx.findAll({ where: { projectId: jsqtzjc.projectId, sourceId: req.body.id }, raw: true });
let yyqtzjcTzfxs = await DB.ThYyqtzjcTzfx.findAll({ where: { projectId: jsqtzjc.projectId, sourceId: req.body.id }, raw: true });
for (let index = 0; index < yyqtzjcTzfxs.length; index++) {
let element = yyqtzjcTzfxs[index];
// fileids.concat(element.tzcbfxhzl || []);
element.tzcbfxhzl = await DB.File.findAll({ where: { id: { [Op.in]: element.tzcbfxhzl } } });
newyyqtzjcTzfxs.push(element);
}
// let yyqtzjcrcjcs = await DB.ThTzYyqtzjcrcjc.findAll({ where: { projectId: jsqtzjc.projectId , sourceId: req.body.id}, raw: true });
// let yyqtzjcrcjcs = await DB.ThYyqtzjcrcjc.findAll({ where: { projectId: jsqtzjc.projectId , sourceId: req.body.id}, raw: true });
// for (let index = 0; index < yyqtzjcrcjcs.length; index++) {
// const element = yyqtzjcrcjcs[index];
// // fileids.concat(element.fxcl || []);
// element.fxcl = await DB.File.findAll({ where: { id: { [Op.in]: element.fxcl } } });
// newyyqtzjcrcjcs.push(element);
// }
let yyqtzjcZxjcs = await DB.ThTzYyqtzjcZxjc.findAll({ where: { projectId: jsqtzjc.projectId, sourceId: req.body.id }, raw: true });
let yyqtzjcZxjcs = await DB.ThYyqtzjcZxjc.findAll({ where: { projectId: jsqtzjc.projectId, sourceId: req.body.id }, raw: true });
for (let index = 0; index < yyqtzjcZxjcs.length; index++) {
const element = yyqtzjcZxjcs[index];
// fileids.concat(element.fjcl || []);
......@@ -244,9 +244,9 @@ async function updateYyqtzjc(req, res, next) {
newArr.push(element);
}
}
await DB.ThTzYyqtzjcTzfx.destroy({ where: { projectId: req.body.projectId, sourceId: req.body.id, id: { [Op.notIn]: ids } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
await DB.ThTzYyqtzjcTzfx.bulkCreate(newArr);//创建新的 没有id的
await Promise.all(info.map(item => { DB.ThTzYyqtzjcTzfx.update(item, { where: { id: item.id } }) }));
await DB.ThYyqtzjcTzfx.destroy({ where: { projectId: req.body.projectId, sourceId: req.body.id, id: { [Op.notIn]: ids } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
await DB.ThYyqtzjcTzfx.bulkCreate(newArr);//创建新的 没有id的
await Promise.all(info.map(item => { DB.ThYyqtzjcTzfx.update(item, { where: { id: item.id } }) }));
delete req.body.yyqtzjcTzfxs;
// let yyqtzjcrcjcs = req.body.yyqtzjcrcjcs || [];
......@@ -262,9 +262,9 @@ async function updateYyqtzjc(req, res, next) {
// newArr1.push(element);
// }
// }
// await DB.ThTzYyqtzjcrcjc.destroy({ where: { projectId: req.body.projectId, id: { [Op.notIn]: ids1 } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
// await DB.ThTzYyqtzjcrcjc.bulkCreate(newArr1);//创建新的 没有id的
// await Promise.all(info1.map(item => { DB.ThTzYyqtzjcrcjc.update(item, { where: { id: item.id } }) }));
// await DB.ThYyqtzjcrcjc.destroy({ where: { projectId: req.body.projectId, id: { [Op.notIn]: ids1 } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
// await DB.ThYyqtzjcrcjc.bulkCreate(newArr1);//创建新的 没有id的
// await Promise.all(info1.map(item => { DB.ThYyqtzjcrcjc.update(item, { where: { id: item.id } }) }));
// delete req.body.yyqtzjcrcjcs;
......@@ -282,12 +282,12 @@ async function updateYyqtzjc(req, res, next) {
newArr2.push(element);
}
}
await DB.ThTzYyqtzjcZxjc.destroy({ where: { projectId: req.body.projectId, sourceId: req.body.id, id: { [Op.notIn]: ids2 } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
await DB.ThTzYyqtzjcZxjc.bulkCreate(newArr2);//创建新的 没有id的
await Promise.all(info2.map(item => { DB.ThTzYyqtzjcZxjc.update(item, { where: { id: item.id } }) }));
await DB.ThYyqtzjcZxjc.destroy({ where: { projectId: req.body.projectId, sourceId: req.body.id, id: { [Op.notIn]: ids2 } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
await DB.ThYyqtzjcZxjc.bulkCreate(newArr2);//创建新的 没有id的
await Promise.all(info2.map(item => { DB.ThYyqtzjcZxjc.update(item, { where: { id: item.id } }) }));
delete req.body.yyqtzjcZxjcs;
await DB.ThTzYyqtzjc.update(req.body, { where: { id: req.body.id } });
await DB.ThYyqtzjc.update(req.body, { where: { id: req.body.id } });
return res.sendData({});
} catch (error) {
next(error);
......@@ -318,7 +318,7 @@ async function getYyqtzjcList(req, res, next) {
if (req.body.attributes && req.body.attributes.length) {
search.attributes = req.body.attributes;
}
let ret = await DB.ThTzYyqtzjc.findAndCountAll(search);
let ret = await DB.ThYyqtzjc.findAndCountAll(search);
return res.sendData(ret);
} catch (error) {
next(error);
......@@ -539,7 +539,7 @@ async function deleteYyqtzhs(req, res, next) {
}
async function deleteYyqtzjc(req, res, next) {
try {
await DB.ThTzYyqtzjc.update({ del: 1 }, { where: { id: req.body.id } });
await DB.ThYyqtzjc.update({ del: 1 }, { where: { id: req.body.id } });
return res.sendData({});
} catch (error) {
next(error);
......
......@@ -77,6 +77,10 @@ const ThYyqtzjcTzfx = require('./model/jt/thYyqtzjcTzfx');
const ThYyqtzjcZxjc = require('./model/jt/thYyqtzjcZxjc');
const ThYyqtzjcrcjc = require('./model/jt/thYyqtzjcrcjc');
const ThYjgl = require("./model/jt/thYjgl");
const ThYyqtzjc = require('./model/jt/thYyqtzjc')
const ThYyqtzjcTzfx = require('./model/jt/thYyqtzjcTzfx')
const ThYyqtzjcZxjc = require('./model/jt/thYyqtzjcZxjc')
const RcTxjs = require('./model/jt/rcTxjs');
const RcTxjsWj = require('./model/jt/rcTxjswj');
......@@ -165,6 +169,11 @@ global.DB = {
RcCgqygl,
RcCgqyglTzfh,
RcCgqyglWtyy,
ThYyqtzjc,
ThYyqtzjcTzfx,
ThYyqtzjcZxjc ,
}
......
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