You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
517 lines
15 KiB
517 lines
15 KiB
<template>
|
|
<view class="">
|
|
<view class="" v-for="(item, index) in formData" :key="index">
|
|
<view class="" v-if="item.Type=='1'">
|
|
<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;">
|
|
<view class="">
|
|
<text style="font-size: 32rpx; font-weight:550">点检状态</text>
|
|
<text style="font-size: 30rpx; color: #9e9e9e;">(单选)</text>
|
|
</view>
|
|
<u-radio-group v-if="isRefresh" v-model="item.SelectName" @change="radioGroupChange(item)">
|
|
<view class="uni-flex" style="width: 50%; margin-left: 0rpx;"
|
|
v-for="(radio, index) in dataList" :key="index">
|
|
<view class="uni-flex " style="margin-top: 10rpx; justify-content: flex-start;">
|
|
<u-radio size="45" labelSize="35" iconSize="40" :name="radio.name" @change="radioChange(radio)">
|
|
{{radio.name}}
|
|
</u-radio>
|
|
</view>
|
|
</view>
|
|
</u-radio-group>
|
|
|
|
</view>
|
|
<!-- <input class="input" disabled style="margin-left: 50rpx;" :placeholder="item.placeholder"
|
|
v-model="item.SelectName" /> -->
|
|
</view>
|
|
<view class=""
|
|
style="width: 100%;background-color: gray;height: 2rpx; margin-top: 15rpx;margin-bottom: 15rpx;" />
|
|
</view>
|
|
|
|
<view class="" v-else-if="item.Type=='2'">
|
|
<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;">
|
|
<view class="">
|
|
<text style="font-size: 32rpx; font-weight:550">点检状态</text>
|
|
<text style="font-size: 30rpx; color: #9e9e9e;">(单选)</text>
|
|
</view>
|
|
<u-radio-group v-if="isRefresh&&isRefreshType2" v-model="item.SelectName" @change="radioGroupChange(item)">
|
|
<view class="uni-flex" style="width: 50%; margin-left: 0rpx;"
|
|
v-for="(radio, index) in dataInputList" :key="index">
|
|
<view class="uni-flex " style="margin-top: 10rpx; justify-content: flex-start;">
|
|
<u-radio size="45" labelSize="35" iconSize="40" :name="radio.name" @change="radioChange(radio)">
|
|
{{radio.name}}
|
|
</u-radio>
|
|
</view>
|
|
</view>
|
|
</u-radio-group>
|
|
</view>
|
|
<input class="input" v-if="item.putMachine.length==1" style="margin-left: 50rpx;"
|
|
type="digit" placeholder="" v-model="item.SelectName" @input="inputType2" />
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
<view class="" v-else-if="item.Type=='3'">
|
|
<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;" v-if="item.Methond!='压力表示数范围2.5bar~4.5bar'">
|
|
<view class="">
|
|
<text style="font-size: 32rpx; font-weight:550">点检状态</text>
|
|
<text style="font-size: 30rpx; color: #9e9e9e;">(单选)</text>
|
|
</view>
|
|
<u-radio-group v-if="isRefresh&&isRefreshType3" v-model="item.SelectName"
|
|
@change="radioGroupChange(item)">
|
|
<view class="uni-flex" style="width: 50%; margin-left: 0rpx;"
|
|
v-for="(radio, index) in dataInputList" :key="index">
|
|
<view class="uni-flex " style="margin-top: 10rpx; justify-content: flex-start;">
|
|
<u-radio size="45" labelSize="35" iconSize="40" :name="radio.name" @change="radioChange(radio)">
|
|
{{radio.name}}
|
|
</u-radio>
|
|
</view>
|
|
</view>
|
|
</u-radio-group>
|
|
</view>
|
|
<view class="" v-if="item.putMachine.length>1">
|
|
<!-- <input class="input" style="margin-left: 50rpx;" :placeholder="item.placeholder"
|
|
v-model="item.SelectName" /> -->
|
|
<view class="" style="margin-left: 50rpx;">
|
|
<text style="font-size: 32rpx; margin: 10rpx;">{{item.putMachine[0].Name}}({{item.putMachine[0].Limit}}~{{item.putMachine[0].Floor}})</text>
|
|
<input class="input" @input="inputMain(item)" type="number"
|
|
placeholder="" v-model="item.putMachine[0].SelectName" />
|
|
</view>
|
|
<view class="" style="margin-left: 50rpx;">
|
|
<text style="font-size: 32rpx; margin: 10rpx;">{{item.putMachine[1].Name}}({{item.putMachine[1].Limit}}~{{item.putMachine[1].Floor}})</text>
|
|
<input class="input" @input="inputMinor(item)" type="number"
|
|
placeholder="" v-model="item.putMachine[1].SelectName" />
|
|
</view>
|
|
</view>
|
|
<view class=""
|
|
style="width: 100%;background-color: gray;height: 2rpx; margin-top: 15rpx;margin-bottom: 15rpx;" />
|
|
|
|
</view>
|
|
</view>
|
|
<view class="" v-else-if="item.Type=='4'">
|
|
|
|
<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="position">
|
|
{{ item.Content }}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="">
|
|
<view class="" style="margin-left: 50rpx;">
|
|
<view style="font-size: 30rpx; color: #9e9e9e;">(单选)</view>
|
|
<u-radio-group v-if="isRefresh" v-model="item.SelectName" @change="radioGroupChange(item)">
|
|
<view class="uni-flex" style="width: 50%; margin-left: 0rpx;"
|
|
v-for="(radio, index) in dataClassList" :key="index">
|
|
<view class="uni-flex " style="margin-top: 10rpx; justify-content: flex-start;">
|
|
<u-radio size="45" labelSize="35" iconSize="40" :name="radio.name" @change="radioChange(radio)">
|
|
{{radio.name}}
|
|
</u-radio>
|
|
</view>
|
|
</view>
|
|
</u-radio-group>
|
|
</view>
|
|
<!-- <input class="input" disabled style="margin-left: 50rpx;" :placeholder="item.placeholder"
|
|
v-model="item.SelectName" /> -->
|
|
</view>
|
|
|
|
</view>
|
|
</view>
|
|
<showModal ref="comMessage"></showModal>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import showModal from '../../mycomponents/common/showModal.vue'
|
|
import {
|
|
deepCopyData
|
|
} from "@/common/basic.js"
|
|
|
|
export default {
|
|
components: {
|
|
showModal
|
|
},
|
|
props: {
|
|
formData: {
|
|
type: Array,
|
|
default: null,
|
|
},
|
|
},
|
|
data() {
|
|
return {
|
|
deviceCode: "",
|
|
deviceName: "",
|
|
class: "",
|
|
value: '',
|
|
dataList: [{
|
|
value: 1,
|
|
name: "状态良好",
|
|
},
|
|
{
|
|
value: 2,
|
|
name: "正在处理",
|
|
},
|
|
{
|
|
value: 3,
|
|
name: "状态不好或损毁",
|
|
},
|
|
{
|
|
value: 4,
|
|
name: "停机状态",
|
|
}
|
|
],
|
|
dataInputList: [{
|
|
value: 4,
|
|
name: "停机状态",
|
|
}],
|
|
dataClassList: [{
|
|
value: 1,
|
|
name: "三班",
|
|
},
|
|
{
|
|
value: 2,
|
|
name: "白班",
|
|
},
|
|
{
|
|
value: 3,
|
|
name: "二班",
|
|
}
|
|
],
|
|
testName: null,
|
|
current: 0,
|
|
isRefresh: true,
|
|
isRefreshType3: true,
|
|
isRefreshType2: true,
|
|
|
|
};
|
|
|
|
|
|
},
|
|
methods: {
|
|
radioChange(radio) {
|
|
console.log("radioChange", radio)
|
|
},
|
|
radioGroupChange(item) {
|
|
// if(item.SelectName=!""){
|
|
// if(item.putMachine.length==2){
|
|
// item.putMachine[0].SelectName=""
|
|
// item.putMachine[1].SelectName=""
|
|
// // this.reload3()
|
|
// }
|
|
|
|
// }
|
|
console.log("radioGroupChange", item)
|
|
},
|
|
inputMain(item) {
|
|
if (item.putMachine[0].SelectName.length > 0) {
|
|
item.SelectName = ""
|
|
}
|
|
this.reload3()
|
|
},
|
|
|
|
inputMinor(item) {
|
|
if (item.putMachine[1].SelectName.length > 0) {
|
|
item.SelectName = ""
|
|
}
|
|
this.reload3()
|
|
},
|
|
|
|
inputType2(item){
|
|
// if(item.length==0){
|
|
|
|
// }
|
|
this.reload2()
|
|
},
|
|
|
|
|
|
submit(callBack) {
|
|
try {
|
|
for (var i = 0; i < this.formData.length; i++) {
|
|
var item = this.formData[i];
|
|
var hintIndex = i + 1
|
|
if (item.Type == 1) {
|
|
if (item.SelectName == "") {
|
|
var hint = hintIndex + ".点检内容 : " + item.Content;
|
|
throw new Error(hint)
|
|
}
|
|
} else if (item.Type == 2) {
|
|
//空值提示
|
|
if (item.SelectName == "") {
|
|
var hint = hintIndex + ".点检内容 : " + item.Content;
|
|
throw new Error(hint)
|
|
}
|
|
//如果不在选择中,输入的内容。对数值进行校验
|
|
if (!this.isExitList(item.SelectName)) {
|
|
if (!this.isWithinInterval(item.SelectName, item.putMachine[0].Limit, item
|
|
.putMachine[0]
|
|
.Floor)) {
|
|
var hint = hintIndex + ".点检内容 : " + item.Content + "输入数量【" + item.SelectName +
|
|
"】不在【" + item.putMachine[0].Limit + "】和【" + item.putMachine[0].Floor + "】之间"
|
|
throw new Error(hint)
|
|
}
|
|
}
|
|
} else if (item.Type == 3) {
|
|
if (item.SelectName == "") {
|
|
if (item.putMachine[0].SelectName == "") {
|
|
var hint = hintIndex + ".点检内容 : " + item.Content;
|
|
throw new Error(hint)
|
|
} else {
|
|
if (!this.isWithinInterval(item.putMachine[0].SelectName, item.putMachine[0].Limit,
|
|
item
|
|
.putMachine[0]
|
|
.Floor)) {
|
|
var hint = hintIndex + ".点检内容 : " + item.Content + "输入数量【" + item.putMachine[0].SelectName +
|
|
"】不在【" + item.putMachine[0].Limit + "】和【" + item.putMachine[0].Floor + "】之间"
|
|
throw new Error(hint)
|
|
}
|
|
}
|
|
|
|
if (item.putMachine[1].SelectName == "") {
|
|
var hint = hintIndex + ".点检内容 : " + item.Content;
|
|
throw new Error(hint)
|
|
} else {
|
|
if (!this.isWithinInterval(item.putMachine[1].SelectName, item.putMachine[1].Limit,
|
|
item
|
|
.putMachine[1]
|
|
.Floor)) {
|
|
var hint = hintIndex + ".点检内容 : " + item.Content + "输入数量【" + item.putMachine[1].SelectName +
|
|
"】不在【" + item.putMachine[1].Limit + "】和【" + item.putMachine[1].Floor + "】之间"
|
|
throw new Error(hint)
|
|
}
|
|
}
|
|
|
|
|
|
} else {
|
|
if (!this.isExitList(item.SelectName)) {
|
|
if (!this.isWithinInterval(item.putMachine[0].SelectName, item.putMachine[0].Limit,
|
|
item
|
|
.putMachine[0]
|
|
.Floor)) {
|
|
var hint = hintIndex + ".点检内容 : " + item.Content + "输入数量【" + item.SelectName +
|
|
"】不在【" + item.putMachine[0].Limit + "】和【" + item.putMachine[0].Floor + "】之间"
|
|
throw new Error(hint)
|
|
}
|
|
|
|
if (!this.isWithinInterval(item.putMachine[1].SelectName, item.putMachine[1].Limit,
|
|
item
|
|
.putMachine[1]
|
|
.Floor)) {
|
|
var hint = hintIndex + ".点检内容 : " + item.Content + "输入数量【" + item.SelectName +
|
|
"】不在【" + item.putMachine[1].Limit + "】和【" + item.putMachine[1].Floor + "】之间"
|
|
throw new Error(hint)
|
|
}
|
|
}
|
|
}
|
|
}else if(item.Type == 4){
|
|
if (item.SelectName == "") {
|
|
var hint = hintIndex + ".点检内容 : " + item.Content;
|
|
throw new Error(hint)
|
|
}
|
|
}
|
|
}
|
|
|
|
this.formData.forEach(res => {
|
|
if(res.SelectName){
|
|
if (res.SelectName.includes("班")) {
|
|
var value = this.dataClassList.filter(item => item.name == res.SelectName)
|
|
if (value.length > 0) {
|
|
res.SelectValue = value[0].value
|
|
} else {
|
|
res.SelectValue = ""
|
|
}
|
|
} else {
|
|
var value = this.dataList.filter(item => item.name == res.SelectName)
|
|
if (value.length > 0) {
|
|
res.SelectValue = value[0].value
|
|
} else {
|
|
res.SelectValue = res.SelectName
|
|
}
|
|
}
|
|
}
|
|
})
|
|
callBack(this.formData)
|
|
} catch (error) {
|
|
this.showHint("", error.message)
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
isWithinInterval(num, lower, upper) {
|
|
var num = Number(num);
|
|
var lower = Number(lower);
|
|
var upper = Number(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
|
|
// })
|
|
this.$refs.comMessage.showMessage("提示", 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 == "1"){
|
|
item.SelectName = ""
|
|
item.SelectValue= ""
|
|
}else if(item.Type == "2"){
|
|
item.SelectName = ""
|
|
item.SelectValue= ""
|
|
}else if(item.Type == "3"){
|
|
item.putMachine.forEach(res=>{
|
|
res.SelectName=""
|
|
res.SelectValue=""
|
|
})
|
|
}else if(item.Type == "4"){
|
|
item.SelectName = ""
|
|
item.SelectValue= ""
|
|
}
|
|
}
|
|
// var testList =deepCopyData(this.dataList)
|
|
// this.dataList =[];
|
|
// this.dataList=testList
|
|
this.reload();
|
|
this.$emit("reset", this.formData)
|
|
|
|
console.log("重置", this.formData)
|
|
},
|
|
|
|
reload() {
|
|
this.isRefresh = false
|
|
this.isRefreshType3 = false
|
|
this.$nextTick(() => {
|
|
this.isRefresh = true
|
|
this.isRefreshType3 = true
|
|
})
|
|
this.$forceUpdate()
|
|
},
|
|
reload3() {
|
|
this.isRefreshType3 = false
|
|
this.$nextTick(() => {
|
|
this.isRefreshType3 = true
|
|
})
|
|
},
|
|
reload2() {
|
|
this.isRefreshType2 = false
|
|
this.$nextTick(() => {
|
|
this.isRefreshType2 = true
|
|
})
|
|
}
|
|
|
|
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.colorRed {
|
|
color: red;
|
|
font-size: 30rpx;
|
|
}
|
|
|
|
.position {
|
|
font-size: 32rpx;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.content {
|
|
font-size: 32rpx;
|
|
}
|
|
|
|
.methond {
|
|
font-size: 29rpx;
|
|
color: #999;
|
|
}
|
|
|
|
.input {
|
|
padding: 10rpx;
|
|
height: 100%;
|
|
text-align: left;
|
|
margin: 10rpx;
|
|
font-size: 28rpx;
|
|
color: #333;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
outline: none;
|
|
border-radius: 10rpx;
|
|
border: 1rpx solid lightgrey;
|
|
}
|
|
</style>
|