fix: 产品测试bug
This commit is contained in:
@@ -143,6 +143,7 @@
|
|||||||
showCount
|
showCount
|
||||||
:maxlength="30"
|
:maxlength="30"
|
||||||
placeholder="请输入测试产品名称"
|
placeholder="请输入测试产品名称"
|
||||||
|
@blur="validateFlavorInput(item)"
|
||||||
>
|
>
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<span class="suffix">
|
<span class="suffix">
|
||||||
@@ -157,6 +158,7 @@
|
|||||||
showCount
|
showCount
|
||||||
:maxlength="30"
|
:maxlength="30"
|
||||||
placeholder="请输入产品口味名称"
|
placeholder="请输入产品口味名称"
|
||||||
|
@blur="validateFlavorInput(item)"
|
||||||
>
|
>
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<span class="suffix">
|
<span class="suffix">
|
||||||
@@ -774,6 +776,17 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 输入框校验
|
||||||
|
function validateFlavorInput(item) {
|
||||||
|
if (
|
||||||
|
(item.text === "产品名称不能为空" && item.productName) ||
|
||||||
|
(item.text === "口味名称不能为空" && item.flavorName)
|
||||||
|
) {
|
||||||
|
item.status = false;
|
||||||
|
item.text = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 校验包装测试
|
// 校验包装测试
|
||||||
function validatePacking() {
|
function validatePacking() {
|
||||||
const innerStatus = validatePackingCardList(packingData.value.inner);
|
const innerStatus = validatePackingCardList(packingData.value.inner);
|
||||||
@@ -881,6 +894,7 @@ export default defineComponent({
|
|||||||
delFlavor,
|
delFlavor,
|
||||||
flavorBlur,
|
flavorBlur,
|
||||||
packingData,
|
packingData,
|
||||||
|
validateFlavorInput,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -52,7 +52,12 @@
|
|||||||
<div class="p-right">
|
<div class="p-right">
|
||||||
<div class="label">
|
<div class="label">
|
||||||
<span class="l-title">产品名称:</span>
|
<span class="l-title">产品名称:</span>
|
||||||
<a-input v-model:value="item.packName" :maxlength="30" placeholder="请输入产品名称">
|
<a-input
|
||||||
|
v-model:value="item.packName"
|
||||||
|
:maxlength="30"
|
||||||
|
placeholder="请输入产品名称"
|
||||||
|
@blur="validateInput(item)"
|
||||||
|
>
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<span class="suffix">
|
<span class="suffix">
|
||||||
{{ `${item.packName.length}/30` }}
|
{{ `${item.packName.length}/30` }}
|
||||||
@@ -62,7 +67,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="label">
|
<div class="label">
|
||||||
<span class="l-title">包装类型:</span>
|
<span class="l-title">包装类型:</span>
|
||||||
<a-input v-model:value="item.packType" :maxlength="30" placeholder="请输入包装类型">
|
<a-input
|
||||||
|
v-model:value="item.packType"
|
||||||
|
:maxlength="30"
|
||||||
|
placeholder="请输入包装类型"
|
||||||
|
@blur="validateInput(item)"
|
||||||
|
>
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<span class="suffix">
|
<span class="suffix">
|
||||||
{{ `${item.packName.length}/30` }}
|
{{ `${item.packName.length}/30` }}
|
||||||
@@ -236,8 +246,19 @@ export default defineComponent({
|
|||||||
item.text = "";
|
item.text = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 输入框校验
|
||||||
|
function validateInput(item) {
|
||||||
|
if (
|
||||||
|
(item.text === "产品名称不能为空" && item.packName) ||
|
||||||
|
(item.text === "包装类型不能为空" && item.packType)
|
||||||
|
) {
|
||||||
|
item.status = false;
|
||||||
|
item.text = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 图片上传校验
|
// 图片上传校验
|
||||||
function validateImg(item, index) {
|
function validateImg(item) {
|
||||||
if (item.text === "请上传产品图片" && item.packImg) {
|
if (item.text === "请上传产品图片" && item.packImg) {
|
||||||
item.status = false;
|
item.status = false;
|
||||||
item.text = "";
|
item.text = "";
|
||||||
@@ -255,6 +276,7 @@ export default defineComponent({
|
|||||||
handlePreview,
|
handlePreview,
|
||||||
setVisible,
|
setVisible,
|
||||||
validate,
|
validate,
|
||||||
|
validateInput,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user