doway-coms 1.1.52 → 1.1.55
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/lib/doway-coms.common.js +1506 -53
- package/lib/doway-coms.umd.js +1506 -53
- package/node_modules/vxe-table/package.json +1 -1
- package/package.json +13 -4
- package/packages/BaseCheckbox/index.js +8 -0
- package/packages/BaseCheckbox/src/index.vue +123 -0
- package/packages/BaseDate/index.js +8 -0
- package/packages/BaseDate/src/index.vue +145 -0
- package/packages/BaseDateWeek/index.js +8 -0
- package/packages/BaseDateWeek/src/index.vue +115 -0
- package/packages/BaseDatetime/index.js +8 -0
- package/packages/BaseDatetime/src/index.vue +143 -0
- package/packages/BaseForm/index.js +8 -0
- package/packages/BaseForm/src/index.vue +631 -0
- package/packages/BaseGrid/index.js +10 -0
- package/packages/BaseGrid/src/index.vue +2375 -0
- package/packages/BaseInput/index.js +8 -0
- package/packages/BaseInput/src/index.vue +122 -0
- package/packages/BaseIntervalInput/index.js +8 -0
- package/packages/BaseIntervalInput/src/index.vue +275 -0
- package/packages/BaseNumberInput/index.js +8 -0
- package/packages/BaseNumberInput/src/index.vue +216 -0
- package/packages/BasePagination/index.js +8 -0
- package/packages/BasePagination/src/index.vue +74 -0
- package/packages/BasePictureCard/index.js +8 -0
- package/packages/BasePictureCard/src/index.vue +580 -0
- package/packages/BasePulldown/index.js +8 -0
- package/packages/BasePulldown/src/index.vue +817 -0
- package/packages/BaseSelect/index.js +8 -0
- package/packages/BaseSelect/src/index.vue +141 -0
- package/packages/BaseSelectMulti/index.js +8 -0
- package/packages/BaseSelectMulti/src/index.vue +135 -0
- package/packages/BaseTextArea/index.js +8 -0
- package/packages/BaseTextArea/src/index.vue +138 -0
- package/packages/BaseTime/index.js +8 -0
- package/packages/BaseTime/src/index.vue +117 -0
- package/packages/BaseTool/index.js +8 -0
- package/packages/BaseTool/src/index.vue +350 -0
- package/packages/BaseToolStatus/index.js +8 -0
- package/packages/BaseToolStatus/src/index.vue +384 -0
- package/packages/index.js +138 -0
- package/packages/styles/default.less +79 -0
- package/packages/utils/api.js +35 -0
- package/packages/utils/auth.js +38 -0
- package/packages/utils/common.js +259 -0
- package/packages/utils/dom.js +181 -0
- package/packages/utils/enum.js +81 -0
- package/packages/utils/filters.js +459 -0
- package/packages/utils/msg.js +17 -0
- package/packages/utils/patchFiles.js +45 -0
- package/packages/utils/request.js +80 -0
- package/packages/utils/store.js +117 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="d-control-container">
|
|
3
|
+
<div class="d-control-label">
|
|
4
|
+
{{ label
|
|
5
|
+
}}<span v-if="rules && rules['required']" class="d-control-label-required"
|
|
6
|
+
>*
|
|
7
|
+
</span>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="d-control">
|
|
10
|
+
<ValidationProvider
|
|
11
|
+
:name="label"
|
|
12
|
+
v-slot="v"
|
|
13
|
+
:rules="rules"
|
|
14
|
+
v-if="edit === true"
|
|
15
|
+
>
|
|
16
|
+
<Input
|
|
17
|
+
:size="'small'"
|
|
18
|
+
v-model="currentValue"
|
|
19
|
+
:placeholder="placeholder"
|
|
20
|
+
@change="change"
|
|
21
|
+
@blur="blur"
|
|
22
|
+
style="width: 100%"
|
|
23
|
+
:class="{ 'd-error-input': v.errors.length > 0 }"
|
|
24
|
+
/>
|
|
25
|
+
<div class="d-error-msg">
|
|
26
|
+
{{ v.errors[0] }}
|
|
27
|
+
</div>
|
|
28
|
+
</ValidationProvider>
|
|
29
|
+
<span v-else>{{ currentValue }}</span>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script>
|
|
35
|
+
|
|
36
|
+
import { Input } from 'ant-design-vue'
|
|
37
|
+
import { ValidationProvider } from 'vee-validate'
|
|
38
|
+
export default {
|
|
39
|
+
name: 'BaseInput',
|
|
40
|
+
components:{
|
|
41
|
+
Input,
|
|
42
|
+
ValidationProvider
|
|
43
|
+
},
|
|
44
|
+
data() {
|
|
45
|
+
return {
|
|
46
|
+
filterValue: '',
|
|
47
|
+
isInputChanged: false,
|
|
48
|
+
inputTimeout: null,
|
|
49
|
+
searchRows: [],
|
|
50
|
+
filterCols: [],
|
|
51
|
+
gridLoading: false,
|
|
52
|
+
gridPagerConfig: {
|
|
53
|
+
total: 0,
|
|
54
|
+
currentPage: 1,
|
|
55
|
+
pageSize: 10
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
computed: {
|
|
60
|
+
currentValue: {
|
|
61
|
+
// 动态计算currentValue的值
|
|
62
|
+
get: function() {
|
|
63
|
+
return this.value // 将props中的value赋值给currentValue
|
|
64
|
+
},
|
|
65
|
+
set: function(val) {
|
|
66
|
+
this.$emit('input', val) // 通过$emit触发父组件
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
props: {
|
|
71
|
+
rules: {
|
|
72
|
+
type: Object,
|
|
73
|
+
default: function() {
|
|
74
|
+
return null
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
value: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: function() {
|
|
80
|
+
return ''
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
edit: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
default: function() {
|
|
86
|
+
return false
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
name: {
|
|
90
|
+
type: String,
|
|
91
|
+
default: function() {
|
|
92
|
+
return ''
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
label: {
|
|
96
|
+
type: String,
|
|
97
|
+
default: function() {
|
|
98
|
+
return ''
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
placeholder: {
|
|
102
|
+
type: String,
|
|
103
|
+
default: function() {
|
|
104
|
+
return ''
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
created() {},
|
|
109
|
+
methods: {
|
|
110
|
+
change() {
|
|
111
|
+
this.$emit('change')
|
|
112
|
+
},
|
|
113
|
+
blur() {
|
|
114
|
+
this.$emit('blur')
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
</script>
|
|
119
|
+
|
|
120
|
+
<style lang="less">
|
|
121
|
+
@import '../../styles/default.less';
|
|
122
|
+
</style>
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="d-control-container">
|
|
3
|
+
<div class="d-control-label">
|
|
4
|
+
{{ label
|
|
5
|
+
}}<span
|
|
6
|
+
v-if="rules && Object.getOwnPropertyNames(rules).length > 0"
|
|
7
|
+
class="d-control-label-required"
|
|
8
|
+
>*</span
|
|
9
|
+
>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="d-control" style="font-size:12px">
|
|
12
|
+
<ValidationProvider
|
|
13
|
+
:name="label"
|
|
14
|
+
v-slot="v"
|
|
15
|
+
:rules="rules"
|
|
16
|
+
v-if="edit === true"
|
|
17
|
+
>
|
|
18
|
+
<input v-model="currentValue" style="display:none" />
|
|
19
|
+
<div style="display:flex;flex-flow:row nowrap">
|
|
20
|
+
<input
|
|
21
|
+
type="number"
|
|
22
|
+
v-model="dayValue"
|
|
23
|
+
@input="dayChange"
|
|
24
|
+
@focus="dayFocus"
|
|
25
|
+
class="input-class"
|
|
26
|
+
/>
|
|
27
|
+
<div style="width:18px;margin-left:2px">
|
|
28
|
+
<span>天</span>
|
|
29
|
+
</div>
|
|
30
|
+
<input
|
|
31
|
+
type="number"
|
|
32
|
+
v-model="hourValue"
|
|
33
|
+
@input="hourChange"
|
|
34
|
+
@focus="hourFocus"
|
|
35
|
+
class="input-class"
|
|
36
|
+
/>
|
|
37
|
+
<div style="width:30px">
|
|
38
|
+
<span>小时</span>
|
|
39
|
+
</div>
|
|
40
|
+
<input
|
|
41
|
+
@input="minuteChange"
|
|
42
|
+
v-if="displayType === 'minute' || displayType === 'second'"
|
|
43
|
+
type="number"
|
|
44
|
+
v-model="minuteValue"
|
|
45
|
+
@focus="minuteFocus"
|
|
46
|
+
class="input-class"
|
|
47
|
+
/>
|
|
48
|
+
<div
|
|
49
|
+
v-if="displayType === 'minute' || displayType === 'second'"
|
|
50
|
+
style="width:30px"
|
|
51
|
+
>
|
|
52
|
+
<span>分钟</span>
|
|
53
|
+
</div>
|
|
54
|
+
<input
|
|
55
|
+
@input="secondChange"
|
|
56
|
+
v-if="displayType === 'second'"
|
|
57
|
+
type="number"
|
|
58
|
+
@focus="secondFocus"
|
|
59
|
+
v-model="secondValue"
|
|
60
|
+
class="input-class"
|
|
61
|
+
/>
|
|
62
|
+
<div v-if="displayType === 'second'" style="width:20px">
|
|
63
|
+
<span>秒</span>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
<div class="d-error-msg">
|
|
67
|
+
{{ v.errors[0] }}
|
|
68
|
+
</div>
|
|
69
|
+
</ValidationProvider>
|
|
70
|
+
<span v-else>{{ dayValue }}天{{ hourValue }}小时</span>
|
|
71
|
+
</div>
|
|
72
|
+
<div style="display:none">
|
|
73
|
+
{{ currentValue }}
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
</template>
|
|
77
|
+
|
|
78
|
+
<script>
|
|
79
|
+
import XEUtils from 'xe-utils'
|
|
80
|
+
import moment from 'moment'
|
|
81
|
+
import { ValidationProvider } from 'vee-validate'
|
|
82
|
+
export default {
|
|
83
|
+
name: 'BaseIntervalInput',
|
|
84
|
+
components:{
|
|
85
|
+
ValidationProvider
|
|
86
|
+
},
|
|
87
|
+
data() {
|
|
88
|
+
return {
|
|
89
|
+
dayValue: 0,
|
|
90
|
+
hourValue: 0,
|
|
91
|
+
minuteValue: 0,
|
|
92
|
+
secondValue: 0,
|
|
93
|
+
testValue: 0,
|
|
94
|
+
filterValue: '',
|
|
95
|
+
isInputChanged: false,
|
|
96
|
+
inputTimeout: null,
|
|
97
|
+
searchRows: [],
|
|
98
|
+
filterCols: [],
|
|
99
|
+
gridLoading: false,
|
|
100
|
+
gridPagerConfig: {
|
|
101
|
+
total: 0,
|
|
102
|
+
currentPage: 1,
|
|
103
|
+
pageSize: 10
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
computed: {
|
|
108
|
+
currentValue: {
|
|
109
|
+
// 动态计算currentValue的值
|
|
110
|
+
get: function() {
|
|
111
|
+
//分钟计算成小时
|
|
112
|
+
let tempValue = this.value
|
|
113
|
+
if (this.valueType === 'hour') {
|
|
114
|
+
tempValue = XEUtils.multiply(tempValue, 3600)
|
|
115
|
+
} else if (this.valueType === 'minute') {
|
|
116
|
+
tempValue = XEUtils.multiply(tempValue, 60)
|
|
117
|
+
}
|
|
118
|
+
//设置天数
|
|
119
|
+
this.dayValue = XEUtils.floor(XEUtils.divide(tempValue, 24 * 3600))
|
|
120
|
+
//天之后的剩余秒数
|
|
121
|
+
tempValue = XEUtils.subtract(tempValue, this.dayValue * 3600 * 24)
|
|
122
|
+
if (tempValue >= 0) {
|
|
123
|
+
//设置小时数
|
|
124
|
+
this.hourValue = XEUtils.floor(XEUtils.divide(tempValue, 3600))
|
|
125
|
+
//小时之后的剩余秒数
|
|
126
|
+
tempValue = XEUtils.subtract(tempValue, this.hourValue * 3600)
|
|
127
|
+
}
|
|
128
|
+
if (tempValue >= 0) {
|
|
129
|
+
//设置分钟
|
|
130
|
+
this.minuteValue = XEUtils.floor(XEUtils.divide(tempValue, 60))
|
|
131
|
+
//小时之后的剩余秒数
|
|
132
|
+
tempValue = XEUtils.subtract(tempValue, this.minuteValue * 60)
|
|
133
|
+
}
|
|
134
|
+
if (tempValue >= 0) {
|
|
135
|
+
//设置秒数
|
|
136
|
+
this.secondValue = tempValue
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return this.value // 将props中的value赋值给currentValue
|
|
140
|
+
},
|
|
141
|
+
set: function(val) {
|
|
142
|
+
if (val === '') {
|
|
143
|
+
val = 0
|
|
144
|
+
}
|
|
145
|
+
if (XEUtils.isNumber(val)) {
|
|
146
|
+
this.$emit('input', XEUtils.toInteger(val))
|
|
147
|
+
}
|
|
148
|
+
// 通过$emit触发父组件
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
props: {
|
|
153
|
+
value: {
|
|
154
|
+
type: Number,
|
|
155
|
+
default: function() {
|
|
156
|
+
return 0
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
rules: {
|
|
160
|
+
type: Object,
|
|
161
|
+
default: function() {
|
|
162
|
+
return null
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
displayType: {
|
|
166
|
+
type: String,
|
|
167
|
+
default: function() {
|
|
168
|
+
return ''
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
valueType: {
|
|
172
|
+
type: String,
|
|
173
|
+
default: function() {
|
|
174
|
+
return ''
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
edit: {
|
|
178
|
+
type: Boolean,
|
|
179
|
+
default: function() {
|
|
180
|
+
return false
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
name: {
|
|
184
|
+
type: String,
|
|
185
|
+
default: function() {
|
|
186
|
+
return ''
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
label: {
|
|
190
|
+
type: String,
|
|
191
|
+
default: function() {
|
|
192
|
+
return ''
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
placeholder: {
|
|
196
|
+
type: String,
|
|
197
|
+
default: function() {
|
|
198
|
+
return ''
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
created() {},
|
|
203
|
+
methods: {
|
|
204
|
+
dayFocus($event) {
|
|
205
|
+
$event.target.select()
|
|
206
|
+
},
|
|
207
|
+
hourFocus($event) {
|
|
208
|
+
$event.target.select()
|
|
209
|
+
},
|
|
210
|
+
minuteFocus($event) {
|
|
211
|
+
$event.target.select()
|
|
212
|
+
},
|
|
213
|
+
secondFocus($event) {
|
|
214
|
+
$event.target.select()
|
|
215
|
+
},
|
|
216
|
+
dayChange() {
|
|
217
|
+
this.setCurrentValue()
|
|
218
|
+
this.$emit('change')
|
|
219
|
+
},
|
|
220
|
+
hourChange() {
|
|
221
|
+
this.setCurrentValue()
|
|
222
|
+
this.$emit('change')
|
|
223
|
+
},
|
|
224
|
+
minuteChange() {
|
|
225
|
+
this.setCurrentValue()
|
|
226
|
+
this.$emit('change')
|
|
227
|
+
},
|
|
228
|
+
secondChange() {
|
|
229
|
+
this.setCurrentValue()
|
|
230
|
+
this.$emit('change')
|
|
231
|
+
},
|
|
232
|
+
setCurrentValue() {
|
|
233
|
+
if (this.valueType === 'hour') {
|
|
234
|
+
this.currentValue =
|
|
235
|
+
XEUtils.multiply(this.dayValue, 24) +
|
|
236
|
+
XEUtils.toInteger(this.hourValue)
|
|
237
|
+
}
|
|
238
|
+
if (this.valueType === 'minute') {
|
|
239
|
+
this.currentValue =
|
|
240
|
+
XEUtils.multiply(this.dayValue, 24 * 60) +
|
|
241
|
+
XEUtils.multiply(this.hourValue, 60) +
|
|
242
|
+
XEUtils.toInteger(this.minuteValue)
|
|
243
|
+
}
|
|
244
|
+
if (this.valueType === 'second') {
|
|
245
|
+
this.currentValue =
|
|
246
|
+
XEUtils.multiply(this.dayValue, 24 * 3600) +
|
|
247
|
+
XEUtils.multiply(this.hourValue, 3600) +
|
|
248
|
+
XEUtils.multiply(this.minuteValue, 60) +
|
|
249
|
+
XEUtils.toInteger(this.secondValue)
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
</script>
|
|
255
|
+
|
|
256
|
+
<style lang="scss" scoped>
|
|
257
|
+
.input-class {
|
|
258
|
+
border-top: none;
|
|
259
|
+
border-right: none;
|
|
260
|
+
border-left: none;
|
|
261
|
+
outline: none;
|
|
262
|
+
width: 25px;
|
|
263
|
+
}
|
|
264
|
+
input[type="number"] {
|
|
265
|
+
&::-webkit-outer-spin-button,
|
|
266
|
+
&::-webkit-inner-spin-button {
|
|
267
|
+
-webkit-appearance: none;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
-moz-appearance: textfield;
|
|
271
|
+
}
|
|
272
|
+
</style>
|
|
273
|
+
<style lang="less">
|
|
274
|
+
@import '../../styles/default.less';
|
|
275
|
+
</style>
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="d-control-container">
|
|
3
|
+
<div
|
|
4
|
+
class="d-control-label"
|
|
5
|
+
v-if="showLabel === true"
|
|
6
|
+
:style="{ width: labelWidth > 0 ? labelWidth + 'px' : 'none' }"
|
|
7
|
+
>
|
|
8
|
+
{{ label
|
|
9
|
+
}}<span
|
|
10
|
+
v-if="rules && Object.getOwnPropertyNames(rules).length > 0"
|
|
11
|
+
class="d-control-label-required"
|
|
12
|
+
>*</span
|
|
13
|
+
>
|
|
14
|
+
</div>
|
|
15
|
+
<div
|
|
16
|
+
:class="{
|
|
17
|
+
'd-control': showLabel === true,
|
|
18
|
+
'd-grid-control': showLabel === false
|
|
19
|
+
}"
|
|
20
|
+
>
|
|
21
|
+
<ValidationProvider
|
|
22
|
+
:name="label"
|
|
23
|
+
v-slot="v"
|
|
24
|
+
:rules="rules"
|
|
25
|
+
v-if="edit === true"
|
|
26
|
+
>
|
|
27
|
+
<InputNumber
|
|
28
|
+
:size="'small'"
|
|
29
|
+
v-model="currentValue"
|
|
30
|
+
@change="numberChange"
|
|
31
|
+
@blur="blur"
|
|
32
|
+
:placeholder="placeholder"
|
|
33
|
+
:formatter="numberFormatter"
|
|
34
|
+
:parser="numberParse"
|
|
35
|
+
style="width: 100%"
|
|
36
|
+
:class="{ 'd-error-input': v.errors.length > 0 }"
|
|
37
|
+
/>
|
|
38
|
+
<div class="d-error-msg">
|
|
39
|
+
{{ v.errors[0] }}
|
|
40
|
+
</div>
|
|
41
|
+
</ValidationProvider>
|
|
42
|
+
<span v-else>{{ currentValue }}</span>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script>
|
|
48
|
+
import XEUtils from 'xe-utils'
|
|
49
|
+
import { InputNumber } from 'ant-design-vue'
|
|
50
|
+
import { ValidationProvider } from 'vee-validate'
|
|
51
|
+
export default {
|
|
52
|
+
name: 'BaseNumberInput',
|
|
53
|
+
components:{
|
|
54
|
+
InputNumber,
|
|
55
|
+
ValidationProvider
|
|
56
|
+
},
|
|
57
|
+
data() {
|
|
58
|
+
return {
|
|
59
|
+
testValue: 0,
|
|
60
|
+
filterValue: '',
|
|
61
|
+
isInputChanged: false,
|
|
62
|
+
inputTimeout: null,
|
|
63
|
+
searchRows: [],
|
|
64
|
+
filterCols: [],
|
|
65
|
+
gridLoading: false,
|
|
66
|
+
gridPagerConfig: {
|
|
67
|
+
total: 0,
|
|
68
|
+
currentPage: 1,
|
|
69
|
+
pageSize: 10
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
computed: {
|
|
74
|
+
currentValue: {
|
|
75
|
+
// 动态计算currentValue的值
|
|
76
|
+
get: function() {
|
|
77
|
+
return this.value // 将props中的value赋值给currentValue
|
|
78
|
+
},
|
|
79
|
+
set: function(val) {
|
|
80
|
+
if (val === '') {
|
|
81
|
+
val = 0
|
|
82
|
+
}
|
|
83
|
+
if (XEUtils.isNumber(val)) {
|
|
84
|
+
this.$emit('input', val)
|
|
85
|
+
}
|
|
86
|
+
// 通过$emit触发父组件
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
props: {
|
|
91
|
+
showLabel: {
|
|
92
|
+
type: Boolean,
|
|
93
|
+
default: function() {
|
|
94
|
+
return true
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
labelWidth: {
|
|
98
|
+
type: Number,
|
|
99
|
+
default: function() {
|
|
100
|
+
return 0
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
value: {
|
|
104
|
+
type: Number,
|
|
105
|
+
default: function() {
|
|
106
|
+
return 0
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
max: {
|
|
110
|
+
//最大值
|
|
111
|
+
type: Number,
|
|
112
|
+
default: function() {
|
|
113
|
+
return null
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
min: {
|
|
117
|
+
//最小值
|
|
118
|
+
type: Number,
|
|
119
|
+
default: function() {
|
|
120
|
+
return 0
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
precision: {
|
|
124
|
+
//小数位精度
|
|
125
|
+
type: Number,
|
|
126
|
+
default: function() {
|
|
127
|
+
return 0
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
rules: {
|
|
131
|
+
type: Object,
|
|
132
|
+
default: function() {
|
|
133
|
+
return null
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
edit: {
|
|
137
|
+
type: Boolean,
|
|
138
|
+
default: function() {
|
|
139
|
+
return false
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
name: {
|
|
143
|
+
type: String,
|
|
144
|
+
default: function() {
|
|
145
|
+
return ''
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
label: {
|
|
149
|
+
type: String,
|
|
150
|
+
default: function() {
|
|
151
|
+
return ''
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
placeholder: {
|
|
155
|
+
type: String,
|
|
156
|
+
default: function() {
|
|
157
|
+
return ''
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
created() {},
|
|
162
|
+
methods: {
|
|
163
|
+
numberChange(value) {
|
|
164
|
+
this.$emit('change')
|
|
165
|
+
},
|
|
166
|
+
blur() {
|
|
167
|
+
this.$emit('blur')
|
|
168
|
+
},
|
|
169
|
+
numberFormatter(value) {
|
|
170
|
+
return value
|
|
171
|
+
},
|
|
172
|
+
numberParse(value) {
|
|
173
|
+
if (value === null || value === '') {
|
|
174
|
+
return value
|
|
175
|
+
}
|
|
176
|
+
let returnValue = value
|
|
177
|
+
let tempPrecision = XEUtils.toNumber(this.precision)
|
|
178
|
+
let reg = new RegExp(
|
|
179
|
+
'^((-?)|(-?([1-9]{1}\\d*)|-?([0]{1})))(\\.(\\d){0,' +
|
|
180
|
+
tempPrecision +
|
|
181
|
+
'})?$'
|
|
182
|
+
)
|
|
183
|
+
if (!reg.test(value)) {
|
|
184
|
+
//小数点验证不通过
|
|
185
|
+
returnValue = XEUtils.floor(value, tempPrecision)
|
|
186
|
+
}
|
|
187
|
+
if (
|
|
188
|
+
this.max !== null &&
|
|
189
|
+
this.max !== undefined &&
|
|
190
|
+
XEUtils.toNumber(returnValue) > this.max
|
|
191
|
+
) {
|
|
192
|
+
returnValue = this.max
|
|
193
|
+
}
|
|
194
|
+
if (
|
|
195
|
+
this.min !== null &&
|
|
196
|
+
this.min !== undefined &&
|
|
197
|
+
XEUtils.toNumber(returnValue) < this.min
|
|
198
|
+
) {
|
|
199
|
+
returnValue = this.min
|
|
200
|
+
}
|
|
201
|
+
return returnValue
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
</script>
|
|
206
|
+
|
|
207
|
+
<style lang="scss" scoped></style>
|
|
208
|
+
<style>
|
|
209
|
+
.ant-input-number-handler-wrap {
|
|
210
|
+
display: none;
|
|
211
|
+
}
|
|
212
|
+
</style>
|
|
213
|
+
<style lang="less">
|
|
214
|
+
@import '../../styles/default.less';
|
|
215
|
+
</style>
|
|
216
|
+
|