n20-common-lib 2.9.86 → 2.9.87
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n20-common-lib",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.87",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"serve": "vue-cli-service serve",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"axios": "*",
|
|
53
53
|
"dayjs": "*",
|
|
54
|
+
"decimal.js": "^10.5.0",
|
|
54
55
|
"js-cookie": "^3.0.1",
|
|
55
56
|
"jsencrypt": "^3.3.2",
|
|
56
57
|
"jsonwebtoken": "^8.5.1",
|
|
@@ -62,12 +63,12 @@
|
|
|
62
63
|
"qrcode": "*",
|
|
63
64
|
"resize-detector": "*",
|
|
64
65
|
"strip-json-comments": "*",
|
|
66
|
+
"swiper": "8.4.5",
|
|
65
67
|
"v-viewer": "1.6.4",
|
|
66
68
|
"vue-jsonp": "2.0.0",
|
|
67
69
|
"vuedraggable": "*",
|
|
68
70
|
"webpack-duplicate-relano-plugin": "^0.1.0",
|
|
69
|
-
"xe-utils": "^3.5.11"
|
|
70
|
-
"swiper": "8.4.5"
|
|
71
|
+
"xe-utils": "^3.5.11"
|
|
71
72
|
},
|
|
72
73
|
"devDependencies": {
|
|
73
74
|
"@babel/plugin-proposal-optional-chaining": "^7.14.5",
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
class="n20-num-w"
|
|
4
|
+
@mouseenter="isHove = true"
|
|
5
|
+
@mouseleave="isHove = false"
|
|
6
|
+
>
|
|
3
7
|
<el-input
|
|
4
8
|
ref="input"
|
|
5
9
|
v-model="valueStr"
|
|
@@ -23,7 +27,9 @@
|
|
|
23
27
|
<slot name="prefix"></slot>
|
|
24
28
|
</template>
|
|
25
29
|
<template v-if="type === 'rate'">
|
|
26
|
-
<span v-if="suffixV" slot="suffix" class="el-input__icon">{{
|
|
30
|
+
<span v-if="suffixV" slot="suffix" class="el-input__icon">{{
|
|
31
|
+
suffix
|
|
32
|
+
}}</span>
|
|
27
33
|
</template>
|
|
28
34
|
</el-input>
|
|
29
35
|
</div>
|
|
@@ -34,6 +40,8 @@ import emitter from '../../utils/element-ui-emitter'
|
|
|
34
40
|
import { $lc } from '../../utils/i18n/index'
|
|
35
41
|
import N from '../../utils/numberPor'
|
|
36
42
|
|
|
43
|
+
import { Decimal } from 'decimal.js'
|
|
44
|
+
|
|
37
45
|
export default {
|
|
38
46
|
name: 'InputNumber',
|
|
39
47
|
mixins: [emitter],
|
|
@@ -50,12 +58,28 @@ export default {
|
|
|
50
58
|
}
|
|
51
59
|
},
|
|
52
60
|
min: {
|
|
53
|
-
type: Number,
|
|
54
|
-
default: -9999999999999.99
|
|
61
|
+
type: [Number, String],
|
|
62
|
+
default: -9999999999999.99,
|
|
63
|
+
validator(v) {
|
|
64
|
+
try {
|
|
65
|
+
new Decimal(v)
|
|
66
|
+
return true
|
|
67
|
+
} catch {
|
|
68
|
+
return false
|
|
69
|
+
}
|
|
70
|
+
}
|
|
55
71
|
},
|
|
56
72
|
max: {
|
|
57
|
-
type: Number,
|
|
58
|
-
default: 9999999999999.99
|
|
73
|
+
type: [Number, String],
|
|
74
|
+
default: 9999999999999.99,
|
|
75
|
+
validator(v) {
|
|
76
|
+
try {
|
|
77
|
+
new Decimal(v)
|
|
78
|
+
return true
|
|
79
|
+
} catch {
|
|
80
|
+
return false
|
|
81
|
+
}
|
|
82
|
+
}
|
|
59
83
|
},
|
|
60
84
|
step: {
|
|
61
85
|
type: Number,
|
|
@@ -141,7 +165,9 @@ export default {
|
|
|
141
165
|
if (val || val === 0) {
|
|
142
166
|
let nF = N.toString(val).split('.')[1] || ''
|
|
143
167
|
if (nF.length < this.fNum) {
|
|
144
|
-
return (this.valueStr = N.addThousands(
|
|
168
|
+
return (this.valueStr = N.addThousands(
|
|
169
|
+
N.subFixed(val, this.fNum)
|
|
170
|
+
))
|
|
145
171
|
}
|
|
146
172
|
}
|
|
147
173
|
this.valueStr = N.addThousands(val)
|
|
@@ -153,6 +179,9 @@ export default {
|
|
|
153
179
|
}
|
|
154
180
|
},
|
|
155
181
|
methods: {
|
|
182
|
+
compare(a, b) {
|
|
183
|
+
return new Decimal(a).cmp(new Decimal(b)) === 1
|
|
184
|
+
},
|
|
156
185
|
focusFn() {
|
|
157
186
|
this.isFocus = true
|
|
158
187
|
if (!this.disabled && this.valueStr) {
|
|
@@ -170,7 +199,10 @@ export default {
|
|
|
170
199
|
this.$emit('clear')
|
|
171
200
|
},
|
|
172
201
|
stepFn(ev) {
|
|
173
|
-
if (
|
|
202
|
+
if (
|
|
203
|
+
(ev.code === 'ArrowUp' || ev.code === 'ArrowDown') &&
|
|
204
|
+
!this.disabled
|
|
205
|
+
) {
|
|
174
206
|
let val = N(this.valueStr)
|
|
175
207
|
if (!isNaN(val)) {
|
|
176
208
|
ev.preventDefault()
|
|
@@ -203,6 +235,7 @@ export default {
|
|
|
203
235
|
})
|
|
204
236
|
|
|
205
237
|
let val = N(valStr)
|
|
238
|
+
|
|
206
239
|
if (isNaN(val)) {
|
|
207
240
|
this.valueStr = ''
|
|
208
241
|
let oVal = this.value
|
|
@@ -225,13 +258,16 @@ export default {
|
|
|
225
258
|
val = Math.round(N) * this.step
|
|
226
259
|
}
|
|
227
260
|
}
|
|
228
|
-
|
|
261
|
+
|
|
262
|
+
if (this.compare(this.min, val)) {
|
|
229
263
|
val = this.min
|
|
230
|
-
} else if (val
|
|
264
|
+
} else if (this.compare(val, this.max)) {
|
|
231
265
|
val = this.max
|
|
266
|
+
} else {
|
|
267
|
+
nStr = N.subFixed(val, this.fNum)
|
|
232
268
|
}
|
|
233
|
-
|
|
234
|
-
this.valueStr = N.addThousands(nStr)
|
|
269
|
+
|
|
270
|
+
this.valueStr = N.addThousands(nStr || val)
|
|
235
271
|
}
|
|
236
272
|
|
|
237
273
|
this.$nextTick(() => {
|
|
@@ -127,7 +127,7 @@ export async function getSign(plain, dn) {
|
|
|
127
127
|
closeOnClickModal: false,
|
|
128
128
|
inputType: 'password'
|
|
129
129
|
}).then(({ value }) => {
|
|
130
|
-
|
|
130
|
+
performSign(plainText, value).then((signedData) => {
|
|
131
131
|
answer = signedData
|
|
132
132
|
})
|
|
133
133
|
})
|
|
@@ -176,8 +176,6 @@ async function performSign(plainText, value) {
|
|
|
176
176
|
Message.error(codeDate[errorCode])
|
|
177
177
|
reject()
|
|
178
178
|
}
|
|
179
|
-
}).catch(() => {
|
|
180
|
-
resolve()
|
|
181
179
|
})
|
|
182
180
|
})
|
|
183
181
|
}
|