vue2-client 1.15.110 → 1.15.111

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.
Files changed (37) hide show
  1. package/.history/src/base-client/components/his/XChart/XChart_20250812134005.vue +160 -0
  2. package/.history/src/base-client/components/his/XChart/XChart_20250812134010.vue +160 -0
  3. package/.history/src/base-client/components/his/XChart/XChart_20250812134019.vue +160 -0
  4. package/.history/src/base-client/components/his/XChart/XChart_20250812134037.vue +160 -0
  5. package/.history/src/base-client/components/his/XChart/XChart_20250812134112.vue +160 -0
  6. package/.history/src/base-client/components/his/XChart/XChart_20250812134114.vue +160 -0
  7. package/.history/src/base-client/components/his/XChart/XChart_20250812134828.vue +148 -0
  8. package/.history/src/base-client/components/his/XChart/XChart_20250812134838.vue +155 -0
  9. package/.history/src/base-client/components/his/XChart/XChart_20250812134846.vue +155 -0
  10. package/.history/src/base-client/components/his/XChart/XChart_20250812134917.vue +155 -0
  11. package/.history/src/base-client/components/his/XChart/XChart_20250812151145.vue +149 -0
  12. package/.history/src/base-client/components/his/XChart/XChart_20250812151810.vue +153 -0
  13. package/.history/src/base-client/components/his/XChart/XChart_20250812151822.vue +153 -0
  14. package/.history/src/base-client/components/his/XChart/XChart_20250812151910.vue +153 -0
  15. package/.history/src/base-client/components/his/XChart/XChart_20250812152858.vue +258 -0
  16. package/.history/src/base-client/components/his/XChart/XChart_20250812152902.vue +258 -0
  17. package/.history/src/base-client/components/his/XChart/XChart_20250812152907.vue +258 -0
  18. package/.history/src/base-client/components/his/XChart/XChart_20250812152919.vue +258 -0
  19. package/.history/src/base-client/components/his/XChart/XChart_20250812153141.vue +269 -0
  20. package/.history/src/base-client/components/his/XChart/XChart_20250812153149.vue +276 -0
  21. package/.history/src/base-client/components/his/XChart/XChart_20250812153153.vue +276 -0
  22. package/.history/src/base-client/components/his/XChart/XChart_20250812153155.vue +276 -0
  23. package/.history/src/base-client/components/his/XChart/XChart_20250812153157.vue +276 -0
  24. package/.history/src/base-client/components/his/XChart/XChart_20250812153158.vue +276 -0
  25. package/.history/src/base-client/components/his/XChart/XChart_20250812153200.vue +276 -0
  26. package/.history/src/base-client/components/his/XChart/XChart_20250812153210.vue +276 -0
  27. package/.history/src/base-client/components/his/XChart/XChart_20250812153918.vue +275 -0
  28. package/.history/src/base-client/components/his/XChart/XChart_20250812154157.vue +280 -0
  29. package/.history/src/base-client/components/his/XChart/XChart_20250812154212.vue +280 -0
  30. package/.history/src/base-client/components/his/XChart/XChart_20250812154250.vue +280 -0
  31. package/.history/src/base-client/components/his/XChart/XChart_20250812154252.vue +280 -0
  32. package/.history/src/base-client/components/his/XChart/XChart_20250812154444.vue +280 -0
  33. package/package.json +1 -1
  34. package/src/base-client/components/common/XReportGrid/XReportTrGroup.vue +4 -3
  35. package/src/base-client/components/his/XChart/XChart.vue +280 -0
  36. package/src/base-client/components/his/XChart/dome.vue +19 -0
  37. package/src/router/async/router.map.js +1 -1
@@ -0,0 +1,153 @@
1
+ <template>
2
+ <div ref="main" :style="{width: config.width, height: config.height}">
3
+ </div>
4
+ </template>
5
+
6
+ <script>
7
+ import * as echarts from 'echarts'
8
+ import { getConfigByName, runLogic } from '@vue2-client/services/api/common'
9
+
10
+ export default {
11
+ name: 'XTable',
12
+ props: {
13
+ // 配置名
14
+ queryParamsName: {
15
+ type: String,
16
+ default: ''
17
+ },
18
+ // 服务名
19
+ serviceName: {
20
+ type: String,
21
+ default: 'af-his'
22
+ }
23
+ },
24
+ data () {
25
+ return {
26
+ data: [],
27
+ // LJ 中心线(靶值/均值)
28
+ standardValue: 3.5,
29
+ // 配置项
30
+ config: {}
31
+ }
32
+ },
33
+ mounted () {},
34
+ methods: {
35
+ initDome (queryParamsName, parameter) {
36
+ getConfigByName(queryParamsName, 'af-his', async (res) => {
37
+ this.config = res
38
+ console.log('res', res)
39
+ runLogic(res.data, parameter, 'af-his').then(result => {
40
+ // 以配置中的字段名提取靶值(中心线)
41
+ this.standardValue = Number(result[0][this.config.standardValue])
42
+ const listData = result.map(item => [item.x, item.y])
43
+ this.data = listData
44
+ this.renderChart()
45
+ })
46
+ })
47
+ },
48
+ // 渲染图表
49
+ renderChart () {
50
+ const chartDom = this.$refs.main
51
+ const myChart = echarts.init(chartDom)
52
+
53
+ // 计算 SD(允许从配置读取,否则用样本标准差估算)
54
+ const yValues = this.data.map(d => Number(d[1])).filter(v => !isNaN(v))
55
+ let sd = Number(this.config.sd || this.config.sigma)
56
+ if (!sd || isNaN(sd)) {
57
+ const n = yValues.length
58
+ if (n > 1) {
59
+ const mean = yValues.reduce((a, b) => a + b, 0) / n
60
+ const variance = yValues.reduce((a, v) => a + Math.pow(v - mean, 2), 0) / (n - 1)
61
+ sd = Math.sqrt(variance)
62
+ } else sd = 0
63
+ }
64
+ if (sd === 0) sd = 1
65
+
66
+ const center = Number(this.standardValue)
67
+ const lines = [
68
+ { value: center, label: `${this.config.formatter || 'CL'}: ${center}`, color: '#a4a4a8', type: 'solid' },
69
+ { value: center + sd, label: '+1 SD', color: '#67C23A', type: 'dotted' },
70
+ { value: center - sd, label: '-1 SD', color: '#67C23A', type: 'dotted' },
71
+ { value: center + 2 * sd, label: '+2 SD', color: '#E6A23C', type: 'dashed' },
72
+ { value: center - 2 * sd, label: '-2 SD', color: '#E6A23C', type: 'dashed' },
73
+ { value: center + 3 * sd, label: '+3 SD', color: '#F56C6C', type: 'solid' },
74
+ { value: center - 3 * sd, label: '-3 SD', color: '#F56C6C', type: 'solid' }
75
+ ]
76
+
77
+ const option = {
78
+ title: {
79
+ text: this.config.title,
80
+ subtext: this.config.subtext,
81
+ left: 'center'
82
+ },
83
+ legend: {
84
+ bottom: 5
85
+ },
86
+ tooltip: {
87
+ trigger: 'axis',
88
+ axisPointer: { type: 'cross' },
89
+ formatter: params => {
90
+ if (!params || !params.length) return ''
91
+ const p = params[0]
92
+ const y = Number(p.data && p.data[1])
93
+ const z = ((y - center) / sd).toFixed(2)
94
+ return `x: ${p.data && p.data[0]}<br/>y: ${y}<br/>Δ: ${(y - center).toFixed(2)}<br/>z: ${z}`
95
+ }
96
+ },
97
+ xAxis: {
98
+ type: 'value',
99
+ splitLine: {
100
+ lineStyle: {
101
+ type: 'dashed'
102
+ }
103
+ }
104
+ },
105
+ yAxis: {
106
+ type: 'value',
107
+ splitLine: {
108
+ lineStyle: {
109
+ type: 'dashed'
110
+ }
111
+ }
112
+ },
113
+ series: [
114
+ {
115
+ name: '检验值',
116
+ type: 'line',
117
+ data: this.data,
118
+ showSymbol: true,
119
+ symbol: 'circle',
120
+ symbolSize: 6,
121
+ lineStyle: { width: 2, color: '#409EFF' },
122
+ itemStyle: { color: '#409EFF' },
123
+ markLine: {
124
+ silent: true,
125
+ symbol: 'none',
126
+ data: lines.map(l => ({
127
+ yAxis: l.value,
128
+ lineStyle: { color: l.color, type: l.type, width: 2 },
129
+ label: { formatter: l.label }
130
+ }))
131
+ }
132
+ }
133
+ ]
134
+ }
135
+ option && myChart.setOption(option)
136
+ }
137
+ },
138
+ watch: {
139
+ queryParamsName: {
140
+ deep: true,
141
+ immediate: true,
142
+ handler (val) {
143
+ console.log('queryParamsName', val)
144
+ this.initDome(val, {})
145
+ }
146
+ }
147
+ }
148
+ }
149
+ </script>
150
+
151
+ <style scoped lang="less">
152
+
153
+ </style>
@@ -0,0 +1,153 @@
1
+ <template>
2
+ <div ref="main" :style="{width: config.width, height: config.height}">
3
+ </div>
4
+ </template>
5
+
6
+ <script>
7
+ import * as echarts from 'echarts'
8
+ import { getConfigByName, runLogic } from '@vue2-client/services/api/common'
9
+
10
+ export default {
11
+ name: 'XTable',
12
+ props: {
13
+ // 配置名
14
+ queryParamsName: {
15
+ type: String,
16
+ default: ''
17
+ },
18
+ // 服务名
19
+ serviceName: {
20
+ type: String,
21
+ default: 'af-his'
22
+ }
23
+ },
24
+ data () {
25
+ return {
26
+ data: [],
27
+ // LJ 中心线(靶值/均值)
28
+ standardValue: 3.5,
29
+ // 配置项
30
+ config: {}
31
+ }
32
+ },
33
+ mounted () {},
34
+ methods: {
35
+ initDome (queryParamsName, parameter) {
36
+ getConfigByName(queryParamsName, 'af-his', async (res) => {
37
+ this.config = res
38
+ console.log('res', res)
39
+ runLogic(res.data, parameter, 'af-his').then(result => {
40
+ // 以配置中的字段名提取靶值(中心线)
41
+ this.standardValue = Number(result[0][this.config.standardValue])
42
+ const listData = result.map(item => [item.x, item.y])
43
+ this.data = listData
44
+ this.renderChart()
45
+ })
46
+ })
47
+ },
48
+ // 渲染图表
49
+ renderChart () {
50
+ const chartDom = this.$refs.main
51
+ const myChart = echarts.init(chartDom)
52
+
53
+ // 计算 SD(允许从配置读取,否则用样本标准差估算)
54
+ const yValues = this.data.map(d => Number(d[1])).filter(v => !isNaN(v))
55
+ let sd = Number(this.config.sd || this.config.sigma)
56
+ if (!sd || isNaN(sd)) {
57
+ const n = yValues.length
58
+ if (n > 1) {
59
+ const mean = yValues.reduce((a, b) => a + b, 0) / n
60
+ const variance = yValues.reduce((a, v) => a + Math.pow(v - mean, 2), 0) / (n - 1)
61
+ sd = Math.sqrt(variance)
62
+ } else sd = 0
63
+ }
64
+ if (sd === 0) sd = 1
65
+
66
+ const center = Number(this.standardValue)
67
+ const lines = [
68
+ { value: center, label: `${this.config.formatter || 'CL'}: ${center}`, color: '#a4a4a8', type: 'solid' },
69
+ { value: center + sd, label: '+1 SD', color: '#67C23A', type: 'dotted' },
70
+ { value: center - sd, label: '-1 SD', color: '#67C23A', type: 'dotted' },
71
+ { value: center + 2 * sd, label: '+2 SD', color: '#E6A23C', type: 'dashed' },
72
+ { value: center - 2 * sd, label: '-2 SD', color: '#E6A23C', type: 'dashed' },
73
+ { value: center + 3 * sd, label: '+3 SD', color: '#F56C6C', type: 'solid' },
74
+ { value: center - 3 * sd, label: '-3 SD', color: '#F56C6C', type: 'solid' }
75
+ ]
76
+
77
+ const option = {
78
+ title: {
79
+ text: this.config.title,
80
+ subtext: this.config.subtext,
81
+ left: 'center'
82
+ },
83
+ legend: {
84
+ bottom: 5
85
+ },
86
+ tooltip: {
87
+ trigger: 'axis',
88
+ axisPointer: { type: 'cross' },
89
+ formatter: params => {
90
+ if (!params || !params.length) return ''
91
+ const p = params[0]
92
+ const y = Number(p.data && p.data[1])
93
+ const z = ((y - center) / sd).toFixed(2)
94
+ return `x: ${p.data && p.data[0]}<br/>y: ${y}<br/>Δ: ${(y - center).toFixed(2)}<br/>z: ${z}`
95
+ }
96
+ },
97
+ xAxis: {
98
+ type: 'value',
99
+ splitLine: {
100
+ lineStyle: {
101
+ type: 'dashed'
102
+ }
103
+ }
104
+ },
105
+ yAxis: {
106
+ type: 'value',
107
+ splitLine: {
108
+ lineStyle: {
109
+ type: 'dashed'
110
+ }
111
+ }
112
+ },
113
+ series: [
114
+ {
115
+ name: '检验值',
116
+ type: 'line',
117
+ data: this.data,
118
+ showSymbol: true,
119
+ symbol: 'circle',
120
+ symbolSize: 6,
121
+ lineStyle: { width: 2, color: '#409EFF' },
122
+ itemStyle: { color: '#409EFF' },
123
+ markLine: {
124
+ silent: true,
125
+ symbol: 'none',
126
+ data: lines.map(l => ({
127
+ yAxis: l.value,
128
+ lineStyle: { color: l.color, type: l.type, width: 2 },
129
+ label: { formatter: l.label }
130
+ }))
131
+ }
132
+ }
133
+ ]
134
+ }
135
+ option && myChart.setOption(option)
136
+ }
137
+ },
138
+ watch: {
139
+ queryParamsName: {
140
+ deep: true,
141
+ immediate: true,
142
+ handler (val) {
143
+ console.log('queryParamsName', val)
144
+ this.initDome(val, {})
145
+ }
146
+ }
147
+ }
148
+ }
149
+ </script>
150
+
151
+ <style scoped lang="less">
152
+
153
+ </style>
@@ -0,0 +1,258 @@
1
+ <template>
2
+ <div ref="main" :style="{width: config.width, height: config.height}">
3
+ </div>
4
+ </template>
5
+
6
+ <script>
7
+ import * as echarts from 'echarts'
8
+ import { getConfigByName, runLogic } from '@vue2-client/services/api/common'
9
+
10
+ export default {
11
+ name: 'XChart',
12
+ props: {
13
+ // 配置名
14
+ queryParamsName: {
15
+ type: String,
16
+ default: ''
17
+ },
18
+ // 服务名
19
+ serviceName: {
20
+ type: String,
21
+ default: 'af-his'
22
+ }
23
+ },
24
+ data () {
25
+ return {
26
+ data: [],
27
+ // 配置项
28
+ config: {},
29
+ // 标准值
30
+ standardValue: 0,
31
+ // 标准差
32
+ sd: 0
33
+ }
34
+ },
35
+ mounted () {},
36
+ methods: {
37
+ initDome (queryParamsName, parameter) {
38
+ getConfigByName(queryParamsName, 'af-his', async (res) => {
39
+ this.config = res
40
+ console.log('res', res)
41
+ runLogic(res.data, parameter, 'af-his').then(result => {
42
+ this.standardValue = result[0][this.config.standardValue]
43
+ this.sd = result[0].sd
44
+ const listData = result.map(item => [item.x, item.y])
45
+ this.data = listData
46
+ this.renderChart()
47
+ })
48
+ })
49
+ },
50
+ // 渲染图表
51
+ renderChart () {
52
+ const chartDom = this.$refs.main
53
+ const myChart = echarts.init(chartDom)
54
+
55
+ // 计算控制线
56
+ const centerLine = this.standardValue
57
+ const sd1Upper = centerLine + this.sd
58
+ const sd1Lower = centerLine - this.sd
59
+ const sd2Upper = centerLine + 2 * this.sd
60
+ const sd2Lower = centerLine - 2 * this.sd
61
+ const sd3Upper = centerLine + 3 * this.sd
62
+ const sd3Lower = centerLine - 3 * this.sd
63
+
64
+ const option = {
65
+ title: {
66
+ text: this.config.title,
67
+ subtext: this.config.subtext,
68
+ left: 'center',
69
+ textStyle: {
70
+ fontSize: 16,
71
+ fontWeight: 'bold'
72
+ },
73
+ subtextStyle: {
74
+ fontSize: 12,
75
+ color: '#666'
76
+ }
77
+ },
78
+ legend: {
79
+ bottom: 10,
80
+ data: ['测量值', '中心线', '±1SD', '±2SD', '±3SD']
81
+ },
82
+ tooltip: {
83
+ trigger: 'axis',
84
+ axisPointer: {
85
+ type: 'cross'
86
+ },
87
+ formatter: function (params) {
88
+ let result = `第${params[0].data[0]}次测量<br/>`
89
+ params.forEach(param => {
90
+ if (param.seriesName === '测量值') {
91
+ result += `${param.seriesName}: ${param.data[1]}<br/>`
92
+ }
93
+ })
94
+ return result
95
+ }
96
+ },
97
+ grid: {
98
+ left: '10%',
99
+ right: '10%',
100
+ top: '15%',
101
+ bottom: '15%'
102
+ },
103
+ xAxis: {
104
+ type: 'category',
105
+ name: '测量次数',
106
+ nameLocation: 'middle',
107
+ nameGap: 30,
108
+ axisLine: {
109
+ lineStyle: {
110
+ color: '#333'
111
+ }
112
+ },
113
+ axisTick: {
114
+ show: true
115
+ },
116
+ splitLine: {
117
+ show: false
118
+ }
119
+ },
120
+ yAxis: {
121
+ type: 'value',
122
+ name: this.config.formatter,
123
+ nameLocation: 'middle',
124
+ nameGap: 50,
125
+ axisLine: {
126
+ lineStyle: {
127
+ color: '#333'
128
+ }
129
+ },
130
+ splitLine: {
131
+ lineStyle: {
132
+ type: 'dashed',
133
+ color: '#ddd'
134
+ }
135
+ }
136
+ },
137
+ series: [
138
+ {
139
+ name: '测量值',
140
+ type: 'line',
141
+ data: this.data,
142
+ symbol: 'circle',
143
+ symbolSize: 8,
144
+ lineStyle: {
145
+ color: '#1890ff',
146
+ width: 2
147
+ },
148
+ itemStyle: {
149
+ color: '#1890ff',
150
+ borderColor: '#fff',
151
+ borderWidth: 2
152
+ },
153
+ markLine: {
154
+ silent: true,
155
+ symbol: 'none',
156
+ lineStyle: {
157
+ color: '#52c41a',
158
+ width: 2,
159
+ type: 'solid'
160
+ },
161
+ data: [
162
+ {
163
+ yAxis: centerLine,
164
+ label: {
165
+ formatter: `中心线: ${centerLine}`,
166
+ position: 'insideEndTop'
167
+ }
168
+ },
169
+ {
170
+ yAxis: sd1Upper,
171
+ lineStyle: {
172
+ color: '#faad14',
173
+ type: 'dashed'
174
+ },
175
+ label: {
176
+ formatter: `+1SD: ${sd1Upper.toFixed(2)}`,
177
+ position: 'insideEndTop'
178
+ }
179
+ },
180
+ {
181
+ yAxis: sd1Lower,
182
+ lineStyle: {
183
+ color: '#faad14',
184
+ type: 'dashed'
185
+ },
186
+ label: {
187
+ formatter: `-1SD: ${sd1Lower.toFixed(2)}`,
188
+ position: 'insideEndBottom'
189
+ }
190
+ },
191
+ {
192
+ yAxis: sd2Upper,
193
+ lineStyle: {
194
+ color: '#ff7a45',
195
+ type: 'dashed'
196
+ },
197
+ label: {
198
+ formatter: `+2SD: ${sd2Upper.toFixed(2)}`,
199
+ position: 'insideEndTop'
200
+ }
201
+ },
202
+ {
203
+ yAxis: sd2Lower,
204
+ lineStyle: {
205
+ color: '#ff7a45',
206
+ type: 'dashed'
207
+ },
208
+ label: {
209
+ formatter: `-2SD: ${sd2Lower.toFixed(2)}`,
210
+ position: 'insideEndBottom'
211
+ }
212
+ },
213
+ {
214
+ yAxis: sd3Upper,
215
+ lineStyle: {
216
+ color: '#ff4d4f',
217
+ type: 'dashed'
218
+ },
219
+ label: {
220
+ formatter: `+3SD: ${sd3Upper.toFixed(2)}`,
221
+ position: 'insideEndTop'
222
+ }
223
+ },
224
+ {
225
+ yAxis: sd3Lower,
226
+ lineStyle: {
227
+ color: '#ff4d4f',
228
+ type: 'dashed'
229
+ },
230
+ label: {
231
+ formatter: `-3SD: ${sd3Lower.toFixed(2)}`,
232
+ position: 'insideEndBottom'
233
+ }
234
+ }
235
+ ]
236
+ }
237
+ }
238
+ ]
239
+ }
240
+ option && myChart.setOption(option)
241
+ }
242
+ },
243
+ watch: {
244
+ queryParamsName: {
245
+ deep: true,
246
+ immediate: true,
247
+ handler (val) {
248
+ console.log('queryParamsName', val)
249
+ this.initDome(val, {})
250
+ }
251
+ }
252
+ }
253
+ }
254
+ </script>
255
+
256
+ <style scoped lang="less">
257
+
258
+ </style>