保存
@@ -67,13 +32,8 @@ const props = defineProps(["res", "type"]);
// 表单数据(init 中整体替换)
const formValidate = ref({
- goodsCheck: 1,
- smallPictureHeight: "0",
- smallPictureWidth: "0",
- abbreviationPictureWidth: "0",
- abbreviationPictureHeight: "0",
- originalPictureWidth: "0",
- originalPictureHeight: "0",
+ goodsCheck: "false",
+ selfOperatedGoodsCheck: "false",
});
// 校验规则(只做属性合并)
const ruleValidate = reactive({});
@@ -104,10 +64,11 @@ function setupSetting() {
}
function init() {
result.value = JSON.parse(props.res);
- Object.keys(result.value).map((item) => {
- result.value[item] += "";
- });
- formValidate.value = { ...result.value };
+ const toBooleanText = (value) => String(value === true || value === "true");
+ formValidate.value = {
+ goodsCheck: toBooleanText(result.value.goodsCheck),
+ selfOperatedGoodsCheck: toBooleanText(result.value.selfOperatedGoodsCheck ?? result.value.goodsCheck),
+ };
Object.keys(formValidate.value).forEach((item) => {
ruleValidate[item] = [
{