基本功能都已完成
This commit is contained in:
@@ -1,211 +0,0 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const request_api = require("../../request/api.js");
|
||||
if (!Array) {
|
||||
const _easycom_up_picker2 = common_vendor.resolveComponent("up-picker");
|
||||
const _easycom_up_datetime_picker2 = common_vendor.resolveComponent("up-datetime-picker");
|
||||
const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
|
||||
const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
|
||||
const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
|
||||
(_easycom_up_picker2 + _easycom_up_datetime_picker2 + _easycom_up_input2 + _easycom_up_textarea2 + _easycom_u_popup2)();
|
||||
}
|
||||
const _easycom_up_picker = () => "../../uni_modules/uview-plus/components/u-picker/u-picker.js";
|
||||
const _easycom_up_datetime_picker = () => "../../uni_modules/uview-plus/components/u-datetime-picker/u-datetime-picker.js";
|
||||
const _easycom_up_input = () => "../../uni_modules/uview-plus/components/u-input/u-input.js";
|
||||
const _easycom_up_textarea = () => "../../uni_modules/uview-plus/components/u-textarea/u-textarea.js";
|
||||
const _easycom_u_popup = () => "../../uni_modules/uview-plus/components/u-popup/u-popup.js";
|
||||
if (!Math) {
|
||||
(_easycom_up_picker + _easycom_up_datetime_picker + _easycom_up_input + _easycom_up_textarea + _easycom_u_popup)();
|
||||
}
|
||||
const _sfc_main = {
|
||||
__name: "application",
|
||||
setup(__props) {
|
||||
const showAddPopup = common_vendor.ref(false);
|
||||
const showHazardPicker = common_vendor.ref(false);
|
||||
const showDatePicker = common_vendor.ref(false);
|
||||
const selectedHazard = common_vendor.ref("");
|
||||
const selectedHazardId = common_vendor.ref("");
|
||||
const hazardColumns = common_vendor.ref([["暂无数据"]]);
|
||||
const hazardList = common_vendor.ref([]);
|
||||
const dateValue = common_vendor.ref(Date.now());
|
||||
const formData = common_vendor.reactive({
|
||||
rectifyDeadline: "",
|
||||
// 整改时限
|
||||
responsibleDeptName: "",
|
||||
// 隐患治理责任单位
|
||||
responsiblePerson: "",
|
||||
// 主要负责人
|
||||
mainTreatmentContent: "",
|
||||
// 主要治理内容
|
||||
treatmentResult: "",
|
||||
// 隐患治理完成内容
|
||||
selfVerifyContent: ""
|
||||
// 责任单位自行验收情况
|
||||
});
|
||||
const fetchHazardList = async () => {
|
||||
try {
|
||||
const res = await request_api.getMyWriteOffList();
|
||||
if (res.code === 0 && res.data) {
|
||||
const list = res.data;
|
||||
hazardList.value = list;
|
||||
if (list.length > 0) {
|
||||
hazardColumns.value = [list.map((item) => item.hazardTitle || `隐患${item.hazardId}`)];
|
||||
}
|
||||
console.log("隐患列表:", list);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取隐患列表失败:", error);
|
||||
}
|
||||
};
|
||||
const onHazardConfirm = (e) => {
|
||||
console.log("选择的隐患:", e);
|
||||
if (e.value && e.value.length > 0) {
|
||||
selectedHazard.value = e.value[0];
|
||||
const index = e.indexs[0];
|
||||
if (hazardList.value[index]) {
|
||||
selectedHazardId.value = hazardList.value[index].hazardId;
|
||||
}
|
||||
}
|
||||
showHazardPicker.value = false;
|
||||
};
|
||||
const onDateConfirm = (e) => {
|
||||
console.log("选择的日期时间:", e);
|
||||
const date = new Date(e.value);
|
||||
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");
|
||||
formData.rectifyDeadline = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
showDatePicker.value = false;
|
||||
};
|
||||
const resetForm = () => {
|
||||
selectedHazard.value = "";
|
||||
selectedHazardId.value = "";
|
||||
formData.rectifyDeadline = "";
|
||||
formData.responsibleDeptName = "";
|
||||
formData.responsiblePerson = "";
|
||||
formData.mainTreatmentContent = "";
|
||||
formData.treatmentResult = "";
|
||||
formData.selfVerifyContent = "";
|
||||
};
|
||||
const handleAdd = async () => {
|
||||
if (!selectedHazardId.value) {
|
||||
common_vendor.index.showToast({ title: "请选择隐患", icon: "none" });
|
||||
return;
|
||||
}
|
||||
const params = {
|
||||
hazardId: Number(selectedHazardId.value),
|
||||
// 隐患ID(必需)
|
||||
rectifyDeadline: formData.rectifyDeadline || "",
|
||||
// 整改时限
|
||||
responsiblePerson: formData.responsiblePerson || "",
|
||||
// 主要负责人
|
||||
mainTreatmentContent: formData.mainTreatmentContent || "",
|
||||
// 主要治理内容
|
||||
treatmentResult: formData.treatmentResult || "",
|
||||
// 隐患治理完成内容
|
||||
selfVerifyContent: formData.selfVerifyContent || ""
|
||||
// 责任单位自行验收情况
|
||||
};
|
||||
console.log("提交数据:", params);
|
||||
try {
|
||||
const res = await request_api.applyDelete(params);
|
||||
if (res.code === 0) {
|
||||
common_vendor.index.showToast({ title: "申请成功", icon: "success" });
|
||||
showAddPopup.value = false;
|
||||
resetForm();
|
||||
} else {
|
||||
common_vendor.index.showToast({ title: res.msg || "申请失败", icon: "none" });
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("申请失败:", error);
|
||||
common_vendor.index.showToast({ title: "请求失败", icon: "none" });
|
||||
}
|
||||
};
|
||||
const editor = () => {
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/closeout/editor"
|
||||
});
|
||||
};
|
||||
common_vendor.onMounted(() => {
|
||||
fetchHazardList();
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return {
|
||||
a: common_vendor.f(hazardList.value, (item, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(item.hazardTitle),
|
||||
b: common_vendor.t(item.statusName),
|
||||
c: common_vendor.t(item.hazardCreatedAt),
|
||||
d: common_vendor.t(item.responsibleDeptName),
|
||||
e: common_vendor.t(item.responsiblePerson),
|
||||
f: common_vendor.t(item.createdAt),
|
||||
g: common_vendor.o(($event) => editor(), index),
|
||||
h: index
|
||||
};
|
||||
}),
|
||||
b: common_vendor.o(($event) => showAddPopup.value = true),
|
||||
c: common_vendor.o(($event) => showAddPopup.value = false),
|
||||
d: common_vendor.t(selectedHazard.value || "请选择隐患"),
|
||||
e: common_vendor.n(selectedHazard.value ? "" : "text-gray"),
|
||||
f: common_vendor.o(($event) => showHazardPicker.value = true),
|
||||
g: common_vendor.o(onHazardConfirm),
|
||||
h: common_vendor.o(($event) => showHazardPicker.value = false),
|
||||
i: common_vendor.o(($event) => showHazardPicker.value = false),
|
||||
j: common_vendor.p({
|
||||
show: showHazardPicker.value,
|
||||
columns: hazardColumns.value
|
||||
}),
|
||||
k: common_vendor.t(formData.rectifyDeadline || "请选择整改时限"),
|
||||
l: common_vendor.n(formData.rectifyDeadline ? "" : "text-gray"),
|
||||
m: common_vendor.o(($event) => showDatePicker.value = true),
|
||||
n: common_vendor.o(onDateConfirm),
|
||||
o: common_vendor.o(($event) => showDatePicker.value = false),
|
||||
p: common_vendor.o(($event) => showDatePicker.value = false),
|
||||
q: common_vendor.o(($event) => dateValue.value = $event),
|
||||
r: common_vendor.p({
|
||||
show: showDatePicker.value,
|
||||
mode: "datetime",
|
||||
modelValue: dateValue.value
|
||||
}),
|
||||
s: common_vendor.o(($event) => formData.responsibleDeptName = $event),
|
||||
t: common_vendor.p({
|
||||
placeholder: "请输入隐患治理责任单位",
|
||||
modelValue: formData.responsibleDeptName
|
||||
}),
|
||||
v: common_vendor.o(($event) => formData.responsiblePerson = $event),
|
||||
w: common_vendor.p({
|
||||
placeholder: "请输入主要负责人",
|
||||
modelValue: formData.responsiblePerson
|
||||
}),
|
||||
x: common_vendor.o(($event) => formData.mainTreatmentContent = $event),
|
||||
y: common_vendor.p({
|
||||
placeholder: "请输入主要治理内容",
|
||||
modelValue: formData.mainTreatmentContent
|
||||
}),
|
||||
z: common_vendor.o(($event) => formData.treatmentResult = $event),
|
||||
A: common_vendor.p({
|
||||
placeholder: "请输入隐患治理完成情况",
|
||||
modelValue: formData.treatmentResult
|
||||
}),
|
||||
B: common_vendor.o(($event) => formData.selfVerifyContent = $event),
|
||||
C: common_vendor.p({
|
||||
placeholder: "请输入隐患治理责任单位自行验收的情况",
|
||||
modelValue: formData.selfVerifyContent
|
||||
}),
|
||||
D: common_vendor.o(($event) => showAddPopup.value = false),
|
||||
E: common_vendor.o(handleAdd),
|
||||
F: common_vendor.o(($event) => showAddPopup.value = false),
|
||||
G: common_vendor.p({
|
||||
show: showAddPopup.value,
|
||||
mode: "center",
|
||||
round: "20"
|
||||
})
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-4b6250eb"]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
Reference in New Issue
Block a user