明树Git Lab

Commit a9a6c9c8 authored by zfp1's avatar zfp1

update

parent f35ae775
Pipeline #108778 passed with stage
in 3 seconds
......@@ -212,8 +212,25 @@ async function createTzkz(req, res, next) {
let ret = await DB.TzTzkz.create(req.body);
//处理财务评价指标
let tzkzcwpjs = (req.body.tzkzcwpjs || []).map(o => { o.projectId = req.body.projectId; o.sourceId = ret.id; return o; });
// let tzkzcwpjs = (req.body.tzkzcwpjs || []).map(o => { o.projectId = req.body.projectId; o.sourceId = ret.id; return o; });
// delete req.body.tzkzcwpjs;
let flattenArrCwpjs = [];
let tzkzcwpjs = req.body.tzkzcwpjs || [[]]; //二维数组 多次上报
delete req.body.tzkzcwpjs;
for (let index = 0; index < tzkzcwpjs.length; index++) {
const element = tzkzcwpjs[index];
element.tables = element.tables || [];
for (let i = 0; i < element.tables.length; i++) {
let ei = element.tables[i];
ei.groupBy = index;
ei.projectId = req.body.projectId;
ei.sourceId = ret.id;
ei.bqsj = element.bqsj;
ei.sqsj = element.sqsj;
ei.key = element.key;
flattenArrCwpjs.push(ei);
}
}
//处理决策批复意见
let tzkzjcpfyjs = (req.body.tzkzjcpfyjs || []).map(o => { o.projectId = req.body.projectId; o.sourceId = ret.id; return o; });;
delete req.body.tzkzjcpfyjs;
......@@ -245,7 +262,7 @@ async function createTzkz(req, res, next) {
let tzkzgqs = (req.body.tzkzgqs || []).map(o => { o.projectId = req.body.projectId; o.sourceId = ret.id; return o; });
delete req.body.tzkzgqs;
//创建
await DB.TzTzkzCwpj.bulkCreate(tzkzcwpjs);
await DB.TzTzkzCwpj.bulkCreate(flattenArrCwpjs);
let a = await DB.TzTzkzJcpfyj.bulkCreate(tzkzjcpfyjs);
let b = await DB.TzTzkzTzsy.bulkCreate(tzkztzsys);
let c = await DB.TzTzkzTzekz.bulkCreate(flattenArr);
......
......@@ -38,6 +38,29 @@ const TzTzkzCwpj = sequelize.define('TzTzkzCwpj', {
type: DataTypes.INTEGER,
comment: "所属项目ID",
},
bqsj: {
type: DataTypes.DATE,
comment: "本期时间",
get() {
const rawValue = this.getDataValue('bqsj');
return rawValue ? moment(rawValue).format('YYYY-MM-DD') : '';
}
},
sqsj: {
type: DataTypes.DATE,
comment: "上期时间",
get() {
const rawValue = this.getDataValue('sqsj');
return rawValue ? moment(rawValue).format('YYYY-MM-DD') : '';
}
},
key: {
type: DataTypes.STRING,
},
groupBy: {
type: DataTypes.INTEGER,
comment: "用来分组 区分期数"
},
createdAt: {
type: DataTypes.DATE,
defaultValue: Date.now,
......
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