Browse Source

修改泡沫点检

master
lijuncheng 8 months ago
parent
commit
3047c5ca0b
  1. 9
      src/mycomponents/common/comMessage.vue
  2. 110
      src/mycomponents/common/showModal.vue
  3. 289
      src/mycomponents/form/customerFrom.vue
  4. 6
      src/mycomponents/form/selectPopup.vue
  5. 96
      src/pages/foam/check.vue

9
src/mycomponents/common/comMessage.vue

@ -1,10 +1,10 @@
<template name="show-modal">
<view>
<u-modal v-model="show" :title-style="{color: 'red'}" :title="title" :showTitle="false"
<u-modal v-model="show" :title-style="{color: 'red'}" :title="title" :showTitle="true"
:showConfirmButton="false" ref="modal">
<view class="slot-content">
<slot name="icon">
<image class="icon" :src="icon" />
<!-- <image class="icon" :src="icon" /> -->
</slot>
<slot name="content">
<rich-text class="content" :nodes="content">
@ -110,6 +110,9 @@
showErrorMessage(mContent, callback) {
this.showConfirmModal("失败", mContent, callback);
},
showErrorMessageHint(title,mContent, callback) {
this.showConfirmModal("失败", mContent, callback);
},
// (
showBreakMessage(mContent, callback) {
@ -176,6 +179,7 @@
showConfirmModal(mIconType, mContent, callback) {
this.showModal({
iconType: mIconType,
title:title,
content: mContent,
showCancelButton: false,
success: function(res) {
@ -323,6 +327,7 @@
default:
break;
}
this.icon=""
}
// image
if (data.title) {

110
src/mycomponents/common/showModal.vue

@ -0,0 +1,110 @@
<template>
<view>
<!-- 模态框组件 -->
<view class="modal" v-if="showModal">
<view class="modal-content">
<view>{{ modalTitle }}</view>
<view>{{ modalContent }}</view>
<view class="modal-buttons " >
<view class="uni-flex center" style="width: 100%;background-color: #A9A9A9;color: #fff; padding: 20rpx; font-size: 32rpx;" @click="handleCancel">
取消
</view>
<view class="uni-flex center" style="width: 100%; background-color: #3C9CFF; color: #fff; padding: 20rpx;font-size: 32rpx;" @click="handleConfirm">
确认
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
showModal: false,
modalTitle: '模态框',
modalContent: '内容'
};
},
methods: {
showMessage(title,content){
this.modalTitle =title;
this.modalContent =content;
this.showModal=true;
},
//
handleConfirm() {
//
//
this.showModal = false; //
},
//
handleCancel() {
//
//
this.showModal = false; //
}
}
};
</script>
<style scoped lang="scss">
/* 遮罩层 */
.modal {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
}
/* 窗口 */
.modal-content {
background-color: white;
/* padding: 20px; */
width: 500rpx;
height: 400rpx;
border-radius: 8rpx;
position: relative;
//modal-contentview
view:first-child{
padding: 10rpx;
font-size:30rpx;
font-weight:bold;
}
//modal-contentview
view:nth-child(2){
font-size:30rpx;
padding-left: 10rpx;
color:red
}
}
/* 按钮 */
.modal-buttons {
width: 100%;
display: flex;
bottom: 0;
position: absolute;
}
.modal-buttons button {
width: 100%;
height: 80rpx;
border: none;
}
.modal-buttons button:first-child {
background-color: #3C9CFF;
color: #fff;
border-radius: 10;
}
.modal-buttons button:last-child {
width: 100%;
border-radius: 0px;
background-color: #A9A9A9;
color: #fff;
}
</style>

289
src/mycomponents/form/customerFrom.vue

@ -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="" 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="" 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">
@ -85,21 +158,18 @@
</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(hintIndex + ".点检内容 : " + item.content, "最低压 : 输入数量【" + item.inputLow.name +
"】不在【" + item.inputLow.lower + "】和【" + item.inputLow.upper + "】之间")
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+"】之间")
}
}
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(hintIndex + ".点检内容 : " + item.content, "最高压 : 输入数量【" + item.inputHigh.name +
"】不在【" + item.inputHigh.lower + "】和【" + item.inputHigh.upper + "】之间")
isCheckPass = false;
break
}
}
} 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.inputHigh.name == ""){
this.showHint("点检内容 : " + item.content, item.inputHigh.placeholder)
if (item.minor.name == "") {
this.showHint(hintIndex + ".点检内容 : " + item.content, item.minor.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+"】之间")
}
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 {

6
src/mycomponents/form/selectPopup.vue

@ -1,13 +1,13 @@
<template>
<view class="">
<uni-popup ref="popup">
<view class="" style="margin: 20rpx; border-radius: 10rpx; font-size: 32rpx;background-color: #fff;">
<view class="" style="text-align: center; padding: 10rpx; font-size: 35rpx;">
<view class="" style="margin: 20rpx; padding: 10rpx; border-radius: 10rpx; font-size: 32rpx;background-color: #fff;">
<view class="" style="text-align: center; padding: 20rpx; font-size: 35rpx; font-weight: bold;">
{{title}}
</view>
<view class="" style="height: 2rpx;background-color: gray;">
</view>
<view class="" v-for="(item, index) in dataList" :key="index" style="background-color: #fff;">
<view class="" v-for="(item, index) in dataList" :key="index" style="background-color: #fff; font-size: 35rpx;">
<view class="" style="padding: 10rpx;" @click="select(item)">
{{index+1}} . {{item.name}}

96
src/pages/foam/check.vue

@ -1,24 +1,26 @@
<template>
<view class="page-wraper">
<view class="page-header flex"
style="font-size: 35rpx; padding-left: 20rpx; padding-top: 20rpx; flex-direction: column;">
style="font-size: 35rpx; padding-left: 10rpx; padding-top: 20rpx; flex-direction: column;">
<view class="flex u-col-center space-between">
<view class="">
设备编号 : {{deviceCode}}
<text v-if="deviceName!=''">({{deviceName}})</text>
</view>
<view class="">
<button type="primary" size="mini" @click="openScanPopup">扫描</button>
</view>
</view>
<view class="">
点检日期 : {{dateTime}}
</view>
<view class="" style="width: 100%;background-color: gray;height: 2rpx;" />
</view>
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll" >
<scroll-view scroll-y="true" class="page-main-scroll">
<view style="padding-bottom: 80rpx;">
<customerFrom ref="customerFrom" :formData="formData"> </customerFrom>
<customerFrom ref="customerFrom" :formData="dataList"> </customerFrom>
</view>
</scroll-view>
</view>
@ -42,7 +44,8 @@
<script>
import customerFrom from "@/mycomponents/form/customerFrom.vue"
import winScanNormal from "@/mycomponents/scan/winScanNormal.vue"
import date from "@/mycomponents/scan/winScanNormal.vue"
import {getCurrDateTime} from "@/common/basic.js"
export default {
components: {
customerFrom,
@ -50,10 +53,12 @@
},
data() {
return {
dateTime:"",
deviceCode: "",
deviceName: "",
dataList: [],
formData: [{
type: "inputAndSelect",
type: "stateSelect",
position: "PB",
content: "检查各个管路及接头",
methond: "目视野无液体渗出",
@ -63,6 +68,67 @@
},
{
type: "inputAndSelect",
check: true,
position: "开孔机",
content: "检查油温",
methond: "目视80°C~100°C",
lower: 80,
upper: 100,
placeholder: "请输入点检状态",
name: '',
value: "",
},
{
type: "inputAndSelect",
position: "开孔机",
content: "待机状态下真空度",
methond: "目视<=6Bar",
lower: 0,
upper: 6,
placeholder: "请输入待机状态下真空度",
name: '',
value: "",
},
{
type: "inputAndSelect",
position: "开孔机",
content: "工作时真空度",
methond: "达到-0.07~0.08Mpa",
lower: -0.07,
upper: 0.08,
placeholder: "请输入工作时真空度",
name: '',
value: "",
},
{
type: "inputAndSelect",
position: "开孔机",
content: "检查开孔机压缩空气压力",
methond: "主表6±0.5bar,副表4±0.5bar",
placeholder: "请输入检查开孔机压缩空气压力",
name: '',
value: "",
main:{
name: "",
value: "",
placeholder: "请输入主表压力",
hint:"主表压力范围5.5~6.5bar",
lower: "5.5",
upper: "6.5"
},
minor:{
name: "",
value: "",
placeholder: "请输入副表压力",
hint:"副表压力范围3.5~4.5bar",
lower: "3.5",
upper: "4.5"
}
},
{
type: "stateSelect",
position: "PB",
content: "电机检查",
methond: "倾听无异响",
@ -71,7 +137,7 @@
value: "",
},
{
type: "inputAndSelect",
type: "stateSelect",
position: "PB",
content: "检查气源气压",
methond: "倾听无异响",
@ -84,23 +150,23 @@
position: "PB",
content: "检查气袋气压",
methond: "压力表示数范围2.5bar-4.5bar",
inputLow:{
inputLow: {
name: "",
value: "",
placeholder: "请输入最低压力",
lower:"2.5",
upper:"4.5"
lower: "2.5",
upper: "4.5"
},
inputHigh:{
inputHigh: {
name: "",
value: "",
placeholder: "请输入最高压力",
lower:"2.5",
upper:"4.5"
lower: "2.5",
upper: "4.5"
}
},
{
type: "select",
type: "groupSelect",
content: "选择班组",
placeholder: "请选择班组",
name: '',
@ -123,6 +189,8 @@
console.log(result)
this.reset();
this.closeScanPopup();
this.dataList = this.formData;
this.dateTime =getCurrDateTime()
},
submit() {
this.$refs.customerFrom.submit(callBack => {

Loading…
Cancel
Save