提交 5d1dd02f authored 作者: JaxBBLL's avatar JaxBBLL

feat: update

上级 c73a5a11
<template>
<input v-bind="$attrs" v-model="inputValue" @input="handleInput" />
</template>
<script>
export default {
name: "NumberInput",
data() {
return {
inputValue: "",
};
},
props: {
decimalPlaces: {
type: Number,
default: 2,
},
min: {
type: Number,
default: -Infinity,
},
max: {
type: Number,
default: Infinity,
},
allowNegative: {
type: Boolean,
default: false,
},
},
methods: {
handleInput(e) {
let value = e.target.value;
if (!this.allowNegative) {
value = value.replace(/-/g, "");
}
// 去除非数字和小数点以外的字符
value = value.replace(/[^\d.]/g, "");
// 保证只有一个小数点
const dotCount = (value.match(/\./g) || []).length;
if (dotCount > 1) {
value = value.slice(0, value.lastIndexOf("."));
}
// 处理小数点后的位数
if (value.includes(".")) {
const parts = value.split(".");
parts[1] = parts[1].slice(0, this.decimalPlaces);
value = parts.join(".");
}
if (value) {
const numValue = parseFloat(value);
if (numValue < this.min) {
value = this.min.toString();
} else if (numValue > this.max) {
value = this.max.toString();
}
}
this.inputValue = value;
this.$emit("input", value);
},
},
};
</script>
...@@ -25,13 +25,12 @@ ...@@ -25,13 +25,12 @@
{{ item.lableArr[1] }} {{ item.lableArr[1] }}
</view> </view </view> </view
><input ><input
v-if="'value' in item && item.inspectionResult === 1" v-if="'value' in item"
class="input" class="input"
v-model="item.value" v-model="item.value"
type="text" type="text"
placeholder="请输入" placeholder="请输入"
maxlength="3" />{{ item.unit }}
/>{{ item.inspectionResult === 1 ? item.unit : "" }}
</view> </view>
<template v-if="item.inspectionResult === 1"> <template v-if="item.inspectionResult === 1">
<view v-if="'conclusion' in item" class="form-item"> <view v-if="'conclusion' in item" class="form-item">
...@@ -133,7 +132,7 @@ export default { ...@@ -133,7 +132,7 @@ export default {
lableArr: ["正常", "异常"], lableArr: ["正常", "异常"],
conclusion: "", conclusion: "",
settingLabel: "设定湿度", settingLabel: "设定湿度",
setting: "25", //设定湿度值 setting: "20%~70", //设定湿度值
value: "", //输入湿度 value: "", //输入湿度
unit: "%", //单位 unit: "%", //单位
photos: [], photos: [],
......
...@@ -28,32 +28,63 @@ ...@@ -28,32 +28,63 @@
<view class="form-item"> <view class="form-item">
<text class="form-label" <text class="form-label"
><text class="required">*</text>{{ item.deviceLabel }}</text ><text class="required">*</text>{{ item.deviceLabel }}</text
><input >
<view>
<view
class="flex items-center"
v-for="(cabinet, idx) in item.cabinets"
:key="idx"
>
<view class="form-item">
<!-- <text class="form-label"></text> -->
<input
class="conclusion" class="conclusion"
v-model="item.deviceId" v-model="cabinet.deviceId"
type="text" type="text"
placeholder="请输入编号" placeholder="请输入编号"
/> />
</view> </view>
<view class="form-item"> <view class="form-item">
<text class="form-label" <text class="form-label"
><text class="required">*</text>{{ item.UpositonLabel }}</text ><text class="required">*</text
><input >{{ cabinet.UpositonLabel }}</text
>
<NumberInput
class="input" class="input"
v-model="item.UpositonS" v-model="cabinet.UpositonS"
type="number" type="number"
placeholder="请输入" placeholder="请输入"
maxlength="2"
/> />
<text class="fg"></text <!-- <input
><input
class="input" class="input"
v-model="item.UpositonE" v-model="cabinet.UpositonS"
type="number" type="number"
placeholder="请输入" placeholder="请输入"
maxlength="2" maxlength="2"
/> -->
<text class="fg"></text>
<NumberInput
class="input"
v-model="cabinet.UpositonE"
type="number"
placeholder="请输入"
/> />
<!-- <input
class="input"
v-model="cabinet.UpositonE"
type="number"
placeholder="请输入"
maxlength="2"
/> -->
</view> </view>
<view>
<button class="v-btn">+</button>
<button class="v-btn v-btn-default ml-10">-</button>
</view>
</view>
</view>
</view>
<view v-if="'conclusion' in item" class="form-item"> <view v-if="'conclusion' in item" class="form-item">
<text class="form-label" <text class="form-label"
><text class="required">*</text>情况摘要</text ><text class="required">*</text>情况摘要</text
...@@ -98,12 +129,14 @@ ...@@ -98,12 +129,14 @@
</template> </template>
<script> <script>
import NumberInput from "@/components/NumberInput/index.vue";
import customPopup from "./customPopup.vue"; import customPopup from "./customPopup.vue";
import _ from "lodash"; import _ from "lodash";
import mixin from "./mixin"; import mixin from "./mixin";
export default { export default {
mixins: [mixin], mixins: [mixin],
components: { components: {
NumberInput,
customPopup, customPopup,
}, },
props: { props: {
...@@ -144,6 +177,15 @@ export default { ...@@ -144,6 +177,15 @@ export default {
UpositonLabel: "U位", UpositonLabel: "U位",
UpositonS: "", UpositonS: "",
UpositonE: "", UpositonE: "",
cabinets: [
{
deviceId: "",
deviceLabel: "故障设备机柜",
UpositonLabel: "U位",
UpositonS: "",
UpositonE: "",
},
],
photos: [], photos: [],
}, },
], ],
......
...@@ -76,7 +76,11 @@ ...@@ -76,7 +76,11 @@
> >
<view <view
class="card" class="card"
:class="{ status1: card.status == 1, status2: card.status == 2 }" :class="{
status1: card.status == 1,
status2: card.status == 2,
active: value === card.value,
}"
> >
<view class="card-content"> <view class="card-content">
<view class="first-row"> <view class="first-row">
...@@ -149,7 +153,12 @@ ...@@ -149,7 +153,12 @@
:key="cardIndex" :key="cardIndex"
@click="getDetailsItem(card.name, card.jfType, card.value)" @click="getDetailsItem(card.name, card.jfType, card.value)"
> >
<view class="card" :class="{ active: card.name == activeName }"> <view
class="card"
:class="{
active: value === card.value,
}"
>
<view class="card-content"> <view class="card-content">
<view class="first-row"> <view class="first-row">
<image <image
...@@ -237,6 +246,7 @@ export default { ...@@ -237,6 +246,7 @@ export default {
this.isDisable = options.isDisable == 1 ? true : false; this.isDisable = options.isDisable == 1 ? true : false;
console.log("options.uid", this.options.uid); console.log("options.uid", this.options.uid);
this.uid = this.options.uid || ""; this.uid = this.options.uid || "";
this.value = this.options.value || "1";
}, },
onShow() { onShow() {
if (this.uid) { if (this.uid) {
...@@ -367,6 +377,7 @@ export default { ...@@ -367,6 +377,7 @@ export default {
// 获取机房详情 // 获取机房详情
getDetailsItem(location, jfType, value) { getDetailsItem(location, jfType, value) {
this.activeName = location; this.activeName = location;
this.value = value;
this.detailsItem = this.detailsInfo.originData[value - 1].details; this.detailsItem = this.detailsInfo.originData[value - 1].details;
this.jfType = this.detailsInfo.originData[value - 1].jfType; this.jfType = this.detailsInfo.originData[value - 1].jfType;
if (this.detailsItem.afxt.detail[2].inspectionResult === 1) { if (this.detailsItem.afxt.detail[2].inspectionResult === 1) {
...@@ -464,6 +475,7 @@ export default { ...@@ -464,6 +475,7 @@ export default {
handlePopupConfirm(summary) { handlePopupConfirm(summary) {
this.detailsInfo.isSign = this.isSign = true; // 回显到文字显示区域 this.detailsInfo.isSign = this.isSign = true; // 回显到文字显示区域
this.detailsInfo.signImg = summary; // 回显到文字显示区域 this.detailsInfo.signImg = summary; // 回显到文字显示区域
this.detailsInfo.isSubmit = 1; // 提交状态
console.log("summary", summary); console.log("summary", summary);
this.submit("sign", this.detailsInfo.signImg); this.submit("sign", this.detailsInfo.signImg);
}, },
......
...@@ -715,7 +715,7 @@ export default { ...@@ -715,7 +715,7 @@ export default {
// 返回 // 返回
back() { back() {
uni.navigateTo({ uni.navigateTo({
url: `/pages/inspectionContent/inspectionContentList?uid=${this.uid}&backValue=${this.backValue}`, url: `/pages/inspectionContent/inspectionContentList?uid=${this.uid}&backValue=${this.backValue}&value=${this.value}`,
}); });
}, },
// 关闭弹窗 // 关闭弹窗
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论