diff --git a/src/mycomponents/form/customerFrom.vue b/src/mycomponents/form/customerFrom.vue index 7f04e98..063839a 100644 --- a/src/mycomponents/form/customerFrom.vue +++ b/src/mycomponents/form/customerFrom.vue @@ -2,25 +2,26 @@ - - + + * {{ index + 1 }}. - + 点检部位 : {{ item.position }} 点检内容 : {{ item.content }} + + 点检方法 : {{item.methond}} + - - 点检方法 : {{item.methond}} - - + @@ -30,9 +31,9 @@ - - - + + + * {{ index + 1 }}. @@ -43,18 +44,53 @@ - + + + + + * + {{ index + 1 }}. + + + + 点检部位 : {{ item.position }} + + + 点检内容 : {{ item.content }} + + + 点检方法 : {{item.methond}} + + + + + + + {{item.inputLow.placeholder}} + + + + {{item.inputHigh.placeholder}} + + + + + + @@ -148,16 +184,39 @@ this.selectStateItem.value = item.value console.log(item) }, + submit(callBack) { var isCheckPass = true for (var i = 0; i < this.formData.length; i++) { var item = this.formData[i]; - if (item.name == "") { - uni.showToast({ - title: item.placeholder - }) - break + if (item.type == "inputRange") { + if(item.inputLow.name == ""){ + this.showHint("点检内容 : " + item.content, item.inputLow.placeholder) + break + }else { + if(!this.isWithinInterval(item.inputLow.name,item.inputLow.lower,item.inputLow.upper)){ + this.showHint("点检内容 : " + item.content, "最低压 : 输入数量【"+item.inputLow.name+"】不在【"+item.inputLow.lower+"】和【"+item.inputLow.upper+"】之间") + break + } + } + + if(item.inputHigh.name == ""){ + this.showHint("点检内容 : " + item.content, item.inputHigh.placeholder) + break + }else { + if(!this.isWithinInterval(item.inputHigh.name,item.inputHigh.lower,item.inputHigh.upper)){ + this.showHint("点检内容 : " + item.content, "最高压 : 输入数量【"+item.inputHigh.name+"】不在【"+item.inputHigh.lower+"】和【"+item.inputHigh.upper+"】之间") + break + } + } + + } else { + if (item.name == "") { + this.showHint("点检内容 : " + item.content, item.placeholder) + break + } } + } if (isCheckPass) { callBack(this.formData) @@ -167,11 +226,26 @@ console.log(this.formData) } }, + isWithinInterval(num, lower, upper){ + return num >= lower && num <= upper; + }, + showHint(title, hint) { + uni.showModal({ + title: title, + content: hint + }) + }, reset() { for (var i = 0; i < this.formData.length; i++) { var item = this.formData[i]; - item.name = "" - item.value = "" + if(item.type=="inputRange"){ + item.inputLow.name=""; + item.inputHigh.name="" + }else { + item.name = "" + item.value = "" + } + } this.$emit("reset", this.formData) console.log(this.formData) @@ -193,7 +267,6 @@ } .methond { - margin-left: 30rpx; font-size: 29rpx; color: #999; } diff --git a/src/pages/foam/check.vue b/src/pages/foam/check.vue index 15c142a..1b161f5 100644 --- a/src/pages/foam/check.vue +++ b/src/pages/foam/check.vue @@ -16,8 +16,8 @@ - - + + @@ -79,6 +79,26 @@ name: '', value: "", }, + { + type: "inputRange", + position: "PB", + content: "检查气袋气压", + methond: "压力表示数范围2.5bar-4.5bar", + inputLow:{ + name: "", + value: "", + placeholder: "请输入最低压力", + lower:"2.5", + upper:"4.5" + }, + inputHigh:{ + name: "", + value: "", + placeholder: "请输入最高压力", + lower:"2.5", + upper:"4.5" + } + }, { type: "select", content: "选择班组", @@ -107,7 +127,7 @@ submit() { this.$refs.customerFrom.submit(callBack => { console.log("提交", JSON.stringify(callBack)) - + }) }, reset() { diff --git a/src/pages/setter/index.vue b/src/pages/setter/index.vue index 2398ba7..832807d 100644 --- a/src/pages/setter/index.vue +++ b/src/pages/setter/index.vue @@ -21,7 +21,7 @@ - +