修改并优化了一些功能及bug
This commit is contained in:
@@ -195,11 +195,21 @@ const _sfc_main = {
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
};
|
||||
const onStartDateConfirm = (e) => {
|
||||
formData.startDate = formatDateTime(e.value);
|
||||
const selectedDate = formatDateTime(e.value);
|
||||
if (formData.endDate && new Date(selectedDate) > new Date(formData.endDate)) {
|
||||
common_vendor.index.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)) {
|
||||
common_vendor.index.showToast({ title: "结束时间不能早于开始时间", icon: "none" });
|
||||
return;
|
||||
}
|
||||
formData.endDate = selectedDate;
|
||||
showEndDatePicker.value = false;
|
||||
};
|
||||
const manualCheckItems = common_vendor.ref([]);
|
||||
@@ -228,7 +238,7 @@ const _sfc_main = {
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:669", "删除检查项失败:", error);
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:681", "删除检查项失败:", error);
|
||||
common_vendor.index.showToast({ title: "删除失败", icon: "none" });
|
||||
}
|
||||
} else {
|
||||
@@ -304,7 +314,7 @@ const _sfc_main = {
|
||||
hasMoreLaw.value = lawList.value.length < total;
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:756", "获取法规列表失败:", error);
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:768", "获取法规列表失败:", error);
|
||||
} finally {
|
||||
lawLoading.value = false;
|
||||
}
|
||||
@@ -384,7 +394,7 @@ const _sfc_main = {
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:856", "添加检查项失败:", error);
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:868", "添加检查项失败:", error);
|
||||
common_vendor.index.showToast({ title: "添加失败", icon: "none" });
|
||||
}
|
||||
};
|
||||
@@ -433,7 +443,7 @@ const _sfc_main = {
|
||||
hasMoreLibrary.value = libraryList.value.length < total;
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:916", "获取检查库列表失败:", error);
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:928", "获取检查库列表失败:", error);
|
||||
} finally {
|
||||
libraryLoading.value = false;
|
||||
}
|
||||
@@ -486,7 +496,7 @@ const _sfc_main = {
|
||||
selectedLibraries.value = [];
|
||||
} catch (error) {
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:981", "获取检查库详情失败:", error);
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:993", "获取检查库详情失败:", error);
|
||||
common_vendor.index.showToast({ title: "添加失败", icon: "none" });
|
||||
}
|
||||
};
|
||||
@@ -519,6 +529,10 @@ const _sfc_main = {
|
||||
common_vendor.index.showToast({ title: "请选择计划时间", icon: "none" });
|
||||
return;
|
||||
}
|
||||
if (new Date(formData.endDate) < new Date(formData.startDate)) {
|
||||
common_vendor.index.showToast({ title: "结束时间不能早于开始时间", icon: "none" });
|
||||
return;
|
||||
}
|
||||
const items = [];
|
||||
manualCheckItems.value.forEach((item) => {
|
||||
if (item.id) {
|
||||
@@ -528,8 +542,8 @@ const _sfc_main = {
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -586,7 +600,7 @@ const _sfc_main = {
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:1101", "保存失败:", error);
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:1117", "保存失败:", error);
|
||||
common_vendor.index.showToast({ title: "保存失败", icon: "none" });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"navigationBarTitleText": "编辑检查表",
|
||||
"navigationBarTitleText": "添加检查表",
|
||||
"usingComponents": {
|
||||
"up-input": "../../uni_modules/uview-plus/components/u-input/u-input",
|
||||
"up-picker": "../../uni_modules/uview-plus/components/u-picker/u-picker",
|
||||
|
||||
Reference in New Issue
Block a user