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