guoyujia il y a 3 mois
Parent
commit
b726d4eeb0

+ 8 - 4
components/dialog-end-work/dialog-end-work.vue

@@ -89,6 +89,9 @@
 		listItem,
 		getIsFirstOrder,
 	} from '@/api/business/dayWorkItem.js'
+	import {
+		Decimal
+	} from 'decimal.js'
 
 	const baseDialog = ref(null)
 	const workInfo = ref({})
@@ -388,9 +391,9 @@
 
 		let max = parseInt(number * (qualifiedNumRatio.value / 100));
 		let sunm = parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value; //计算总合格数
-		let percent = (sunm / number) * 100; //合格率
-
-		percent = Math.ceil(percent * 100) / 100; //只入不舍
+		let percent = new Decimal(sunm).div(number).mul(100); // 使用 Decimal.js 计算
+		// 保留两位小数
+		percent = percent.toDecimalPlaces(2, Decimal.ROUND_DOWN).toString();
 		console.log("合格量", percent)
 		// let percent = (((parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value) / number) * 100).toFixed(2);
 
@@ -411,6 +414,7 @@
 				})
 			} else {
 				if (percent > num) {
+					console.log("999")
 					uni.showToast({
 						icon: 'none',
 						title: '合格数总量为投产量的' + percent + "%,请重新输入!"
@@ -421,7 +425,6 @@
 				}
 			}
 		} else {
-			console.log("999")
 			//判断当前序合格总数为0 ,不允许保存
 			console.log(parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value == 0)
 			if (workInfo.value.status == "3" && parseInt(workInfo.value.qualifiedNum) + lotPreSumQualifiedNum.value == 0) {
@@ -476,6 +479,7 @@
 					percent = qualifiedNumRatio.value
 				}
 				if (percent > num) {
+					console.log("888")
 					uni.showToast({
 						icon: 'none',
 						title: '合格数总量为投产量的' + percent + "%,请重新输入!"

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "(测试)德迈仕数字生产管理平台",
     "appid" : "__UNI__54D8B02",
     "description" : "",
-    "versionName" : "1.0.41",
-    "versionCode" : 141,
+    "versionName" : "1.0.42",
+    "versionCode" : 142,
     "transformPx" : false,
     /* 5+App特有相关 */
     "app-plus" : {

+ 1 - 0
package.json

@@ -1,5 +1,6 @@
 {
   "dependencies": {
+    "decimal.js": "^10.5.0",
     "vue-inset-loader": "^1.2.6",
     "vuex": "^4.1.0"
   }

+ 9 - 1
pages/notification/index.vue

@@ -66,9 +66,17 @@
 	function close() {
 		store.isNotification = true
 		let pages = getCurrentPages();
+		let index = 0
+		for (let i = pages.length - 1; i >= 0; i--) {
 
+			if (pages[i].$page.fullPath != "/pages/notification/index") {
+
+				index = pages.length - i - 1;
+				break
+			}
+		}
 		uni.navigateBack({
-			delta: pages.length - 2
+			delta: index
 		});
 		console.log(pages)
 	}