@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,183 +1,181 @@
1
- <template>
2
- <div class="measure-stat-cell">
3
- <template v-if="!cell">—</template>
4
- <!-- 手工填报 -->
5
- <template v-else-if="cell.sourceType === 3">
6
- <span v-if="column.disabled || readonly">{{ displayValue(cell) }}</span>
7
- <InputNumber
8
- v-else
9
- class="full-w"
10
- size="small"
11
- :type="cell.displayStyle === 1 ? 'rate' : 'money'"
12
- :d-num="digits"
13
- v-model="cell.value"
14
- />
15
- </template>
16
- <!-- 不可量化下拉 -->
17
- <template v-else-if="cell.sourceType === 0">
18
- <span v-if="column.disabled || readonly">{{ displayValue(cell) }}</span>
19
-
20
- <el-select
21
- v-else
22
- class="full-w"
23
- v-model="cell.value"
24
- size="small"
25
- placeholder="请选择"
26
- value-key="scoreMapID"
27
- >
28
- <el-option
29
- v-for="option in cell.optionList || []"
30
- :key="option.scoreMapID || option.scoreText"
31
- :label="option.scoreText"
32
- :value="option"
33
- style="height: auto"
34
- >
35
- <div class="select-top">{{ option.scoreText }}</div>
36
- <div class="select-bottom">{{ option.reason }}</div>
37
- </el-option>
38
- </el-select>
39
- </template>
40
- <!-- 其余:只读或调整(可调整时原值与输入框同时展示) -->
41
- <template v-else>
42
- <el-tooltip
43
- v-if="showOriginalWhenAdjust && showFormulaTip"
44
- placement="top"
45
- effect="dark"
46
- >
47
- <div slot="content">
48
- {{ cell.displayFormula }}:
49
- <br />
50
- {{ cell.relFormula }}
51
- </div>
52
- <span>{{ originalValue(cell) }}</span>
53
- </el-tooltip>
54
- <span v-else-if="showOriginalWhenAdjust">{{ originalValue(cell) }}</span>
55
- <InputNumber
56
- v-if="
57
- cell.modifyRank === 2 &&
58
- cell.value !== '' &&
59
- cell.value !== null &&
60
- !column.disabled
61
- "
62
- class="full-w"
63
- size="small"
64
- :type="cell.displayStyle === 1 ? 'rate' : 'money'"
65
- :d-num="digits"
66
- :disabled="readonly"
67
- v-model="cell.value"
68
- />
69
- <el-tooltip
70
- v-else-if="showFormulaTip"
71
- placement="top"
72
- effect="dark"
73
- >
74
- <div slot="content">
75
- {{ cell.displayFormula }}:
76
- <br />
77
- {{ cell.relFormula }}
78
- </div>
79
- <span>{{ displayValue(cell) }}</span>
80
- </el-tooltip>
81
- <span v-else-if="!showOriginalWhenAdjust">{{ displayValue(cell) }}</span>
82
- </template>
83
- </div>
84
- </template>
85
-
86
- <script>
87
- import { InputNumber } from './ui'
88
- import { toFixedTrunc, addThousands } from '../common'
89
-
90
- export default {
91
- name: 'MeasureStatCell',
92
- components: { InputNumber },
93
- inject: ['measureCtx'],
94
- props: {
95
- cell: { type: Object, default: null },
96
- column: { type: Object, default: () => ({}) },
97
- digits: { type: Number, default: 2 }
98
- },
99
- computed: {
100
- readonly() {
101
- return !!this.measureCtx().readonly
102
- },
103
- /** 指标值列才展示公式;得分列 column.disabled 不展示 */
104
- showFormulaTip() {
105
- if (!this.cell || this.column.disabled) return false
106
- return !!(this.cell.displayFormula || this.cell.relFormula)
107
- },
108
- showOriginalWhenAdjust() {
109
- return (
110
- this.cell &&
111
- this.cell.modifyRank === 2 &&
112
- this.cell.indicatorResult !== '' &&
113
- this.cell.indicatorResult !== null
114
- )
115
- }
116
- },
117
- methods: {
118
- originalValue(cell) {
119
- const val = cell.indicatorResult
120
- if (val === '' || val == null) return ''
121
- let text = Number(val).toFixed(this.digits)
122
- if (cell.showStyle === 2) {
123
- text = addThousands(toFixedTrunc(val, this.digits))
124
- }
125
- const suffix = cell.displayStyle === 1 && (val || val === 0) ? '%' : ''
126
- return text + suffix
127
- },
128
- displayValue(cell) {
129
- // 满分值列:按录入原样展示,不做位数格式化
130
- if (this.column.isFullScore) {
131
- const val =
132
- cell.result !== '' && cell.result != null ? cell.result : cell.value
133
- if (val === '' || val == null) return ''
134
- return String(val)
135
- }
136
- if (this.column.disabled) {
137
- const val =
138
- cell.result !== '' && cell.result != null ? cell.result : cell.value
139
- if (val === '' || val == null) return ''
140
- let text = Number(val).toFixed(this.digits)
141
- if (cell.showStyle === 2) {
142
- text = addThousands(toFixedTrunc(val, this.digits))
143
- }
144
- return text
145
- }
146
- const val = cell.value
147
- if (val === '' || val == null) return ''
148
- if (typeof val === 'object' && val.scoreText) return val.scoreText
149
- let text = val || val === 0 ? Number(val).toFixed(this.digits) : ''
150
- if (cell.showStyle === 2 && text) {
151
- text = addThousands(toFixedTrunc(val, this.digits))
152
- }
153
- const suffix = cell.displayStyle === 1 && (val || val === 0) ? '%' : ''
154
- return text + suffix
155
- }
156
- }
157
- }
158
- </script>
159
-
160
- <style lang="less" scoped>
161
- .full-w {
162
- width: 100%;
163
- }
164
- .select-top {
165
- margin-top: 2px;
166
- height: 14px;
167
- line-height: 16px;
168
- font-size: 14px;
169
- }
170
- .select-bottom {
171
- margin-top: 1px;
172
- min-height: 14px;
173
- line-height: 16px;
174
- color: #999999;
175
- font-size: 13px;
176
- max-width: 500px;
177
- white-space: normal;
178
- word-wrap: break-word;
179
- }
180
- /deep/ .el-select .el-input__inner {
181
- text-align: center;
182
- }
183
- </style>
1
+ <template>
2
+ <div class="measure-stat-cell">
3
+ <template v-if="!cell">—</template>
4
+ <!-- 手工填报 -->
5
+ <template v-else-if="cell.sourceType === 3">
6
+ <span v-if="column.disabled || readonly">{{ displayValue(cell) }}</span>
7
+ <InputNumber
8
+ v-else
9
+ class="full-w"
10
+ size="small"
11
+ :type="cell.displayStyle === 1 ? 'rate' : 'money'"
12
+ :d-num="digits"
13
+ v-model="cell.value"
14
+ />
15
+ </template>
16
+ <!-- 不可量化下拉 -->
17
+ <template v-else-if="cell.sourceType === 0">
18
+ <span v-if="column.disabled || readonly">{{ displayValue(cell) }}</span>
19
+
20
+ <el-select
21
+ v-else
22
+ class="full-w"
23
+ v-model="cell.value"
24
+ size="small"
25
+ placeholder="请选择"
26
+ value-key="scoreMapID"
27
+ >
28
+ <el-option
29
+ v-for="option in cell.optionList || []"
30
+ :key="option.scoreMapID || option.scoreText"
31
+ :label="option.scoreText"
32
+ :value="option"
33
+ style="height: auto"
34
+ >
35
+ <div class="select-top">{{ option.scoreText }}</div>
36
+ <div class="select-bottom">{{ option.reason }}</div>
37
+ </el-option>
38
+ </el-select>
39
+ </template>
40
+ <!-- 其余:只读或调整(可调整时原值与输入框同时展示) -->
41
+ <template v-else>
42
+ <el-tooltip
43
+ v-if="showOriginalWhenAdjust && showFormulaTip"
44
+ placement="top"
45
+ effect="dark"
46
+ >
47
+ <div slot="content">
48
+ {{ cell.displayFormula }}:
49
+ <br />
50
+ {{ cell.relFormula }}
51
+ </div>
52
+ <span>{{ originalValue(cell) }}</span>
53
+ </el-tooltip>
54
+ <span v-else-if="showOriginalWhenAdjust">{{ originalValue(cell) }}</span>
55
+ <InputNumber
56
+ v-if="
57
+ cell.modifyRank === 2 &&
58
+ cell.value !== '' &&
59
+ cell.value !== null &&
60
+ !column.disabled
61
+ "
62
+ class="full-w"
63
+ size="small"
64
+ :type="cell.displayStyle === 1 ? 'rate' : 'money'"
65
+ :d-num="digits"
66
+ :disabled="readonly"
67
+ v-model="cell.value"
68
+ />
69
+ <el-tooltip
70
+ v-else-if="showFormulaTip"
71
+ placement="top"
72
+ effect="dark"
73
+ >
74
+ <div slot="content">
75
+ {{ cell.displayFormula }}:
76
+ <br />
77
+ {{ cell.relFormula }}
78
+ </div>
79
+ <span>{{ displayValue(cell) }}</span>
80
+ </el-tooltip>
81
+ <span v-else-if="!showOriginalWhenAdjust">{{ displayValue(cell) }}</span>
82
+ </template>
83
+ </div>
84
+ </template>
85
+
86
+ <script>
87
+ import { InputNumber } from './ui'
88
+ import { toFixedTrunc, addThousands } from '../common'
89
+ import { formatScoreText } from './helpers'
90
+
91
+ export default {
92
+ name: 'MeasureStatCell',
93
+ components: { InputNumber },
94
+ inject: ['measureCtx'],
95
+ props: {
96
+ cell: { type: Object, default: null },
97
+ column: { type: Object, default: () => ({}) },
98
+ /** 指标值小数位(可读模型配置);得分列固定 SCORE_DIGITS */
99
+ digits: { type: Number, default: 2 }
100
+ },
101
+ computed: {
102
+ readonly() {
103
+ return !!this.measureCtx().readonly
104
+ },
105
+ /** 指标值列才展示公式;得分列 column.disabled 不展示 */
106
+ showFormulaTip() {
107
+ if (!this.cell || this.column.disabled) return false
108
+ return !!(this.cell.displayFormula || this.cell.relFormula)
109
+ },
110
+ showOriginalWhenAdjust() {
111
+ return (
112
+ this.cell &&
113
+ this.cell.modifyRank === 2 &&
114
+ this.cell.indicatorResult !== '' &&
115
+ this.cell.indicatorResult !== null
116
+ )
117
+ }
118
+ },
119
+ methods: {
120
+ originalValue(cell) {
121
+ const val = cell.indicatorResult
122
+ if (val === '' || val == null) return ''
123
+ let text = Number(val).toFixed(this.digits)
124
+ if (cell.showStyle === 2) {
125
+ text = addThousands(toFixedTrunc(val, this.digits))
126
+ }
127
+ const suffix = cell.displayStyle === 1 && (val || val === 0) ? '%' : ''
128
+ return text + suffix
129
+ },
130
+ displayValue(cell) {
131
+ // 满分值列:按录入原样展示,不做位数格式化
132
+ if (this.column.isFullScore) {
133
+ const val =
134
+ cell.result !== '' && cell.result != null ? cell.result : cell.value
135
+ if (val === '' || val == null) return ''
136
+ return String(val)
137
+ }
138
+ // 得分列:固定 2 位四舍五入,不读模型 digits
139
+ if (this.column.disabled) {
140
+ const val =
141
+ cell.result !== '' && cell.result != null ? cell.result : cell.value
142
+ return formatScoreText(val, { thousands: cell.showStyle === 2 })
143
+ }
144
+ const val = cell.value
145
+ if (val === '' || val == null) return ''
146
+ if (typeof val === 'object' && val.scoreText) return val.scoreText
147
+ let text = val || val === 0 ? Number(val).toFixed(this.digits) : ''
148
+ if (cell.showStyle === 2 && text) {
149
+ text = addThousands(toFixedTrunc(val, this.digits))
150
+ }
151
+ const suffix = cell.displayStyle === 1 && (val || val === 0) ? '%' : ''
152
+ return text + suffix
153
+ }
154
+ }
155
+ }
156
+ </script>
157
+
158
+ <style lang="less" scoped>
159
+ .full-w {
160
+ width: 100%;
161
+ }
162
+ .select-top {
163
+ margin-top: 2px;
164
+ height: 14px;
165
+ line-height: 16px;
166
+ font-size: 14px;
167
+ }
168
+ .select-bottom {
169
+ margin-top: 1px;
170
+ min-height: 14px;
171
+ line-height: 16px;
172
+ color: #999999;
173
+ font-size: 13px;
174
+ max-width: 500px;
175
+ white-space: normal;
176
+ word-wrap: break-word;
177
+ }
178
+ /deep/ .el-select .el-input__inner {
179
+ text-align: center;
180
+ }
181
+ </style>