Commit 21b6ac66 by 李伟康

commit 异常占比放开限制

1 parent 19e2aecd
......@@ -14,23 +14,39 @@
@mousemove="handleMove"
ref="reference"
>
<el-input
v-model="userInput[0]"
:placeholder="startPlaceholder"
@blur="handleBlur(0)"
@input="handleStartInput"
class="el-range-input"
></el-input>
<span class="el-range-separator">至</span>
<el-input
v-model="userInput[1]"
:placeholder="endPlaceholder"
@input="handleEndInput"
@focus="handleFocus"
@blur="handleBlur(1)"
class="el-range-input"
></el-input>
<template v-if="infinity">
<el-input-number
class="el-range-input hide-btn"
:placeholder="startPlaceholder"
v-model="userInput[0]"
@blur="handleBlur(0)"
></el-input-number>
<span class="el-range-separator">至</span>
<el-input-number
class="el-range-input hide-btn"
:placeholder="endPlaceholder"
v-model="userInput[1]"
@blur="handleBlur(1)"
></el-input-number>
</template>
<template v-else>
<el-input
v-model="userInput[0]"
:placeholder="startPlaceholder"
@blur="handleBlur(0)"
@input="handleStartInput"
class="el-range-input"
></el-input>
<span class="el-range-separator">至</span>
<el-input
v-model="userInput[1]"
:placeholder="endPlaceholder"
@input="handleEndInput"
@focus="handleFocus"
@blur="handleBlur(1)"
class="el-range-input"
></el-input>
</template>
<i
v-show="showClose"
@click="handleClickIcon"
......@@ -42,7 +58,7 @@
</template>
<script>
export default {
data() {
data () {
return {
pickerVisible: false,
showClose: false,
......@@ -54,17 +70,18 @@ export default {
displayValue: Array,
placeholder: String,
startPlaceholder: String,
endPlaceholder: String
endPlaceholder: String,
infinity: Boolean
},
watch: {
displayValue(val) {
displayValue (val) {
if (val) {
this.userInput = val
}
}
},
methods: {
handleStartInput(event) {
handleStartInput (event) {
let isNumber = /^\d+$/.test(event)
if (!isNumber) {
event = null
......@@ -73,7 +90,7 @@ export default {
this.userInput[0] = event
},
handleEndInput(event) {
handleEndInput (event) {
let isNumber = /^\d+$/.test(event)
if (!isNumber) {
event = null
......@@ -81,11 +98,11 @@ export default {
if (event > 100) event = 100
this.userInput[1] = event
},
handleClickIcon(event) {
handleClickIcon (event) {
this.userInput[0] = null
this.userInput[1] = null
},
valueIsEmpty() {
valueIsEmpty () {
const val = this.userInput
if (Array.isArray(val)) {
for (let i = 0, len = val.length; i < len; i++) {
......@@ -96,28 +113,28 @@ export default {
}
return true
},
handleRangeClick() {
handleRangeClick () {
this.pickerVisible = true
},
handleMove() {
handleMove () {
if (this.valueIsEmpty()) {
this.showClose = false
} else {
this.showClose = true
}
},
handleFocus() {
handleFocus () {
if (!this.pickerVisible) {
this.pickerVisible = true
this.$emit("focus", this)
}
},
handleBlur(index) {
handleBlur (index) {
this.pickerVisible = false
this.contrastValue()
},
contrastValue() {
contrastValue () {
let val = this.userInput
if (Array.isArray(val)) {
if (val[0] > val[1]) {
......@@ -143,5 +160,15 @@ export default {
color: #dcdfe6;
margin-left: 10px;
}
.hide-btn{
::v-deep{
span{
display: none;
}
input{
padding: 0;
}
}
}
}
</style>
\ No newline at end of file
......@@ -30,7 +30,7 @@
<el-input-range start-placeholder="请输入" end-placeholder="请输入" :displayValue="searchForm.toStoreCount"></el-input-range>
</div> -->
<div slot="AbnormalProportion">
<el-input-range start-placeholder="请输入" end-placeholder="请输入" :displayValue="searchForm.AbnormalProportion"></el-input-range>
<el-input-range start-placeholder="请输入" end-placeholder="请输入" :displayValue="searchForm.AbnormalProportion" infinity></el-input-range>
</div>
</GLCombiForm>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!