@ningboyz/vue 1.0.27 → 1.0.29

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.
@@ -1,10 +1,10 @@
1
1
  import { defineComponent as f, ref as u, watch as v, createBlock as d, openBlock as g, unref as s } from "vue";
2
- import { Designer as D } from "../../node_modules/stimulsoft-reports-js-vuejs/designer.js";
2
+ import { Designer as D } from "../../../node_modules/stimulsoft-reports-js-vuejs/designer.js";
3
3
  import R from "./factory.js";
4
- import { Stimulsoft as _ } from "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.reports.engine.js";
5
- import "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.viewer.js";
6
- import "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.designer.js";
7
- import "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.blockly.editor.js";
4
+ import { Stimulsoft as _ } from "../../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.reports.engine.js";
5
+ import "../../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.viewer.js";
6
+ import "../../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.designer.js";
7
+ import "../../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.blockly.editor.js";
8
8
  const N = /* @__PURE__ */ f({
9
9
  __name: "desginer",
10
10
  props: {
@@ -1,9 +1,9 @@
1
1
  import l from "lodash";
2
- import "../../node_modules/stimulsoft-reports-js-vuejs/designer.js";
3
- import { Stimulsoft as o } from "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.reports.engine.js";
4
- import "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.viewer.js";
5
- import "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.designer.js";
6
- import "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.blockly.editor.js";
2
+ import "../../../node_modules/stimulsoft-reports-js-vuejs/designer.js";
3
+ import { Stimulsoft as o } from "../../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.reports.engine.js";
4
+ import "../../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.viewer.js";
5
+ import "../../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.designer.js";
6
+ import "../../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.blockly.editor.js";
7
7
  class f {
8
8
  listData = [];
9
9
  report;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ningboyz/vue",
3
- "version": "1.0.27",
3
+ "version": "1.0.29",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "宁波甬政vue-ui库",
@@ -20,7 +20,9 @@
20
20
  "types": "types/index.d.ts",
21
21
  "files": [
22
22
  "es",
23
- "types"
23
+ "types",
24
+ "packages",
25
+ "styles"
24
26
  ],
25
27
  "scripts": {
26
28
  "build": "vite build",
@@ -0,0 +1,9 @@
1
+ import type { App } from "vue";
2
+ import { YzDesginer } from "./stimulsoft/desginer";
3
+ const components = [YzDesginer];
4
+
5
+ export const install = (app: App) => {
6
+ components.forEach((component) => app.use(component));
7
+ };
8
+
9
+ export * from "./stimulsoft/desginer";
@@ -0,0 +1,3 @@
1
+ import * as YzUI from "./components";
2
+ export * from "./components";
3
+ export default YzUI;
@@ -0,0 +1,49 @@
1
+ <script setup lang="ts">
2
+ import { Designer as StimulsoftDesginer, Stimulsoft } from "stimulsoft-reports-js-vuejs/designer";
3
+ import { ref, watch } from "vue";
4
+ import _ from "lodash";
5
+ import ReportFactory from "./factory";
6
+ import type { TWldy } from "@ningboyz/types";
7
+ import { YzDesginerEmits, YzDesginerProps, YzDesginerSlots } from "types/components/stimulsoft/desginer/desginer";
8
+ const props = defineProps<YzDesginerProps>();
9
+ defineSlots<YzDesginerSlots>();
10
+ const report = ref<Stimulsoft.Report.StiReport>();
11
+ const designerOptions = new Stimulsoft.Designer.StiDesignerOptions();
12
+ designerOptions.appearance.fullScreenMode = true;
13
+
14
+ const emits = defineEmits<YzDesginerEmits>();
15
+
16
+ watch(
17
+ () => props.listData,
18
+ (newValue) => {
19
+ renderReport(newValue);
20
+ },
21
+ {
22
+ deep: true
23
+ }
24
+ );
25
+
26
+ const saveReport = (args: Stimulsoft.Designer.SaveReportArgs) => {
27
+ args.preventDefault = true;
28
+ const json = args.report.saveToJsonString();
29
+ const fileName = args.fileName;
30
+ emits("saveReport", fileName, json);
31
+ };
32
+
33
+ const renderReport = async (listData: TWldy.IWldyDataResponse[]) => {
34
+ try {
35
+ const instance = new ReportFactory();
36
+ instance.setListData(listData);
37
+ const reportInst = instance.getReport();
38
+ report.value = reportInst;
39
+ } catch (e: any) {
40
+ console.log(e.message);
41
+ }
42
+ };
43
+ </script>
44
+
45
+ <template>
46
+ <StimulsoftDesginer :report="report" :options="designerOptions" @save-report="saveReport" />
47
+ </template>
48
+
49
+ <style scoped lang="scss"></style>
@@ -0,0 +1,74 @@
1
+ import type { TWldy } from "@ningboyz/types";
2
+ import type { IWldyDataResponse, IWldyItemResponse } from "@ningboyz/types/src/wldy";
3
+ import _ from "lodash";
4
+ import { Stimulsoft } from "stimulsoft-reports-js-vuejs/designer";
5
+
6
+ class Factory {
7
+ private listData: TWldy.IWldyDataResponse[] = [];
8
+ private report: Stimulsoft.Report.StiReport;
9
+
10
+ constructor(listData?: TWldy.IWldyDataResponse[]) {
11
+ if (!_.isNil(listData)) {
12
+ this.listData = listData;
13
+ }
14
+ this.report = new Stimulsoft.Report.StiReport();
15
+ }
16
+
17
+ public setListData = (listData: TWldy.IWldyDataResponse[]) => {
18
+ this.listData = listData;
19
+ };
20
+
21
+ public getReport = () => {
22
+ this.report.dataSources.clear();
23
+ this.getDataSet();
24
+ return this.report;
25
+ };
26
+
27
+ private getDataSet = () => {
28
+ if (this.listData.length === 0) {
29
+ return;
30
+ }
31
+ const dataSet = new Stimulsoft.System.Data.DataSet("网络打印");
32
+ for (let i = 0; i < this.listData.length; i++) {
33
+ const wldyData = this.listData[i];
34
+ const dataTable = new Stimulsoft.System.Data.DataTable(wldyData.dataName);
35
+ this.listItem2DataTable(dataTable, wldyData);
36
+ this.listData2DataTable(dataTable, wldyData);
37
+ dataSet.tables.add(dataTable);
38
+ this.report.regData(dataSet.dataSetName, dataSet.dataSetName, dataSet);
39
+ }
40
+ this.report.dictionary.synchronize();
41
+ };
42
+
43
+ private listItem2DataTable = (dataTable: Stimulsoft.System.Data.DataTable, wldyData: IWldyDataResponse) => {
44
+ for (let i = 0; i < wldyData.listItem.length; i++) {
45
+ const item = wldyData.listItem[i];
46
+ if (_.isEmpty(item.printVal)) {
47
+ continue;
48
+ }
49
+ const dataColumn = new Stimulsoft.System.Data.DataColumn(item.printVal);
50
+ dataTable.columns.add(dataColumn);
51
+ }
52
+ };
53
+
54
+ private listData2DataTable = (dataTable: Stimulsoft.System.Data.DataTable, wldyData: IWldyDataResponse) => {
55
+ for (let i = 0; i < wldyData.listData.length; i++) {
56
+ const data = wldyData.listData[i];
57
+ const dataRow = this.getRow(dataTable, wldyData.listItem, data);
58
+ dataTable.addRow(dataRow);
59
+ }
60
+ };
61
+
62
+ private getRow = (dataTable: Stimulsoft.System.Data.DataTable, listItem: IWldyItemResponse[], data: any) => {
63
+ const dataRow = dataTable.newRow();
64
+ for (let j = 0; j < listItem.length; j++) {
65
+ const wldyItem = listItem[j];
66
+ if (!_.isEmpty(wldyItem.printVal)) {
67
+ dataRow.setValue(wldyItem.printVal, Reflect.get(data, wldyItem.itemCode));
68
+ }
69
+ }
70
+ return dataRow;
71
+ };
72
+ }
73
+
74
+ export default Factory;
@@ -0,0 +1,8 @@
1
+ import type { App } from "vue";
2
+ import Desginer from "./desginer.vue";
3
+
4
+ export const YzDesginer = Object.assign({}, Desginer, {
5
+ install(app: App) {
6
+ app.component(Desginer.name as string, Desginer);
7
+ }
8
+ });
@@ -3,11 +3,18 @@ import { YzComponent } from "../../core/component";
3
3
 
4
4
  export declare const YzDesginer: YzComponent<YzDesginerProps, {}, YzDesginerSlots, YzDesginerMethod>;
5
5
 
6
+ export namespace YzDesginerPropTypes {
7
+ export type ListData = TWldy.IWldyDataResponse[];
8
+ }
9
+
6
10
  export type YzDesginerProps = {
7
- listData: TWldy.IWldyDataResponse[];
11
+ listData: YzDesginerPropTypes.ListData;
8
12
  };
9
13
 
10
- export type YzDesginerMethod = {} & YzDesginerEmits;
14
+ export type YzDesginerMethod = {
15
+ onOK: () => void;
16
+ } & YzDesginerEmits;
17
+
11
18
  export type YzDesginerEmits = {
12
19
  (event: "saveReport", fileName: string, json: string): void;
13
20
  };
File without changes
File without changes