Commit 71341c86 authored by tanjunxin's avatar tanjunxin

fix: 日期选择器增加限制

parent 463905a2
......@@ -290,6 +290,7 @@
value-format="yyyy-MM-dd HH:mm:ss"
format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择计划开始时间"
:picker-options="pickerOptions"
@focus="writeRow(scope.row)"
@change="editTime(scope.row, 'start')"
>
......@@ -315,6 +316,7 @@
value-format="yyyy-MM-dd HH:mm:ss"
format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择计划结束时间"
:picker-options="pickerOptions"
@focus="writeRow(scope.row)"
@change="editTime(scope.row, 'end')"
>
......@@ -730,8 +732,15 @@ export default {
// 表单校验
rules: {
},
timestamp: 0
};
timestamp: 0,
pickerOptions: {
disabledDate(time) {
return time.getTime() < Date.now() - 8.64e7
},
selectableRange:
new Date().getHours() + ':' + (new Date().getMinutes() + 1) + ':00' + ' - 23:59:59',
}
}
},
created() {
// this.getList();
......@@ -993,7 +1002,9 @@ export default {
console.log('duration', duration)
row.scheduleStartDate = dayjs(row.scheduleEndDate).add(duration).format('YYYY-MM-DD HH:mm:ss')
}
this.submitForm(row)
console.log(scheduleStartDate)
console.log(scheduleEndDate)
// this.submitForm(row)
},
/** 搜索按钮操作 */
handleWorkunitQuery() {
......
......@@ -36,6 +36,7 @@
style="width: 100%;"
placeholder="请选择计划开始时间"
format ="yyyy-MM-dd HH:mm:ss"
:picker-options="pickerOptions"
value-format="yyyy-MM-dd HH:mm:ss">
</el-date-picker>
</el-form-item>
......@@ -51,6 +52,7 @@
style="width: 100%;"
placeholder="请选择计划结束时间"
format ="yyyy-MM-dd HH:mm:ss"
:picker-options="pickerOptions"
value-format="yyyy-MM-dd HH:mm:ss">
</el-date-picker>
</el-form-item>
......@@ -110,6 +112,13 @@ export default {
}
]
},
pickerOptions: {
disabledDate(time) {
return time.getTime() < Date.now() - 8.64e7
},
selectableRange:
new Date().getHours() + ':' + (new Date().getMinutes() + 1) + ':00' + ' - 23:59:59',
}
};
},
created() {
......
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