欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

vue-cli使用stimulsoft.reports.js的詳細(xì)教程

 更新時間:2021年12月16日 17:14:52   作者:小C好好干飯  
Stimulsoft?Reports.JS是一個使用JavaScript和HTML5生成報表的平臺。它擁有所有擁來設(shè)計,編輯和查看報表的必需組件。該報表工具根據(jù)開發(fā)人員數(shù)量授權(quán)而不是根據(jù)應(yīng)用程序的用戶數(shù)量。接下來通過本文給大家介紹vue-cli使用stimulsoft.reports.js的方法,一起看看吧

vue-cli使用stimulsoft.reports.js(保姆級教程)

第一部分:數(shù)據(jù)源準(zhǔn)備

以下是JSON數(shù)據(jù)的教程

在這里插入圖片描述

在這里插入圖片描述
在這里插入圖片描述
在這里插入圖片描述
在這里插入圖片描述
在這里插入圖片描述
在這里插入圖片描述

json數(shù)據(jù)結(jié)構(gòu)

{
	"數(shù)據(jù)源名":[
		// ...數(shù)據(jù)列表
	]
}

自己的測試JSON數(shù)據(jù)

{
    "data": [
        {
            "a": "我是A",
            "b": "我是B",
            "c": "我是C"
        },
        {
            "a": "我是A",
            "b": "我是B",
            "c": "我是C"
        },
        {
            "a": "我是A",
            "b": "我是B",
            "c": "我是C"
        }
    ]
}

附上官方處數(shù)據(jù)(自己刪減了一些數(shù)據(jù)讓讀者能更好看懂結(jié)構(gòu))

{
	"Customers": [{
		"CustomerID": "ALFKI",
		"CompanyName": "Alfreds Futterkiste",
		"ContactName": "Maria Anders",
		"ContactTitle": "Sales Representative",
		"Address": "Obere Str. 57",
		"City": "Berlin",
		"Region": null,
		"PostalCode": "12209",
		"Country": "Germany",
		"Phone": "030-0074321",
		"Fax": "030-0076545"
	}, {
		"CustomerID": "ANATR",
		"CompanyName": "Ana Trujillo Emparedados y helados",
		"ContactName": "Ana Trujillo",
		"ContactTitle": "Owner",
		"Address": "Avda. de la Constitución 2222",
		"City": "México D.F.",
		"Region": null,
		"PostalCode": "05021",
		"Country": "Mexico",
		"Phone": "(5) 555-4729",
		"Fax": "(5) 555-3745"
	}]
}

第二部分:vue-cli引入stimulsoft.reports.js

在這里插入圖片描述
在這里插入圖片描述

附上App.vue代碼
分別有展示數(shù)據(jù)、打印數(shù)據(jù)、保存數(shù)據(jù)、導(dǎo)入json數(shù)據(jù)的功能測試

<template>
  <div id="app">
    <div>
      <h2>Stimulsoft Reports.JS Viewer</h2>
      <button @click="print">打印</button>
      <button @click="save">保存</button>
      <button @click="setJson">設(shè)置JSON</button>
      <div id="viewer"></div>
    </div>
  </div>
</template>

<script>
export default {
  name: "app",
  data() {
    return {};
  },
    // 加載官方示例模板代碼
  mounted: function () {
    console.log("加載查看器視圖");
    // 工具欄
    console.log("創(chuàng)建具有默認(rèn)選項的報表查看器");
    var viewer = new window.Stimulsoft.Viewer.StiViewer(
      null,
      "StiViewer",
      false
    );

    // 報表
    console.log("創(chuàng)建一個新的報表實例");
    var report = new window.Stimulsoft.Report.StiReport();

    // 加載文件
    console.log("從url加載報告");
    report.loadFile("/reports/SimpleList.mrt");

    // 創(chuàng)建報表
    console.log("將報表分配給查看器,報表將在呈現(xiàn)查看器之后自動生成  ");
    viewer.report = report;

    // 注入標(biāo)簽
    console.log("將查看器呈現(xiàn)給選定的元素");
    viewer.renderHtml("viewer");

    console.log("加載成功完成!");
  },
  methods: {
    // 調(diào)用打印機(jī)打印數(shù)據(jù)
    print() {
      var report = new window.Stimulsoft.Report.StiReport();
      report.loadFile("/reports/SimpleList.mrt");
      report.print();
    },
    // 導(dǎo)出保存數(shù)據(jù)
    save() {
      var report = new window.Stimulsoft.Report.StiReport();
      report.loadFile("/reports/SimpleList.mrt");
      // 將呈現(xiàn)的報告保存為JSON字符串
      var json = report.saveDocumentToJsonString();
      console.log("json", json);
      // 獲取報告文件名
      var fileName = report.reportAlias
        ? report.reportAlias
        : report.reportName;
      console.log("report.reportName", report.reportName);
      console.log("report.reportAlias", report.reportAlias);
      console.log("fileName", fileName);
      // 將數(shù)據(jù)保存到文件
      window.Stimulsoft.System.StiObject.saveAs(
        json,
        fileName + ".mdc",
        "application/json;charset=utf-8"
      );
    },
    // 獲取json數(shù)據(jù)并寫入頁面
    setJson() {
      var report = new window.Stimulsoft.Report.StiReport();

      // report.loadFile("/reports/SimpleList.mrt");// 官方數(shù)據(jù)模板
      report.loadFile("/reports/Test.mrt");// 自己的數(shù)據(jù)模板
      
      // 創(chuàng)建新的DataSet對象
      var dataSet = new window.Stimulsoft.System.Data.DataSet("JSON");
      // 將JSON數(shù)據(jù)文件從指定的URL加載到DataSet對象

      // dataSet.readJsonFile("/reports/Demo.json");//官方數(shù)據(jù)
      dataSet.readJsonFile("/reports/Test.json");// 自己的json數(shù)據(jù)
        
	  //文件用上面的readJsonFile方式導(dǎo)入,接口網(wǎng)絡(luò)請求用下面這種方式進(jìn)行導(dǎo)入
      // let json=/*此處省略獲取數(shù)據(jù)請求*/
      // dataSet.readJson(JSON.stringify(json));
        
      // 清除報告模板中數(shù)據(jù)
      report.dictionary.databases.clear();
        
      // 注冊數(shù)據(jù)集對象
      report.regData("JSON", "JSON", dataSet);
        
      // 用注冊數(shù)據(jù)呈現(xiàn)報表
      // report.render();
      // 工具欄
      var viewer = new window.Stimulsoft.Viewer.StiViewer(
        null,
        "StiViewer",
        false
      );
      // 創(chuàng)建報表
      viewer.report = report;
      // 注入標(biāo)簽
      viewer.renderHtml("viewer");
    },
  },
};
</script>

<style>
</style>

最后附上本人測試項目連接

項目鏈接
鏈接: https://pan.baidu.com/s/1HahzqHgFXvHT6OuE4IqzgQ

提取碼: vr57?

工具鏈接

鏈接: https://pan.baidu.com/s/1374m-kCBZBeOdlDrAbXtbQ?

提取碼: dfkc

官方教程鏈接
https://www.evget.com/serializedetail/510

到此這篇關(guān)于vue-cli使用stimulsoft.reports.js的文章就介紹到這了,更多相關(guān)vue-cli使用stimulsoft.reports.js內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Vue快速實現(xiàn)通用表單驗證的示例代碼

    Vue快速實現(xiàn)通用表單驗證的示例代碼

    這篇文章主要介紹了Vue快速實現(xiàn)通用表單驗證的示例代碼,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-01-01
  • vue給組件傳遞不同的值方法

    vue給組件傳遞不同的值方法

    今天小編就為大家分享一篇vue給組件傳遞不同的值方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2018-09-09
  • vue2.0 自定義日期時間過濾器

    vue2.0 自定義日期時間過濾器

    本文給大家?guī)韮煞N方法實現(xiàn)vue2.0 自定義日期時間過濾器,需要的的朋友參考下吧
    2017-06-06
  • Vue精簡版風(fēng)格概述

    Vue精簡版風(fēng)格概述

    本篇文章給大家講解了一下Vue精簡版風(fēng)格的相關(guān)知識點(diǎn)內(nèi)容以及分享了實例代碼,有興趣的朋友參考下。
    2018-01-01
  • Vue3封裝全局函數(shù)式組件方法總結(jié)

    Vue3封裝全局函數(shù)式組件方法總結(jié)

    函數(shù)式組件就是沒有管理任何狀態(tài),也沒有監(jiān)聽任何傳遞給它的狀態(tài),也沒有生命周期方法,它只是一個接受一些 prop 的函數(shù),下面這篇文章主要給大家介紹了關(guān)于Vue3封裝全局函數(shù)式組件方法的相關(guān)資料,需要的朋友可以參考下
    2023-06-06
  • vue遍歷對象中的數(shù)組取值示例

    vue遍歷對象中的數(shù)組取值示例

    今天小編就為大家分享一篇vue遍歷對象中的數(shù)組取值示例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2019-11-11
  • Vue組件基礎(chǔ)操作介紹

    Vue組件基礎(chǔ)操作介紹

    這篇文章主要介紹了Vue組件基礎(chǔ)操作,組件是vue.js最強(qiáng)大的功能之一,而組件實例的作用域是相互獨(dú)立的,這就意味著不同組件之間的數(shù)據(jù)無法相互進(jìn)行直接的引用
    2023-01-01
  • vue中elementUI里面一些插件的使用

    vue中elementUI里面一些插件的使用

    Element UI是一套基于Vue的桌面端組件庫,封裝好了很多常用的UI組件,下面這篇文章主要給大家介紹了關(guān)于vue中elementUI里面一些插件的使用方法,文中通過實例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2022-06-06
  • useEffect理解React、Vue設(shè)計理念的不同

    useEffect理解React、Vue設(shè)計理念的不同

    這篇文章主要為大家介紹了useEffect理解React、Vue設(shè)計理念的不同詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-09-09
  • 學(xué)習(xí)Vue組件實例

    學(xué)習(xí)Vue組件實例

    本篇文章給大家分享了Vue實例的相關(guān)內(nèi)容以及重要知識點(diǎn),對此有興趣的朋友可以跟著學(xué)習(xí)參考下。
    2018-04-04

最新評論