明树Git Lab

Commit fbffa97a authored by zfp1's avatar zfp1

update

parent f6f13ba4
Pipeline #106054 passed with stage
in 3 seconds
...@@ -206,11 +206,15 @@ async function createTzkz(req, res, next) { ...@@ -206,11 +206,15 @@ async function createTzkz(req, res, next) {
delete req.body.tzkztzekzs; delete req.body.tzkztzekzs;
for (let index = 0; index < tzkztzekzs.length; index++) { for (let index = 0; index < tzkztzekzs.length; index++) {
const element = tzkztzekzs[index]; const element = tzkztzekzs[index];
for (let i = 0; i < element.length; i++) { element.tables = element.tables || [];
let ei = element[i]; for (let i = 0; i < element.tables.length; i++) {
let ei = element.tables[i];
ei.groupBy = index; ei.groupBy = index;
ei.projectId = req.body.projectId; ei.projectId = req.body.projectId;
ei.sourceId = ret.id; ei.sourceId = ret.id;
ei.bqsj = element.bqsj;
ei.sqsj = element.sqsj;
ei.key = element.key;
flattenArr.push(ei); flattenArr.push(ei);
} }
} }
...@@ -271,11 +275,15 @@ async function updateTzkz(req, res, next) { ...@@ -271,11 +275,15 @@ async function updateTzkz(req, res, next) {
let ids3 = [], infos3 = [], newtzkztzekzs = []; let ids3 = [], infos3 = [], newtzkztzekzs = [];
for (let index = 0; index < tzkztzekzs.length; index++) { for (let index = 0; index < tzkztzekzs.length; index++) {
const element = tzkztzekzs[index]; const element = tzkztzekzs[index];
for (let i = 0; i < element.length; i++) { element.tables = element.tables || [];
let ei = element[i]; for (let i = 0; i < element.tables.length; i++) {
let ei = element.tables[i];
ei.groupBy = index; ei.groupBy = index;
ei.projectId = req.body.projectId; ei.projectId = req.body.projectId;
ei.sourceId = ret.id; ei.sourceId = ret.id;
ei.bqsj = element.bqsj;
ei.sqsj = element.sqsj;
ei.key = element.key;
if (!ei.id) { if (!ei.id) {
if (!_.isEmpty(ei)) { if (!_.isEmpty(ei)) {
newtzkztzekzs.push(ei); newtzkztzekzs.push(ei);
...@@ -388,8 +396,20 @@ async function getTzkzInfo(req, res, next) { ...@@ -388,8 +396,20 @@ async function getTzkzInfo(req, res, next) {
where: { projectId: tzkz.projectId, sourceId: tzkz.id }, where: { projectId: tzkz.projectId, sourceId: tzkz.id },
raw: true raw: true
}); });
tzkz.tzkztzekzs = _.values(_.groupBy(tzkztzekzs, 'groupBy')) || [[]] let tzeGroupByObj = _.groupBy(tzkztzekzs, 'groupBy');
let keyindexs = _.keys(tzeGroupByObj);
let newTze = [];
for (let index = 0; index < keyindexs.length; index++) {
const element = keyindexs[index];
let obj ={
tables: tzeGroupByObj[element],
bqsj: tzeGroupByObj[element] && tzeGroupByObj[element][0] && tzeGroupByObj[element][0].bqsj ,
sqsj:tzeGroupByObj[element] && tzeGroupByObj[element][0] && tzeGroupByObj[element][0].sqsj,
key: tzeGroupByObj[element] && tzeGroupByObj[element][0] && tzeGroupByObj[element][0].key,
};
newTze.push(obj);
}
tzkz.tzkztzekzs = newTze;
return res.sendData(tzkz); return res.sendData(tzkz);
} catch (error) { } catch (error) {
next(error); next(error);
......
...@@ -34,7 +34,7 @@ const TzTzkzTzekz = sequelize.define('TzTzkzTzekz', { ...@@ -34,7 +34,7 @@ const TzTzkzTzekz = sequelize.define('TzTzkzTzekz', {
comment: "批复概算", comment: "批复概算",
}, },
tkjgs: { tkjgs: {
type:DataTypes.DECIMAL(20, 8), type: DataTypes.DECIMAL(20, 8),
comment: "同口径概算", comment: "同口径概算",
}, },
pfys: { pfys: {
...@@ -77,7 +77,9 @@ const TzTzkzTzekz = sequelize.define('TzTzkzTzekz', { ...@@ -77,7 +77,9 @@ const TzTzkzTzekz = sequelize.define('TzTzkzTzekz', {
type: DataTypes.STRING, type: DataTypes.STRING,
comment: "竣工决算审计", comment: "竣工决算审计",
}, },
key: {
type: DataTypes.STRING,
},
// tzkzId: { // tzkzId: {
// type: DataTypes.INTEGER, // type: DataTypes.INTEGER,
// comment: "所属投资控制主表id", // comment: "所属投资控制主表id",
......
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