隐患详情重新设计,检查计划重新设计成做题排查式
This commit is contained in:
@@ -45,8 +45,20 @@ const _sfc_main = {
|
||||
const onSwitchChange = (e) => {
|
||||
workdaySwitch.value = e.detail.value;
|
||||
};
|
||||
const startDateValue = common_vendor.ref(Number(/* @__PURE__ */ new Date()));
|
||||
const endDateValue = common_vendor.ref(Number(/* @__PURE__ */ new Date()));
|
||||
const getTodayTimestamp = () => {
|
||||
const now = /* @__PURE__ */ new Date();
|
||||
return new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime();
|
||||
};
|
||||
const todayMinDate = common_vendor.computed(() => getTodayTimestamp());
|
||||
const endDateMinDate = common_vendor.computed(() => {
|
||||
if (formData.startDate) {
|
||||
const [year, month, day] = formData.startDate.split("-").map(Number);
|
||||
return new Date(year, month - 1, day).getTime();
|
||||
}
|
||||
return getTodayTimestamp();
|
||||
});
|
||||
const startDateValue = common_vendor.ref(getTodayTimestamp());
|
||||
const endDateValue = common_vendor.ref(getTodayTimestamp());
|
||||
const showDeptPicker = common_vendor.ref(false);
|
||||
const showTypePicker = common_vendor.ref(false);
|
||||
const showModePicker = common_vendor.ref(false);
|
||||
@@ -103,7 +115,7 @@ const _sfc_main = {
|
||||
executorList.value = res.data || [];
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:505", "获取部门用户失败:", error);
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:522", "获取部门用户失败:", error);
|
||||
}
|
||||
};
|
||||
const toggleExecutorSelect = (item) => {
|
||||
@@ -132,7 +144,7 @@ const _sfc_main = {
|
||||
initDeptCascader(res.data);
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:543", "获取部门树失败:", error);
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:560", "获取部门树失败:", error);
|
||||
}
|
||||
};
|
||||
const initDeptCascader = (data) => {
|
||||
@@ -184,19 +196,42 @@ const _sfc_main = {
|
||||
}
|
||||
showCyclePicker.value = false;
|
||||
};
|
||||
const formatDateTime = (timestamp) => {
|
||||
const formatDate = (timestamp) => {
|
||||
const date = new Date(timestamp);
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, "0");
|
||||
const day = String(date.getDate()).padStart(2, "0");
|
||||
const hours = String(date.getHours()).padStart(2, "0");
|
||||
const minutes = String(date.getMinutes()).padStart(2, "0");
|
||||
const seconds = String(date.getSeconds()).padStart(2, "0");
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
return `${year}-${month}-${day}`;
|
||||
};
|
||||
const parseDateValue = (dateStr) => {
|
||||
if (!dateStr)
|
||||
return 0;
|
||||
const [datePart] = dateStr.split(" ");
|
||||
const [year, month, day] = datePart.split("-").map(Number);
|
||||
return new Date(year, month - 1, day).getTime();
|
||||
};
|
||||
const openStartDatePicker = () => {
|
||||
const today = getTodayTimestamp();
|
||||
if (startDateValue.value < today) {
|
||||
startDateValue.value = today;
|
||||
}
|
||||
showStartDatePicker.value = true;
|
||||
};
|
||||
const openEndDatePicker = () => {
|
||||
const minDate = endDateMinDate.value;
|
||||
if (endDateValue.value < minDate) {
|
||||
endDateValue.value = minDate;
|
||||
}
|
||||
showEndDatePicker.value = true;
|
||||
};
|
||||
const onStartDateConfirm = (e) => {
|
||||
const selectedDate = formatDateTime(e.value);
|
||||
if (formData.endDate && new Date(selectedDate) > new Date(formData.endDate)) {
|
||||
const selectedDate = formatDate(e.value);
|
||||
const todayStr = formatDate(getTodayTimestamp());
|
||||
if (selectedDate < todayStr) {
|
||||
common_vendor.index.showToast({ title: "开始时间不能早于今天", icon: "none" });
|
||||
return;
|
||||
}
|
||||
if (formData.endDate && parseDateValue(selectedDate) > parseDateValue(formData.endDate)) {
|
||||
common_vendor.index.showToast({ title: "开始时间不能晚于结束时间", icon: "none" });
|
||||
return;
|
||||
}
|
||||
@@ -204,8 +239,8 @@ const _sfc_main = {
|
||||
showStartDatePicker.value = false;
|
||||
};
|
||||
const onEndDateConfirm = (e) => {
|
||||
const selectedDate = formatDateTime(e.value);
|
||||
if (formData.startDate && new Date(selectedDate) < new Date(formData.startDate)) {
|
||||
const selectedDate = formatDate(e.value);
|
||||
if (formData.startDate && parseDateValue(selectedDate) < parseDateValue(formData.startDate)) {
|
||||
common_vendor.index.showToast({ title: "结束时间不能早于开始时间", icon: "none" });
|
||||
return;
|
||||
}
|
||||
@@ -249,7 +284,7 @@ const _sfc_main = {
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:700", "删除检查项失败:", error);
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:740", "删除检查项失败:", error);
|
||||
common_vendor.index.showToast({ title: "删除失败", icon: "none" });
|
||||
}
|
||||
} else {
|
||||
@@ -325,7 +360,7 @@ const _sfc_main = {
|
||||
hasMoreLaw.value = lawList.value.length < total;
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:787", "获取法规列表失败:", error);
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:827", "获取法规列表失败:", error);
|
||||
} finally {
|
||||
lawLoading.value = false;
|
||||
}
|
||||
@@ -405,7 +440,7 @@ const _sfc_main = {
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:887", "添加检查项失败:", error);
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:927", "添加检查项失败:", error);
|
||||
common_vendor.index.showToast({ title: "添加失败", icon: "none" });
|
||||
}
|
||||
};
|
||||
@@ -454,7 +489,7 @@ const _sfc_main = {
|
||||
hasMoreLibrary.value = libraryList.value.length < total;
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:947", "获取检查库列表失败:", error);
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:987", "获取检查库列表失败:", error);
|
||||
} finally {
|
||||
libraryLoading.value = false;
|
||||
}
|
||||
@@ -557,7 +592,7 @@ const _sfc_main = {
|
||||
selectedLibraries.value = [];
|
||||
} catch (error) {
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:1067", "获取检查库详情失败:", error);
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:1107", "获取检查库详情失败:", error);
|
||||
common_vendor.index.showToast({ title: "添加失败", icon: "none" });
|
||||
}
|
||||
};
|
||||
@@ -590,7 +625,7 @@ const _sfc_main = {
|
||||
common_vendor.index.showToast({ title: "请选择计划时间", icon: "none" });
|
||||
return;
|
||||
}
|
||||
if (new Date(formData.endDate) < new Date(formData.startDate)) {
|
||||
if (parseDateValue(formData.endDate) < parseDateValue(formData.startDate)) {
|
||||
common_vendor.index.showToast({ title: "结束时间不能早于开始时间", icon: "none" });
|
||||
return;
|
||||
}
|
||||
@@ -634,8 +669,8 @@ const _sfc_main = {
|
||||
// 从检查库选择的库id数组
|
||||
cycle: cycleMap[formData.cycleName] || 1,
|
||||
isWeekend: workdaySwitch.value ? 1 : 2,
|
||||
planStartTime: formData.startDate,
|
||||
planEndTime: formData.endDate
|
||||
planStartTime: `${formData.startDate} 00:00:00`,
|
||||
planEndTime: `${formData.endDate} 23:59:59`
|
||||
};
|
||||
if (formData.modeName === "指定人员" && formData.executorIds.length > 0) {
|
||||
params.executorId = formData.executorIds[0];
|
||||
@@ -654,7 +689,7 @@ const _sfc_main = {
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:1185", "保存失败:", error);
|
||||
common_vendor.index.__f__("error", "at pages/editchecklist/editchecklist.vue:1225", "保存失败:", error);
|
||||
common_vendor.index.showToast({ title: "保存失败", icon: "none" });
|
||||
}
|
||||
};
|
||||
@@ -727,26 +762,28 @@ const _sfc_main = {
|
||||
N: common_vendor.o(onSwitchChange),
|
||||
O: common_vendor.t(formData.startDate || "请选择开始时间"),
|
||||
P: common_vendor.n(formData.startDate ? "picker-value" : "picker-placeholder"),
|
||||
Q: common_vendor.o(($event) => showStartDatePicker.value = true),
|
||||
Q: common_vendor.o(openStartDatePicker),
|
||||
R: common_vendor.o(onStartDateConfirm),
|
||||
S: common_vendor.o(($event) => showStartDatePicker.value = false),
|
||||
T: common_vendor.o(($event) => showStartDatePicker.value = false),
|
||||
U: common_vendor.o(($event) => startDateValue.value = $event),
|
||||
V: common_vendor.p({
|
||||
show: showStartDatePicker.value,
|
||||
mode: "datetime",
|
||||
mode: "date",
|
||||
minDate: todayMinDate.value,
|
||||
modelValue: startDateValue.value
|
||||
}),
|
||||
W: common_vendor.t(formData.endDate || "请选择结束时间"),
|
||||
X: common_vendor.n(formData.endDate ? "picker-value" : "picker-placeholder"),
|
||||
Y: common_vendor.o(($event) => showEndDatePicker.value = true),
|
||||
Y: common_vendor.o(openEndDatePicker),
|
||||
Z: common_vendor.o(onEndDateConfirm),
|
||||
aa: common_vendor.o(($event) => showEndDatePicker.value = false),
|
||||
ab: common_vendor.o(($event) => showEndDatePicker.value = false),
|
||||
ac: common_vendor.o(($event) => endDateValue.value = $event),
|
||||
ad: common_vendor.p({
|
||||
show: showEndDatePicker.value,
|
||||
mode: "datetime",
|
||||
mode: "date",
|
||||
minDate: endDateMinDate.value,
|
||||
modelValue: endDateValue.value
|
||||
}),
|
||||
ae: common_vendor.t(checkItemCount.value),
|
||||
|
||||
Reference in New Issue
Block a user