Commit 71341c86 authored by tanjunxin's avatar tanjunxin

fix: 日期选择器增加限制

parent 463905a2
...@@ -226,7 +226,7 @@ ...@@ -226,7 +226,7 @@
{{ row.virtualFlag ? '是' : '否' }} {{ row.virtualFlag ? '是' : '否' }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="工序名称" label="工序名称"
align="center" align="center"
prop="processName" prop="processName"
...@@ -290,6 +290,7 @@ ...@@ -290,6 +290,7 @@
value-format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择计划开始时间" placeholder="请选择计划开始时间"
:picker-options="pickerOptions"
@focus="writeRow(scope.row)" @focus="writeRow(scope.row)"
@change="editTime(scope.row, 'start')" @change="editTime(scope.row, 'start')"
> >
...@@ -315,6 +316,7 @@ ...@@ -315,6 +316,7 @@
value-format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择计划结束时间" placeholder="请选择计划结束时间"
:picker-options="pickerOptions"
@focus="writeRow(scope.row)" @focus="writeRow(scope.row)"
@change="editTime(scope.row, 'end')" @change="editTime(scope.row, 'end')"
> >
...@@ -730,8 +732,15 @@ export default { ...@@ -730,8 +732,15 @@ export default {
// 表单校验 // 表单校验
rules: { 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() { created() {
// this.getList(); // this.getList();
...@@ -993,7 +1002,9 @@ export default { ...@@ -993,7 +1002,9 @@ export default {
console.log('duration', duration) console.log('duration', duration)
row.scheduleStartDate = dayjs(row.scheduleEndDate).add(duration).format('YYYY-MM-DD HH:mm:ss') 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() { handleWorkunitQuery() {
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
style="width: 100%;" style="width: 100%;"
placeholder="请选择计划开始时间" placeholder="请选择计划开始时间"
format ="yyyy-MM-dd HH:mm:ss" format ="yyyy-MM-dd HH:mm:ss"
:picker-options="pickerOptions"
value-format="yyyy-MM-dd HH:mm:ss"> value-format="yyyy-MM-dd HH:mm:ss">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
...@@ -51,6 +52,7 @@ ...@@ -51,6 +52,7 @@
style="width: 100%;" style="width: 100%;"
placeholder="请选择计划结束时间" placeholder="请选择计划结束时间"
format ="yyyy-MM-dd HH:mm:ss" format ="yyyy-MM-dd HH:mm:ss"
:picker-options="pickerOptions"
value-format="yyyy-MM-dd HH:mm:ss"> value-format="yyyy-MM-dd HH:mm:ss">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
...@@ -110,6 +112,13 @@ export default { ...@@ -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() { 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