修改并优化了一些功能及bug
This commit is contained in:
@@ -623,12 +623,24 @@ const formatDateTime = (timestamp) => {
|
||||
};
|
||||
|
||||
const onStartDateConfirm = (e) => {
|
||||
formData.startDate = formatDateTime(e.value);
|
||||
const selectedDate = formatDateTime(e.value);
|
||||
// 如果已经选了结束时间,校验开始时间不能晚于结束时间
|
||||
if (formData.endDate && new Date(selectedDate) > new Date(formData.endDate)) {
|
||||
uni.showToast({ title: '开始时间不能晚于结束时间', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
formData.startDate = selectedDate;
|
||||
showStartDatePicker.value = false;
|
||||
};
|
||||
|
||||
const onEndDateConfirm = (e) => {
|
||||
formData.endDate = formatDateTime(e.value);
|
||||
const selectedDate = formatDateTime(e.value);
|
||||
// 如果已经选了开始时间,校验结束时间不能早于开始时间
|
||||
if (formData.startDate && new Date(selectedDate) < new Date(formData.startDate)) {
|
||||
uni.showToast({ title: '结束时间不能早于开始时间', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
formData.endDate = selectedDate;
|
||||
showEndDatePicker.value = false;
|
||||
};
|
||||
|
||||
@@ -1015,6 +1027,10 @@ const handleSave = async () => {
|
||||
uni.showToast({ title: '请选择计划时间', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
if (new Date(formData.endDate) < new Date(formData.startDate)) {
|
||||
uni.showToast({ title: '结束时间不能早于开始时间', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
// 构建 items 数组(关联检查项id列表)
|
||||
const items = [];
|
||||
@@ -1024,12 +1040,12 @@ const handleSave = async () => {
|
||||
items.push(item.id );
|
||||
}
|
||||
});
|
||||
// 添加从检查库选择的检查项详情中的所有项的 pointId
|
||||
// 添加从检查库选择的检查项详情中的所有项的 itemId
|
||||
checkItems.value.forEach(lib => {
|
||||
if (lib.details && lib.details.length > 0) {
|
||||
lib.details.forEach(detail => {
|
||||
if (detail.pointId) {
|
||||
items.push(detail.pointId );
|
||||
if (detail.itemId) {
|
||||
items.push(detail.itemId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user