Browse Source

修改泡沫点检

master
lijuncheng 6 months ago
parent
commit
45a58ddc0d
  1. 5
      src/mycomponents/common/showModal.vue
  2. 176
      src/mycomponents/form/customerFrom.vue
  3. 25
      src/pages/foam/check.vue
  4. 489
      src/uni_modules/vk-uview-ui/components/u-radio/u-radio.vue

5
src/mycomponents/common/showModal.vue

@ -71,15 +71,16 @@
height: 400rpx;
border-radius: 8rpx;
position: relative;
text-align: center;
//modal-contentview
view:first-child{
padding: 10rpx;
font-size:30rpx;
font-size:35rpx;
font-weight:bold;
}
//modal-contentview
view:nth-child(2){
font-size:30rpx;
font-size:32rpx;
padding-left: 10rpx;
color:red
}

176
src/mycomponents/form/customerFrom.vue

@ -22,21 +22,24 @@
</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="">
<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.name" @change="radioGroupChange(item)">
<view class="uni-flex" style="width: 50%; margin-left: 0rpx;"
v-for="(radio, index) in dataList" :key="index" @change="radioChange">
v-for="(radio, index) in dataList" :key="index">
<view class="uni-flex " style="margin-top: 10rpx; justify-content: flex-start;">
<u-radio :name="radio.name">
<u-radio :name="radio.name" @change="radioChange(radio)">
{{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" />
<input class="input" disabled style="margin-left: 50rpx;" :placeholder="item.placeholder"
v-model="item.name" />
</view>
</view>
@ -61,21 +64,23 @@
<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="">
<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.name" @change="radioGroupChange(item)">
<view class="uni-flex" style="width: 50%; margin-left: 0rpx;"
v-for="(radio, index) in dataList" :key="index" @change="radioChange">
v-for="(radio, index) in dataInputList" :key="index">
<view class="uni-flex " style="margin-top: 10rpx; justify-content: flex-start;">
<u-radio :name="radio.name">
<u-radio :name="radio.name" @change="radioChange(radio)">
{{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" />
<input class="input" style="margin-left: 50rpx;" :placeholder="item.placeholder"
v-model="item.name" />
</view>
<view class="" v-if="item.main">
@ -109,19 +114,19 @@
<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">
<u-radio-group v-if="isRefresh" v-model="item.name" @change="radioGroupChange(item)">
<view class="uni-flex" style="width: 50%; margin-left: 0rpx;"
v-for="(radio, index) in dataClassList" :key="index" @change="radioChange">
v-for="(radio, index) in dataClassList" :key="index">
<view class="uni-flex " style="margin-top: 10rpx; justify-content: flex-start;">
<u-radio :name="radio.name">
<u-radio :name="radio.name" @change="radioChange(radio)">
{{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" />
<input class="input" :disabled="false" style="margin-left: 50rpx;" :placeholder="item.placeholder"
v-model="item.name" />
</view>
</view>
@ -165,7 +170,9 @@
<script>
import showModal from '../../mycomponents/common/showModal.vue'
import {
deepCopyData
} from "@/common/basic.js"
export default {
components: {
@ -200,55 +207,44 @@
name: "停机状态",
}
],
dataInputList: [{
value: 4,
name: "停机状态",
}],
dataClassList: [{
value: 1,
name: "白班",
name: "班",
},
{
value: 2,
name: "班",
name: "班",
},
{
value: 3,
name: "班",
name: "班",
}
],
// formData: [{
// content: "",
// methond: "",
// placeholder: "1",
// name: '',
// value:"",
// },
// {
// content: "",
// methond: "",
// placeholder: "2",
// name: '',
// value:"",
// }],
selectStateItem: {},
selectClassItem: {},
testName: null,
current: 0,
isRefresh: true
};
},
methods: {
radioChange(e) {
console.log(e)
radioChange(radio) {
console.log("radioChange")
},
radioGroupChange(item) {
console.log("radioGroupChange", item)
// for (let i = 0; i < this.dataList.length; i++) {
// if (this.dataList[i].value === evt.detail.value) {
// if (this.dataList[i].name === item.name) {
// this.current = i;
// break;
// }
// }
},
radioGroupChange(e) {
console.log(e)
},
inputMain(item) {
item.name = item.minor.name + "~" + item.main.name;
if (item.minor.name == "" && item.main.name == "") {
@ -308,42 +304,44 @@
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
}
if (item.main) {
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.hint)
isCheckPass = false;
break
}
if (item.main.name == "") {
this.showHint(hintIndex + ".点检内容 : " + item.content, item.main.placeholder)
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.hint)
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
}
}
}
}
@ -354,7 +352,6 @@
break
}
}
}
if (isCheckPass) {
callBack(this.formData)
@ -372,7 +369,7 @@
},
isExitList(name) {
var isExit = this.dataList.filter(res => res.name == name)
if(isExit.length==0){
if (isExit.length == 0) {
return false
}
return true;
@ -409,10 +406,21 @@
item.name = ""
item.value = ""
}
}
// var testList =deepCopyData(this.dataList)
// this.dataList =[];
// this.dataList=testList
this.reload();
this.$emit("reset", this.formData)
console.log(this.formData)
console.log("重置", this.formData)
}
,
reload(){
this.isRefresh = false
this.$nextTick(() => {
this.isRefresh = true
})
}

25
src/pages/foam/check.vue

@ -1,7 +1,7 @@
<template>
<view class="page-wraper">
<view class="page-header flex"
style="font-size: 35rpx; padding-left: 10rpx; padding-top: 20rpx; flex-direction: column;">
style="font-size: 32rpx; padding-left: 10rpx; padding-top: 10rpx; flex-direction: column;">
<view class="flex u-col-center space-between">
<view class="">
设备编号 : {{deviceCode}}
@ -11,10 +11,10 @@
<button type="primary" size="mini" @click="openScanPopup">扫描</button>
</view>
</view>
<view class="">
<view class="" v-if="deviceName!=''">
点检日期 : {{dateTime}}
</view>
<view class="" style="width: 100%;background-color: gray;height: 2rpx;" />
<view class="" style="width: 100%;background-color: gray;height: 2rpx; margin-top: 10rpx;" />
</view>
<view class="page-main">
@ -36,20 +36,24 @@
</view>
</view>
<winScanNormal ref="scanPopup" title="设备编号" @getResult='getScanResult'></winScanNormal>
<showModal ref="comMessage"></showModal>
</view>
</template>
<script>
import showModal from '../../mycomponents/common/showModal.vue'
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"
import {getCurrDateTime,
deepCopyData} from "@/common/basic.js"
export default {
components: {
customerFrom,
winScanNormal
winScanNormal,
showModal
},
data() {
return {
@ -63,7 +67,7 @@
content: "检查各个管路及接头",
methond: "目视野无液体渗出",
placeholder: "请输入点检状态",
name: '',
name: "正在处理",
value: "",
},
{
@ -75,7 +79,7 @@
lower: 80,
upper: 100,
placeholder: "请输入点检状态",
name: '',
name: '停机状态',
value: "",
},
{
@ -86,7 +90,7 @@
lower: 0,
upper: 6,
placeholder: "请输入待机状态下真空度",
name: '',
name: '5',
value: "",
},
{
@ -193,7 +197,12 @@
this.dateTime =getCurrDateTime()
},
submit() {
if(this.deviceCode==""){
this.$refs.comMessage.showMessage("提示", "请先扫描设备编号")
return
}
this.$refs.customerFrom.submit(callBack => {
console.log("提交", JSON.stringify(callBack))
})

489
src/uni_modules/vk-uview-ui/components/u-radio/u-radio.vue

@ -1,12 +1,7 @@
<template>
<view class="u-radio" :style="[radioStyle]">
<view class="u-radio__icon-wrap" @tap="toggle" :class="[iconClass]" :style="[iconStyle]">
<u-icon
class="u-radio__icon-wrap__icon"
name="checkbox-mark"
:size="elIconSize"
:color="iconColor"
/>
<u-icon class="u-radio__icon-wrap__icon" name="checkbox-mark" :size="elIconSize" :color="iconColor" />
</view>
<view class="u-radio__label" @tap="onClickLabel" :style="{ fontSize: $u.addUnit(labelSize) }">
<slot />
@ -15,262 +10,276 @@
</template>
<script>
/**
* radio 单选框
* @description 单选框用于有一个选择用户只能选择其中一个的场景搭配u-radio-group使用
* @tutorial https://www.uviewui.com/components/radio.html
* @property {String Number} icon-size 图标大小单位rpx默认24
* @property {String Number} label-size label字体大小单位rpx默认28
* @property {String Number} name radio组件的标示符
* @property {String} shape 形状见上方说明默认circle
* @property {Boolean} disabled 是否禁用默认false
* @property {Boolean} label-disabled 点击文本是否可以操作radio默认true
* @property {String} active-color 选中时的颜色如设置parent的active-color将失效
* @event {Function} change 某个radio状态发生变化时触发(选中状态)
* @example <u-radio :label-disabled="false">门掩黄昏无计留春住</u-radio>
*/
export default {
name: "u-radio",
emits: ["change"],
props: {
// radio
name: {
type: [String, Number],
default: ""
},
//
size: {
type: [String, Number],
default: 34
},
// squarecircle
shape: {
type: String,
default: ""
},
//
disabled: {
type: [String, Boolean],
default: ""
},
//
labelDisabled: {
type: [String, Boolean],
default: ""
},
// parentactiveColor
activeColor: {
type: String,
default: ""
},
// rpx
iconSize: {
type: [String, Number],
default: ""
},
// labelrpx
labelSize: {
type: [String, Number],
default: ""
}
},
data() {
return {
// computed使this.parent.shape
// 使
parentData: {
iconSize: null,
labelDisabled: null,
disabled: null,
shape: null,
activeColor: null,
size: null,
width: null,
height: null,
value: null,
wrap: null
/**
* radio 单选框
* @description 单选框用于有一个选择用户只能选择其中一个的场景搭配u-radio-group使用
* @tutorial https://www.uviewui.com/components/radio.html
* @property {String Number} icon-size 图标大小单位rpx默认24
* @property {String Number} label-size label字体大小单位rpx默认28
* @property {String Number} name radio组件的标示符
* @property {String} shape 形状见上方说明默认circle
* @property {Boolean} disabled 是否禁用默认false
* @property {Boolean} label-disabled 点击文本是否可以操作radio默认true
* @property {String} active-color 选中时的颜色如设置parent的active-color将失效
* @event {Function} change 某个radio状态发生变化时触发(选中状态)
* @example <u-radio :label-disabled="false">门掩黄昏无计留春住</u-radio>
*/
export default {
name: "u-radio",
emits: ["change"],
props: {
// radio
name: {
type: [String, Number],
default: ""
},
//
size: {
type: [String, Number],
default: 34
},
// squarecircle
shape: {
type: String,
default: ""
},
//
disabled: {
type: [String, Boolean],
default: ""
},
//
labelDisabled: {
type: [String, Boolean],
default: ""
},
// parentactiveColor
activeColor: {
type: String,
default: ""
},
// rpx
iconSize: {
type: [String, Number],
default: ""
},
// labelrpx
labelSize: {
type: [String, Number],
default: ""
}
};
},
created() {
this.parent = false;
// provide/inject使created
this.updateParentData();
this.parent.children.push(this);
},
computed: {
// u-raios-group
elDisabled() {
return this.disabled !== ""? this.disabled: this.parentData.disabled !== null? this.parentData.disabled: false;
},
// label
elLabelDisabled() {
return this.labelDisabled !== ""? this.labelDisabled: this.parentData.labelDisabled !== null? this.parentData.labelDisabled: false;
},
// size34rpx
elSize() {
return this.size ? this.size : this.parentData.size ? this.parentData.size : 34;
},
// 20
elIconSize() {
return this.iconSize? this.iconSize: this.parentData.iconSize? this.parentData.iconSize: 20;
},
//
elActiveColor() {
return this.activeColor? this.activeColor: this.parentData.activeColor? this.parentData.activeColor: "primary";
data() {
return {
// computed使this.parent.shape
// 使
parentData: {
iconSize: null,
labelDisabled: null,
disabled: null,
shape: null,
activeColor: null,
size: null,
width: null,
height: null,
value: null,
wrap: null
},
select: false
};
},
//
elShape() {
return this.shape ? this.shape : this.parentData.shape ? this.parentData.shape : "circle";
created() {
this.parent = false;
// provide/inject使created
this.updateParentData();
this.parent.children.push(this);
},
// radioradionameparentvalue
iconStyle() {
let style = {};
if (this.elActiveColor && this.parentData.value === this.name && !this.elDisabled) {
style.borderColor = this.elActiveColor;
style.backgroundColor = this.elActiveColor;
computed: {
// u-raios-group
elDisabled() {
return this.disabled !== "" ? this.disabled : this.parentData.disabled !== null ? this.parentData
.disabled : false;
},
// label
elLabelDisabled() {
return this.labelDisabled !== "" ? this.labelDisabled : this.parentData.labelDisabled !== null ? this
.parentData.labelDisabled : false;
},
// size34rpx
elSize() {
return this.size ? this.size : this.parentData.size ? this.parentData.size : 34;
},
// 20
elIconSize() {
return this.iconSize ? this.iconSize : this.parentData.iconSize ? this.parentData.iconSize : 20;
},
//
elActiveColor() {
return this.activeColor ? this.activeColor : this.parentData.activeColor ? this.parentData.activeColor :
"primary";
},
//
elShape() {
return this.shape ? this.shape : this.parentData.shape ? this.parentData.shape : "circle";
},
// radioradionameparentvalue
iconStyle() {
let style = {};
if (this.elActiveColor && this.parentData.value === this.name && !this.elDisabled) {
style.borderColor = this.elActiveColor;
style.backgroundColor = this.elActiveColor;
}
style.width = this.$u.addUnit(this.elSize);
style.height = this.$u.addUnit(this.elSize);
return style;
},
iconColor() {
return this.name === this.parentData.value ? "#ffffff" : "transparent";
},
iconClass() {
let classes = [];
classes.push("u-radio__icon-wrap--" + this.elShape);
if (this.name === this.parentData.value) classes.push("u-radio__icon-wrap--checked");
if (this.elDisabled) classes.push("u-radio__icon-wrap--disabled");
if (this.name === this.parentData.value && this.elDisabled)
classes.push("u-radio__icon-wrap--disabled--checked");
// ","
return classes.join(" ");
},
radioStyle() {
let style = {};
if (this.parentData.width) {
style.width = this.$u.addUnit(this.parentData.width);
// #ifdef MP
// 使float
style.float = "left";
// #endif
// #ifndef MP
// H5APP使flex
style.flex = `0 0 ${this.$u.addUnit(this.parentData.width)}`;
// #endif
}
if (this.parentData.wrap) {
style.width = "100%";
// #ifndef MP
// H5APP使flex100%
style.flex = "0 0 100%";
// #endif
}
return style;
}
style.width = this.$u.addUnit(this.elSize);
style.height = this.$u.addUnit(this.elSize);
return style;
},
iconColor() {
return this.name === this.parentData.value ? "#ffffff" : "transparent";
},
iconClass() {
let classes = [];
classes.push("u-radio__icon-wrap--" + this.elShape);
if (this.name === this.parentData.value) classes.push("u-radio__icon-wrap--checked");
if (this.elDisabled) classes.push("u-radio__icon-wrap--disabled");
if (this.name === this.parentData.value && this.elDisabled)
classes.push("u-radio__icon-wrap--disabled--checked");
// ","
return classes.join(" ");
},
radioStyle() {
let style = {};
if (this.parentData.width) {
style.width = this.$u.addUnit(this.parentData.width);
// #ifdef MP
// 使float
style.float = "left";
// #endif
// #ifndef MP
// H5APP使flex
style.flex = `0 0 ${this.$u.addUnit(this.parentData.width)}`;
// #endif
}
if (this.parentData.wrap) {
style.width = "100%";
// #ifndef MP
// H5APP使flex100%
style.flex = "0 0 100%";
// #endif
methods: {
updateParentData() {
this.getParentData("u-radio-group");
},
onClickLabel() {
if (!this.elLabelDisabled && !this.elDisabled) {
this.setRadioCheckedStatus();
}
},
toggle() {
if (!this.elDisabled) {
this.setRadioCheckedStatus();
}
},
emitEvent() {
// u-radionamev-model()
if (this.parentData.value != this.name) this.$emit("change", this.name);
},
//
// parentData.valuenameu-radio
// u-radioparentData.value(computed)
setRadioCheckedStatus() {
this.emitEvent();
// if (this.parent) {
// this.parent.setValue(this.name);
// this.parentData.value = this.name;
// }
if (this.parent) {
if (this.parentData.value !== this.name) {
this.parent.setValue(this.name);
this.parentData.value = this.name;
} else {
this.parent.setValue('');
this.parentData.value = '';
}
}
}
return style;
}
},
methods: {
updateParentData() {
this.getParentData("u-radio-group");
},
onClickLabel() {
if (!this.elLabelDisabled && !this.elDisabled) {
this.setRadioCheckedStatus();
}
},
toggle() {
if (!this.elDisabled) {
this.setRadioCheckedStatus();
}
},
emitEvent() {
// u-radionamev-model()
if (this.parentData.value != this.name) this.$emit("change", this.name);
},
//
// parentData.valuenameu-radio
// u-radioparentData.value(computed)
setRadioCheckedStatus() {
this.emitEvent();
if (this.parent) {
this.parent.setValue(this.name);
this.parentData.value = this.name;
}
}
}
};
};
</script>
<style lang="scss" scoped>
@import "../../libs/css/style.components.scss";
.u-radio {
/* #ifndef APP-NVUE */
display: inline-flex;
/* #endif */
align-items: center;
overflow: hidden;
user-select: none;
line-height: 1.8;
@import "../../libs/css/style.components.scss";
&__icon-wrap {
color: $u-content-color;
@include vue-flex;
flex: none;
.u-radio {
/* #ifndef APP-NVUE */
display: inline-flex;
/* #endif */
align-items: center;
justify-content: center;
box-sizing: border-box;
width: 42rpx;
height: 42rpx;
color: transparent;
text-align: center;
transition-property: color, border-color, background-color;
font-size: 20px;
border: 1px solid #c8c9cc;
transition-duration: 0.2s;
overflow: hidden;
user-select: none;
line-height: 1.8;
/* #ifdef MP-TOUTIAO */
// 0
&__icon {
line-height: 0;
}
/* #endif */
&__icon-wrap {
color: $u-content-color;
@include vue-flex;
flex: none;
align-items: center;
justify-content: center;
box-sizing: border-box;
width: 42rpx;
height: 42rpx;
color: transparent;
text-align: center;
transition-property: color, border-color, background-color;
font-size: 20px;
border: 1px solid #c8c9cc;
transition-duration: 0.2s;
&--circle {
border-radius: 100%;
}
/* #ifdef MP-TOUTIAO */
// 0
&__icon {
line-height: 0;
}
&--square {
border-radius: 3px;
}
/* #endif */
&--checked {
color: #fff;
background-color: #2979ff;
border-color: #2979ff;
}
&--circle {
border-radius: 100%;
}
&--disabled {
background-color: #ebedf0;
border-color: #c8c9cc;
}
&--square {
border-radius: 3px;
}
&--checked {
color: #fff;
background-color: #2979ff;
border-color: #2979ff;
}
&--disabled--checked {
color: #c8c9cc !important;
&--disabled {
background-color: #ebedf0;
border-color: #c8c9cc;
}
&--disabled--checked {
color: #c8c9cc !important;
}
}
}
&__label {
word-wrap: break-word;
margin-left: 10rpx;
margin-right: 24rpx;
color: $u-content-color;
font-size: 30rpx;
&__label {
word-wrap: break-word;
margin-left: 10rpx;
margin-right: 24rpx;
color: $u-content-color;
font-size: 30rpx;
&--disabled {
color: #c8c9cc;
&--disabled {
color: #c8c9cc;
}
}
}
}
</style>
Loading…
Cancel
Save