明树Git Lab

Commit 0e6aa3c4 authored by zfp1's avatar zfp1

update:

parent 8c605504
Pipeline #106032 passed with stage
in 3 seconds
......@@ -629,30 +629,30 @@ async function createJsqtzjc(req, res, next) {
}
delete req.body.jsqtzjcTzfxs;
//日常检查
let jsqtzjcrcjcs = req.body.jsqtzjcrcjcs || [];
let newjsqtzjcrcjcs = [];
for (let index = 0; index < jsqtzjcrcjcs.length; index++) {
let element = jsqtzjcrcjcs[index];
element.projectId = req.body.projectId;
element.fxcl = (element.fxcl || []).map(o => { return o && o.id || o });
newjsqtzjcrcjcs.push(element);
}
delete req.body.jsqtzjcrcjcs;
//专项检查
let jsqtzjcZxjcs = req.body.jsqtzjcZxjcs || [];
let newjsqtzjcZxjcs = [];
for (let index = 0; index < jsqtzjcZxjcs.length; index++) {
let element = jsqtzjcZxjcs[index];
element.projectId = req.body.projectId;
element.fjcl = (element.fjcl || []).map(o => { return o && o.id || o });
newjsqtzjcZxjcs.push(element);
}
delete req.body.jsqtzjcZxjcs;
// let jsqtzjcrcjcs = req.body.jsqtzjcrcjcs || [];
// let newjsqtzjcrcjcs = [];
// for (let index = 0; index < jsqtzjcrcjcs.length; index++) {
// let element = jsqtzjcrcjcs[index];
// element.projectId = req.body.projectId;
// element.fxcl = (element.fxcl || []).map(o => { return o && o.id || o });
// newjsqtzjcrcjcs.push(element);
// }
// delete req.body.jsqtzjcrcjcs;
// //专项检查
// let jsqtzjcZxjcs = req.body.jsqtzjcZxjcs || [];
// let newjsqtzjcZxjcs = [];
// for (let index = 0; index < jsqtzjcZxjcs.length; index++) {
// let element = jsqtzjcZxjcs[index];
// element.projectId = req.body.projectId;
// element.fjcl = (element.fjcl || []).map(o => { return o && o.id || o });
// newjsqtzjcZxjcs.push(element);
// }
// delete req.body.jsqtzjcZxjcs;
//创建
await DB.TzJsqtzjcTzfx.bulkCreate(jsqtzjcTzfxs);
await DB.TzJsqtzjcrcjc.bulkCreate(jsqtzjcrcjcs);
await DB.TzJsqtzjcZxjc.bulkCreate(jsqtzjcZxjcs);
// await DB.TzJsqtzjcrcjc.bulkCreate(jsqtzjcrcjcs);
// await DB.TzJsqtzjcZxjc.bulkCreate(jsqtzjcZxjcs);
let ret = await DB.TzJsqtzjc.create(req.body);
return res.sendData(ret);
} catch (error) {
......@@ -685,24 +685,24 @@ async function getJsqtzjcInfo(req, res, next) {
element.tzcbfxhzl = await DB.File.findAll({ where: { id: { [Op.in]: element.tzcbfxhzl } } });
newjsqtzjcTzfxs.push(element);
}
let jsqtzjcrcjcs = await DB.TzJsqtzjcrcjc.findAll({ where: { projectId: jsqtzjc.projectId }, raw: true });
for (let index = 0; index < jsqtzjcrcjcs.length; index++) {
const element = jsqtzjcrcjcs[index];
// fileids.concat(element.fxcl || []);
element.fxcl = await DB.File.findAll({ where: { id: { [Op.in]: element.fxcl } } });
newjsqtzjcrcjcs.push(element);
}
let jsqtzjcZxjcs = await DB.TzJsqtzjcZxjc.findAll({ where: { projectId: jsqtzjc.projectId }, raw: true });
for (let index = 0; index < jsqtzjcZxjcs.length; index++) {
const element = jsqtzjcZxjcs[index];
// fileids.concat(element.fjcl || []);
element.fjcl = await DB.File.findAll({ where: { id: { [Op.in]: element.fjcl } } });
newjsqtzjcZxjcs.push(element);
}
// let jsqtzjcrcjcs = await DB.TzJsqtzjcrcjc.findAll({ where: { projectId: jsqtzjc.projectId }, raw: true });
// for (let index = 0; index < jsqtzjcrcjcs.length; index++) {
// const element = jsqtzjcrcjcs[index];
// // fileids.concat(element.fxcl || []);
// element.fxcl = await DB.File.findAll({ where: { id: { [Op.in]: element.fxcl } } });
// newjsqtzjcrcjcs.push(element);
// }
// let jsqtzjcZxjcs = await DB.TzJsqtzjcZxjc.findAll({ where: { projectId: jsqtzjc.projectId }, raw: true });
// for (let index = 0; index < jsqtzjcZxjcs.length; index++) {
// const element = jsqtzjcZxjcs[index];
// // fileids.concat(element.fjcl || []);
// element.fjcl = await DB.File.findAll({ where: { id: { [Op.in]: element.fjcl } } });
// newjsqtzjcZxjcs.push(element);
// }
jsqtzjc.jsqtzjcTzfxs = newjsqtzjcTzfxs;
jsqtzjc.jsqtzjcrcjcs = newjsqtzjcrcjcs;
jsqtzjc.jsqtzjcZxjcs = newjsqtzjcZxjcs;
// jsqtzjc.jsqtzjcrcjcs = newjsqtzjcrcjcs;
// jsqtzjc.jsqtzjcZxjcs = newjsqtzjcZxjcs;
return res.sendData(jsqtzjc);
} catch (error) {
......@@ -732,42 +732,42 @@ async function updateJsqtzjc(req, res, next) {
await Promise.all(info.map(item => { DB.TzJsqtzjcTzfx.update(item, { where: { id: item.id } }) }));
delete req.body.jsqtzjcTzfxs;
let jsqtzjcrcjcs = req.body.jsqtzjcrcjcs || [];
let ids1 = [], newArr1 = [], info1 = [];
for (let index = 0; index < jsqtzjcrcjcs.length; index++) {
let element = jsqtzjcrcjcs[index];
element.projectId = req.body.projectId;
element.fxcl = (element.fxcl || []).map(o => { return o && o.id || o });
if (element.id) {
ids1.push(element.id);
info1.push(element);
} else {
newArr1.push(element);
}
}
await DB.TzJsqtzjcrcjc.destroy({ where: { projectId: req.body.projectId, id: { [Op.notIn]: ids1 } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
await DB.TzJsqtzjcrcjc.bulkCreate(newArr1);//创建新的 没有id的
await Promise.all(info1.map(item => { DB.TzJsqtzjcrcjc.update(item, { where: { id: item.id } }) }));
delete req.body.jsqtzjcrcjcs;
let jsqtzjcZxjcs = req.body.jsqtzjcZxjcs || [];
let ids2 = [], newArr2 = [], info2 = [];
for (let index = 0; index < jsqtzjcZxjcs.length; index++) {
let element = jsqtzjcZxjcs[index];
element.projectId = req.body.projectId;
element.fjcl = (element.fjcl || []).map(o => { return o && o.id || o });
if (element.id) {
ids2.push(element.id);
info2.push(element);
} else {
newArr2.push(element);
}
}
await DB.TzJsqtzjcZxjc.destroy({ where: { projectId: req.body.projectId, id: { [Op.notIn]: ids2 } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
await DB.TzJsqtzjcZxjc.bulkCreate(newArr2);//创建新的 没有id的
await Promise.all(info2.map(item => { DB.TzJsqtzjcZxjc.update(item, { where: { id: item.id } }) }));
delete req.body.jsqtzjcZxjcs;
// let jsqtzjcrcjcs = req.body.jsqtzjcrcjcs || [];
// let ids1 = [], newArr1 = [], info1 = [];
// for (let index = 0; index < jsqtzjcrcjcs.length; index++) {
// let element = jsqtzjcrcjcs[index];
// element.projectId = req.body.projectId;
// element.fxcl = (element.fxcl || []).map(o => { return o && o.id || o });
// if (element.id) {
// ids1.push(element.id);
// info1.push(element);
// } else {
// newArr1.push(element);
// }
// }
// await DB.TzJsqtzjcrcjc.destroy({ where: { projectId: req.body.projectId, id: { [Op.notIn]: ids1 } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
// await DB.TzJsqtzjcrcjc.bulkCreate(newArr1);//创建新的 没有id的
// await Promise.all(info1.map(item => { DB.TzJsqtzjcrcjc.update(item, { where: { id: item.id } }) }));
// delete req.body.jsqtzjcrcjcs;
// let jsqtzjcZxjcs = req.body.jsqtzjcZxjcs || [];
// let ids2 = [], newArr2 = [], info2 = [];
// for (let index = 0; index < jsqtzjcZxjcs.length; index++) {
// let element = jsqtzjcZxjcs[index];
// element.projectId = req.body.projectId;
// element.fjcl = (element.fjcl || []).map(o => { return o && o.id || o });
// if (element.id) {
// ids2.push(element.id);
// info2.push(element);
// } else {
// newArr2.push(element);
// }
// }
// await DB.TzJsqtzjcZxjc.destroy({ where: { projectId: req.body.projectId, id: { [Op.notIn]: ids2 } } }); // 删除id不在传入id数组里面的(用户在界面删除的)
// await DB.TzJsqtzjcZxjc.bulkCreate(newArr2);//创建新的 没有id的
// await Promise.all(info2.map(item => { DB.TzJsqtzjcZxjc.update(item, { where: { id: item.id } }) }));
// delete req.body.jsqtzjcZxjcs;
await DB.TzJsqtzjc.update(req.body, { where: { id: req.body.id } });
return res.sendData({});
......
......@@ -14,7 +14,7 @@ const TzJsqtzjcTzfx = sequelize.define('TzJsqtzjcTzfx', {
},
jd: {
type: DataTypes.STRING,
comment: "季度",
comment: "时间 提示语 季度改为时间,内容提示为xx年xx季度",
},
ycztz: {
type: DataTypes.DECIMAL(20, 2),
......
const { DataTypes } = require('sequelize');
const sequelize = require('../index');
const moment = require('moment');
// const { DataTypes } = require('sequelize');
// const sequelize = require('../index');
// const moment = require('moment');
//投中管理- 建设期投资检查 ---日常检查 对投资目标偏差每半年进行一次系统盘点,上传分析材料
const TzJsqtzjcZxjc = sequelize.define('TzJsqtzjcZxjc', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
zxjcfl: {
type: DataTypes.INTEGER,
comment: "专项检查分类 1 能建投资检查、2 葛洲坝集团投资检查、3 公司投资检查、4 其他投资检查"
},
kssj: {
type: DataTypes.DATE,
comment: "开始时间",
get() {
const rawValue = this.getDataValue('kssj');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
},
jssj: {
type: DataTypes.DATE,
comment: "结束时间",
get() {
const rawValue = this.getDataValue('jssj');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
},
// //投中管理- 建设期投资检查 ---日常检查 对投资目标偏差每半年进行一次系统盘点,上传分析材料
// const TzJsqtzjcZxjc = sequelize.define('TzJsqtzjcZxjc', {
// id: {
// type: DataTypes.INTEGER,
// primaryKey: true,
// autoIncrement: true
// },
// zxjcfl: {
// type: DataTypes.INTEGER,
// comment: "专项检查分类 1 能建投资检查、2 葛洲坝集团投资检查、3 公司投资检查、4 其他投资检查"
// },
// kssj: {
// type: DataTypes.DATE,
// comment: "开始时间",
// get() {
// const rawValue = this.getDataValue('kssj');
// return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
// }
// },
// jssj: {
// type: DataTypes.DATE,
// comment: "结束时间",
// get() {
// const rawValue = this.getDataValue('jssj');
// return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
// }
// },
fjcl: {
type: DataTypes.JSON,
comment: "附件材料"
},
// fjcl: {
// type: DataTypes.JSON,
// comment: "附件材料"
// },
projectId: {
type: DataTypes.INTEGER,
comment: "所属项目ID",
},
del: {
type: DataTypes.INTEGER,
defaultValue: 0,
comment: "0 正常 1 删除"
},
createdAt: {
type: DataTypes.DATE,
defaultValue: new Date(),
get() {
const rawValue = this.getDataValue('createdAt');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
},
updatedAt: { // 同样处理 updatedAt
type: DataTypes.DATE,
defaultValue: new Date(),
get() {
const rawValue = this.getDataValue('updatedAt');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
}
}, {
tableName: 'jt_tz_jsqtzjcZxjc', // 指定表名(如果与模型名不同)
timestamps: true, // 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
});
// projectId: {
// type: DataTypes.INTEGER,
// comment: "所属项目ID",
// },
// del: {
// type: DataTypes.INTEGER,
// defaultValue: 0,
// comment: "0 正常 1 删除"
// },
// createdAt: {
// type: DataTypes.DATE,
// defaultValue: new Date(),
// get() {
// const rawValue = this.getDataValue('createdAt');
// return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
// }
// },
// updatedAt: { // 同样处理 updatedAt
// type: DataTypes.DATE,
// defaultValue: new Date(),
// get() {
// const rawValue = this.getDataValue('updatedAt');
// return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
// }
// }
// }, {
// tableName: 'jt_tz_jsqtzjcZxjc', // 指定表名(如果与模型名不同)
// timestamps: true, // 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
// });
// 同步模型到数据库(创建表)
TzJsqtzjcZxjc.sync({
// force: false,
// force: true ,//会删除已存在表并重新创建
alter: true
})
.then(() => {
console.log('TzJsqtzjcZxjc 表同步成功');
});
// // 同步模型到数据库(创建表)
// TzJsqtzjcZxjc.sync({
// // force: false,
// // force: true ,//会删除已存在表并重新创建
// alter: true
// })
// .then(() => {
// console.log('TzJsqtzjcZxjc 表同步成功');
// });
module.exports = TzJsqtzjcZxjc;
\ No newline at end of file
// module.exports = TzJsqtzjcZxjc;
\ No newline at end of file
const { DataTypes } = require('sequelize');
const sequelize = require('../index');
const moment = require('moment');
// const { DataTypes } = require('sequelize');
// const sequelize = require('../index');
// const moment = require('moment');
//投中管理- 建设期投资检查 ---日常检查 对投资目标偏差每半年进行一次系统盘点,上传分析材料
const TzJsqtzjcrcjc = sequelize.define('TzJsqtzjcrcjc', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
kssj: {
type: DataTypes.DATE,
comment: "开始时间",
get() {
const rawValue = this.getDataValue('kssj');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
},
jssj: {
type: DataTypes.DATE,
comment: "结束时间",
get() {
const rawValue = this.getDataValue('jssj');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
},
pdnrsm: {
type: DataTypes.TEXT,
comment: "盘点内容说明"
},
fxcl: {
type: DataTypes.JSON,
comment: "分析材料"
},
// //投中管理- 建设期投资检查 ---日常检查 对投资目标偏差每半年进行一次系统盘点,上传分析材料
// const TzJsqtzjcrcjc = sequelize.define('TzJsqtzjcrcjc', {
// id: {
// type: DataTypes.INTEGER,
// primaryKey: true,
// autoIncrement: true
// },
// kssj: {
// type: DataTypes.DATE,
// comment: "开始时间",
// get() {
// const rawValue = this.getDataValue('kssj');
// return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
// }
// },
// jssj: {
// type: DataTypes.DATE,
// comment: "结束时间",
// get() {
// const rawValue = this.getDataValue('jssj');
// return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
// }
// },
// pdnrsm: {
// type: DataTypes.TEXT,
// comment: "盘点内容说明"
// },
// fxcl: {
// type: DataTypes.JSON,
// comment: "分析材料"
// },
projectId: {
type: DataTypes.INTEGER,
comment: "所属项目ID",
},
del: {
type: DataTypes.INTEGER,
defaultValue: 0,
comment: "0 正常 1 删除"
},
createdAt: {
type: DataTypes.DATE,
defaultValue: new Date(),
get() {
const rawValue = this.getDataValue('createdAt');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
},
updatedAt: { // 同样处理 updatedAt
type: DataTypes.DATE,
defaultValue: new Date(),
get() {
const rawValue = this.getDataValue('updatedAt');
return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
}
}
}, {
tableName: 'jt_tz_jsqtzjcrcjc', // 指定表名(如果与模型名不同)
timestamps: true, // 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
});
// projectId: {
// type: DataTypes.INTEGER,
// comment: "所属项目ID",
// },
// del: {
// type: DataTypes.INTEGER,
// defaultValue: 0,
// comment: "0 正常 1 删除"
// },
// createdAt: {
// type: DataTypes.DATE,
// defaultValue: new Date(),
// get() {
// const rawValue = this.getDataValue('createdAt');
// return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
// }
// },
// updatedAt: { // 同样处理 updatedAt
// type: DataTypes.DATE,
// defaultValue: new Date(),
// get() {
// const rawValue = this.getDataValue('updatedAt');
// return rawValue ? moment(rawValue).format('YYYY-MM-DD HH:mm:ss') : '';
// }
// }
// }, {
// tableName: 'jt_tz_jsqtzjcrcjc', // 指定表名(如果与模型名不同)
// timestamps: true, // 是否自动添加 createdAt 和 updatedAt 字段(覆盖全局设置)
// });
// 同步模型到数据库(创建表)
TzJsqtzjcrcjc.sync({
// force: false,
// force: true ,//会删除已存在表并重新创建
alter: true
})
.then(() => {
console.log('TzJsqtzjcrcjc 表同步成功');
});
// // 同步模型到数据库(创建表)
// TzJsqtzjcrcjc.sync({
// // force: false,
// // force: true ,//会删除已存在表并重新创建
// alter: true
// })
// .then(() => {
// console.log('TzJsqtzjcrcjc 表同步成功');
// });
module.exports = TzJsqtzjcrcjc;
\ No newline at end of file
// module.exports = TzJsqtzjcrcjc;
\ No newline at end of file
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