From e1fca1a98c4da6122ccaeaf25575ed405487ab81 Mon Sep 17 00:00:00 2001
From: fcx <2246384483@qq.com>
Date: 星期三, 03 十二月 2025 18:01:34 +0800
Subject: [PATCH] 新加如果上限值小于标准值提示上限值过小应大于等于标准值,如果下限值大于标准值提示下限值过大应小于等于标准值
---
pages/QC/SJ/detail.vue | 89 +++++++++++++++++++++++++++++++++++---------
1 files changed, 71 insertions(+), 18 deletions(-)
diff --git a/pages/QC/SJ/detail.vue b/pages/QC/SJ/detail.vue
index 5852394..ed5caee 100644
--- a/pages/QC/SJ/detail.vue
+++ b/pages/QC/SJ/detail.vue
@@ -40,15 +40,16 @@
<view class="info-label">妫�楠屾暟</view>
<view class="info-value">{{ formData.levelNum }}</view>
</view>
- <view v-if="formData.minValue" class="info-item">
+ <!-- 淇锛氫娇鐢ㄦ洿鍑嗙‘鐨勫垽鏂潯浠讹紝閬垮厤0琚鍒や负falsy -->
+ <view v-if="formData.minValue != null" class="info-item">
<view class="info-label">涓嬮檺</view>
<view class="info-value">{{ formData.minValue }}</view>
</view>
- <view v-if="formData.standardValue" class="info-item">
+ <view v-if="formData.standardValue != null" class="info-item">
<view class="info-label">鏍囧噯鍊�</view>
<view class="info-value">{{ formData.standardValue }}</view>
</view>
- <view v-if="formData.maxValue" class="info-item">
+ <view v-if="formData.maxValue != null" class="info-item">
<view class="info-label">涓婇檺</view>
<view class="info-value">{{ formData.maxValue }}</view>
</view>
@@ -69,11 +70,11 @@
<view class="section-header">妫�楠岀粨鏋�</view>
<view class="section-body">
<view class="info-grid">
- <view v-if="formData.result" class="info-item">
+ <view v-if="formData.result != null" class="info-item">
<view class="info-label">棰勮缁撴灉</view>
<view class="info-value">{{ formData.result }}</view>
</view>
- <view v-if="formData.remarks" class="info-item">
+ <view v-if="formData.remarks != null" class="info-item">
<view class="info-label">澶囨敞</view>
<view class="info-value danger">{{ formData.remarks }}</view>
</view>
@@ -85,7 +86,8 @@
<view class="section">
<view class="section-header">妫�楠岀粨鏋滃綍鍏�</view>
<view class="section-body">
- <view v-if="!formData.maxValue && !formData.minValue" class="info-item edit">
+ <!-- 淇锛氫娇鐢ㄦ洿鍑嗙‘鐨勫垽鏂潯浠讹紝閬垮厤0琚鍒や负falsy -->
+ <view v-if="formData.maxValue == null && formData.minValue == null" class="info-item edit">
<view class="info-label" style="color: #F56C6C">鎻愮ず</view>
<view class="info-value" style="color: #F56C6C">娌℃湁鏈�澶у�煎拰鏈�灏忓�兼椂濉啓0锛堟湭閫氳繃妫�楠岋級鎴�1锛堥�氳繃妫�楠岋級</view>
</view>
@@ -102,7 +104,7 @@
</button>
<input v-if="(tableData.length < formData.levelNum)" v-model="formData.fcheckResu" class="result-input"
placeholder="璇疯緭鍏ユ楠岀粨鏋�..." type="number"/>
- <button v-if="(tableData.length < formData.levelNum)" class="btn primary-btn" @click="submit">淇濆瓨缁撴灉
+ <button v-if="(tableData.length < formData.levelNum)" class="btn primary-btn" @click="submit" style="margin: 0px;">淇濆瓨缁撴灉
</button>
</view>
</view>
@@ -110,20 +112,21 @@
<!-- 鍝嶅簲寮忚璁$殑绗簩涓緭鍏ョ粍 -->
<view class="input-group input2">
<view class="input-wrapper">
- <button class="btn upload-btn" @click="chooseImage">
+ <button class="btn upload-btn" @click="chooseImage ">
<uni-icons type="upload" size="16" color="#fff"></uni-icons>
涓婁紶/鏌ョ湅鍥剧墖
</button>
- <button v-if="current" class="btn upload-btn" @click="saveRemarks">
+ <button v-if="current" class="btn upload-btn" @click="saveRemarks ">
<uni-icons type="compose" size="16" color="#fff"></uni-icons>
澶囨敞
</button>
</view>
<view class="input-wrapper" style="margin-top: 15px;">
- <input v-if="(tableData.length < formData.levelNum)" v-model="formData.fcheckResu" class="result-input"
+ <input v-if="(tableData.length < formData.levelNum)" v-model="formData.fcheckResu" class="result-input"
placeholder="璇疯緭鍏ユ楠岀粨鏋�..." type="number"/>
- <button v-if="(tableData.length < formData.levelNum) && current" class="btn primary-btn" @click="submit">淇濆瓨缁撴灉
- </button>
+
+ <button v-if="tableData.length < formData.levelNum" class="btn primary-btn" @click="submit" style="margin: 0px;" >淇濆瓨缁撴灉
+ </button>
</view>
</view>
</view>
@@ -266,8 +269,8 @@
let count = this.formData.levelNum;
let fstand = "鈭�";
- //鏈夋渶澶у�煎拰鏈�灏忓�煎氨鏍规嵁鏄惁绗﹀悎鏍囧噯鍊兼洿鏂板垽瀹氱粨鏋滐紝娌℃湁鏈�澶у�煎拰鏈�灏忓�煎氨鏍规嵁鏄惁閫氳繃妫�楠屽垽瀹氱粨鏋�
- if (this.formData.maxValue && this.formData.minValue) {
+ // 淇锛氫娇鐢ㄦ洿鍑嗙‘鐨勫垽鏂潯浠讹紝閬垮厤0琚鍒や负falsy
+ if (this.formData.maxValue != null && this.formData.minValue != null) {
if (!this.formData.fcheckResu) {
this.$showMessage("璇疯緭鍏ユ楠屽��");
@@ -277,6 +280,19 @@
let checkValue = Number(this.formData.fcheckResu);
let minValue = Number(this.formData.minValue);
let maxValue = Number(this.formData.maxValue);
+ let standardValue = Number(this.formData.standardValue);
+
+ // 娣诲姞鏂扮殑楠岃瘉锛氭鏌ヤ笂闄愬�煎拰涓嬮檺鍊间笌鏍囧噯鍊肩殑鍏崇郴
+ if (this.formData.standardValue != null) {
+ if (maxValue < standardValue) {
+ this.$showMessage("涓婇檺鍊艰繃灏忥紝搴斿ぇ浜庣瓑浜庢爣鍑嗗��");
+ return;
+ }
+ if (minValue > standardValue) {
+ this.$showMessage("涓嬮檺鍊艰繃澶э紝搴斿皬浜庣瓑浜庢爣鍑嗗��");
+ return;
+ }
+ }
if (isNaN(checkValue) || isNaN(minValue) || isNaN(maxValue)) {
this.$showMessage("妫�楠屽�兼垨鑼冨洿鍊兼牸寮忎笉姝g‘锛岃妫�鏌ヨ緭鍏�");
@@ -338,7 +354,8 @@
this.isShowImg = true;
this.base64Image = 'data:image/jpeg;base64,' + this.formData.imageData;
}
- if (this.formData.maxValue && this.formData.minValue && this.formData.standardValue) {
+ // 淇锛氫娇鐢ㄦ洿鍑嗙‘鐨勫垽鏂潯浠讹紝閬垮厤0琚鍒や负falsy
+ if (this.formData.maxValue != null && this.formData.minValue != null && this.formData.standardValue != null) {
this.isNumber = true;
}
})
@@ -370,7 +387,8 @@
let fstand = "鈭�";
- if (this.formData.maxValue && this.formData.minValue) {
+ // 淇锛氫娇鐢ㄦ洿鍑嗙‘鐨勫垽鏂潯浠讹紝閬垮厤0琚鍒や负falsy
+ if (this.formData.maxValue != null && this.formData.minValue != null) {
if (!this.editData.fcheckResu) {
this.$showMessage("璇疯緭鍏ユ楠屽��");
@@ -380,6 +398,19 @@
let checkValue = Number(this.editData.fcheckResu);
let minValue = Number(this.formData.minValue);
let maxValue = Number(this.formData.maxValue);
+ let standardValue = Number(this.formData.standardValue);
+
+ // 娣诲姞鏂扮殑楠岃瘉锛氭鏌ヤ笂闄愬�煎拰涓嬮檺鍊间笌鏍囧噯鍊肩殑鍏崇郴
+ if (this.formData.standardValue != null) {
+ if (maxValue < standardValue) {
+ this.$showMessage("涓婇檺鍊艰繃灏忥紝搴斿ぇ浜庣瓑浜庢爣鍑嗗��");
+ return;
+ }
+ if (minValue > standardValue) {
+ this.$showMessage("涓嬮檺鍊艰繃澶э紝搴斿皬浜庣瓑浜庢爣鍑嗗��");
+ return;
+ }
+ }
if (isNaN(checkValue) || isNaN(minValue) || isNaN(maxValue)) {
this.$showMessage("妫�楠屽�兼垨鑼冨洿鍊兼牸寮忎笉姝g‘锛岃妫�鏌ヨ緭鍏�");
@@ -398,9 +429,13 @@
this.editData.fcheckResu = 1
}
+ // 鏀硅繘鍚庣殑閫昏緫锛氭牴鎹楠岀粨鏋滃�兼潵鍒ゆ柇鍚堟牸涓庡惁
if (this.editData.fcheckResu == 0 || this.editData.fcheckResu == 1) {
+ // 0琛ㄧず涓嶅悎鏍硷紝1琛ㄧず鍚堟牸
if (this.editData.fcheckResu == 0) {
fstand = "脳";
+ } else {
+ fstand = "鈭�";
}
} else {
this.$showMessage("鏃犳爣鍑嗗�兼椂锛屾楠岀粨鏋滃彧鑳戒负0鎴�1!");
@@ -487,14 +522,16 @@
},
// 鍒ゆ柇鏁板瓧鏄惁鍦ㄨ寖鍥村唴
isInRange(value) {
- if (!this.formData.maxValue || !this.formData.minValue) return true;
+ // 淇锛氫娇鐢ㄦ洿鍑嗙‘鐨勫垽鏂潯浠讹紝閬垮厤0琚鍒や负falsy
+ if (this.formData.maxValue == null || this.formData.minValue == null) return true;
const numValue = parseFloat(value);
return numValue >= parseFloat(this.formData.minValue) &&
numValue <= parseFloat(this.formData.maxValue);
},
// 鑾峰彇鏁板瓧缁撴灉鐨勬牱寮忕被
getNumberResultClass(value) {
- if (!this.formData.maxValue || !this.formData.minValue) return 'number-normal';
+ // 淇锛氫娇鐢ㄦ洿鍑嗙‘鐨勫垽鏂潯浠讹紝閬垮厤0琚鍒や负falsy
+ if (this.formData.maxValue == null || this.formData.minValue == null) return 'number-normal';
return this.isInRange(value) ? 'number-pass' : 'number-fail';
},
// 鑾峰彇鐘舵�佺粨鏋滅殑鏍峰紡绫�
@@ -653,6 +690,15 @@
border: none;
border-radius: 4px;
}
+
+ .primary-btn {
+ height: 45px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ border: none;
+ border-radius: 4px;
+ }
}
}
@@ -721,6 +767,13 @@
&.primary-btn {
background-color: $primary-color;
color: #fff;
+ height: 45px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ border: none;
+ border-radius: 4px;
+ padding: 0 20px;
}
&.cancel-btn {
--
Gitblit v1.9.3