提交 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 @@
{{ item.lableArr[1] }}
</view> </view
><input
v-if="'value' in item && item.inspectionResult === 1"
v-if="'value' in item"
class="input"
v-model="item.value"
type="text"
placeholder="请输入"
maxlength="3"
/>{{ item.inspectionResult === 1 ? item.unit : "" }}
/>{{ item.unit }}
</view>
<template v-if="item.inspectionResult === 1">
<view v-if="'conclusion' in item" class="form-item">
......@@ -133,7 +132,7 @@ export default {
lableArr: ["正常", "异常"],
conclusion: "",
settingLabel: "设定湿度",
setting: "25", //设定湿度值
setting: "20%~70", //设定湿度值
value: "", //输入湿度
unit: "%", //单位
photos: [],
......
......@@ -28,32 +28,63 @@
<view class="form-item">
<text class="form-label"
><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"
v-model="item.deviceId"
v-model="cabinet.deviceId"
type="text"
placeholder="请输入编号"
/>
</view>
<view class="form-item">
<text class="form-label"
><text class="required">*</text>{{ item.UpositonLabel }}</text
><input
><text class="required">*</text
>{{ cabinet.UpositonLabel }}</text
>
<NumberInput
class="input"
v-model="item.UpositonS"
v-model="cabinet.UpositonS"
type="number"
placeholder="请输入"
maxlength="2"
/>
<text class="fg"></text
><input
<!-- <input
class="input"
v-model="item.UpositonE"
v-model="cabinet.UpositonS"
type="number"
placeholder="请输入"
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>
<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">
<text class="form-label"
><text class="required">*</text>情况摘要</text
......@@ -98,12 +129,14 @@
</template>
<script>
import NumberInput from "@/components/NumberInput/index.vue";
import customPopup from "./customPopup.vue";
import _ from "lodash";
import mixin from "./mixin";
export default {
mixins: [mixin],
components: {
NumberInput,
customPopup,
},
props: {
......@@ -144,6 +177,15 @@ export default {
UpositonLabel: "U位",
UpositonS: "",
UpositonE: "",
cabinets: [
{
deviceId: "",
deviceLabel: "故障设备机柜",
UpositonLabel: "U位",
UpositonS: "",
UpositonE: "",
},
],
photos: [],
},
],
......
......@@ -76,7 +76,11 @@
>
<view
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="first-row">
......@@ -149,7 +153,12 @@
:key="cardIndex"
@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="first-row">
<image
......@@ -237,6 +246,7 @@ export default {
this.isDisable = options.isDisable == 1 ? true : false;
console.log("options.uid", this.options.uid);
this.uid = this.options.uid || "";
this.value = this.options.value || "1";
},
onShow() {
if (this.uid) {
......@@ -367,6 +377,7 @@ export default {
// 获取机房详情
getDetailsItem(location, jfType, value) {
this.activeName = location;
this.value = value;
this.detailsItem = this.detailsInfo.originData[value - 1].details;
this.jfType = this.detailsInfo.originData[value - 1].jfType;
if (this.detailsItem.afxt.detail[2].inspectionResult === 1) {
......@@ -464,6 +475,7 @@ export default {
handlePopupConfirm(summary) {
this.detailsInfo.isSign = this.isSign = true; // 回显到文字显示区域
this.detailsInfo.signImg = summary; // 回显到文字显示区域
this.detailsInfo.isSubmit = 1; // 提交状态
console.log("summary", summary);
this.submit("sign", this.detailsInfo.signImg);
},
......
......@@ -715,7 +715,7 @@ export default {
// 返回
back() {
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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论