一单四制优化及加入工作流
This commit is contained in:
@@ -1,196 +1,22 @@
|
||||
"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_textarea2 = common_vendor.resolveComponent("up-textarea");
|
||||
const _easycom_up_radio2 = common_vendor.resolveComponent("up-radio");
|
||||
const _easycom_up_radio_group2 = common_vendor.resolveComponent("up-radio-group");
|
||||
const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
|
||||
(_easycom_up_picker2 + _easycom_up_textarea2 + _easycom_up_radio2 + _easycom_up_radio_group2 + _easycom_u_popup2)();
|
||||
}
|
||||
const _easycom_up_picker = () => "../../uni_modules/uview-plus/components/u-picker/u-picker.js";
|
||||
const _easycom_up_textarea = () => "../../uni_modules/uview-plus/components/u-textarea/u-textarea.js";
|
||||
const _easycom_up_radio = () => "../../uni_modules/uview-plus/components/u-radio/u-radio.js";
|
||||
const _easycom_up_radio_group = () => "../../uni_modules/uview-plus/components/u-radio-group/u-radio-group.js";
|
||||
const _easycom_u_popup = () => "../../uni_modules/uview-plus/components/u-popup/u-popup.js";
|
||||
if (!Math) {
|
||||
(_easycom_up_picker + _easycom_up_textarea + _easycom_up_radio + _easycom_up_radio_group + _easycom_u_popup)();
|
||||
}
|
||||
const _sfc_main = {
|
||||
__name: "application",
|
||||
setup(__props) {
|
||||
const showAddPopup = common_vendor.ref(false);
|
||||
const showHazardPicker = common_vendor.ref(false);
|
||||
const selectedHazard = common_vendor.ref("");
|
||||
const selectedHazardId = common_vendor.ref("");
|
||||
const hazardColumns = common_vendor.ref([["暂无数据"]]);
|
||||
const acceptanceHazardList = common_vendor.ref([]);
|
||||
const hazardList = common_vendor.ref([]);
|
||||
const selectedDeptName = common_vendor.ref("");
|
||||
const aiGenerating = common_vendor.ref(false);
|
||||
const sendMsgFlagRadio = common_vendor.ref("yes");
|
||||
const sendMsgFlag = common_vendor.computed(() => sendMsgFlagRadio.value === "yes");
|
||||
const formData = common_vendor.reactive({
|
||||
rectifyDeadline: "",
|
||||
// 整改时限
|
||||
responsibleDeptId: "",
|
||||
// 隐患治理责任单位ID
|
||||
responsiblePerson: "",
|
||||
// 主要负责人
|
||||
mainTreatmentContent: "",
|
||||
// 主要治理内容
|
||||
treatmentResult: "",
|
||||
// 隐患治理完成内容
|
||||
selfVerifyContent: ""
|
||||
// 责任单位自行验收情况
|
||||
});
|
||||
const fetchWriteOffList = async () => {
|
||||
try {
|
||||
const res = await request_api.getMyWriteOffList();
|
||||
if (res.code === 0 && res.data) {
|
||||
hazardList.value = res.data;
|
||||
common_vendor.index.__f__("log", "at pages/closeout/application.vue:166", "销号申请列表:", res.data);
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/closeout/application.vue:169", "获取销号申请列表失败:", error);
|
||||
common_vendor.index.__f__("error", "at pages/closeout/application.vue:47", "获取销号申请列表失败:", error);
|
||||
}
|
||||
};
|
||||
const fetchAcceptanceList = async () => {
|
||||
try {
|
||||
const res = await request_api.getAcceptanceList();
|
||||
if (res.code === 0 && res.data) {
|
||||
const list = res.data.records || res.data || [];
|
||||
acceptanceHazardList.value = list;
|
||||
if (list.length > 0) {
|
||||
hazardColumns.value = [list.map((item) => item.title || item.hazardTitle || `隐患${item.hazardId}`)];
|
||||
} else {
|
||||
hazardColumns.value = [["暂无可申请销号的隐患"]];
|
||||
}
|
||||
common_vendor.index.__f__("log", "at pages/closeout/application.vue:186", "可申请销号的隐患列表:", list);
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/closeout/application.vue:189", "获取可申请销号隐患列表失败:", error);
|
||||
}
|
||||
};
|
||||
const openAddPopup = () => {
|
||||
resetForm();
|
||||
fetchAcceptanceList();
|
||||
showAddPopup.value = true;
|
||||
};
|
||||
const fillHazardRelatedFields = (hazard) => {
|
||||
formData.rectifyDeadline = hazard.deadline || "";
|
||||
selectedDeptName.value = hazard.deptName || "";
|
||||
formData.responsiblePerson = hazard.rectifierName || "";
|
||||
formData.responsibleDeptId = hazard.deptId || "";
|
||||
};
|
||||
const onHazardConfirm = (e) => {
|
||||
common_vendor.index.__f__("log", "at pages/closeout/application.vue:210", "选择的隐患:", e);
|
||||
if (e.value && e.value.length > 0) {
|
||||
selectedHazard.value = e.value[0];
|
||||
const index = e.indexs[0];
|
||||
const hazard = acceptanceHazardList.value[index];
|
||||
if (hazard) {
|
||||
selectedHazardId.value = hazard.hazardId;
|
||||
fillHazardRelatedFields(hazard);
|
||||
}
|
||||
}
|
||||
showHazardPicker.value = false;
|
||||
};
|
||||
const resetForm = () => {
|
||||
selectedHazard.value = "";
|
||||
selectedHazardId.value = "";
|
||||
selectedDeptName.value = "";
|
||||
formData.rectifyDeadline = "";
|
||||
formData.responsibleDeptId = "";
|
||||
formData.responsiblePerson = "";
|
||||
formData.mainTreatmentContent = "";
|
||||
formData.treatmentResult = "";
|
||||
formData.selfVerifyContent = "";
|
||||
sendMsgFlagRadio.value = "yes";
|
||||
};
|
||||
const handleAiGenerate = async () => {
|
||||
if (!selectedHazardId.value) {
|
||||
common_vendor.index.showToast({ title: "请先选择隐患", icon: "none" });
|
||||
return;
|
||||
}
|
||||
aiGenerating.value = true;
|
||||
try {
|
||||
const hazardRes = await request_api.getHiddenDangerDetail({ hazardId: selectedHazardId.value });
|
||||
if (hazardRes.code !== 0 || !hazardRes.data) {
|
||||
common_vendor.index.showToast({ title: "获取隐患详情失败", icon: "none" });
|
||||
return;
|
||||
}
|
||||
const assigns = hazardRes.data.assigns;
|
||||
if (!assigns || assigns.length === 0 || !assigns[0].rectify) {
|
||||
common_vendor.index.showToast({ title: "该隐患暂无整改记录", icon: "none" });
|
||||
return;
|
||||
}
|
||||
const rectifyId = assigns[0].rectify.rectifyId;
|
||||
const rectifyRes = await request_api.getRectifyDetail({ rectifyId });
|
||||
if (rectifyRes.code !== 0 || !rectifyRes.data) {
|
||||
common_vendor.index.showToast({ title: "获取整改详情失败", icon: "none" });
|
||||
return;
|
||||
}
|
||||
const rectifyPlan = rectifyRes.data.rectifyPlan;
|
||||
if (!rectifyPlan) {
|
||||
common_vendor.index.showToast({ title: "整改方案内容为空", icon: "none" });
|
||||
return;
|
||||
}
|
||||
const aiRes = await request_api.generateWriteoffContent({ rectifyContent: rectifyPlan });
|
||||
if (aiRes.code === 0 && aiRes.data) {
|
||||
formData.mainTreatmentContent = aiRes.data.mainContent || "";
|
||||
formData.treatmentResult = aiRes.data.completionContent || "";
|
||||
formData.selfVerifyContent = aiRes.data.selfInspection || "";
|
||||
common_vendor.index.showToast({ title: "AI生成成功", icon: "success" });
|
||||
} else {
|
||||
common_vendor.index.showToast({ title: aiRes.msg || "AI生成失败", icon: "none" });
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/closeout/application.vue:285", "AI生成销号方案失败:", error);
|
||||
common_vendor.index.showToast({ title: "AI生成失败,请重试", icon: "none" });
|
||||
} finally {
|
||||
aiGenerating.value = false;
|
||||
}
|
||||
};
|
||||
const handleAdd = async () => {
|
||||
if (!selectedHazardId.value) {
|
||||
common_vendor.index.showToast({ title: "请选择隐患", icon: "none" });
|
||||
return;
|
||||
}
|
||||
const params = {
|
||||
hazardId: Number(selectedHazardId.value),
|
||||
// 隐患ID(必需)
|
||||
rectifyDeadline: formData.rectifyDeadline || "",
|
||||
// 整改时限
|
||||
responsibleDeptId: Number(formData.responsibleDeptId) || 0,
|
||||
// 隐患治理责任单位ID
|
||||
responsiblePerson: formData.responsiblePerson || "",
|
||||
// 主要负责人
|
||||
mainTreatmentContent: formData.mainTreatmentContent || "",
|
||||
// 主要治理内容
|
||||
treatmentResult: formData.treatmentResult || "",
|
||||
// 隐患治理完成内容
|
||||
selfVerifyContent: formData.selfVerifyContent || "",
|
||||
// 责任单位自行验收情况
|
||||
sendMsgFlag: sendMsgFlag.value
|
||||
// 是否短信提醒
|
||||
};
|
||||
common_vendor.index.__f__("log", "at pages/closeout/application.vue:311", "提交数据:", params);
|
||||
try {
|
||||
const res = await request_api.applyDelete(params);
|
||||
if (res.code === 0) {
|
||||
common_vendor.index.showToast({ title: "申请成功", icon: "success" });
|
||||
showAddPopup.value = false;
|
||||
resetForm();
|
||||
fetchWriteOffList();
|
||||
} else {
|
||||
common_vendor.index.showToast({ title: res.msg || "申请失败", icon: "none" });
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/closeout/application.vue:325", "申请失败:", error);
|
||||
common_vendor.index.showToast({ title: "请求失败", icon: "none" });
|
||||
}
|
||||
const goAddApply = () => {
|
||||
common_vendor.index.navigateTo({ url: "/pages/closeout/apply" });
|
||||
};
|
||||
const editor = (item) => {
|
||||
if (!(item == null ? void 0 : item.id)) {
|
||||
@@ -217,11 +43,11 @@ const _sfc_main = {
|
||||
return "status-rejected";
|
||||
return "status-default";
|
||||
};
|
||||
common_vendor.onMounted(() => {
|
||||
common_vendor.onShow(() => {
|
||||
fetchWriteOffList();
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
return {
|
||||
a: common_vendor.f(hazardList.value, (item, k0, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(item.hazardTitle),
|
||||
@@ -235,74 +61,9 @@ const _sfc_main = {
|
||||
i: item.hazardId || item.id
|
||||
};
|
||||
}),
|
||||
b: common_vendor.o(openAddPopup),
|
||||
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)
|
||||
}, {}, {
|
||||
k: common_vendor.t(formData.rectifyDeadline || "请先选择隐患"),
|
||||
l: common_vendor.n(formData.rectifyDeadline ? "" : "text-gray"),
|
||||
m: common_vendor.t(selectedDeptName.value || "请先选择隐患"),
|
||||
n: common_vendor.n(selectedDeptName.value ? "" : "text-gray"),
|
||||
o: common_vendor.t(formData.responsiblePerson || "请先选择隐患"),
|
||||
p: common_vendor.n(formData.responsiblePerson ? "" : "text-gray"),
|
||||
q: !aiGenerating.value
|
||||
}, !aiGenerating.value ? {} : {}, {
|
||||
r: common_vendor.t(aiGenerating.value ? "AI生成中..." : "AI 生成销号方案"),
|
||||
s: aiGenerating.value,
|
||||
t: aiGenerating.value,
|
||||
v: common_vendor.o(handleAiGenerate),
|
||||
w: common_vendor.o(($event) => formData.mainTreatmentContent = $event),
|
||||
x: common_vendor.p({
|
||||
placeholder: "请输入主要治理内容",
|
||||
modelValue: formData.mainTreatmentContent
|
||||
}),
|
||||
y: common_vendor.o(($event) => formData.treatmentResult = $event),
|
||||
z: common_vendor.p({
|
||||
placeholder: "请输入隐患治理完成情况",
|
||||
modelValue: formData.treatmentResult
|
||||
}),
|
||||
A: common_vendor.o(($event) => formData.selfVerifyContent = $event),
|
||||
B: common_vendor.p({
|
||||
placeholder: "请输入隐患治理责任单位自行验收的情况",
|
||||
modelValue: formData.selfVerifyContent
|
||||
}),
|
||||
C: common_vendor.p({
|
||||
label: "是",
|
||||
name: "yes",
|
||||
customStyle: {
|
||||
marginRight: "48rpx"
|
||||
}
|
||||
}),
|
||||
D: common_vendor.p({
|
||||
label: "否",
|
||||
name: "no"
|
||||
}),
|
||||
E: common_vendor.o(($event) => sendMsgFlagRadio.value = $event),
|
||||
F: common_vendor.p({
|
||||
placement: "row",
|
||||
activeColor: "#2667e9",
|
||||
modelValue: sendMsgFlagRadio.value
|
||||
}),
|
||||
G: common_vendor.o(($event) => showAddPopup.value = false),
|
||||
H: common_vendor.o(handleAdd),
|
||||
I: common_vendor.o(($event) => showAddPopup.value = false),
|
||||
J: common_vendor.p({
|
||||
show: showAddPopup.value,
|
||||
mode: "center",
|
||||
round: "20",
|
||||
safeAreaInsetBottom: false
|
||||
}),
|
||||
K: common_vendor.o(onHazardConfirm),
|
||||
L: common_vendor.o(($event) => showHazardPicker.value = false),
|
||||
M: common_vendor.o(($event) => showHazardPicker.value = false),
|
||||
N: common_vendor.p({
|
||||
show: showHazardPicker.value,
|
||||
columns: hazardColumns.value
|
||||
}),
|
||||
O: common_vendor.gei(_ctx, "")
|
||||
});
|
||||
b: common_vendor.o(goAddApply),
|
||||
c: common_vendor.gei(_ctx, "")
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user