Commit 215c7e00 by 庄冰

form_id

parent 99143124
...@@ -6,13 +6,15 @@ ...@@ -6,13 +6,15 @@
*/ */
module.exports = (db, DataTypes) => { module.exports = (db, DataTypes) => {
return db.define("formsubmitrecord", { return db.define("formsubmitrecord", {
template_id: DataTypes.INTEGER(11),///模板id business_code:DataTypes.STRING(100),
template_id: DataTypes.INTEGER(11),//模板id
templatelink_id: DataTypes.INTEGER(11),//模板链接id templatelink_id: DataTypes.INTEGER(11),//模板链接id
form_id: DataTypes.INTEGER(11),//表单id form_id: DataTypes.INTEGER(11),//表单id
record_status: DataTypes.STRING(60),//记录状态 1未读 2已读 3无效 record_status: DataTypes.STRING(60),//记录状态 1未读 2已读 3无效
record_status_name: DataTypes.STRING(60),//记录状态名称 record_status_name: DataTypes.STRING(60),//记录状态名称
templatelink_snapshot:DataTypes.JSON,//模板链接快照 templatelink_snapshot:DataTypes.JSON,//模板链接快照
record_content:DataTypes.JSON,//记录内容 record_content:DataTypes.JSON,//记录内容
push_status:DataTypes.INTEGER,//推送状态 0:未推送,1:已推送 2:异常
}, { }, {
paranoid: true,//假的删除 paranoid: true,//假的删除
underscored: true, underscored: true,
......
...@@ -32,7 +32,17 @@ class FormsubmitrecordService extends ServiceBase { ...@@ -32,7 +32,17 @@ class FormsubmitrecordService extends ServiceBase {
where:{code:ab.link_code},raw:true where:{code:ab.link_code},raw:true
}); });
if(!linkInfo || !linkInfo.id){ if(!linkInfo || !linkInfo.id){
return system.getResultFail(-300,"未知模板链接") return system.getResultFail(-300,"未知模板链接");
}
if(!linkInfo.template_id){
return system.getResultFail(-301,"链接模板信息错误")
}
var templateinfo = await this.templateinfoDao.model.findOne{
where:{id:linkInfo.template_id},raw:true,
attributes:["id","business_code"]
};
if(!templateinfo || !templateinfo.id){
return system.getResultFail(-500,"未知模板信息");
} }
//获取表单信息 //获取表单信息
var forminfo = await this.forminfoDao.model.findOne({ var forminfo = await this.forminfoDao.model.findOne({
...@@ -55,7 +65,7 @@ class FormsubmitrecordService extends ServiceBase { ...@@ -55,7 +65,7 @@ class FormsubmitrecordService extends ServiceBase {
template_id:linkInfo.template_id,templatelink_id:linkInfo.id, template_id:linkInfo.template_id,templatelink_id:linkInfo.id,
form_id:forminfo.id,record_status:1,templatelink_snapshot:linkInfo, form_id:forminfo.id,record_status:1,templatelink_snapshot:linkInfo,
form_snapshot:{forminfo:forminfo,formitems:formitems}, form_snapshot:{forminfo:forminfo,formitems:formitems},
record_content:params record_content:params,business_code:templateinfo.business_code
} }
await this.dao.create(addObj);//创建记录 await this.dao.create(addObj);//创建记录
return system.getResultSuccess(); return system.getResultSuccess();
......
...@@ -122,7 +122,11 @@ class TemplateinfoService extends ServiceBase { ...@@ -122,7 +122,11 @@ class TemplateinfoService extends ServiceBase {
// if(templateInfo.is_enabled===1){ // if(templateInfo.is_enabled===1){
// return system.getResultFail(-301,"该模板正在使用中,不能执行此操作"); // return system.getResultFail(-301,"该模板正在使用中,不能执行此操作");
// } // }
await this.dao.update({id:templateInfo.id,template_content:ab.template_content}); var updateObj = {id:templateInfo.id,template_content:ab.template_content};
if(ab.form_id){
updateObj["form_id"] = ab.form_id;
}
await this.dao.update(updateObj);
return system.getResultSuccess(); return system.getResultSuccess();
} }
/** /**
......
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