@ningboyz/vue 1.0.84 → 1.0.85
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.
- package/es/components.js +9 -7
- package/es/index.js +9 -7
- package/es/stimulsoft/dataUtils/stimulsoftData.js +66 -0
- package/es/stimulsoft/desginer/factory.js +9 -59
- package/es/stimulsoft/printer/index.js +5 -0
- package/es/stimulsoft/printer/printer.js +64 -0
- package/package.json +1 -1
- package/types/components.d.ts +1 -0
- package/types/stimulsoft/desginer/factory.d.ts +2 -6
- package/types/stimulsoft/printer/printer.d.ts +14 -0
package/es/components.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { YzDesginer as r } from "./stimulsoft/desginer/index.js";
|
|
2
|
-
import { StimulsoftFactory as
|
|
2
|
+
import { StimulsoftFactory as a } from "./stimulsoft/desginer/index.js";
|
|
3
3
|
import { YzLayout as e } from "./layout/index.js";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { StimulsoftPrinter as l } from "./stimulsoft/printer/index.js";
|
|
5
|
+
import { YzMessage as x } from "./message/index.js";
|
|
6
|
+
const m = [r, e], i = (o) => {
|
|
7
|
+
m.forEach((t) => o.use(t));
|
|
7
8
|
};
|
|
8
9
|
export {
|
|
9
|
-
|
|
10
|
+
a as StimulsoftFactory,
|
|
11
|
+
l as StimulsoftPrinter,
|
|
10
12
|
r as YzDesginer,
|
|
11
13
|
e as YzLayout,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
x as YzMessage,
|
|
15
|
+
i as install
|
|
14
16
|
};
|
package/es/index.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import * as o from "./components.js";
|
|
2
2
|
import { install as e } from "./components.js";
|
|
3
|
-
import { StimulsoftFactory as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { StimulsoftFactory as f, YzDesginer as s } from "./stimulsoft/desginer/index.js";
|
|
4
|
+
import { StimulsoftPrinter as a } from "./stimulsoft/printer/index.js";
|
|
5
|
+
import { YzMessage as x } from "./message/index.js";
|
|
6
|
+
import { YzLayout as n } from "./layout/index.js";
|
|
6
7
|
export {
|
|
7
|
-
|
|
8
|
-
a as
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
f as StimulsoftFactory,
|
|
9
|
+
a as StimulsoftPrinter,
|
|
10
|
+
s as YzDesginer,
|
|
11
|
+
n as YzLayout,
|
|
12
|
+
x as YzMessage,
|
|
11
13
|
o as default,
|
|
12
14
|
e as install
|
|
13
15
|
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { decode as m } from "js-base64";
|
|
2
|
+
import n from "lodash";
|
|
3
|
+
import { Stimulsoft as c } from "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.reports.engine.js";
|
|
4
|
+
import "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.reports.chart.js";
|
|
5
|
+
import "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.reports.export.js";
|
|
6
|
+
import "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.reports.import.xlsx.js";
|
|
7
|
+
import "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.reports.maps.js";
|
|
8
|
+
class g {
|
|
9
|
+
static DATA_SET_NAME = "网络打印";
|
|
10
|
+
static createDataSet = (s, t) => {
|
|
11
|
+
this.getDataSet(s, t);
|
|
12
|
+
};
|
|
13
|
+
static getDataSet = (s, t) => {
|
|
14
|
+
const a = new c.System.Data.DataSet(this.DATA_SET_NAME);
|
|
15
|
+
for (let i = 0; i < t.length; i++) {
|
|
16
|
+
const e = t[i], o = new c.System.Data.DataTable(e.dataName);
|
|
17
|
+
this.listItem2DataTable(o, e), this.listData2DataTable(o, e), a.tables.add(o), s.regData(a.dataSetName, a.dataSetName, a);
|
|
18
|
+
}
|
|
19
|
+
s.dictionary.synchronize();
|
|
20
|
+
};
|
|
21
|
+
static listItem2DataTable = (s, t) => {
|
|
22
|
+
for (let a = 0; a < t.listItem.length; a++) {
|
|
23
|
+
const i = t.listItem[a];
|
|
24
|
+
if (n.isEmpty(i.printVal))
|
|
25
|
+
continue;
|
|
26
|
+
const e = new c.System.Data.DataColumn(i.printVal);
|
|
27
|
+
s.columns.add(e);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
static listData2DataTable = (s, t) => {
|
|
31
|
+
for (let a = 0; a < t.listData.length; a++) {
|
|
32
|
+
const i = t.listData[a], e = this.getRow(s, t.listItem, i);
|
|
33
|
+
s.addRow(e);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
static getRow = (s, t, a) => {
|
|
37
|
+
const i = s.newRow();
|
|
38
|
+
for (let e = 0; e < t.length; e++) {
|
|
39
|
+
const o = t[e];
|
|
40
|
+
if (!n.isEmpty(o.printVal)) {
|
|
41
|
+
let l = Reflect.get(a, o.itemCode);
|
|
42
|
+
n.isEmpty(o.jsMethod) || (l = this.execJsMethod(o.jsMethod, l)), i.setValue(o.printVal, l);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return i;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* 执行js语句
|
|
49
|
+
* @param jsMethod
|
|
50
|
+
* @param value
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
53
|
+
static execJsMethod = (s, t) => {
|
|
54
|
+
const a = m(s), i = new Function("value", a);
|
|
55
|
+
try {
|
|
56
|
+
const e = i(t);
|
|
57
|
+
n.isNil(e) || (t = e);
|
|
58
|
+
} catch (e) {
|
|
59
|
+
console.log(e.message);
|
|
60
|
+
}
|
|
61
|
+
return t;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export {
|
|
65
|
+
g as default
|
|
66
|
+
};
|
|
@@ -1,78 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
import s from "lodash";
|
|
1
|
+
import r from "lodash";
|
|
3
2
|
import "../../node_modules/stimulsoft-reports-js-vuejs/designer.js";
|
|
4
|
-
import
|
|
3
|
+
import o from "../dataUtils/stimulsoftData.js";
|
|
4
|
+
import { Stimulsoft as i } from "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.reports.engine.js";
|
|
5
5
|
import "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.viewer.js";
|
|
6
6
|
import "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.designer.js";
|
|
7
7
|
import "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.blockly.editor.js";
|
|
8
|
-
class
|
|
8
|
+
class f {
|
|
9
9
|
listData = void 0;
|
|
10
10
|
report;
|
|
11
11
|
constructor(t) {
|
|
12
|
-
|
|
12
|
+
r.isNil(t) || (this.listData = t), this.report = new i.Report.StiReport();
|
|
13
13
|
}
|
|
14
|
-
initLicense = () => (
|
|
14
|
+
initLicense = () => (i.Base.StiLicense.key = "6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHkVaUjYnRU/wphl9h6TkK9UtvGvwIZ/qCzU7vjHmM5RWbvCAfAhZhn+eMayEo4PRtUFJINrdMkfnVj1/HeyPgSgAKdpQpP1wzGj2ri5UgGNU8p7Pi59UAegRyUxjTI96rT+khTJIcSoTTPkqZwt0uC+IGtEdehlDchk7madvSLA9guSEZZuSHsc+adQ93NZogak6uo7LbqRh2xC23iGH4sValMR9CBxAsjWUYJH0yrcXODeYrX6ARDlVCW40MGOMrYnx/2W3O8L26oTyAFEdQ1TN1KzYjP4zenjvu4KBAWIopWG6Gk2ydffI0zldxHaPeEl0Lt6U77ykFtsXqW5fN/9t040SfeZfzMAq2ZoVGXPXKCjBo+asFZHrxn7iLpsxF7zwWkYIto8ObpimosoY0on8aLx7At7Qo3VaUOST48gIdqBabUpVz3O9h8UULJa23nlwMVMXheIMMmp6ACD9Bupla/giERFXIYIfpE4eFCD93sR2Cq2f8jdm5Z9B/faB8j4iz0IugVhK4BYhw2q9jAufdWTIx3nsE2Qw7ah0jNsgkR9kWWnHQ3qI/lwFLcFr81SVgyNpFzZ/zcV6vM+xaqbuEMivQx5uFx9WLOMU/ZYkyV8Hi/IEmU+O72NObJtWDxnhUkl4iV0WsYT2V2EU8t0NZP9SBCrLU+rd0SERAdGnRUfoJrm8mXPgcN6+FGNyTgiw0Do8oLU/Skqa/TohVeT", i.Base.Localization.StiLocalization.addLocalizationFile("../localizations/zh.xml", !1, "中文"), i.Base.Localization.StiLocalization.cultureName = "中文", this);
|
|
15
15
|
setListData = (t) => (this.listData = t, this);
|
|
16
16
|
/**
|
|
17
17
|
* 加载打印模版json
|
|
18
18
|
* @param json
|
|
19
19
|
* @returns
|
|
20
20
|
*/
|
|
21
|
-
loadJson = (t) => (
|
|
22
|
-
getReport = () => (this.report.dataSources.clear(),
|
|
21
|
+
loadJson = (t) => (r.isEmpty(t) || this.report.load(t), this);
|
|
22
|
+
getReport = () => (this.report.dataSources.clear(), r.isNil(this.listData) || this.listData.length === 0 ? this.report : (o.createDataSet(this.report, this.listData), this.report));
|
|
23
23
|
print = () => (this.report.print(), this);
|
|
24
24
|
printToPdf = () => (this.report.printToPdf(), this);
|
|
25
|
-
getDataSet = (t) => {
|
|
26
|
-
const e = new r.System.Data.DataSet("网络打印");
|
|
27
|
-
for (let i = 0; i < t.length; i++) {
|
|
28
|
-
const o = t[i], a = new r.System.Data.DataTable(o.dataName);
|
|
29
|
-
this.listItem2DataTable(a, o), this.listData2DataTable(a, o), e.tables.add(a), this.report.regData(e.dataSetName, e.dataSetName, e);
|
|
30
|
-
}
|
|
31
|
-
this.report.dictionary.synchronize();
|
|
32
|
-
};
|
|
33
|
-
listItem2DataTable = (t, e) => {
|
|
34
|
-
for (let i = 0; i < e.listItem.length; i++) {
|
|
35
|
-
const o = e.listItem[i];
|
|
36
|
-
if (s.isEmpty(o.printVal))
|
|
37
|
-
continue;
|
|
38
|
-
const a = new r.System.Data.DataColumn(o.printVal);
|
|
39
|
-
t.columns.add(a);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
listData2DataTable = (t, e) => {
|
|
43
|
-
for (let i = 0; i < e.listData.length; i++) {
|
|
44
|
-
const o = e.listData[i], a = this.getRow(t, e.listItem, o);
|
|
45
|
-
t.addRow(a);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
getRow = (t, e, i) => {
|
|
49
|
-
const o = t.newRow();
|
|
50
|
-
for (let a = 0; a < e.length; a++) {
|
|
51
|
-
const n = e[a];
|
|
52
|
-
if (!s.isEmpty(n.printVal)) {
|
|
53
|
-
let l = Reflect.get(i, n.itemCode);
|
|
54
|
-
s.isEmpty(n.jsMethod) || (l = this.execJsMethod(n.jsMethod, l)), o.setValue(n.printVal, l);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return o;
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* 执行js语句
|
|
61
|
-
* @param jsMethod
|
|
62
|
-
* @param value
|
|
63
|
-
* @returns
|
|
64
|
-
*/
|
|
65
|
-
execJsMethod = (t, e) => {
|
|
66
|
-
const i = h(t), o = new Function("value", i);
|
|
67
|
-
try {
|
|
68
|
-
const a = o(e);
|
|
69
|
-
s.isNil(a) || (e = a);
|
|
70
|
-
} catch (a) {
|
|
71
|
-
console.error(a.message);
|
|
72
|
-
}
|
|
73
|
-
return e;
|
|
74
|
-
};
|
|
75
25
|
}
|
|
76
26
|
export {
|
|
77
|
-
|
|
27
|
+
f as default
|
|
78
28
|
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Stimulsoft as r } from "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.reports.engine.js";
|
|
2
|
+
import "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.reports.chart.js";
|
|
3
|
+
import "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.reports.export.js";
|
|
4
|
+
import "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.reports.import.xlsx.js";
|
|
5
|
+
import "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.reports.maps.js";
|
|
6
|
+
import p from "../dataUtils/stimulsoftData.js";
|
|
7
|
+
import n from "lodash";
|
|
8
|
+
class z {
|
|
9
|
+
reports = [];
|
|
10
|
+
report;
|
|
11
|
+
printData;
|
|
12
|
+
/**
|
|
13
|
+
* json模版
|
|
14
|
+
* 打印数据
|
|
15
|
+
* @param jsonTemplate
|
|
16
|
+
* @param listData
|
|
17
|
+
*/
|
|
18
|
+
constructor(t) {
|
|
19
|
+
this.printData = t, this.report = new r.Report.StiReport();
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 初始化license
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
setLicense = () => (r.Base.StiLicense.key = "6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHnoqRsTjn3r4gCjGmI4zigyx1/jykQLu0NAARASnJjAQSyt52+ehldWEiMsZr8vWwzgXL/3VIlNgijvFXFLs34gS6703afT96ozRsf6Vk6R8lFE8TtNzZOAhDQhIaA4KA8LyCDq5CDwl1tnSZ8le+Kjo5dpbeydmKhuvCwtPDzdkT4SH72amyuwPw5V/JY3q7Qx+hoRwJ+po3nwnUuNXvhMzSLf6u4dICb1ZwoTBLzLrb3nI59GOzt4GZxTtP+YxmhrqgNz/qjx5INz7xiWya1qSyaV5kwYzc/PC5TBBzNqNIdWEjceObbxhZlYe8ftibTERDpdzgNLpvlqtc4T5hsuW+QF90lcDcFrAjLcb3qXSaWyolq8pu5YV72jtvwvSKx08MK79u+tHbg8+Sp4hFdeTfPBY+ASAEYmbTHksa3a3yhKnmm8Ukc5YDOqLtjE7rRqqVnbfDOJAJwFveTgcBS/jqPnOxiyYn5moz0Ql7THTomnaO+D1q31yZEKr8MmdaEj1beofSS8loVhbU76FRnMfKCxGFRVa0RWT2lDBHuBmf7WDciO6KYgiMLSGeN3yvvDY+5Miavh6vQqGZUoIN3BTog+V04NiiLWYF4NYAi/63mM0/FnlWLgPwMnChfNstWL9Q8LFIEy1HepHGbq6i5kwx2nANiJBnMnPJEB4Tdd8wAP5HN1LHG71xwV5XHEkghmgn2BPC8XOtHaRw0NpHWa", r.Base.Localization.StiLocalization.addLocalizationFile("./localizations/zh.xml", !1, "中文"), r.Base.Localization.StiLocalization.cultureName = "中文", this);
|
|
26
|
+
/**
|
|
27
|
+
* 初始化报销
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
initReport = () => {
|
|
31
|
+
for (let t = 0; t < this.printData.length; t++) {
|
|
32
|
+
const i = this.printData[t];
|
|
33
|
+
for (let e = 0; e < i.jsonTemplates.length; e++) {
|
|
34
|
+
const a = i.jsonTemplates[e];
|
|
35
|
+
for (let o = 0; o < i.listData.length; o++) {
|
|
36
|
+
const l = i.listData[o], s = new r.Report.StiReport();
|
|
37
|
+
s.load(a), p.createDataSet(s, l), this.reports.push(s);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return this;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* 合并报表
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
mergeReport = async () => {
|
|
48
|
+
for (let t = 0; t < this.reports.length; t++) {
|
|
49
|
+
const i = this.reports[t];
|
|
50
|
+
i.render(), t === 0 ? this.report = i : i.renderedPages.toList().forEach((e) => {
|
|
51
|
+
this.report.renderedPages.add(e.clone());
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return this;
|
|
55
|
+
};
|
|
56
|
+
print() {
|
|
57
|
+
n.isNil(this.printData) || this.printData.length === 0 || (this.printData.forEach((t) => {
|
|
58
|
+
n.isNil(t.jsonTemplates) || t.jsonTemplates.length === 0 || n.isNil(t.listData) || t.listData.length;
|
|
59
|
+
}), this.setLicense(), this.initReport(), this.mergeReport(), this.report.print());
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
z as default
|
|
64
|
+
};
|
package/package.json
CHANGED
package/types/components.d.ts
CHANGED
|
@@ -18,5 +18,6 @@ export {};
|
|
|
18
18
|
export * from "./components/core/core";
|
|
19
19
|
export * from "./stimulsoft/desginer/desginer";
|
|
20
20
|
export * from "./stimulsoft/desginer/factory";
|
|
21
|
+
export * from "./stimulsoft/printer/printer";
|
|
21
22
|
export * from "./message/message";
|
|
22
23
|
export * from "./layout/layout";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TWldy } from "@ningboyz/types";
|
|
2
2
|
import { Stimulsoft } from "stimulsoft-reports-js-vuejs/designer";
|
|
3
3
|
declare class Factory {
|
|
4
|
-
private listData;
|
|
5
|
-
private report;
|
|
4
|
+
private listData: TWldy.IWldyDataResponse[];
|
|
5
|
+
private report: Stimulsoft.Report.StiReport;
|
|
6
6
|
constructor(listData?: TWldy.IWldyDataResponse[]);
|
|
7
7
|
initLicense: () => Factory;
|
|
8
8
|
setListData: (listData: TWldy.IWldyDataResponse[]) => Factory;
|
|
@@ -10,10 +10,6 @@ declare class Factory {
|
|
|
10
10
|
getReport: () => Stimulsoft.Report.StiReport;
|
|
11
11
|
print: () => Factory;
|
|
12
12
|
printToPdf: () => Factory;
|
|
13
|
-
private getDataSet;
|
|
14
|
-
private listItem2DataTable;
|
|
15
|
-
private listData2DataTable;
|
|
16
|
-
private getRow;
|
|
17
13
|
}
|
|
18
14
|
export default Factory;
|
|
19
15
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TWldy, TStim } from "@ningboyz/types";
|
|
2
|
+
import { Stimulsoft } from "stimulsoft-reports-js-vuejs/designer";
|
|
3
|
+
declare class Printer {
|
|
4
|
+
private printData: TStim.IStimulSoftData[];
|
|
5
|
+
private report: Stimulsoft.Report.StiReport;
|
|
6
|
+
constructor(printData: TStim.IStimulSoftData[]);
|
|
7
|
+
private setLicense: () => Printer;
|
|
8
|
+
private initReport: () => Printer;
|
|
9
|
+
private mergeReport: () => Printer;
|
|
10
|
+
public print: () => void;
|
|
11
|
+
}
|
|
12
|
+
export default Printer;
|
|
13
|
+
|
|
14
|
+
export const StimulsoftPrinter = Printer;
|