提交 8a6dc512 编写于 作者: NoSubject's avatar NoSubject

修复流程提交时,转换word后保存附件可能出现无权限的问题

上级 7a30ec2d
......@@ -1032,8 +1032,17 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla
if (this.json.toWord=="y"){
if (this.json.toWordTrigger=="open") this.docToWord();
if (this.json.toWordTrigger=="save") this.form.addEvent("beforeSave", this.docToWord.bind(this));
if (this.json.toWordTrigger=="submit") this.form.addEvent("beforeProcess", this.docToWord.bind(this));
//if (this.json.toWordTrigger=="save") this.form.addEvent("beforeSave", this.docToWord.bind(this));
//if (this.json.toWordTrigger=="submit") this.form.addEvent("beforeProcess", this.docToWord.bind(this));
if (this.json.toWordTrigger=="save") {
if (!this.form.toWordSaveList) this.form.toWordSaveList = [];
this.form.toWordSaveList.push(this);
}
if (this.json.toWordTrigger=="submit") {
if (!this.form.toWordSubmitList) this.form.toWordSubmitList = [];
this.form.toWordSubmitList.push(this);
}
}
if (!layout.mobile) this.loadSideToolbar();
......@@ -3322,7 +3331,7 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla
* //attachmentData 转换后的附件数据
* })
*/
toWord: function(callback, name){
toWord: function(callback, name, cb){
var docNmae = name || "";
if (!docNmae){
......@@ -3373,6 +3382,7 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla
}.bind(this));
}
}.bind(this));
if (cb) cb();
}else{
var content = this.getDocumentHtml();
o2.xDesktop.requireApp("process.Xform", "widget.OOXML", function(){
......@@ -3397,6 +3407,8 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla
}
}.bind(this));
if (cb) cb();
//
//
//
......@@ -3428,14 +3440,21 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla
}
}.bind(this));
},
docToWord: function(){
var flag = true;
if (this.json.toWordConditionScript && this.json.toWordConditionScript.code){
flag = !!this.form.Macro.exec(this.json.toWordConditionScript.code, this);
}
if (flag){
this.toWord();
}
docToWord: function(callback){
try {
var flag = true;
if (this.json.toWordConditionScript && this.json.toWordConditionScript.code){
flag = !!this.form.Macro.exec(this.json.toWordConditionScript.code, this);
}
if (flag){
this.toWord(null, "", callback);
}else{
if (callback) callback();
}
}catch(e){
console.error(e);
if (callback) callback();
};
},
showToWord: function(att_word){
debugger;
......
......@@ -1564,7 +1564,17 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class(
this.modifedData = {};
this.setModifedData(data);
this.workAction.saveData(callback || function () { }, failure, this.businessData.work.id, this.modifedData);
if (this.toWordSaveList && this.toWordSaveList.length){
var p = [];
this.toWordSaveList.each(function(editor){
if (editor.docToWord) p.push(new Promise(function(resolve){ editor.docToWord(resolve) }));
});
Promise.all(p).then(function(){
this.workAction.saveData(callback || function () { }, failure, this.businessData.work.id, this.modifedData);
}.bind(this));
}else{
this.workAction.saveData(callback || function () { }, failure, this.businessData.work.id, this.modifedData);
}
this.businessData.originalData = null;
this.businessData.originalData = Object.clone(data);
......@@ -2515,12 +2525,28 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class(
medias = medias.concat(mds)
}
_self.submitWork(routeName, opinion, medias, function () {
this.destroy();
processNode.destroy();
if (_self.processDlg) _self.processDlg.close();
delete this;
}.bind(this), this, null, appendTaskIdentityList, processorOrgList, callbackBeforeSave);
var promise;
if (this.toWordSubmitList && this.toWordSubmitList.length){
var p = [];
this.toWordSubmitList.each(function(editor){
if (editor.docToWord) p.push(new Promise(function(resolve){ editor.docToWord(resolve) }));
});
Promise.all(p).then(function(){
_self.submitWork(routeName, opinion, medias, function () {
this.destroy();
processNode.destroy();
if (_self.processDlg) _self.processDlg.close();
delete this;
}.bind(this), this, null, appendTaskIdentityList, processorOrgList, callbackBeforeSave);
}.bind(this));
}else{
_self.submitWork(routeName, opinion, medias, function () {
this.destroy();
processNode.destroy();
if (_self.processDlg) _self.processDlg.close();
delete this;
}.bind(this), this, null, appendTaskIdentityList, processorOrgList, callbackBeforeSave);
}
}
}, this);
}.bind(this));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册