From 41cf3a8797b60c65d4e6c4e10cc531ec0fab7e48 Mon Sep 17 00:00:00 2001 From: huqi Date: Wed, 7 Jul 2021 16:23:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AD=A3=E6=96=87=E6=8E=A7=E4=BB=B6=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E7=9B=96=E7=AB=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Module/Documenteditor/documenteditor.html | 15 +- .../Documenteditor/templete/combine.html | 6 +- .../Documenteditor/templete/command.html | 4 +- .../Documenteditor/templete/letter.html | 4 +- .../Documenteditor/templete/meeting.html | 7 +- .../templete/party-meeting.html | 5 +- .../Module/Documenteditor/templete/party.html | 4 + .../Documenteditor/templete/standard.html | 6 +- .../x_component_process_FormDesigner/lp/en.js | 1 + .../lp/zh-cn.js | 1 + .../Documenteditor.js | 141 +++++++++++++++++- .../x_component_process_Xform/widget/OOXML.js | 32 +++- 12 files changed, 202 insertions(+), 24 deletions(-) diff --git a/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/documenteditor.html b/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/documenteditor.html index 29e7bc8feb..116ed18dc0 100644 --- a/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/documenteditor.html +++ b/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/documenteditor.html @@ -178,12 +178,19 @@ {{$.lp.fileSite}}: + + + + + + + + - {{$.lp.addPageNumber}}: + {{$.lp.isConversionSeal}}: - {{$.lp.yes}} - {{$.lp.no}} -
{{$.lp.addPageNumberInfo}}
+ {{$.lp.yes}} + {{$.lp.no}} diff --git a/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/combine.html b/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/combine.html index 59d4db71a6..547dbda97c 100644 --- a/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/combine.html +++ b/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/combine.html @@ -205,8 +205,8 @@

-

-   +

+

@@ -252,6 +252,8 @@
+

 

+

 

 

diff --git a/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/command.html b/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/command.html index 3699190938..6623fe1d35 100644 --- a/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/command.html +++ b/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/command.html @@ -192,7 +192,9 @@
- +

+ +

diff --git a/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/letter.html b/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/letter.html index 40a2d6327e..1f20ab61ad 100644 --- a/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/letter.html +++ b/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/letter.html @@ -299,8 +299,8 @@ AAAAAAAAAAAAACUEAABkcnMvZG93bnJldi54bWxQSwUGAAAAAAQABADzAAAALQUAAAAA -

- +

+

diff --git a/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/meeting.html b/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/meeting.html index e1c3cdc47f..1081669b16 100644 --- a/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/meeting.html +++ b/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/meeting.html @@ -182,7 +182,12 @@

 

+

+ +

+
+

 

 

@@ -190,7 +195,7 @@
-
+

送:

diff --git a/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/party-meeting.html b/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/party-meeting.html index aca29825c2..ae86a54d9c 100644 --- a/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/party-meeting.html +++ b/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/party-meeting.html @@ -199,8 +199,11 @@

 

 

- +

+ +

+

 

 

diff --git a/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/party.html b/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/party.html index 3a36599778..baf00ed01f 100644 --- a/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/party.html +++ b/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/party.html @@ -333,8 +333,12 @@ relative;z-index:251662336;left:-463px;top:10px;width:1207px;height:48px'>

 

 

+

+ +

+

 

 

diff --git a/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/standard.html b/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/standard.html index 60f8e3fd15..4ab2c35614 100644 --- a/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/standard.html +++ b/o2web/source/x_component_process_FormDesigner/Module/Documenteditor/templete/standard.html @@ -230,8 +230,8 @@ @@ -239,6 +239,8 @@
+

 

+

 

 

-

- +

+

diff --git a/o2web/source/x_component_process_FormDesigner/lp/en.js b/o2web/source/x_component_process_FormDesigner/lp/en.js index 81f27ec9cc..a153144bd8 100644 --- a/o2web/source/x_component_process_FormDesigner/lp/en.js +++ b/o2web/source/x_component_process_FormDesigner/lp/en.js @@ -773,6 +773,7 @@ MWF.xApplication.process.FormDesigner.LP = { "fullScreenInfo": "Whether to allow full screen display", "wordConversion": "Convert to word", "wordConversionType": "Convert Type", + "isConversionSeal": "Convert Seal", "wordConversionWithService": "By Service", "fileName": "Filename", "fileSite": "Attachment site", diff --git a/o2web/source/x_component_process_FormDesigner/lp/zh-cn.js b/o2web/source/x_component_process_FormDesigner/lp/zh-cn.js index 891e8b239c..befc19fa9d 100644 --- a/o2web/source/x_component_process_FormDesigner/lp/zh-cn.js +++ b/o2web/source/x_component_process_FormDesigner/lp/zh-cn.js @@ -778,6 +778,7 @@ MWF.xApplication.process.FormDesigner.LP = { "fullScreenInfo": "是否允许全屏显示", "wordConversion": "WORD转换", "wordConversionType": "转换方式", + "isConversionSeal": "转换印章", "wordConversionWithService": "使用服务", "fileName": "文件名", "fileSite": "附件site", diff --git a/o2web/source/x_component_process_Xform/Documenteditor.js b/o2web/source/x_component_process_Xform/Documenteditor.js index f733813e1c..48b443b64b 100644 --- a/o2web/source/x_component_process_Xform/Documenteditor.js +++ b/o2web/source/x_component_process_Xform/Documenteditor.js @@ -372,12 +372,24 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla this.layout_copiesSecretPriority = this.contentNode.getElement(".doc_layout_copiesSecretPriority"); if (this.layout_copiesSecretPriority) this.layout_copiesSecretPriority.setStyles(this.css.doc_layout_copiesSecretPriority); + /** + * @summary 份数的dom对象. + * @member {MWF.xApplication.process.Xform.Documenteditor} + */ this.layout_copies = this.contentNode.getElement(".doc_layout_copies"); if (this.layout_copies) this.layout_copies.setStyles(this.css.doc_layout_copies); + /** + * @summary 密级的dom对象. + * @member {MWF.xApplication.process.Xform.Documenteditor} + */ this.layout_secret = this.contentNode.getElement(".doc_layout_secret"); if (this.layout_secret) this.layout_secret.setStyles(this.css.doc_layout_secret); + /** + * @summary 紧急度的dom对象. + * @member {MWF.xApplication.process.Xform.Documenteditor} + */ this.layout_priority = this.contentNode.getElement(".doc_layout_priority"); if (this.layout_priority) this.layout_priority.setStyles(this.css.doc_layout_priority); @@ -387,6 +399,10 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla //红头 _loadRedHeader: function(){ + /** + * @summary 红头的dom对象. + * @member {MWF.xApplication.process.Xform.Documenteditor} + */ this.layout_redHeader = this.contentNode.getElement(".doc_layout_redHeader"); if (this.layout_redHeader) this.layout_redHeader.setStyles(this.css.doc_layout_redHeader); }, @@ -399,6 +415,10 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla var td = this.contentNode.getElement(".doc_layout_filenoup_fileno_td"); if (td) td.setStyles(this.css.doc_layout_filenoup_fileno_td); + /** + * @summary 文号的dom对象. + * @member {MWF.xApplication.process.Xform.Documenteditor} + */ this.layout_fileno = this.contentNode.getElement(".doc_layout_filenoup_fileno"); if (this.layout_fileno) this.layout_fileno.setStyles(this.css.doc_layout_filenoup_fileno); @@ -414,6 +434,10 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla node = this.contentNode.getElement(".doc_layout_filenoup_signerContent_td"); if (node) node.setStyles(this.css.doc_layout_filenoup_signerContent_td); + /** + * @summary 签发人的dom对象. + * @member {MWF.xApplication.process.Xform.Documenteditor} + */ this.layout_signer = this.contentNode.getElement(".doc_layout_filenoup_signerContent"); if (this.layout_signer) this.layout_signer.setStyles(this.css.doc_layout_filenoup_signerContent); @@ -468,12 +492,20 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla //标题 _loadSubject:function(){ + /** + * @summary 标题的dom对象. + * @member {MWF.xApplication.process.Xform.Documenteditor} + */ this.layout_subject = this.contentNode.getElement(".doc_layout_subject"); if (this.layout_subject) this.layout_subject.setStyles(this.css.doc_layout_subject); }, //主送 _loadMainSend: function(){ + /** + * @summary 主送的dom对象. + * @member {MWF.xApplication.process.Xform.Documenteditor} + */ this.layout_mainSend = this.contentNode.getElement(".doc_layout_mainSend"); if (this.layout_mainSend) this.layout_mainSend.setStyles(this.css.doc_layout_mainSend); }, @@ -501,6 +533,10 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla // return filetextNode; // }, _loadFiletext: function(){ + /** + * @summary 正文区域的dom对象. + * @member {MWF.xApplication.process.Xform.Documenteditor} + */ this.layout_filetext = this.contentNode.getElement(".doc_layout_filetext"); this.layout_filetext.addClass("css"+this.form.json.id+this.json.id); this.layout_filetext.setStyles(this.css.doc_layout_filetext); @@ -527,6 +563,10 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla node = this.contentNode.getElement(".doc_layout_attachment_content_td"); if (node) node.setStyles(this.css.doc_layout_attachment_content_td); + /** + * @summary 附件区域的dom对象. + * @member {MWF.xApplication.process.Xform.Documenteditor} + */ this.layout_attachment = this.contentNode.getElement(".doc_layout_attachment_content"); if (this.layout_attachment) this.layout_attachment.setStyles(this.css.doc_layout_attachment_content); }, @@ -534,7 +574,15 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla //发布单位 _loadIssuance: function(){ this.layout_issuanceTable = this.contentNode.getElement(".doc_layout_issuance"); + /** + * @summary 发文单位的dom对象. + * @member {MWF.xApplication.process.Xform.Documenteditor} + */ this.layout_issuanceUnit = this.contentNode.getElement(".doc_layout_issuanceUnit"); + /** + * @summary 发文时间的dom对象. + * @member {MWF.xApplication.process.Xform.Documenteditor} + */ this.layout_issuanceDate = this.contentNode.getElement(".doc_layout_issuanceDate"); if (this.layout_issuanceTable) this.layout_issuanceTable.setStyles(this.css.doc_layout_issuance); @@ -544,6 +592,10 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla //附注 _loadAnnotation: function(){ + /** + * @summary 附注的dom对象. + * @member {MWF.xApplication.process.Xform.Documenteditor} + */ this.layout_annotation = this.contentNode.getElement(".doc_layout_annotation"); if (this.layout_annotation) this.layout_annotation.setStyles(this.css.doc_layout_annotation); }, @@ -566,6 +618,11 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla this.layout_copytoTitle = this.contentNode.getElement(".doc_layout_edition_copyto_title"); if (this.layout_copytoTitle) this.layout_copytoTitle.setStyles(this.css.doc_layout_edition_copyto_title); + + /** + * @summary 抄送的dom对象. + * @member {MWF.xApplication.process.Xform.Documenteditor} + */ this.layout_copytoContent = this.contentNode.getElement(".doc_layout_edition_copyto_content"); if (this.layout_copytoContent) this.layout_copytoContent.setStyles(this.css.doc_layout_edition_copyto_content); @@ -578,12 +635,59 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla if (issuance) issuance.setStyles(this.css.doc_layout_edition_issuance); var issuance_table = this.contentNode.getElement(".doc_layout_edition_issuance_table"); if (issuance_table) issuance_table.setStyles(this.css.doc_layout_edition_issuance_table); + /** + * @summary 印发单位的dom对象. + * @member {MWF.xApplication.process.Xform.Documenteditor} + */ this.layout_edition_issuance_unit = this.contentNode.getElement(".doc_layout_edition_issuance_unit"); if (this.layout_edition_issuance_unit) this.layout_edition_issuance_unit.setStyles(this.css.doc_layout_edition_issuance_unit); + /** + * @summary 印发时间的dom对象. + * @member {MWF.xApplication.process.Xform.Documenteditor} + */ this.layout_edition_issuance_date = this.contentNode.getElement(".doc_layout_edition_issuance_date"); if (this.layout_edition_issuance_date) this.layout_edition_issuance_date.setStyles(this.css.doc_layout_edition_issuance_date); }, + loadSeal: function(){ + /** + * @summary 模拟盖章的dom对象. + * @member {MWF.xApplication.process.Xform.Documenteditor} + */ + this.layout_seals = this.contentNode.getElements(".doc_layout_seal"); + this.layout_seals.each(function(node){ + // if (!node.get("src")){ + node.hide(); + // }else{ + // node.show(); + // node.setStyles({ + // "border": "0", + // "border-radius": "0" + // }); + // } + }); + }, + /**对正文进行模拟盖章(模板中必须有class为“doc_layout_seal”的img对象) + * @summary 对正文进行模拟盖章,此方法只是进行模拟盖章,通过图片显示,并非专业盖章,不具备法律效应。 + * * @param src{String} 盖章图片的url. + * @param position{integer} 要盖章的位置, 默认为0. + * @example + * this.form.get("documenteditor").seal(0, "../custom/img/seal.png"); //在第一个盖章位置进行模拟盖章 + */ + seal: function(src, position){ + var p = position || 0; + if (this.layout_seals && this.layout_seals.length){ + if (this.layout_seals[p]){ + this.layout_seals[p].src = src; + this.layout_seals[p].show(); + this.layout_seals[p].setStyles({ + "border": "0", + "border-radius": "0" + }); + } + this.getSealData(); + } + }, _loadMeeting: function(){ this.layout_meetingAttendArea = this.contentNode.getElement(".doc_layout_meeting_attend"); this.layout_meetingAttendTitle = this.contentNode.getElement(".doc_layout_meeting_attend_title"); @@ -638,6 +742,8 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla this._loadEdition(); + this.loadSeal(); + //会议纪要 this._loadMeeting(); @@ -2874,6 +2980,8 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla if (this.layout_meetingSitContent) this.data.meetingSit = this.layout_meetingSitContent.get("html"); if (this.layout_meetingRecordContent) this.data.meetingRecord = this.layout_meetingRecordContent.get("html"); + this.getSealData(); + if (this.customLayouts){ this.customLayouts.each(function(l){ this.data[l.name] = l.node.get("html"); @@ -2883,6 +2991,14 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla //} return this.data; }, + getSealData: function(){ + if (this.layout_seals && this.layout_seals.length) { + this.data.seals = []; + this.layout_seals.each(function(seal){ + this.data.seals.push(seal.get("src")); + }.bind(this)); + } + }, setAttachmentData: function(){ if (!this.attachmentTemplete){ this.attachmentTemplete = this.layout_attachment.get("html"); @@ -2988,6 +3104,21 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla if (this.layout_meetingSitContent) this.layout_meetingSitContent.set("html", data.meetingSit || " "); if (this.layout_meetingRecordContent) this.layout_meetingRecordContent.set("html", data.meetingRecord || " "); + if (this.layout_seals){ + if (data.seals && data.seals.length){ + data.seals.each(function(src, i){ + if (this.layout_seals[i] && src){ + this.layout_seals[i].src = src; + this.layout_seals[i].show(); + this.layout_seals[i].setStyles({ + "border": "0", + "border-radius": "0" + }); + } + }.bind(this)); + } + } + if (this.customLayouts){ this.customLayouts.each(function(l){ l.node.set("html", this.data[l.name] || " "); @@ -3002,12 +3133,12 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla var unitWidth = o2.getTextSize(this.layout_issuanceUnit.get("text"), { "font-size":"16pt", "font-family":"'Times New Roman',仿宋", - "letter-spacing": "-0.4pt" + "letter-spacing": "-0.2pt" }).x; var dateWidth = o2.getTextSize(this.layout_issuanceDate.get("text"), { "font-size":"16pt", "font-family":"'Times New Roman',仿宋", - "letter-spacing": "-0.4pt" + "letter-spacing": "-0.2pt" }).x; // var unitWidth = this.layout_issuanceUnit.getSize().x; @@ -3082,8 +3213,8 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla var l = 14*text.length; var wl = 19*text.length; cell.setStyles({ - "max-width": ""+l+"pt !important", - "min-width": ""+l+"pt !important", + "max-width": ""+l+"pt", + "min-width": ""+l+"pt", "width": ""+wl+"pt" }); } @@ -3251,7 +3382,7 @@ MWF.xApplication.process.Xform.Documenteditor = MWF.APPDocumenteditor = new Cla removeDisplayNone: function(node){ var n = node.getFirst(); while (n){ - if (n.getStyle("display")=="none"){ + if (n.getStyle("display")=="none" || (this.json.toWordSeal=="n" && n.hasClass("doc_layout_seal"))){ var tmp = n.getNext(); n.destroy(); n = tmp; diff --git a/o2web/source/x_component_process_Xform/widget/OOXML.js b/o2web/source/x_component_process_Xform/widget/OOXML.js index 942907fc3a..54b2798c12 100644 --- a/o2web/source/x_component_process_Xform/widget/OOXML.js +++ b/o2web/source/x_component_process_Xform/widget/OOXML.js @@ -682,6 +682,14 @@ o2.xApplication.process.Xform.widget.OOXML.WordprocessingML = o2.OOXML.WML = new return false; }); } + var d = dom.dataset; + if (d){ + Object.keys(d).forEach(function(k){ + if (k.substr(0,3).toLowerCase()==="mso"){ + o[k.hyphenate()] = d[k]; + } + }); + } return o; }, processTableDom: function(dom, oo_body, append, divAsP, oo_tc){ @@ -1174,6 +1182,7 @@ o2.xApplication.process.Xform.widget.OOXML.WordprocessingML = o2.OOXML.WML = new }, pxToPt: function(px){ + if (!px) return 0; var v = px; if (px && o2.typeOf(px)==="string"){ u = px.substring(px.length-2, px.length); @@ -1217,15 +1226,24 @@ o2.xApplication.process.Xform.widget.OOXML.WordprocessingML = o2.OOXML.WML = new var oo_run = this.createRun(oo_doc, {"rPrs": {"noProof":{}}}); var oo_drawing = this.createEl(oo_doc, "drawing"); + var msoStyle = this.getMsoStyle(img); + var position = img.getStyle("position"); - var p = (position==="absolute" || position==="fixed") ? "anchor" : "inline"; + var p = (position==="absolute" || msoStyle["mso-position-vertical"]==="absolute") ? "anchor" : "inline"; var oo_position; if (p==="anchor"){ //var pos = img.getPosition(img.getParent(".WordSection1")); - var pos = img.getPosition(); - positionH = (pos.x*9525).toInt(); - positionV = (pos.y*9525).toInt(); + //var pos = img.getPosition(); + var positionV = this.pxToPt(msoStyle["mso-top"]); + var positionH = this.pxToPt(msoStyle["mso-left"]); + if (!positionV || !positionH){ + var pos = img.getPosition(img.getOffsetParent()); + if (!positionH) positionH = this.pxToPt(pos.x); + if (!positionV) positionV = this.pxToPt(pos.y); + } + positionH = (positionH*12700).toInt(); + positionV = (positionV*12700).toInt(); var oo_anchor = this.createEl(oo_doc, "anchor", "wp"); this.setAttrs(oo_anchor, { @@ -1237,14 +1255,16 @@ o2.xApplication.process.Xform.widget.OOXML.WordprocessingML = o2.OOXML.WML = new var oo_simplePos = this.createEl(oo_doc, "simplePos", "wp"); this.setAttrs(oo_simplePos, {"x": "0", "y": "0"}, false); + var relativeFrom = msoStyle["mso-position-horizontal-relative"] || "margin"; var oo_positionH = this.createEl(oo_doc, "positionH", "wp"); - this.setAttrs(oo_positionH, {"relativeFrom": "margin"}, false); + this.setAttrs(oo_positionH, {"relativeFrom": relativeFrom}, false); var oo_posOffset = this.createEl(oo_doc, "posOffset", "wp"); oo_posOffset.appendChild(oo_doc.createTextNode(positionH)); oo_positionH.appendChild(oo_posOffset); + relativeFrom = msoStyle["mso-position-vertical-relative"] || "margin"; var oo_positionV = this.createEl(oo_doc, "positionV", "wp"); - this.setAttrs(oo_positionV, {"relativeFrom": "margin"}, false); + this.setAttrs(oo_positionV, {"relativeFrom": relativeFrom}, false); var oo_posOffset = this.createEl(oo_doc, "posOffset", "wp"); oo_posOffset.appendChild(oo_doc.createTextNode(positionV)); //此处需要根据行高来设置数值,暂时固定数值 oo_positionV.appendChild(oo_posOffset); -- GitLab