diff --git a/src/views/certificate/certificateReturnManage/certificateSave/index.vue b/src/views/certificate/certificateReturnManage/certificateSave/index.vue index 586d3cf..d54a970 100644 --- a/src/views/certificate/certificateReturnManage/certificateSave/index.vue +++ b/src/views/certificate/certificateReturnManage/certificateSave/index.vue @@ -111,6 +111,8 @@ v-model="baseForm.processDate" type="date" placeholder="选择日期" + :disabled-date="disabledBeforeToday" + :picker-options="pickerOptions" format="yyyy-MM-dd" style="width: 100%" value-format="yyyy-MM-dd"> @@ -145,6 +147,13 @@ components: { Treeselect }, data() { return { + pickerOptions: { + disabledDate(time) { + // 选择今天以及今天之后的日期 + return time.getTime() < Date.now() - 8.64e7// 如果没有后面的-8.64e7就是不可以选择 + // 选择今天以及今天之前的日期 + // return time.getTime() > Date.now() - 8.64e7// 如果没有后面的-8.64e7就是不可以选择今天的 + } }, // 遮罩层 loading: true, // 选中数组 @@ -215,6 +224,14 @@ }, methods: { + disabledBeforeToday(time) { + // 获取今天的日期 + const today = new Date(); + today.setHours(0, 0, 0, 0); // 设置时间为午夜12点,以确保比较时不考虑时间部分 + // 比较传入的日期是否早于今天 + console.log("disabledBeforeToday",time) + return time.getTime() < today.getTime(); + }, /** 搜索按钮操作 */ handleQuery() { this.queryParams.pageNum = 1;