@ningboyz/vue 1.0.83 → 1.0.84
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,24 +1,26 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Designer as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { defineComponent as g, ref as U, watch as S, createBlock as h, openBlock as L, unref as i } from "vue";
|
|
2
|
+
import { Designer as v } from "../../node_modules/stimulsoft-reports-js-vuejs/designer.js";
|
|
3
|
+
import z from "lodash";
|
|
4
|
+
import x from "./factory.js";
|
|
5
|
+
import { Stimulsoft as a } from "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.reports.engine.js";
|
|
5
6
|
import "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.viewer.js";
|
|
6
7
|
import "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.designer.js";
|
|
7
8
|
import "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.blockly.editor.js";
|
|
8
|
-
const
|
|
9
|
+
const N = /* @__PURE__ */ g({
|
|
9
10
|
__name: "desginer",
|
|
10
11
|
props: {
|
|
11
12
|
templateJson: {},
|
|
12
|
-
listData: {}
|
|
13
|
+
listData: {},
|
|
14
|
+
registerTable: { type: Function }
|
|
13
15
|
},
|
|
14
16
|
emits: ["saveReport"],
|
|
15
|
-
setup(p, { expose:
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
const m =
|
|
20
|
-
|
|
21
|
-
() => [
|
|
17
|
+
setup(p, { expose: c, emit: l }) {
|
|
18
|
+
a.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", a.Base.Localization.StiLocalization.addLocalizationFile("../localizations/zh.xml", !1, "中文"), a.Base.Localization.StiLocalization.cultureName = "中文";
|
|
19
|
+
const r = p, n = U(), s = new a.Designer.StiDesignerOptions();
|
|
20
|
+
s.appearance.fullScreenMode = !0;
|
|
21
|
+
const m = l;
|
|
22
|
+
S(
|
|
23
|
+
() => [r.templateJson, r.listData],
|
|
22
24
|
(e) => {
|
|
23
25
|
console.log(e);
|
|
24
26
|
const o = e[0], t = e[1];
|
|
@@ -32,23 +34,23 @@ const y = /* @__PURE__ */ u({
|
|
|
32
34
|
e.preventDefault = !0;
|
|
33
35
|
const o = e.report.saveToJsonString(), t = e.fileName;
|
|
34
36
|
m("saveReport", t, o);
|
|
35
|
-
}, d = async (e, o) => {
|
|
37
|
+
}, u = () => z.isNil(n.value) ? "" : "data:application/pdf;base64," + n.value.exportDocument(a.Report.StiExportFormat.Pdf).toString("base64"), d = async (e, o) => {
|
|
36
38
|
try {
|
|
37
|
-
const t = new
|
|
38
|
-
|
|
39
|
+
const t = new x();
|
|
40
|
+
n.value = t.setListData(o).loadJson(e).getReport();
|
|
39
41
|
} catch (t) {
|
|
40
42
|
console.log(t.message);
|
|
41
43
|
}
|
|
42
44
|
};
|
|
43
|
-
return
|
|
44
|
-
|
|
45
|
-
}), (e, o) => (L(), h(i(
|
|
46
|
-
report:
|
|
47
|
-
options: i(
|
|
45
|
+
return c({
|
|
46
|
+
getPdfBase64: u
|
|
47
|
+
}), (e, o) => (L(), h(i(v), {
|
|
48
|
+
report: n.value,
|
|
49
|
+
options: i(s),
|
|
48
50
|
onSaveReport: f
|
|
49
51
|
}, null, 8, ["report", "options"]));
|
|
50
52
|
}
|
|
51
53
|
});
|
|
52
54
|
export {
|
|
53
|
-
|
|
55
|
+
N as default
|
|
54
56
|
};
|
|
@@ -1,58 +1,78 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { decode as h } from "js-base64";
|
|
2
|
+
import s from "lodash";
|
|
2
3
|
import "../../node_modules/stimulsoft-reports-js-vuejs/designer.js";
|
|
3
|
-
import { Stimulsoft as
|
|
4
|
+
import { Stimulsoft as r } from "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.reports.engine.js";
|
|
4
5
|
import "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.viewer.js";
|
|
5
6
|
import "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.designer.js";
|
|
6
7
|
import "../../node_modules/stimulsoft-reports-js-vuejs/stimulsoft.blockly.editor.js";
|
|
7
|
-
class
|
|
8
|
+
class g {
|
|
8
9
|
listData = void 0;
|
|
9
10
|
report;
|
|
10
11
|
constructor(t) {
|
|
11
|
-
|
|
12
|
+
s.isNil(t) || (this.listData = t), this.report = new r.Report.StiReport();
|
|
12
13
|
}
|
|
13
|
-
initLicense = () => (
|
|
14
|
+
initLicense = () => (r.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", r.Base.Localization.StiLocalization.addLocalizationFile("../localizations/zh.xml", !1, "中文"), r.Base.Localization.StiLocalization.cultureName = "中文", this);
|
|
14
15
|
setListData = (t) => (this.listData = t, this);
|
|
15
16
|
/**
|
|
16
17
|
* 加载打印模版json
|
|
17
18
|
* @param json
|
|
18
19
|
* @returns
|
|
19
20
|
*/
|
|
20
|
-
loadJson = (t) => (
|
|
21
|
-
getReport = () => (this.report.dataSources.clear(),
|
|
21
|
+
loadJson = (t) => (s.isEmpty(t) || this.report.load(t), this);
|
|
22
|
+
getReport = () => (this.report.dataSources.clear(), s.isNil(this.listData) || this.listData.length === 0 ? this.report : (this.getDataSet(this.listData), this.report));
|
|
22
23
|
print = () => (this.report.print(), this);
|
|
23
24
|
printToPdf = () => (this.report.printToPdf(), this);
|
|
24
25
|
getDataSet = (t) => {
|
|
25
|
-
const
|
|
26
|
+
const e = new r.System.Data.DataSet("网络打印");
|
|
26
27
|
for (let i = 0; i < t.length; i++) {
|
|
27
|
-
const
|
|
28
|
-
this.listItem2DataTable(
|
|
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);
|
|
29
30
|
}
|
|
30
31
|
this.report.dictionary.synchronize();
|
|
31
32
|
};
|
|
32
|
-
listItem2DataTable = (t,
|
|
33
|
-
for (let i = 0; i <
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
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))
|
|
36
37
|
continue;
|
|
37
|
-
const
|
|
38
|
-
t.columns.add(
|
|
38
|
+
const a = new r.System.Data.DataColumn(o.printVal);
|
|
39
|
+
t.columns.add(a);
|
|
39
40
|
}
|
|
40
41
|
};
|
|
41
|
-
listData2DataTable = (t,
|
|
42
|
-
for (let i = 0; i <
|
|
43
|
-
const
|
|
44
|
-
t.addRow(
|
|
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);
|
|
45
46
|
}
|
|
46
47
|
};
|
|
47
|
-
getRow = (t,
|
|
48
|
-
const
|
|
49
|
-
for (let
|
|
50
|
-
const n = a
|
|
51
|
-
|
|
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);
|
|
52
72
|
}
|
|
53
73
|
return e;
|
|
54
74
|
};
|
|
55
75
|
}
|
|
56
76
|
export {
|
|
57
|
-
|
|
77
|
+
g as default
|
|
58
78
|
};
|
package/package.json
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { TWldy } from "@ningboyz/types";
|
|
2
2
|
import { YzComponentApp } from "../../components/core/core";
|
|
3
|
+
import { Stimulsoft } from "stimulsoft-reports-js-vuejs";
|
|
3
4
|
|
|
4
5
|
export declare const YzDesginer: YzComponentApp<YzDesginerProps, {}, YzDesginerSlots, YzDesginerMethod>;
|
|
5
6
|
|
|
6
7
|
export type YzDesginerProps = {
|
|
7
8
|
templateJson?: string;
|
|
8
9
|
listData?: TWldy.IWldyDataResponse[];
|
|
10
|
+
registerTable?: (report: Stimulsoft.Report.StiReport) => Promise<{
|
|
11
|
+
table: Stimulsoft.Report.Components.Table.StiTable;
|
|
12
|
+
index: number;
|
|
13
|
+
}>;
|
|
9
14
|
};
|
|
10
15
|
|
|
11
16
|
export type YzDesginerMethod = {
|
|
@@ -16,4 +21,6 @@ export interface YzDesginerSlots {
|
|
|
16
21
|
title?: () => any;
|
|
17
22
|
}
|
|
18
23
|
|
|
19
|
-
export type YzDesginerInstance = {
|
|
24
|
+
export type YzDesginerInstance = {
|
|
25
|
+
getPdfBase64: () => string;
|
|
26
|
+
};
|