Commit 21b6ac66 by 李伟康

commit 异常占比放开限制

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