ol-base-components 3.3.5 → 3.3.6
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/package.json
CHANGED
|
@@ -22,6 +22,10 @@ export default {
|
|
|
22
22
|
type: String,
|
|
23
23
|
default: "",
|
|
24
24
|
},
|
|
25
|
+
printData: {
|
|
26
|
+
type: [Object, Array],
|
|
27
|
+
default: () => {},
|
|
28
|
+
},
|
|
25
29
|
},
|
|
26
30
|
data() {
|
|
27
31
|
return {
|
|
@@ -75,8 +79,19 @@ export default {
|
|
|
75
79
|
if (!Array.isArray(this.templateList)) return;
|
|
76
80
|
const tempItem = this.templateList.find(item => item.id === command);
|
|
77
81
|
if (!tempItem) return this.$message.error("未找到打印模板");
|
|
82
|
+
|
|
83
|
+
const data = this.printData;
|
|
84
|
+
const isValidData =
|
|
85
|
+
data &&
|
|
86
|
+
((Array.isArray(data) && data.length > 0) ||
|
|
87
|
+
(typeof data === "object" && Object.keys(data).length > 0));
|
|
88
|
+
|
|
89
|
+
if (!isValidData) {
|
|
90
|
+
return this.$message.error("打印数据不能为空");
|
|
91
|
+
}
|
|
92
|
+
|
|
78
93
|
this.$hiprint.print({
|
|
79
|
-
printData:
|
|
94
|
+
printData: data,
|
|
80
95
|
defaultTemplate: tempItem.templeteJson ? JSON.parse(tempItem.templeteJson) : {},
|
|
81
96
|
});
|
|
82
97
|
},
|