|
|
@@ -217,7 +217,7 @@
|
|
|
<el-col :xs="colSpan.xs" :sm="colSpan.sm" :md="colSpan.md" :lg="colSpan.lg" :xl="colSpan.xl">
|
|
|
<el-form-item label="注册日期" prop="registerDate" class="red-btn">
|
|
|
<el-date-picker v-dateFormat v-model="carInfo.registerDate" :picker-options="pickerOptions" @blur="getCompanyList"
|
|
|
- value-format="yyyy-MM-dd" type="date" placeholder="选择注册日期" placement="bottom-start"></el-date-picker>
|
|
|
+ value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date" placeholder="选择注册日期" placement="bottom-start" @change="validateDate"></el-date-picker>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :xs="colSpan.xs" :sm="colSpan.sm" :md="colSpan.md" :lg="colSpan.lg" :xl="colSpan.xl">
|
|
|
@@ -6065,6 +6065,34 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
+ validateDate(value) {
|
|
|
+ console.log('有值吗?', value)
|
|
|
+ if(value) {
|
|
|
+ let [Year, Month, Day] = value.split('-')
|
|
|
+ // 创建并返回正确的日期对象
|
|
|
+ const date = new Date(Year, Month-1, Day);
|
|
|
+ const myYear = date.getFullYear(), myMonth = date.getMonth() + 1, myDay = date.getDay()
|
|
|
+ console.log(123123123, myYear, myMonth, myDay)
|
|
|
+ }
|
|
|
+
|
|
|
+ // const regex = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
|
+ // const match = value.match(regex);
|
|
|
+ // if (match) {
|
|
|
+ // const [year, month, day] = match.slice(1).map(Number);
|
|
|
+ // // 创建一个新的 Date 对象来检查日期的有效性
|
|
|
+ // const date = new Date(year, month - 1, day);
|
|
|
+ // // 检查月份是否正确以及日期是否有效
|
|
|
+ // if (date.getFullYear() === year && date.getMonth() + 1 === month && date.getDate() === day) {
|
|
|
+ // this.$message.success(('日期有效'))
|
|
|
+ // } else {
|
|
|
+ // this.$message.error('请输入正确的日期格式');
|
|
|
+ // this.carInfo.registerDate = ''
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // this.$message.error('请输入正确的日期格式');
|
|
|
+ // this.carInfo.registerDate = ''
|
|
|
+ // }
|
|
|
+ },
|
|
|
vehicleUseChange(value){
|
|
|
if(value='05'){
|
|
|
this.carInfo.property='1';
|