|
|
@ -1,14 +1,53 @@ |
|
|
|
<template> |
|
|
|
<view class=""> |
|
|
|
<view class="" v-for="(item, index) in formData" :key="index"> |
|
|
|
<view class="" v-if="item.type=='inputAndSelect'"> |
|
|
|
<view class="" v-if="item.type=='stateSelect'"> |
|
|
|
<view class="flex uni-row " style=" padding-left: 10rpx; border-bottom: #9e9e9e;"> |
|
|
|
<view class=" " style="margin-top: 3rpx;"> |
|
|
|
<text class="colorRed">*</text> |
|
|
|
<text class="num" style="font-size: 32rpx;">{{ index + 1 }}.</text> |
|
|
|
</view> |
|
|
|
<view class="uni-flex uni-column"> |
|
|
|
|
|
|
|
<view class="position"> |
|
|
|
点检部位 : {{ item.position }} |
|
|
|
</view> |
|
|
|
<view class="content"> |
|
|
|
点检内容 : {{ item.content }} |
|
|
|
</view> |
|
|
|
<view class="methond" style="margin-bottom: 10rpx;"> |
|
|
|
点检方法 : {{item.methond}} |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class=""> |
|
|
|
<view class="" style="margin-left: 50rpx;"> |
|
|
|
<text style="font-size: 32rpx; font-weight:550">点检状态</text> |
|
|
|
<text style="font-size: 30rpx; color: #9e9e9e;">(单选)</text> |
|
|
|
<u-radio-group v-model="item.name" @change="radioGroupChange"> |
|
|
|
<view class="uni-flex" style="width: 50%; margin-left: 0rpx;" |
|
|
|
v-for="(radio, index) in dataList" :key="index" @change="radioChange"> |
|
|
|
<view class="uni-flex " style="margin-top: 10rpx; justify-content: flex-start;"> |
|
|
|
<u-radio :name="radio.name"> |
|
|
|
{{radio.name}} |
|
|
|
</u-radio> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</u-radio-group> |
|
|
|
</view> |
|
|
|
<input class="input" :disabled="false" style="margin-left: 50rpx;" |
|
|
|
:placeholder="item.placeholder" v-model="item.name" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="" v-else-if="item.type=='inputAndSelect'"> |
|
|
|
<view class="flex uni-row " style=" padding-left: 10rpx; border-bottom: #9e9e9e;"> |
|
|
|
<view class=" " style="margin-top: 3rpx;"> |
|
|
|
<text class="colorRed">*</text> |
|
|
|
<text class="num" style="font-size: 32rpx;">{{ index + 1 }}.</text> |
|
|
|
</view> |
|
|
|
<view class="uni-flex uni-column"> |
|
|
|
<view class="position"> |
|
|
|
点检部位 : {{ item.position }} |
|
|
|
</view> |
|
|
|
<view class="content"> |
|
|
@ -19,38 +58,72 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="flex uni-row uni-center align-center"> |
|
|
|
<input class="input" style="margin-left: 50rpx;" :placeholder="item.placeholder" |
|
|
|
v-model="item.name" /> |
|
|
|
<view class=""> |
|
|
|
<!-- <image src="../../static/icons/arrow_down.svg" style="width: 50rpx; height: 50rpx;"></image> --> |
|
|
|
<button type="primary" size="mini" @click="select(item)">选择</button> |
|
|
|
|
|
|
|
<view class=""> |
|
|
|
<view class="" style="margin-left: 50rpx;"> |
|
|
|
<text style="font-size: 32rpx; font-weight:550">点检状态</text> |
|
|
|
<text style="font-size: 30rpx; color: #9e9e9e;">(单选)</text> |
|
|
|
<u-radio-group v-model="item.name" @change="radioGroupChange"> |
|
|
|
<view class="uni-flex" style="width: 50%; margin-left: 0rpx;" |
|
|
|
v-for="(radio, index) in dataList" :key="index" @change="radioChange"> |
|
|
|
<view class="uni-flex " style="margin-top: 10rpx; justify-content: flex-start;"> |
|
|
|
<u-radio :name="radio.name"> |
|
|
|
{{radio.name}} |
|
|
|
</u-radio> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</u-radio-group> |
|
|
|
</view> |
|
|
|
<input class="input" :disabled="false" style="margin-left: 50rpx;" |
|
|
|
:placeholder="item.placeholder" v-model="item.name" /> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="" v-if="item.main"> |
|
|
|
<view class="" style="margin-left: 50rpx;"> |
|
|
|
<text style="font-size: 32rpx; margin: 10rpx;">{{item.minor.hint}}</text> |
|
|
|
<input class="input" @input="inputMinor(item)" type="number" |
|
|
|
:placeholder="item.minor.placeholder" v-model="item.minor.name" /> |
|
|
|
</view> |
|
|
|
<view class="" style="margin-left: 50rpx;"> |
|
|
|
<text style="font-size: 32rpx; margin: 10rpx;">{{item.main.hint}}</text> |
|
|
|
<input class="input" @input="inputMain(item)" type="number" :placeholder="item.main.placeholder" |
|
|
|
v-model="item.main.name" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="" v-else-if="item.type=='select'"> |
|
|
|
<view class="" v-else-if="item.type=='groupSelect'"> |
|
|
|
<view class="flex uni-row" style="padding-left: 10rpx; border-bottom: #9e9e9e;"> |
|
|
|
<view class="" style="margin-top: 3rpx;"> |
|
|
|
<text class="colorRed">*</text> |
|
|
|
<text class="num" style="font-size: 32rpx;">{{ index + 1 }}.</text> |
|
|
|
</view> |
|
|
|
<view class="" style="display: flex;flex-direction: column;"> |
|
|
|
<view class="content"> |
|
|
|
<view class="position"> |
|
|
|
{{ item.content }} |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="flex uni-row uni-center align-center"> |
|
|
|
<input class="input" style="margin-left: 50rpx;" disabled :placeholder="item.placeholder" |
|
|
|
v-model="item.name" /> |
|
|
|
<view class=""> |
|
|
|
<!-- <image src="../../static/icons/arrow_down.svg" style="width: 50rpx; height: 50rpx;"></image> --> |
|
|
|
<button type="primary" size="mini" @click="selectClass(item)">选择</button> |
|
|
|
|
|
|
|
<view class=""> |
|
|
|
<view class="" style="margin-left: 50rpx;"> |
|
|
|
<view style="font-size: 30rpx; color: #9e9e9e;">(单选)</view> |
|
|
|
<u-radio-group v-model="item.name" @change="radioGroupChange"> |
|
|
|
<view class="uni-flex" style="width: 50%; margin-left: 0rpx;" |
|
|
|
v-for="(radio, index) in dataClassList" :key="index" @change="radioChange"> |
|
|
|
<view class="uni-flex " style="margin-top: 10rpx; justify-content: flex-start;"> |
|
|
|
<u-radio :name="radio.name"> |
|
|
|
{{radio.name}} |
|
|
|
</u-radio> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</u-radio-group> |
|
|
|
</view> |
|
|
|
<input class="input" :disabled="false" style="margin-left: 50rpx;" |
|
|
|
:placeholder="item.placeholder" v-model="item.name" /> |
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
<view class="" v-else-if="item.type=='inputRange'"> |
|
|
|
<view class="flex uni-row " style="padding-left: 10rpx; border-bottom: #9e9e9e;"> |
|
|
@ -59,7 +132,7 @@ |
|
|
|
<text class="num" style="font-size: 32rpx;">{{ index + 1 }}.</text> |
|
|
|
</view> |
|
|
|
<view class="uni-flex uni-column"> |
|
|
|
<view class="content"> |
|
|
|
<view class="position"> |
|
|
|
点检部位 : {{ item.position }} |
|
|
|
</view> |
|
|
|
<view class="content"> |
|
|
@ -75,31 +148,28 @@ |
|
|
|
<view class="" style="margin-left: 50rpx;"> |
|
|
|
<text style="font-size: 32rpx; margin: 10rpx;">{{item.inputLow.placeholder}}</text> |
|
|
|
<input class="input" type="number" :placeholder="item.inputLow.placeholder" |
|
|
|
v-model="item.inputLow.name" /> |
|
|
|
v-model="item.inputLow.name" /> |
|
|
|
</view> |
|
|
|
<view class="" style="margin-left: 50rpx;"> |
|
|
|
<text style="font-size: 32rpx; margin: 10rpx;">{{item.inputHigh.placeholder}}</text> |
|
|
|
<input class="input" type="number" :placeholder="item.inputHigh.placeholder" |
|
|
|
v-model="item.inputHigh.name" /> |
|
|
|
v-model="item.inputHigh.name" /> |
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
<selectPopup :dataList="dataList2" ref="selectPopup2" title="选择班次" @select="getSelect2"></selectPopup> |
|
|
|
|
|
|
|
<selectPopup :dataList="dataList" ref="selectPopup" title="选择点检状态" @select="getSelect"></selectPopup> |
|
|
|
<u-top-tips ref="uTips"></u-top-tips> |
|
|
|
<showModal ref="comMessage"></showModal> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import selectPopup from "./selectPopup.vue" |
|
|
|
import showModal from '../../mycomponents/common/showModal.vue' |
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
components: { |
|
|
|
selectPopup |
|
|
|
showModal |
|
|
|
}, |
|
|
|
props: { |
|
|
|
formData: { |
|
|
@ -112,6 +182,7 @@ |
|
|
|
deviceCode: "", |
|
|
|
deviceName: "", |
|
|
|
class: "", |
|
|
|
value: '', |
|
|
|
dataList: [{ |
|
|
|
value: 1, |
|
|
|
name: "状态良好", |
|
|
@ -129,7 +200,7 @@ |
|
|
|
name: "停机状态", |
|
|
|
} |
|
|
|
], |
|
|
|
dataList2: [{ |
|
|
|
dataClassList: [{ |
|
|
|
value: 1, |
|
|
|
name: "白班", |
|
|
|
}, |
|
|
@ -158,61 +229,128 @@ |
|
|
|
// value:"", |
|
|
|
// }], |
|
|
|
selectStateItem: {}, |
|
|
|
selectClassItem: {} |
|
|
|
selectClassItem: {}, |
|
|
|
current: 0, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
methods: { |
|
|
|
select(item) { |
|
|
|
this.selectStateItem = item |
|
|
|
this.$refs.selectPopup.showPopup() |
|
|
|
radioChange(e) { |
|
|
|
console.log(e) |
|
|
|
// for (let i = 0; i < this.dataList.length; i++) { |
|
|
|
// if (this.dataList[i].value === evt.detail.value) { |
|
|
|
// this.current = i; |
|
|
|
// break; |
|
|
|
// } |
|
|
|
// } |
|
|
|
}, |
|
|
|
selectClass(item) { |
|
|
|
this.selectClassItem = item |
|
|
|
this.$refs.selectPopup2.showPopup() |
|
|
|
radioGroupChange(e) { |
|
|
|
console.log(e) |
|
|
|
}, |
|
|
|
getSelect2(item) { |
|
|
|
this.selectClassItem.name = item.name |
|
|
|
this.selectClassItem.value = item.value |
|
|
|
console.log(item) |
|
|
|
inputMain(item) { |
|
|
|
item.name = item.minor.name + "~" + item.main.name; |
|
|
|
if (item.minor.name == "" && item.main.name == "") { |
|
|
|
item.name = "" |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
getSelect(item) { |
|
|
|
this.selectStateItem.name = item.name |
|
|
|
this.selectStateItem.value = item.value |
|
|
|
console.log(item) |
|
|
|
inputMinor(item) { |
|
|
|
item.name = item.minor.name + "~" + item.main.name; |
|
|
|
if (item.minor.name == "" && item.main.name == "") { |
|
|
|
item.name = "" |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
submit(callBack) { |
|
|
|
var isCheckPass = true |
|
|
|
for (var i = 0; i < this.formData.length; i++) { |
|
|
|
var item = this.formData[i]; |
|
|
|
var hintIndex = i + 1 |
|
|
|
if (item.type == "inputRange") { |
|
|
|
if(item.inputLow.name == ""){ |
|
|
|
this.showHint("点检内容 : " + item.content, item.inputLow.placeholder) |
|
|
|
if (item.inputLow.name == "") { |
|
|
|
this.showHint(hintIndex + ".点检内容 : " + item.content, item.inputLow.placeholder) |
|
|
|
isCheckPass = false; |
|
|
|
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+"】之间") |
|
|
|
} else { |
|
|
|
if (!this.isWithinInterval(item.inputLow.name, item.inputLow.lower, item.inputLow.upper)) { |
|
|
|
this.showHint(hintIndex + ".点检内容 : " + item.content, "最低压 : 输入数量【" + item.inputLow.name + |
|
|
|
"】不在【" + item.inputLow.lower + "】和【" + item.inputLow.upper + "】之间") |
|
|
|
isCheckPass = false; |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(item.inputHigh.name == ""){ |
|
|
|
this.showHint("点检内容 : " + item.content, item.inputHigh.placeholder) |
|
|
|
if (item.inputHigh.name == "") { |
|
|
|
this.showHint(hintIndex + ".点检内容 : " + item.content, item.inputHigh.placeholder) |
|
|
|
isCheckPass = false; |
|
|
|
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+"】之间") |
|
|
|
} else { |
|
|
|
if (!this.isWithinInterval(item.inputHigh.name, item.inputHigh.lower, item.inputHigh.upper)) { |
|
|
|
this.showHint(hintIndex + ".点检内容 : " + item.content, "最高压 : 输入数量【" + item.inputHigh.name + |
|
|
|
"】不在【" + item.inputHigh.lower + "】和【" + item.inputHigh.upper + "】之间") |
|
|
|
isCheckPass = false; |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
} else if (item.type == "stateSelect") { |
|
|
|
if (item.name == "") { |
|
|
|
this.showHint(hintIndex + ".点检内容 : " + item.content, item.placeholder) |
|
|
|
isCheckPass = false; |
|
|
|
break |
|
|
|
} |
|
|
|
} else if (item.type == "inputAndSelect") { |
|
|
|
if (item.name == "") { |
|
|
|
this.showHint(hintIndex + ".点检内容 : " + item.content, item.placeholder) |
|
|
|
isCheckPass = false; |
|
|
|
break |
|
|
|
} else { |
|
|
|
if (!this.isExitList(item.name)) { |
|
|
|
if (item.main) { |
|
|
|
if (item.main.name == "") { |
|
|
|
this.showHint(hintIndex + ".点检内容 : " + item.content, item.main.placeholder) |
|
|
|
isCheckPass = false; |
|
|
|
break |
|
|
|
} |
|
|
|
|
|
|
|
if (item.minor.name == "") { |
|
|
|
this.showHint(hintIndex + ".点检内容 : " + item.content, item.minor.placeholder) |
|
|
|
isCheckPass = false; |
|
|
|
break |
|
|
|
} |
|
|
|
|
|
|
|
if (!this.isWithinInterval(item.minor.name, item.minor.lower, item.minor.upper)) { |
|
|
|
this.showHint(hintIndex + ".点检内容 : " + item.content, "输入数量【" + item.minor |
|
|
|
.name + "】不在【" + item.minor.lower + "】和【" + item.minor.upper + "】之间") |
|
|
|
isCheckPass = false; |
|
|
|
break |
|
|
|
} |
|
|
|
|
|
|
|
if (!this.isWithinInterval(item.main.name, item.main.lower, item.main.upper)) { |
|
|
|
this.showHint(hintIndex + ".点检内容 : " + item.content, "输入数量【" + item.main.name + |
|
|
|
"】不在【" + item.main.lower + "】和【" + item.main.upper + "】之间") |
|
|
|
isCheckPass = false; |
|
|
|
break |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
if (!this.isWithinInterval(item.name, item.lower, item.upper)) { |
|
|
|
this.showHint(hintIndex + ".点检内容 : " + item.content, "输入数量【" + item.name + |
|
|
|
"】不在【" + item.lower + "】和【" + item.upper + "】之间") |
|
|
|
isCheckPass = false; |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} else if (item.type == "groupSelect") { |
|
|
|
if (item.name == "") { |
|
|
|
this.showHint("点检内容 : " + item.content, item.placeholder) |
|
|
|
this.showHint(hintIndex + ".点检内容 : " + item.content, item.placeholder) |
|
|
|
isCheckPass = false; |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
@ -221,27 +359,53 @@ |
|
|
|
if (isCheckPass) { |
|
|
|
callBack(this.formData) |
|
|
|
// this.$emit("submit",this.formData) |
|
|
|
console.log(this.formData) |
|
|
|
console.log("通过", this.formData) |
|
|
|
} else { |
|
|
|
console.log(this.formData) |
|
|
|
console.log("失败") |
|
|
|
} |
|
|
|
}, |
|
|
|
isWithinInterval(num, lower, upper){ |
|
|
|
isWithinInterval(num, lower, upper) { |
|
|
|
if (!this.isNumber(num)) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
return num >= lower && num <= upper; |
|
|
|
}, |
|
|
|
isExitList(name) { |
|
|
|
var isExit = this.dataList.filter(res => res.name == name) |
|
|
|
if(isExit.length==0){ |
|
|
|
return false |
|
|
|
} |
|
|
|
return true; |
|
|
|
}, |
|
|
|
showHint(title, hint) { |
|
|
|
uni.showModal({ |
|
|
|
title: title, |
|
|
|
content: hint |
|
|
|
}) |
|
|
|
// uni.showModal({ |
|
|
|
// title: title, |
|
|
|
// content: hint |
|
|
|
// }) |
|
|
|
this.$refs.comMessage.showMessage(title, hint) |
|
|
|
|
|
|
|
}, |
|
|
|
isNumber(val) { |
|
|
|
return !isNaN(parseFloat(val)) && isFinite(val); |
|
|
|
}, |
|
|
|
reset() { |
|
|
|
for (var i = 0; i < this.formData.length; i++) { |
|
|
|
var item = this.formData[i]; |
|
|
|
if(item.type=="inputRange"){ |
|
|
|
item.inputLow.name=""; |
|
|
|
item.inputHigh.name="" |
|
|
|
}else { |
|
|
|
if (item.type == "inputRange") { |
|
|
|
item.inputLow.name = ""; |
|
|
|
item.inputHigh.name = "" |
|
|
|
} else if (item.type == "inputAndSelect") { |
|
|
|
if (item.main) { |
|
|
|
item.main.name = "" |
|
|
|
item.main.value = "" |
|
|
|
} |
|
|
|
if (item.minor) { |
|
|
|
item.minor.name = "" |
|
|
|
item.minor.value = "" |
|
|
|
} |
|
|
|
item.name = "" |
|
|
|
item.value = "" |
|
|
|
} else { |
|
|
|
item.name = "" |
|
|
|
item.value = "" |
|
|
|
} |
|
|
@ -262,8 +426,13 @@ |
|
|
|
font-size: 30rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.position { |
|
|
|
font-size: 32rpx; |
|
|
|
font-weight: bold; |
|
|
|
} |
|
|
|
|
|
|
|
.content { |
|
|
|
font-size: 33rpx; |
|
|
|
font-size: 32rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.methond { |
|
|
|