提交 85038e3e 编写于 作者: U unknown

datatemplate拆分情况下的问题

上级 5a42abbf
......@@ -840,6 +840,30 @@ MWF.xApplication.process.Xform.Datatemplate = MWF.APPDatatemplate = new Class(
return this._getBusinessData();
}
},
_getSectionKey: function(){
if (this.json.section!=="yes"){
return "";
}else {
switch (this.json.sectionBy){
case "person":
return layout.desktop.session.user.id;
case "unit":
return (this.form.businessData.task) ? this.form.businessData.task.unit : "";
case "activity":
return (this.form.businessData.work) ? this.form.businessData.work.activity : "";
case "splitValue":
return (this.form.businessData.work) ? this.form.businessData.work.splitValue : "";
case "script":
if( this.json.sectionByScript && this.json.sectionByScript.code){
return this.form.Macro.exec(this.json.sectionByScript.code, this) || "";
}else{
return "";
}
default:
return "";
}
}
},
createErrorNode: function(text){
var node = new Element("div");
var iconNode = new Element("div", {
......@@ -1049,6 +1073,10 @@ MWF.xApplication.process.Xform.Datatemplate.Line = new Class({
load: function(){
this.node.set("html", this.template.templateHtml);
var moduleNodes = this.form._getModuleNodes(this.node);
//拆分状态
var sectionKey = this.template._getSectionKey();
moduleNodes.each(function (node) {
if (node.get("MWFtype") !== "form") {
var _self = this;
......@@ -1063,8 +1091,12 @@ MWF.xApplication.process.Xform.Datatemplate.Line = new Class({
var index = this.options.index;
var id = this.template.json.id + ".." + index + ".." + json.id;
var id;
if( sectionKey ){
id = this.template.json.id + ".." + sectionKey + ".."+ index + ".." + json.id;
}else{
id = this.template.json.id + ".." + index + ".." + json.id;
}
json.id = id;
node.set("id", id);
......@@ -1072,7 +1104,7 @@ MWF.xApplication.process.Xform.Datatemplate.Line = new Class({
if( json.type==="Attachment" || json.type==="AttachmentDg" ){
json.type = "AttachmentDg";
json.ignoreSite = true;
json.site = this.getAttachmentSite(json, templateJsonId);
json.site = this.getAttachmentSite(json, templateJsonId, sectionKey);
}
if (this.form.all[id]) this.form.all[id] = null;
......@@ -1136,7 +1168,7 @@ MWF.xApplication.process.Xform.Datatemplate.Line = new Class({
get: function(templateJsonId){
return this.all_templateId[templateJsonId];
},
getAttachmentSite: function(json, templateJsonId){
getAttachmentSite: function(json, templateJsonId, sectionKey){
//确保site最长为64,否则后台会报错
var index = this.options.index;
......@@ -1144,12 +1176,21 @@ MWF.xApplication.process.Xform.Datatemplate.Line = new Class({
var baseSite;
baseSite = "." + index + "." + (json.site || templateJsonId);
var maxLength = 64 - baseSite.length;
var maxLength;
var sectionId = "";
if( sectionKey ){
maxLength = Math.floor((63 - baseSite.length)/2 );
sectionId = (sectionKey.length > maxLength) ? sectionKey.substr(sectionKey.length-maxLength, maxLength) : sectionKey;
sectionId = "." + sectionId;
}else{
maxLength = 64 - baseSite.length;
}
var templateId = this.template.json.id;
templateId = (templateId.length > maxLength) ? templateId.substr(templateId.length-maxLength, maxLength) : templateId;
return templateId + baseSite;
return templateId + sectionId + baseSite;
},
setEvents: function (module, id) {
if( this.template.addActionIdList.contains( id )){
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册