Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Fedex
/
imac-vue
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Elements-SY
2023-10-13 16:58:24 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c34bbbd6af6045ea5424f70b1c1a7b08b5df3cf3
c34bbbd6
1 parent
9d98a622
modify
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
41 deletions
src/utils/mixins.js
src/views/et86Config/et86RuleConfig/components/input-number/src/input-number.vue
src/utils/mixins.js
View file @
c34bbbd
...
...
@@ -37,7 +37,15 @@ export const inputBlurValidate = {
}
// 最小重量有值的情况下
if
(
target
.
value
&&
Number
(
target
.
value
)
>=
0
)
{
if
(
/^
(
0|
[
1-9
]\d
*
)(
.
\d{1,5})?
$/
.
test
(
Number
(
target
.
value
)))
{
if
(
this
.
queryForm
.
maxWeight
)
{
if
(
Number
(
this
.
queryForm
.
maxWeight
)
<
Number
(
this
.
queryForm
.
minWeight
)
)
{
this
.
validateForm
=
false
;
this
.
$refs
.
minWeight
.
innerHTML
=
"最小重量不得大于最大重量"
;
}
else
if
(
/^
(
0|
[
1-9
]\d
*
)(
.
\d{1,5})?
$/
.
test
(
Number
(
this
.
queryForm
.
maxWeight
))
)
{
this
.
validateForm
=
true
;
...
...
@@ -45,25 +53,14 @@ export const inputBlurValidate = {
}
else
{
this
.
validateForm
=
false
;
this
.
$refs
.
minWeight
.
innerHTML
=
"请输入有效重量,小数保留5位"
;
// this.msgError("请输入有效重量,小数保留5位");
}
if
(
/^
(
0|
[
1-9
]\d
*
)(
.
\d{1,5})?
$/
.
test
(
Number
(
target
.
value
)))
{
}
else
{
this
.
validateForm
=
true
;
this
.
$refs
.
minWeight
.
innerHTML
=
""
;
}
}
else
{
this
.
validateForm
=
false
;
this
.
$refs
.
minWeight
.
innerHTML
=
"请输入有效重量,小数保留5位"
;
// this.msgError("请输入有效重量,小数保留5位");
}
}
// 重量最小值和最大值都不为空的情况下
if
(
this
.
queryForm
.
minWeight
&&
this
.
queryForm
.
maxWeight
)
{
if
(
Number
(
this
.
queryForm
.
maxWeight
)
<
Number
(
this
.
queryForm
.
minWeight
)
)
{
this
.
validateForm
=
false
;
this
.
$refs
.
minWeight
.
innerHTML
=
"最小重量不得大于最大重量"
;
// this.msgError("最小重量不得大于最大重量");
}
}
},
...
...
@@ -87,9 +84,16 @@ export const inputBlurValidate = {
// this.msgError("请输入有效重量,小数保留5位");
}
}
// 最大重量有值的情况下
if
(
target
.
value
&&
Number
(
target
.
value
)
>=
0
)
{
if
(
/^
(
0|
[
1-9
]\d
*
)(
.
\d{1,5})?
$/
.
test
(
Number
(
target
.
value
)))
{
if
(
this
.
queryForm
.
minWeight
)
{
if
(
Number
(
this
.
queryForm
.
maxWeight
)
<
Number
(
this
.
queryForm
.
minWeight
)
)
{
this
.
validateForm
=
false
;
this
.
$refs
.
minWeight
.
innerHTML
=
"最小重量不得大于最大重量"
;
}
else
if
(
/^
(
0|
[
1-9
]\d
*
)(
.
\d{1,5})?
$/
.
test
(
Number
(
this
.
queryForm
.
minWeight
))
)
{
this
.
validateForm
=
true
;
...
...
@@ -97,25 +101,14 @@ export const inputBlurValidate = {
}
else
{
this
.
validateForm
=
false
;
this
.
$refs
.
minWeight
.
innerHTML
=
"请输入有效重量,小数保留5位"
;
// this.msgError("请输入有效重量,小数保留5位");
}
if
(
/^
(
0|
[
1-9
]\d
*
)(
.
\d{1,5})?
$/
.
test
(
Number
(
target
.
value
)))
{
}
else
{
this
.
validateForm
=
true
;
this
.
$refs
.
minWeight
.
innerHTML
=
""
;
}
}
else
{
this
.
validateForm
=
false
;
this
.
$refs
.
minWeight
.
innerHTML
=
"请输入有效重量,小数保留5位"
;
// this.msgError("请输入有效重量,小数保留5位");
}
}
// 重量最小值和最大值都不为空的情况下
if
(
this
.
queryForm
.
minWeight
&&
this
.
queryForm
.
maxWeight
)
{
if
(
Number
(
this
.
queryForm
.
maxWeight
)
<
Number
(
this
.
queryForm
.
minWeight
)
)
{
this
.
validateForm
=
false
;
this
.
$refs
.
minWeight
.
innerHTML
=
"最小重量不得大于最大重量"
;
// this.msgError("最小重量不得大于最大重量");
}
}
},
...
...
src/views/et86Config/et86RuleConfig/components/input-number/src/input-number.vue
View file @
c34bbbd
...
...
@@ -48,8 +48,6 @@
<script>
import ElInput from 'element-ui/packages/input';
import Focus from 'element-ui/src/mixins/focus';
import RepeatClick from 'element-ui/src/directives/repeat-click';
export default {
name: 'YlElInputNumber',
mixins: [Focus('input')],
...
...
@@ -61,9 +59,6 @@
default: ''
}
},
directives: {
repeatClick: RepeatClick
},
components: {
ElInput
},
...
...
@@ -120,13 +115,11 @@
if (isNaN(newVal)) {
return;
}
if (this.stepStrictly) {
const stepPrecision = this.getPrecision(this.step);
const precisionFactor = Math.pow(10, stepPrecision);
newVal = Math.round(newVal / this.step) * precisionFactor * this.step / precisionFactor;
}
if (this.precision !== undefined) {
newVal = this.toPrecision(newVal, this.precision);
}
...
...
@@ -174,9 +167,7 @@
if (this.userInput !== null) {
return this.userInput;
}
let currentValue = this.currentValue;
if (typeof currentValue === 'number') {
if (this.stepStrictly) {
const stepPrecision = this.getPrecision(this.step);
...
...
@@ -188,7 +179,6 @@
currentValue = currentValue.toFixed(this.precision);
}
}
return currentValue;
}
},
...
...
@@ -209,16 +199,12 @@
},
_increase(val, step) {
if (typeof val !== 'number' && val !== undefined) return this.currentValue;
const precisionFactor = Math.pow(10, this.numPrecision);
// Solve the accuracy problem of JS decimal calculation by converting the value to integer.
return this.toPrecision((precisionFactor * val + precisionFactor * step) / precisionFactor);
},
_decrease(val, step) {
if (typeof val !== 'number' && val !== undefined) return this.currentValue;
const precisionFactor = Math.pow(10, this.numPrecision);
return this.toPrecision((precisionFactor * val - precisionFactor * step) / precisionFactor);
},
increase() {
...
...
Please
register
or
login
to post a comment