1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
| {
| "schemaVersion": "1.1",
| "page": {
| "size": "A4",
| "orientation": "portrait",
| "margin": { "top": 12, "right": 8, "bottom": 12, "left": 8 }
| },
| "grapes": {
| "pages": [
| {
| "frames": [
| {
| "component": {
| "type": "wrapper",
| "components": [
| {
| "type": "textnode",
| "content": "报告编号:{{report.reportNo}},结论:{{report.conclusion}}"
| },
| {
| "type": "table",
| "attributes": { "class": "qc-table" },
| "style": { "width": "100%" },
| "components": [
| {
| "type": "thead",
| "components": [
| {
| "type": "row",
| "components": [
| {
| "type": "cell",
| "tagName": "th",
| "content": "序号",
| "style": { "border": "1px solid #d9d9d9" }
| },
| { "type": "cell", "tagName": "th", "content": "检验项目" }
| ]
| }
| ]
| },
| {
| "type": "tbody",
| "attributes": { "data-qc-repeat": "inspectionItems" },
| "components": [
| {
| "type": "row",
| "attributes": { "data-qc-repeat-row": "item", "id": "qc-row-main" },
| "components": [
| { "type": "cell", "tagName": "td", "content": "{{index}}" },
| { "type": "cell", "tagName": "td", "content": "{{item.itemName}}" },
| { "type": "cell", "tagName": "td", "content": "{{item.actualValue}}" },
| { "type": "cell", "tagName": "td", "content": "{{item.resultText}}" }
| ]
| }
| ]
| }
| ]
| },
| {
| "type": "text",
| "content": "合格率:{{report.passRate}},共 {{report.total}} 项",
| "attributes": { "id": "qc-rate", "title": "合格率" },
| "style": { "margin": "6px 0 0" }
| },
| {
| "type": "text",
| "content": "客户:{{report.customerName}}|供方编号:{{report.supplierCode}}",
| "attributes": {}
| },
| {
| "type": "text",
| "content": "特殊字符:<原样>&\"引号\"",
| "attributes": {}
| }
| ]
| }
| }
| ]
| }
| ],
| "styles": [
| { "selectors": ["#qc-rate"], "style": { "font-weight": "600", "color": "#333333" } },
| {
| "selectors": ["#qc-row-main td"],
| "style": { "border": "1px solid #d9d9d9", "padding": "4px 6px" }
| },
| { "selectors": [".qc-table"], "style": { "border-collapse": "collapse" } },
| { "selectors": [".empty-rule"], "style": {} }
| ]
| },
| "rules": [
| {
| "id": "rule-item-limit",
| "name": "实测值在规格内",
| "scope": "item",
| "expression": "item.actualValue >= item.lowerLimit AND item.actualValue <= item.upperLimit",
| "enabled": true
| },
| {
| "id": "rule-report-rate",
| "name": "整体合格(合格率≥60)",
| "scope": "report",
| "expression": "PASS_RATE(inspectionItems) >= 60"
| }
| ]
| }
|
|