明树Git Lab

Commit 3c714327 authored by zfp1's avatar zfp1

update

parent 2074bb58
Pipeline #103935 passed with stage
in 3 seconds
...@@ -9,14 +9,17 @@ const { Op } = require('sequelize'); ...@@ -9,14 +9,17 @@ const { Op } = require('sequelize');
async function createResource(req, res, next) { async function createResource(req, res, next) {
try { try {
const body = req.body; const body = req.body;
const ret = await DB.Resources.create(body); let ret = await DB.Resources.create(body);
if (body.resourcesInfos && body.resourcesInfos.length && ret.id) { ret = ret.toJSON();
console.log(ret);
if (body.resourceInfos && body.resourceInfos.length && ret.id) {
let ris = []; let ris = [];
for (let index = 0; index < array.length; index++) { for (let index = 0; index < body.resourceInfos.length; index++) {
const element = array[index]; const element = body.resourceInfos[index];
element.resourceId = ret.id; element.resourceId = ret.id;
ris.push(element); ris.push(element);
} }
console.log(ris, "===")
await DB.ResourcesInfo.bulkCreate(ris); await DB.ResourcesInfo.bulkCreate(ris);
} }
return res.sendData(ret); return res.sendData(ret);
......
...@@ -107,7 +107,7 @@ const Project = sequelize.define('Project', { ...@@ -107,7 +107,7 @@ const Project = sequelize.define('Project', {
zsqy: { type: DataTypes.STRING, allowNull: true, comment: "直属企业" }, zsqy: { type: DataTypes.STRING, allowNull: true, comment: "直属企业" },
sfnjzdhzytz: { type: DataTypes.INTEGER, allowNull: true, comment: "是否能建重大或重要投资" }, sfnjzdhzytz: { type: DataTypes.INTEGER, allowNull: true, comment: "是否能建重大或重要投资" },
sfzzjc: { type: DataTypes.INTEGER, allowNull: true, comment: "是否自主决策" }, sfzzjc: { type: DataTypes.INTEGER, allowNull: true, comment: "是否自主决策" },
financialStatementType: { type: DataTypes.STRING, allowNull: true, comment: "财务报表类型" }, //TODO:下拉 cwbblx: { type: DataTypes.STRING, allowNull: true, comment: "财务报表类型" }, //TODO:下拉
zfsphzbajb: { type: DataTypes.STRING, allowNull: true, comment: "政府审批(核准、备案)级别" }, //TODO:下拉 zfsphzbajb: { type: DataTypes.STRING, allowNull: true, comment: "政府审批(核准、备案)级别" }, //TODO:下拉
sflxbqyscx: { type: DataTypes.INTEGER, allowNull: true, comment: "是否履行标前预审程序" }, sflxbqyscx: { type: DataTypes.INTEGER, allowNull: true, comment: "是否履行标前预审程序" },
xmztz: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "项目总投资" }, xmztz: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "项目总投资" },
...@@ -119,7 +119,7 @@ const Project = sequelize.define('Project', { ...@@ -119,7 +119,7 @@ const Project = sequelize.define('Project', {
xmlx: { type: DataTypes.STRING, allowNull: true, comment: "项目类型" }, //TODO:下拉 xmlx: { type: DataTypes.STRING, allowNull: true, comment: "项目类型" }, //TODO:下拉
sfpppxm: { type: DataTypes.INTEGER, allowNull: true, comment: "是否PPP项目" }, sfpppxm: { type: DataTypes.INTEGER, allowNull: true, comment: "是否PPP项目" },
//项目所在地 //项目所在地
domesticOrOverseas: { type: DataTypes.STRING, allowNull: true, comment: "境内/外" },//TODO:下拉 jnw: { type: DataTypes.STRING, allowNull: true, comment: "境内/外" },//TODO:下拉
sjnzjjw: { type: DataTypes.STRING, allowNull: true, comment: "省(境内)/洲际(境外)" },//TODO:下拉 sjnzjjw: { type: DataTypes.STRING, allowNull: true, comment: "省(境内)/洲际(境外)" },//TODO:下拉
cityOrCountry: { type: DataTypes.STRING, allowNull: true, comment: "地市(境内)/国家(境外)" },//TODO:下拉 cityOrCountry: { type: DataTypes.STRING, allowNull: true, comment: "地市(境内)/国家(境外)" },//TODO:下拉
qxjngjjw: { type: DataTypes.STRING, allowNull: true, comment: "区县(境内)/国家(境外)" },//TODO:下拉 qxjngjjw: { type: DataTypes.STRING, allowNull: true, comment: "区县(境内)/国家(境外)" },//TODO:下拉
...@@ -1765,9 +1765,9 @@ const Project = sequelize.define('Project', { ...@@ -1765,9 +1765,9 @@ const Project = sequelize.define('Project', {
// 同步模型到数据库(创建表) // 同步模型到数据库(创建表)
Project.sync({ Project.sync({
force: false, // force: false,
// force: true ,//会删除已存在表并重新创建 // force: true ,//会删除已存在表并重新创建
// alter: true alter: true
}) })
.then(() => { .then(() => {
console.log('Project 表同步成功'); console.log('Project 表同步成功');
......
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