明树Git Lab

Commit 44b716e0 authored by zfp1's avatar zfp1

1

parent 0e6aa3c4
Pipeline #106034 passed with stage
in 3 seconds
...@@ -638,21 +638,21 @@ async function createJsqtzjc(req, res, next) { ...@@ -638,21 +638,21 @@ async function createJsqtzjc(req, res, next) {
// 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) {
...@@ -692,17 +692,17 @@ async function getJsqtzjcInfo(req, res, next) { ...@@ -692,17 +692,17 @@ async function getJsqtzjcInfo(req, res, next) {
// 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) {
...@@ -751,23 +751,23 @@ async function updateJsqtzjc(req, res, next) { ...@@ -751,23 +751,23 @@ async function updateJsqtzjc(req, res, next) {
// 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({});
......
// 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') : '';
// } // }
// }, // },
jcjg: {
// fjcl: { type: DataTypes.TEXT,
// type: DataTypes.JSON, comment: "检查结果"
// comment: "附件材料" },
// }, zgcsqd: {
type: DataTypes.TEXT,
comment: "整改措施清单"
},
fjcl: {
type: DataTypes.JSON,
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
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