@egova/egova-api 1.0.254 → 1.0.255

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26709,7 +26709,7 @@ module.exports = function (it) {
26709
26709
  /***/ "45bb":
26710
26710
  /***/ (function(module, exports) {
26711
26711
 
26712
- module.exports = "<i-modal draggable sticky reset-drag-position :mask-closable=\"false\" v-model=\"show\" width=\"880\" class=\"u-data-model-doc-modal diy-modal\" transfer>\r\n <header slot=\"header\">查看接口文档</header>\r\n <main>\r\n <div class=\"v-mavon-container\">\r\n <!-- startprint -->\r\n <mavon-editor :subfield=\"false\" :toolbars=\"toolbars\" :value=\"doc\" defaultOpen=\"preview\" @save=\"onSave\"></mavon-editor>\r\n <!-- endprint -->\r\n <iframe id=\"printf\" src=\"\" width=\"0\" height=\"0\" frameborder=\"0\"></iframe>\r\n </div>\r\n </main>\r\n <footer slot=\"footer\">\r\n <i-button type=\"primary\" class=\"diy-btn-primary\" @click=\"onOk\">关闭</i-button>\r\n </footer>\r\n</i-modal>\r\n"
26712
+ module.exports = "<i-modal draggable sticky reset-drag-position :mask-closable=\"false\" v-model=\"show\" width=\"880\" class=\"u-data-model-doc-modal diy-modal\" transfer>\r\n <header slot=\"header\">查看接口文档</header>\r\n <main>\r\n <div class=\"v-mavon-container\">\r\n <!-- startprint -->\r\n <mavon-editor :subfield=\"false\" :toolbars=\"toolbars\" :value=\"doc\" defaultOpen=\"preview\" @change=\"onChange\">\r\n <template slot=\"left-toolbar-before\">\r\n <i-dropdown placement=\"right-start\" @on-click=\"onMenuClick\">\r\n <span class=\"op-icon fa fa-mavon-floppy-o\"></span>\r\n <i-dropdown-menu slot=\"list\">\r\n <i-dropdown-item name=\"pdf\">保存为pdf</i-dropdown-item>\r\n <i-dropdown-item name=\"html\">保存为html</i-dropdown-item>\r\n </i-dropdown-menu>\r\n </i-dropdown>\r\n </template>\r\n </mavon-editor>\r\n <!-- endprint -->\r\n <iframe id=\"printf\" src=\"\" width=\"0\" height=\"0\" frameborder=\"0\"></iframe>\r\n </div>\r\n </main>\r\n <footer slot=\"footer\">\r\n <i-button type=\"primary\" class=\"diy-btn-primary\" @click=\"onOk\">关闭</i-button>\r\n </footer>\r\n</i-modal>\r\n"
26713
26713
 
26714
26714
  /***/ }),
26715
26715
 
@@ -52660,6 +52660,11 @@ var data_model_doc = __webpack_require__("9b65");
52660
52660
 
52661
52661
 
52662
52662
 
52663
+
52664
+
52665
+
52666
+
52667
+
52663
52668
  var data_model_doc_extends = undefined && undefined.__extends || function () {
52664
52669
  var _extendStatics = function extendStatics(d, b) {
52665
52670
  _extendStatics = Object.setPrototypeOf || {
@@ -52718,9 +52723,8 @@ function (_super) {
52718
52723
 
52719
52724
 
52720
52725
  _this.markdownOption = {};
52721
- _this.toolbars = {
52722
- save: true // 保存(触发events中的save事件)
52723
-
52726
+ _this.render = "";
52727
+ _this.toolbars = {// save: true // 保存(触发events中的save事件)
52724
52728
  };
52725
52729
  return _this;
52726
52730
  }
@@ -52749,6 +52753,49 @@ function (_super) {
52749
52753
  iframe.contentWindow.print();
52750
52754
  };
52751
52755
 
52756
+ DataModelDoc.prototype.onChange = function (value, render) {
52757
+ this.render = render;
52758
+ };
52759
+
52760
+ DataModelDoc.prototype.onMenuClick = function (name) {
52761
+ if (name === "pdf") {
52762
+ this.onSavePdf();
52763
+ } else {
52764
+ this.onSaveHtml();
52765
+ }
52766
+ };
52767
+
52768
+ DataModelDoc.prototype.onSavePdf = function () {
52769
+ var iframe = document.getElementById("printf"); // 获取id为svgframe的iframe对象
52770
+
52771
+ iframe.contentDocument.write(this.render);
52772
+ iframe.contentDocument.close();
52773
+ iframe.contentWindow.print();
52774
+ };
52775
+
52776
+ DataModelDoc.prototype.onSaveHtml = function () {
52777
+ //生成报告
52778
+ var fileName = "接口文档";
52779
+
52780
+ try {
52781
+ var start = this.doc.indexOf("#");
52782
+ var end = this.doc.indexOf("\n");
52783
+ fileName = this.doc.substring(start, end);
52784
+ } catch (error) {}
52785
+
52786
+ var link = document.createElement("a");
52787
+ link.download = "".concat(fileName, ".html"); // 文件名
52788
+
52789
+ link.style.display = "none";
52790
+ var blob = new Blob([this.render], {
52791
+ type: "text/html"
52792
+ });
52793
+ link.href = window.URL.createObjectURL(blob);
52794
+ document.body.appendChild(link);
52795
+ link.click();
52796
+ document.body.removeChild(link);
52797
+ };
52798
+
52752
52799
  DataModelDoc.prototype.onOk = function () {
52753
52800
  this.show = false;
52754
52801
  };