|
@@ -651,29 +651,14 @@ const updateProd = async (data, msg, fn) => {
|
|
|
fn ? fn() : "";
|
|
|
});
|
|
|
};
|
|
|
-const validInput = async (record, min, max, type) => {
|
|
|
- // if (!record[type]) return;
|
|
|
- // if (record[type] > max) {
|
|
|
- // record[type] = max;
|
|
|
- // } else if (record[type] < min) {
|
|
|
- // record[type] = min;
|
|
|
- // } else {
|
|
|
- // record[type] = record[type];
|
|
|
- // }
|
|
|
+const validInput = (record) => {
|
|
|
const pd = new Product(record)
|
|
|
- let lengthValidData = { min: min, max: max, type: type };
|
|
|
- let widthValData = { min:min, max: max, type: type };
|
|
|
-
|
|
|
- if (!pd.checkDimension(widthValData, record, 'width', '自定义宽度超出可选范围!')) {
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- if (!pd.checkDimension(lengthValidData, record, 'length', '自定义长度超出可选范围!')) {
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- // 如果所有检查都通过
|
|
|
- return true;
|
|
|
+ let lengthValidData = {min: record.lengthmin, max:record.lengthmax,}
|
|
|
+ let widthValData = {min: record.widthmin, max: record.widthmax,}
|
|
|
+ if (!pd.checkDimension({width:widthValData,length:lengthValidData}, record)) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return true
|
|
|
};
|
|
|
const qtyModal = ref(false)
|
|
|
const promotionQty = ref(null)
|
|
@@ -932,6 +917,8 @@ const openCustom = (data) => {
|
|
|
prod.value = data;
|
|
|
};
|
|
|
const handleOk = () => {
|
|
|
+ if (!validInput(prod.value.record))
|
|
|
+ return false
|
|
|
prod.value.record.isselect = true;
|
|
|
prodlist.value.data.some((item) => {
|
|
|
if (item.itemid == prod.value.itemid) {
|