@nstc-business/imes 1.0.26 → 1.0.28

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,208 +1,208 @@
1
- <template>
2
- <div class="measure-group-blocks">
3
- <measure-qual-analysis
4
- v-if="qualLooseNodes.length"
5
- :groups="qualLooseGroups"
6
- />
7
- <measure-tree-table
8
- v-if="tableLooseNodes.length"
9
- :nodes="tableLooseNodes"
10
- :level="level"
11
- :number-prefix="numberPrefix"
12
- :calc-mode="calcMode"
13
- :section="section"
14
- />
15
-
16
- <div
17
- v-for="(group, i) in nestedGroups"
18
- :key="group._rowKey || i"
19
- class="measure-inner-group"
20
- >
21
- <div class="section-title" @click="toggleGroup(group)">
22
- {{ group.name }}
23
- <span v-if="group.remark" class="section-remark">
24
- 备注:<span class="remark-html" v-html="group.remark"></span>
25
- </span>
26
- <span v-if="innerWeightText(group)" class="section-weight-pill">
27
- {{ innerWeightText(group) }}
28
- </span>
29
- <span v-if="innerSubtotalText(group)" class="section-score-pill">
30
- {{ innerSubtotalText(group) }}
31
- </span>
32
- <span class="group-toggle">
33
- {{ isExpanded(group) ? '收起' : '展开' }}
34
- <i :class="isExpanded(group) ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"></i>
35
- </span>
36
- </div>
37
- <measure-group-blocks
38
- v-show="isExpanded(group)"
39
- :nodes="group.children || []"
40
- :group-node="group"
41
- :level="level + 1"
42
- :number-prefix="childNumberPrefix(group)"
43
- :calc-mode="calcMode"
44
- :section="section"
45
- />
46
- </div>
47
- </div>
48
- </template>
49
-
50
- <script>
51
- import MeasureQualAnalysis from './MeasureQualAnalysis.vue'
52
- import MeasureTreeTable from './MeasureTreeTable.vue'
53
- import {
54
- splitGroupNodes,
55
- isQualIndicator,
56
- hierarchySerial,
57
- hierarchySerialPrefix
58
- } from './helpers'
59
-
60
- export default {
61
- name: 'MeasureGroupBlocks',
62
- components: {
63
- MeasureQualAnalysis,
64
- MeasureTreeTable
65
- },
66
- inject: ['measureCtx'],
67
- props: {
68
- nodes: {
69
- type: Array,
70
- default: () => []
71
- },
72
- groupNode: {
73
- type: Object,
74
- default: null
75
- },
76
- level: {
77
- type: Number,
78
- default: 1
79
- },
80
- numberPrefix: {
81
- type: String,
82
- default: ''
83
- },
84
- calcMode: {
85
- type: Boolean,
86
- default: false
87
- },
88
- section: {
89
- type: Object,
90
- default: () => ({})
91
- }
92
- },
93
- computed: {
94
- ctx() {
95
- return this.measureCtx()
96
- },
97
- split() {
98
- return splitGroupNodes(this.nodes)
99
- },
100
- nestedGroups() {
101
- return this.split.groups
102
- },
103
- looseNodes() {
104
- return this.split.loose
105
- },
106
- qualLooseNodes() {
107
- return this.looseNodes.filter(isQualIndicator)
108
- },
109
- tableLooseNodes() {
110
- return this.looseNodes.filter(n => !isQualIndicator(n))
111
- },
112
- qualLooseGroups() {
113
- const resolve = this.ctx.resolveLeafNode
114
- return [
115
- {
116
- name: '',
117
- children: this.qualLooseNodes.map(n =>
118
- resolve ? resolve(n) || n : n
119
- )
120
- }
121
- ]
122
- }
123
- },
124
- methods: {
125
- innerWeightText(group) {
126
- const fn = this.ctx.groupWeightText
127
- return fn ? fn(group) : ''
128
- },
129
- innerSubtotalText(group) {
130
- const fn = this.ctx.groupSubtotalText
131
- return fn ? fn(group) : ''
132
- },
133
- isExpanded(group) {
134
- const fn = this.ctx.isGroupExpanded
135
- return fn ? fn(group) : !group || group._groupExpanded !== false
136
- },
137
- toggleGroup(group) {
138
- const fn = this.ctx.toggleGroupExpanded
139
- if (fn) fn(group)
140
- else if (group) this.$set(group, '_groupExpanded', group._groupExpanded === false)
141
- },
142
- childNumberPrefix(group) {
143
- const idx = this.nodes.findIndex(n => n._rowKey === group._rowKey)
144
- const serial = hierarchySerial(this.numberPrefix, idx < 0 ? 0 : idx)
145
- return hierarchySerialPrefix(serial)
146
- }
147
- }
148
- }
149
- </script>
150
-
151
- <style lang="less" scoped>
152
- .measure-group-blocks {
153
- width: 100%;
154
- }
155
- .measure-inner-group {
156
- margin-top: 12px;
157
- }
158
- .measure-inner-group + .measure-inner-group {
159
- margin-top: 16px;
160
- }
161
- .section-title {
162
- display: flex;
163
- align-items: center;
164
- flex-wrap: wrap;
165
- gap: 8px;
166
- font-size: 15px;
167
- font-weight: 600;
168
- padding-left: 8px;
169
- margin-bottom: 8px;
170
- border-left: 3px solid #409eff;
171
- cursor: pointer;
172
- }
173
- .group-toggle {
174
- margin-left: auto;
175
- font-size: 13px;
176
- font-weight: 400;
177
- color: #409eff;
178
- white-space: nowrap;
179
- user-select: none;
180
- }
181
- .group-toggle i {
182
- margin-left: 2px;
183
- }
184
- .section-weight-pill,
185
- .section-score-pill {
186
- display: inline-block;
187
- margin-left: 4px;
188
- padding: 2px 10px;
189
- font-size: 14px;
190
- font-weight: 400;
191
- color: #606266;
192
- line-height: 20px;
193
- background: #f2f3f5;
194
- border-radius: 4px;
195
- }
196
- .section-remark {
197
- margin-left: 0;
198
- font-weight: 400;
199
- color: #909399;
200
- }
201
- .section-remark .remark-html {
202
- display: inline;
203
- ::v-deep p {
204
- display: inline;
205
- margin: 0;
206
- }
207
- }
208
- </style>
1
+ <template>
2
+ <div class="measure-group-blocks">
3
+ <measure-qual-analysis
4
+ v-if="qualLooseNodes.length"
5
+ :groups="qualLooseGroups"
6
+ />
7
+ <measure-tree-table
8
+ v-if="tableLooseNodes.length"
9
+ :nodes="tableLooseNodes"
10
+ :level="level"
11
+ :number-prefix="numberPrefix"
12
+ :calc-mode="calcMode"
13
+ :section="section"
14
+ />
15
+
16
+ <div
17
+ v-for="(group, i) in nestedGroups"
18
+ :key="group._rowKey || i"
19
+ class="measure-inner-group"
20
+ >
21
+ <div class="section-title" @click="toggleGroup(group)">
22
+ {{ group.name }}
23
+ <span v-if="group.remark" class="section-remark">
24
+ 备注:<span class="remark-html" v-html="group.remark"></span>
25
+ </span>
26
+ <span v-if="innerWeightText(group)" class="section-weight-pill">
27
+ {{ innerWeightText(group) }}
28
+ </span>
29
+ <span v-if="innerSubtotalText(group)" class="section-score-pill">
30
+ {{ innerSubtotalText(group) }}
31
+ </span>
32
+ <span class="group-toggle">
33
+ {{ isExpanded(group) ? '收起' : '展开' }}
34
+ <i :class="isExpanded(group) ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"></i>
35
+ </span>
36
+ </div>
37
+ <measure-group-blocks
38
+ v-show="isExpanded(group)"
39
+ :nodes="group.children || []"
40
+ :group-node="group"
41
+ :level="level + 1"
42
+ :number-prefix="childNumberPrefix(group)"
43
+ :calc-mode="calcMode"
44
+ :section="section"
45
+ />
46
+ </div>
47
+ </div>
48
+ </template>
49
+
50
+ <script>
51
+ import MeasureQualAnalysis from './MeasureQualAnalysis.vue'
52
+ import MeasureTreeTable from './MeasureTreeTable.vue'
53
+ import {
54
+ splitGroupNodes,
55
+ isQualIndicator,
56
+ hierarchySerial,
57
+ hierarchySerialPrefix
58
+ } from './helpers'
59
+
60
+ export default {
61
+ name: 'MeasureGroupBlocks',
62
+ components: {
63
+ MeasureQualAnalysis,
64
+ MeasureTreeTable
65
+ },
66
+ inject: ['measureCtx'],
67
+ props: {
68
+ nodes: {
69
+ type: Array,
70
+ default: () => []
71
+ },
72
+ groupNode: {
73
+ type: Object,
74
+ default: null
75
+ },
76
+ level: {
77
+ type: Number,
78
+ default: 1
79
+ },
80
+ numberPrefix: {
81
+ type: String,
82
+ default: ''
83
+ },
84
+ calcMode: {
85
+ type: Boolean,
86
+ default: false
87
+ },
88
+ section: {
89
+ type: Object,
90
+ default: () => ({})
91
+ }
92
+ },
93
+ computed: {
94
+ ctx() {
95
+ return this.measureCtx()
96
+ },
97
+ split() {
98
+ return splitGroupNodes(this.nodes)
99
+ },
100
+ nestedGroups() {
101
+ return this.split.groups
102
+ },
103
+ looseNodes() {
104
+ return this.split.loose
105
+ },
106
+ qualLooseNodes() {
107
+ return this.looseNodes.filter(isQualIndicator)
108
+ },
109
+ tableLooseNodes() {
110
+ return this.looseNodes.filter(n => !isQualIndicator(n))
111
+ },
112
+ qualLooseGroups() {
113
+ const resolve = this.ctx.resolveLeafNode
114
+ return [
115
+ {
116
+ name: '',
117
+ children: this.qualLooseNodes.map(n =>
118
+ resolve ? resolve(n) || n : n
119
+ )
120
+ }
121
+ ]
122
+ }
123
+ },
124
+ methods: {
125
+ innerWeightText(group) {
126
+ const fn = this.ctx.groupWeightText
127
+ return fn ? fn(group) : ''
128
+ },
129
+ innerSubtotalText(group) {
130
+ const fn = this.ctx.groupSubtotalText
131
+ return fn ? fn(group) : ''
132
+ },
133
+ isExpanded(group) {
134
+ const fn = this.ctx.isGroupExpanded
135
+ return fn ? fn(group) : !group || group._groupExpanded !== false
136
+ },
137
+ toggleGroup(group) {
138
+ const fn = this.ctx.toggleGroupExpanded
139
+ if (fn) fn(group)
140
+ else if (group) this.$set(group, '_groupExpanded', group._groupExpanded === false)
141
+ },
142
+ childNumberPrefix(group) {
143
+ const idx = this.nodes.findIndex(n => n._rowKey === group._rowKey)
144
+ const serial = hierarchySerial(this.numberPrefix, idx < 0 ? 0 : idx)
145
+ return hierarchySerialPrefix(serial)
146
+ }
147
+ }
148
+ }
149
+ </script>
150
+
151
+ <style lang="less" scoped>
152
+ .measure-group-blocks {
153
+ width: 100%;
154
+ }
155
+ .measure-inner-group {
156
+ margin-top: 12px;
157
+ }
158
+ .measure-inner-group + .measure-inner-group {
159
+ margin-top: 16px;
160
+ }
161
+ .section-title {
162
+ display: flex;
163
+ align-items: center;
164
+ flex-wrap: wrap;
165
+ gap: 8px;
166
+ font-size: 15px;
167
+ font-weight: 600;
168
+ padding-left: 8px;
169
+ margin-bottom: 8px;
170
+ border-left: 3px solid #409eff;
171
+ cursor: pointer;
172
+ }
173
+ .group-toggle {
174
+ margin-left: auto;
175
+ font-size: 13px;
176
+ font-weight: 400;
177
+ color: #409eff;
178
+ white-space: nowrap;
179
+ user-select: none;
180
+ }
181
+ .group-toggle i {
182
+ margin-left: 2px;
183
+ }
184
+ .section-weight-pill,
185
+ .section-score-pill {
186
+ display: inline-block;
187
+ margin-left: 4px;
188
+ padding: 2px 10px;
189
+ font-size: 14px;
190
+ font-weight: 400;
191
+ color: #606266;
192
+ line-height: 20px;
193
+ background: #f2f3f5;
194
+ border-radius: 4px;
195
+ }
196
+ .section-remark {
197
+ margin-left: 0;
198
+ font-weight: 400;
199
+ color: #909399;
200
+ }
201
+ .section-remark .remark-html {
202
+ display: inline;
203
+ ::v-deep p {
204
+ display: inline;
205
+ margin: 0;
206
+ }
207
+ }
208
+ </style>