From f214efc8f70964b77e0d2cc62fe05fa40e4d68be Mon Sep 17 00:00:00 2001
From: lizhenhua <1075222162@qq.com>
Date: Thu, 7 Aug 2025 16:18:49 +0800
Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E9=85=8D=E7=BD=AE=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9=20=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../purchaseManage/goodsInquiry/edit.vue | 51 +++++++++++++++++--
1 file changed, 46 insertions(+), 5 deletions(-)
diff --git a/src/views/foodManage/purchaseManage/goodsInquiry/edit.vue b/src/views/foodManage/purchaseManage/goodsInquiry/edit.vue
index 3cbd3dae..a48a1dbe 100644
--- a/src/views/foodManage/purchaseManage/goodsInquiry/edit.vue
+++ b/src/views/foodManage/purchaseManage/goodsInquiry/edit.vue
@@ -85,11 +85,23 @@
-
+
+
+
+ limitDecimalInput(v, scope.row, 'purNum')"
+ />
+
+
@@ -268,6 +280,35 @@ export default {
},
},
methods: {
+ limitDecimalInput(value, row, key) {
+ // 只允许数字和小数点
+ let val = value.replace(/[^\d.]/g, '');
+
+ // 不允许开头是多个 0(除非小数)
+ val = val.replace(/^0+(\d)/, '$1');
+ val = val.replace(/^\./, '');
+
+ // 只保留第一个小数点
+ val = val.replace('.', '#').replace(/\./g, '').replace('#', '.');
+
+ // 限制整数7位,小数最多3位
+ if (val.includes('.')) {
+ let [intPart, decPart] = val.split('.');
+ intPart = intPart.slice(0, 7);
+ decPart = decPart.slice(0, 3);
+ val = intPart + '.' + decPart;
+ } else {
+ val = val.slice(0, 7); // 纯整数最多7位
+ }
+
+ // 限制最大值为 9999999.999
+ const max = 9999999.999;
+ if (parseFloat(val) > max) {
+ val = max.toString();
+ }
+
+ row[key] = val;
+ },
// 返回列表页
jumpList() {
const obj = { path: "/foodManage/purchaseManage/goodsInquiryEdit" };
@@ -283,7 +324,7 @@ export default {
getGoodsInquiryInfoApi(param).then((response) => {
this.baseInfo = response.data;
console.log("this.baseInfo",this.baseInfo);
- this.$set(this.baseInfo,'dateRange',[this.baseInfo.startTime,this.baseInfo.endTime])
+ this.$set(this.baseInfo,'dateRange',[this.baseInfo.startTime,this.baseInfo.endTime])
this.materialList = this.baseInfo.detailList;
supplierPageApi({ isPaging:1,areaIdList:[] }).then((response) => {
this.supplierOptions = response.rows||[];
@@ -362,7 +403,7 @@ export default {
resetQuery() {
this.queryParams = {
pageNum: 1,
- pageSize: 10,
+ pageSize: 10,
}
this.resetForm("queryForm");
this.handleQuery();
@@ -393,11 +434,11 @@ export default {
confirmChosen(){
if(this.batchChosenMaterial.length>0){
this.loading = true
- let items = [...this.materialList,...this.batchChosenMaterial]
+ let items = [...this.materialList,...this.batchChosenMaterial]
let uniqueItems = items.filter((item, index, array) => {
return array.findIndex((t) => (t.materialId === item.materialId)) === index;
});
- this.materialList = uniqueItems
+ this.materialList = uniqueItems
this.materialList.forEach(item=>{
this.$set(item,"unitPrice",item.unitPrice/100)
})