Commit 325f564a by huaying

fix: 宝宝生日限制

parent 7399d9ba
......@@ -39,6 +39,7 @@
value-format="yyyy-MM-dd"
v-model="fieldsList[activeName].form[item.systemFieldId]"
type="date"
:picker-options="pickerOptions()"
/>
<el-select v-if="item.fieldType == 2" :placeholder="item.fieldDescription" v-model="fieldsList[activeName].form[item.systemFieldId]" style="width: 160px;">
<el-option v-for="(el, index) in JSON.parse(item.fieldContent.replaceAll('\'', '&quot;'))" :key="index" :label="el.name" :value="el.name" />
......@@ -195,22 +196,24 @@ export default {
}
}
return { validator: validatePass, trigger: 'blur' }
} else if(item.unifiedIdentification == 'k20303') {
let rule = JSON.parse(item.fieldContent.replaceAll('\'', '"'));
let time = rule.timeLong
validatePass = (rule, value, callback) => {
if (value === '' || value === null) {
callback();
} else if (new Date().getFullYear() - new Date(value).getFullYear() > parseInt(time)) {
callback(new Error(`超过当前日期时间之前${time}年`));
} else if(new Date(value) > new Date()) {
callback(new Error(`超过当前日期时间`));
} else {
callback();
}
}
return { validator: validatePass, trigger: 'blur' }
} else {
}
// else if(item.unifiedIdentification == 'k20303') {
// let rule = JSON.parse(item.fieldContent.replaceAll('\'', '"'));
// let time = rule.timeLong
// validatePass = (rule, value, callback) => {
// if (value === '' || value === null) {
// callback();
// } else if (new Date().getFullYear() - new Date(value).getFullYear() > parseInt(time)) {
// callback(new Error(`超过当前日期时间之前${time}年`));
// } else if(new Date(value) > new Date()) {
// callback(new Error(`超过当前日期时间`));
// } else {
// callback();
// }
// }
// return { validator: validatePass, trigger: 'blur' }
// }
else {
return null
}
},
......
<template>
<div>
<el-dialog
title="编辑基本信息333"
title="编辑基本信息"
custom-class="customer-dialog"
:visible.sync="visible"
:close-on-click-modal="false"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment