n20-common-lib 1.3.193 → 1.3.195
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 +1 -1
- package/src/components/CascaderArea/index.vue +14 -6
- package/src/components/DateSelect/index.vue +12 -12
- package/src/components/DateSelect/quarterDatePicker.vue +6 -3
- package/src/components/InputNumber/index.vue +65 -75
- package/src/components/Layout/index.vue +5 -5
- package/src/components/Statis/statisItem.vue +2 -2
- package/src/components/Table/filters.js +2 -2
- package/src/index.js +10 -4
- package/src/utils/element-ui-emitter.js +19 -0
- package/src/utils/numberPor.js +278 -0
- package/style/index.css +3 -3
- package/theme/blue.css +2 -2
- package/theme/cctcRed.css +2 -2
- package/theme/green.css +2 -2
- package/theme/lightBlue.css +2 -2
- package/theme/orange.css +2 -2
- package/theme/purple.css +2 -2
- package/theme/red.css +2 -2
- package/theme/yellow.css +2 -2
package/package.json
CHANGED
|
@@ -6,12 +6,7 @@
|
|
|
6
6
|
:options="areaTree"
|
|
7
7
|
:filterable="filterable"
|
|
8
8
|
:clearable="clearable"
|
|
9
|
-
:props="
|
|
10
|
-
value: 'regionNo',
|
|
11
|
-
label: 'regionName',
|
|
12
|
-
children: 'children',
|
|
13
|
-
expandTrigger: 'hover'
|
|
14
|
-
}"
|
|
9
|
+
:props="propsAs"
|
|
15
10
|
v-on="$listeners"
|
|
16
11
|
/>
|
|
17
12
|
</template>
|
|
@@ -44,6 +39,10 @@ export default {
|
|
|
44
39
|
countryId: {
|
|
45
40
|
type: String,
|
|
46
41
|
default: 'CHN'
|
|
42
|
+
},
|
|
43
|
+
props: {
|
|
44
|
+
type: Object,
|
|
45
|
+
default: undefined
|
|
47
46
|
}
|
|
48
47
|
},
|
|
49
48
|
data() {
|
|
@@ -52,6 +51,15 @@ export default {
|
|
|
52
51
|
}
|
|
53
52
|
},
|
|
54
53
|
computed: {
|
|
54
|
+
propsAs() {
|
|
55
|
+
let _prop = {
|
|
56
|
+
value: 'regionNo',
|
|
57
|
+
label: 'regionName',
|
|
58
|
+
children: 'children',
|
|
59
|
+
expandTrigger: 'hover'
|
|
60
|
+
}
|
|
61
|
+
return Object.assign(_prop, this.props)
|
|
62
|
+
},
|
|
55
63
|
areaKey() {
|
|
56
64
|
return this.countryId === 'CHN' ? '_china_area_tree_' : `_${this.countryId}_area_tree_`
|
|
57
65
|
},
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
<!--结算 日 周 月 年 时间选择控件封装 -->
|
|
3
3
|
<div class="n20-date-select">
|
|
4
4
|
<el-select v-model="type" placeholder="请选择" style="width: 65px" @change="dateTypeSelectChange">
|
|
5
|
-
<el-option v-for="(item, index) in
|
|
5
|
+
<el-option v-for="(item, index) in selectList" :key="index" :label="item" :value="item" />
|
|
6
6
|
</el-select>
|
|
7
|
-
<
|
|
7
|
+
<date-picker
|
|
8
8
|
v-if="type === '日'"
|
|
9
9
|
key="day"
|
|
10
10
|
v-model="day"
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
placeholder="选择日"
|
|
17
17
|
@change="dayChange"
|
|
18
18
|
/>
|
|
19
|
-
<
|
|
19
|
+
<date-picker
|
|
20
20
|
v-if="type === '周'"
|
|
21
|
-
v-model="week"
|
|
22
21
|
key="week"
|
|
22
|
+
v-model="week"
|
|
23
23
|
format="yyyy 第 WW 周"
|
|
24
24
|
type="week"
|
|
25
25
|
:picker-options="{ firstDayOfWeek: 1 }"
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
@change="weekChange"
|
|
29
29
|
/>
|
|
30
30
|
|
|
31
|
-
<
|
|
31
|
+
<date-picker
|
|
32
32
|
v-if="type === '月'"
|
|
33
|
-
v-model="month"
|
|
34
33
|
key="month"
|
|
34
|
+
v-model="month"
|
|
35
35
|
type="month"
|
|
36
36
|
format="yyyy-MM"
|
|
37
37
|
value-format="yyyy-MM"
|
|
@@ -39,9 +39,10 @@
|
|
|
39
39
|
placeholder="选择月"
|
|
40
40
|
@change="monthChange"
|
|
41
41
|
/>
|
|
42
|
-
<quarter-date-picker
|
|
43
|
-
<
|
|
42
|
+
<quarter-date-picker v-if="type === '季'" key="quarter" v-model="quarter" @change="handleChange" />
|
|
43
|
+
<date-picker
|
|
44
44
|
v-if="type === '年'"
|
|
45
|
+
key="year"
|
|
45
46
|
v-model="year"
|
|
46
47
|
type="year"
|
|
47
48
|
format="yyyy"
|
|
@@ -54,13 +55,12 @@
|
|
|
54
55
|
</template>
|
|
55
56
|
|
|
56
57
|
<script>
|
|
58
|
+
import datePicker from '../DatePicker/index.vue'
|
|
57
59
|
import quarterDatePicker from './quarterDatePicker'
|
|
58
60
|
import dayjs from 'dayjs'
|
|
59
61
|
export default {
|
|
60
62
|
name: 'SelectDatePicker',
|
|
61
|
-
components: {
|
|
62
|
-
quarterDatePicker
|
|
63
|
-
},
|
|
63
|
+
components: { datePicker, quarterDatePicker },
|
|
64
64
|
props: {
|
|
65
65
|
value: {
|
|
66
66
|
type: [Array, String, Object],
|
|
@@ -72,7 +72,7 @@ export default {
|
|
|
72
72
|
type: String,
|
|
73
73
|
default: '日'
|
|
74
74
|
},
|
|
75
|
-
|
|
75
|
+
selectList: {
|
|
76
76
|
type: Array,
|
|
77
77
|
default: () => {
|
|
78
78
|
return ['日', '周', '月', '季', '年']
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
clearable
|
|
64
64
|
@focus="changeFocus"
|
|
65
65
|
>
|
|
66
|
-
<i slot="
|
|
66
|
+
<i slot="suffix" class="el-input__icon el-icon-date" :class="showValue && 'quarter-date-icon'"></i>
|
|
67
67
|
</el-input>
|
|
68
68
|
</el-popover>
|
|
69
69
|
</template>
|
|
@@ -167,5 +167,8 @@ export default {
|
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
</script>
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
<style>
|
|
171
|
+
.el-date-editor:hover .quarter-date-icon {
|
|
172
|
+
display: none;
|
|
173
|
+
}
|
|
174
|
+
</style>
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="n20-num-w" @mouseenter="isHove = true" @mouseleave="isHove = false">
|
|
3
3
|
<el-input
|
|
4
|
+
ref="input"
|
|
4
5
|
v-model="valueStr"
|
|
5
6
|
class="n20-stc"
|
|
6
7
|
:disabled="disabled"
|
|
7
8
|
:placeholder="phd"
|
|
8
9
|
:clearable="isClearable"
|
|
10
|
+
:validate-event="false"
|
|
9
11
|
@clear="closeFn"
|
|
10
12
|
@focus="focusFn"
|
|
11
13
|
@input="inputFn"
|
|
@@ -14,9 +16,7 @@
|
|
|
14
16
|
@keydown.native="stepFn"
|
|
15
17
|
>
|
|
16
18
|
<template v-if="type === 'rate'">
|
|
17
|
-
<span v-if="!isClearable || (
|
|
18
|
-
suffix
|
|
19
|
-
}}</span>
|
|
19
|
+
<span v-if="!isClearable || (!isHove && !isFocus)" slot="suffix" class="el-input__icon">{{ suffix }}</span>
|
|
20
20
|
</template>
|
|
21
21
|
</el-input>
|
|
22
22
|
</div>
|
|
@@ -24,9 +24,12 @@
|
|
|
24
24
|
|
|
25
25
|
<script>
|
|
26
26
|
import { $lc } from '../../utils/i18n/index'
|
|
27
|
-
import
|
|
27
|
+
import emitter from '../../utils/element-ui-emitter'
|
|
28
|
+
import N from '../../utils/numberPor'
|
|
29
|
+
|
|
28
30
|
export default {
|
|
29
31
|
name: 'InputNumber',
|
|
32
|
+
mixins: [emitter],
|
|
30
33
|
props: {
|
|
31
34
|
value: {
|
|
32
35
|
type: [Number, String],
|
|
@@ -41,11 +44,11 @@ export default {
|
|
|
41
44
|
},
|
|
42
45
|
min: {
|
|
43
46
|
type: Number,
|
|
44
|
-
default: -9999999999999
|
|
47
|
+
default: -9999999999999.99
|
|
45
48
|
},
|
|
46
49
|
max: {
|
|
47
50
|
type: Number,
|
|
48
|
-
default: 9999999999999
|
|
51
|
+
default: 9999999999999.99
|
|
49
52
|
},
|
|
50
53
|
step: {
|
|
51
54
|
type: Number,
|
|
@@ -78,6 +81,10 @@ export default {
|
|
|
78
81
|
suffix: {
|
|
79
82
|
type: String,
|
|
80
83
|
default: '%'
|
|
84
|
+
},
|
|
85
|
+
rangeAuto: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: false
|
|
81
88
|
}
|
|
82
89
|
},
|
|
83
90
|
data() {
|
|
@@ -98,36 +105,37 @@ export default {
|
|
|
98
105
|
} else {
|
|
99
106
|
return $lc('请输入金额')
|
|
100
107
|
}
|
|
108
|
+
},
|
|
109
|
+
fNum() {
|
|
110
|
+
if (this.format) {
|
|
111
|
+
let i_f = this.format.indexOf('.')
|
|
112
|
+
return i_f === -1 ? 0 : this.format.length - i_f - 1
|
|
113
|
+
}
|
|
114
|
+
if (this.dNum) {
|
|
115
|
+
return this.dNum
|
|
116
|
+
}
|
|
117
|
+
if (this.type === 'rate') {
|
|
118
|
+
return 4
|
|
119
|
+
}
|
|
120
|
+
if (this.type === 'money') {
|
|
121
|
+
return 2
|
|
122
|
+
}
|
|
123
|
+
return 2
|
|
101
124
|
}
|
|
102
125
|
},
|
|
103
126
|
watch: {
|
|
104
127
|
value: {
|
|
105
128
|
handler(val) {
|
|
106
|
-
if (
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
this
|
|
110
|
-
this.valueStr = this.num2str(val)
|
|
111
|
-
return
|
|
129
|
+
if (this.rangeAuto) {
|
|
130
|
+
this.valueStr = N.addThousands(val)
|
|
131
|
+
} else {
|
|
132
|
+
this.valueStr = N.addThousands(N.subFixed(val, this.fNum))
|
|
112
133
|
}
|
|
113
|
-
this.valueStr = this.num2str(val)
|
|
114
134
|
},
|
|
115
135
|
immediate: true
|
|
116
136
|
}
|
|
117
137
|
},
|
|
118
138
|
methods: {
|
|
119
|
-
num2str(val = '') {
|
|
120
|
-
if (val === '' || val === null || val === undefined) {
|
|
121
|
-
return ''
|
|
122
|
-
}
|
|
123
|
-
switch (this.type) {
|
|
124
|
-
case 'rate':
|
|
125
|
-
return numerify(val, this.format || '0.0000')
|
|
126
|
-
case 'money':
|
|
127
|
-
default:
|
|
128
|
-
return numerify(val, this.format || '0,0.00')
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
139
|
focusFn() {
|
|
132
140
|
this.isFocus = true
|
|
133
141
|
if (!this.disabled && this.valueStr) {
|
|
@@ -143,7 +151,7 @@ export default {
|
|
|
143
151
|
},
|
|
144
152
|
stepFn(ev) {
|
|
145
153
|
if ((ev.code === 'ArrowUp' || ev.code === 'ArrowDown') && !this.disabled) {
|
|
146
|
-
let val =
|
|
154
|
+
let val = N(this.valueStr)
|
|
147
155
|
if (!isNaN(val)) {
|
|
148
156
|
ev.preventDefault()
|
|
149
157
|
val = ev.code === 'ArrowUp' ? val + this.step : val - this.step
|
|
@@ -152,9 +160,11 @@ export default {
|
|
|
152
160
|
} else if (val > this.max) {
|
|
153
161
|
val = this.max
|
|
154
162
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
163
|
+
if (this.rangeAuto) {
|
|
164
|
+
this.valueStr = N.toString(val)
|
|
165
|
+
} else {
|
|
166
|
+
this.valueStr = N.subFixed(val, this.fNum)
|
|
167
|
+
}
|
|
158
168
|
}
|
|
159
169
|
}
|
|
160
170
|
},
|
|
@@ -172,51 +182,42 @@ export default {
|
|
|
172
182
|
this.changeIng = false
|
|
173
183
|
})
|
|
174
184
|
|
|
175
|
-
|
|
176
|
-
let val = NumberP(valStr)
|
|
177
|
-
|
|
185
|
+
let val = N(valStr)
|
|
178
186
|
if (isNaN(val)) {
|
|
179
187
|
this.valueStr = ''
|
|
180
188
|
this.$emit('input', undefined)
|
|
181
189
|
this.$emit('change', undefined)
|
|
190
|
+
this.dispatch('ElFormItem', 'el.form.change', [undefined])
|
|
182
191
|
return
|
|
183
192
|
}
|
|
184
193
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
} else
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
194
|
+
let nStr
|
|
195
|
+
if (this.rangeAuto) {
|
|
196
|
+
nStr = N.toString(val)
|
|
197
|
+
this.valueStr = N.addThousands(valStr)
|
|
198
|
+
} else {
|
|
199
|
+
if (this.stepStrictly) {
|
|
200
|
+
let N = val / this.step
|
|
201
|
+
if (val % this.step !== 0) {
|
|
202
|
+
val = Math.round(N) * this.step
|
|
203
|
+
}
|
|
193
204
|
}
|
|
205
|
+
if (val < this.min) {
|
|
206
|
+
val = this.min
|
|
207
|
+
} else if (val > this.max) {
|
|
208
|
+
val = this.max
|
|
209
|
+
}
|
|
210
|
+
nStr = N.subFixed(val, this.fNum)
|
|
211
|
+
this.valueStr = N.addThousands(nStr)
|
|
194
212
|
}
|
|
195
|
-
this.valueStr = this.num2str(val)
|
|
196
213
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
this.$emit('change', nVar)
|
|
205
|
-
})
|
|
206
|
-
}
|
|
207
|
-
break
|
|
208
|
-
case 'money':
|
|
209
|
-
default:
|
|
210
|
-
{
|
|
211
|
-
let dNum = this.dNum !== undefined ? this.dNum : 2
|
|
212
|
-
let nVar = Number(val.toFixed(dNum))
|
|
213
|
-
this.$nextTick(() => {
|
|
214
|
-
this.$emit('input', nVar)
|
|
215
|
-
this.$emit('change', nVar)
|
|
216
|
-
})
|
|
217
|
-
}
|
|
218
|
-
break
|
|
219
|
-
}
|
|
214
|
+
this.$nextTick(() => {
|
|
215
|
+
let nVar = Number(nStr)
|
|
216
|
+
this.$emit('input', nVar)
|
|
217
|
+
this.$emit('change', nVar)
|
|
218
|
+
|
|
219
|
+
this.dispatch('ElFormItem', 'el.form.change', [nVar])
|
|
220
|
+
})
|
|
220
221
|
},
|
|
221
222
|
closeFn() {
|
|
222
223
|
this.$emit('input', undefined)
|
|
@@ -224,15 +225,4 @@ export default {
|
|
|
224
225
|
}
|
|
225
226
|
}
|
|
226
227
|
}
|
|
227
|
-
|
|
228
|
-
function NumberP(val) {
|
|
229
|
-
if (typeof val === 'string') {
|
|
230
|
-
val = val.replace(/,/g, '').trim()
|
|
231
|
-
}
|
|
232
|
-
if (val === undefined || val === null || val === '') {
|
|
233
|
-
return NaN
|
|
234
|
-
} else {
|
|
235
|
-
return Number(val)
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
228
|
</script>
|
|
@@ -398,11 +398,11 @@ export default {
|
|
|
398
398
|
this.updateK = ''
|
|
399
399
|
})
|
|
400
400
|
} else {
|
|
401
|
-
window.postMessage({
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
})
|
|
401
|
+
// window.postMessage({
|
|
402
|
+
// updateActiveCache: true,
|
|
403
|
+
// targetName: '*',
|
|
404
|
+
// originName: 'main'
|
|
405
|
+
// })
|
|
406
406
|
this.CompatibleUpdateCache(tab.route) // 兼容旧的子模块清除缓存
|
|
407
407
|
}
|
|
408
408
|
}
|
|
@@ -21,12 +21,12 @@ export default {
|
|
|
21
21
|
numerify({ label, value }, f, w, unit = '') {
|
|
22
22
|
unit = unit ? (unit === true ? $lc('元') : unit) : ''
|
|
23
23
|
if (!w) {
|
|
24
|
-
return numerify(value, f) + unit
|
|
24
|
+
return numerify(value, f, Math.floor) + unit
|
|
25
25
|
} else {
|
|
26
26
|
if (value > n) {
|
|
27
27
|
return numerify(value / n, f) + $lc('万') + unit
|
|
28
28
|
} else {
|
|
29
|
-
return numerify(value, f) + unit
|
|
29
|
+
return numerify(value, f, Math.floor) + unit
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -14,10 +14,10 @@ function tplFn(row, sc, mck, map = {}) {
|
|
|
14
14
|
let type = kA[1]
|
|
15
15
|
switch (type) {
|
|
16
16
|
case 'money':
|
|
17
|
-
str += numerify(row[key], '0,0.00')
|
|
17
|
+
str += numerify(row[key], '0,0.00', Math.floor)
|
|
18
18
|
break
|
|
19
19
|
case 'rate':
|
|
20
|
-
str += numerify(row[key], '0.000000')
|
|
20
|
+
str += numerify(row[key], '0.000000', Math.floor)
|
|
21
21
|
break
|
|
22
22
|
case 'map':
|
|
23
23
|
str += map[row[key]]
|
package/src/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import './utils/importGlobal.js' // 联合加载组件保存位置
|
|
2
1
|
import './utils/storagePro.js' // 扩展Storage
|
|
3
2
|
/** 提供组件给外部使用的入口 */
|
|
4
3
|
import ContentLoading from './components/ContentLoading/index.vue'
|
|
@@ -87,7 +86,10 @@ import VHas from './directives/VHas/index.js'
|
|
|
87
86
|
|
|
88
87
|
/** 注入方法 */
|
|
89
88
|
import dayjs from 'dayjs'
|
|
90
|
-
import
|
|
89
|
+
import _numerify from 'numerify'
|
|
90
|
+
function numerify(input, formatType, roundingFunction) {
|
|
91
|
+
return _numerify(input, formatType, roundingFunction || Math.floor)
|
|
92
|
+
}
|
|
91
93
|
import axios from './utils/axios.js'
|
|
92
94
|
import auth from './utils/auth.js'
|
|
93
95
|
import { msgPor, msgboxPor } from './utils/msgboxPor.js'
|
|
@@ -100,6 +102,8 @@ import list2tree from './utils/list2tree'
|
|
|
100
102
|
import { has as isHas } from './directives/VHas/index.js'
|
|
101
103
|
import { hasG as isHasG } from './directives/VHas/index.js'
|
|
102
104
|
import asyncGetRelaNos from './utils/asyncGetRelaNos.js'
|
|
105
|
+
import importG from './utils/importGlobal.js' // 联合加载组件保存位置
|
|
106
|
+
import N from './utils/numberPor.js' // 扩展Number
|
|
103
107
|
|
|
104
108
|
/** 国际化 */
|
|
105
109
|
import i18n, { $l } from './utils/i18n'
|
|
@@ -220,7 +224,8 @@ export {
|
|
|
220
224
|
// 方法
|
|
221
225
|
auth,
|
|
222
226
|
axios,
|
|
223
|
-
|
|
227
|
+
$l,
|
|
228
|
+
N,
|
|
224
229
|
downloadBlob,
|
|
225
230
|
forEachs,
|
|
226
231
|
list2tree,
|
|
@@ -233,7 +238,8 @@ export {
|
|
|
233
238
|
dayjs,
|
|
234
239
|
numerify,
|
|
235
240
|
asyncGetRelaNos,
|
|
236
|
-
|
|
241
|
+
getJsonc,
|
|
242
|
+
importG,
|
|
237
243
|
// 组件
|
|
238
244
|
ContentLoading,
|
|
239
245
|
ContentNull,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
methods: {
|
|
3
|
+
dispatch(componentName, eventName, params) {
|
|
4
|
+
var parent = this.$parent || this.$root
|
|
5
|
+
var name = parent.$options.componentName
|
|
6
|
+
|
|
7
|
+
while (parent && (!name || name !== componentName)) {
|
|
8
|
+
parent = parent.$parent
|
|
9
|
+
|
|
10
|
+
if (parent) {
|
|
11
|
+
name = parent.$options.componentName
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
if (parent) {
|
|
15
|
+
parent.$emit.apply(parent, [eventName].concat(params))
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|