first commit

This commit is contained in:
2025-12-29 14:59:44 +08:00
commit 10c3fbb0d7
5315 changed files with 795443 additions and 0 deletions

View File

@@ -0,0 +1,238 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const request_api = require("../../request/api.js");
const request_request = require("../../request/request.js");
if (!Array) {
const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
const _easycom_up_calendar2 = common_vendor.resolveComponent("up-calendar");
const _easycom_up_radio2 = common_vendor.resolveComponent("up-radio");
const _easycom_up_radio_group2 = common_vendor.resolveComponent("up-radio-group");
const _easycom_up_upload2 = common_vendor.resolveComponent("up-upload");
(_easycom_up_textarea2 + _easycom_up_input2 + _easycom_up_calendar2 + _easycom_up_radio2 + _easycom_up_radio_group2 + _easycom_up_upload2)();
}
const _easycom_up_textarea = () => "../../uni_modules/uview-plus/components/u-textarea/u-textarea.js";
const _easycom_up_input = () => "../../uni_modules/uview-plus/components/u-input/u-input.js";
const _easycom_up_calendar = () => "../../uni_modules/uview-plus/components/u-calendar/u-calendar.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_up_upload = () => "../../uni_modules/uview-plus/components/u-upload/u-upload.js";
if (!Math) {
(_easycom_up_textarea + _easycom_up_input + _easycom_up_calendar + _easycom_up_radio + _easycom_up_radio_group + _easycom_up_upload)();
}
const _sfc_main = {
__name: "rectification",
setup(__props) {
const hazardId = common_vendor.ref("");
const assignId = common_vendor.ref("");
const formData = common_vendor.reactive({
rectifyPlan: "",
// 整改方案
rectifyResult: "",
// 整改完成情况
planCost: "",
// 投资资金(计划)
actualCost: ""
// 投资资金(实际)
});
const show = common_vendor.ref(false);
const mode = common_vendor.ref("single");
const selectedDate = common_vendor.ref("");
const radiovalue1 = common_vendor.ref("");
const radiolist1 = common_vendor.reactive([
{
name: "孙致远",
disabled: false
},
{
name: "符友成",
disabled: false
},
{
name: "向彪",
disabled: false
},
{
name: "向纪荣",
disabled: false
}
]);
const fileList1 = common_vendor.ref([]);
const deletePic = (event) => {
fileList1.value.splice(event.index, 1);
};
const afterRead = async (event) => {
let lists = [].concat(event.file);
let fileListLen = fileList1.value.length;
lists.map((item) => {
fileList1.value.push({
...item,
status: "uploading",
message: "上传中"
});
});
for (let i = 0; i < lists.length; i++) {
const result = await uploadFilePromise(lists[i].url);
let item = fileList1.value[fileListLen];
fileList1.value.splice(fileListLen, 1, {
...item,
status: "success",
message: "",
url: result
});
fileListLen++;
}
};
const confirmDate = (e) => {
selectedDate.value = e[0];
show.value = false;
};
const uploadFilePromise = (filePath) => {
return new Promise((resolve, reject) => {
common_vendor.index.uploadFile({
url: request_request.baseUrl + "/frontend/attachment/upload",
filePath,
name: "file",
header: {
"Authorization": request_request.AUTH_TOKEN
},
success: (res) => {
const data = JSON.parse(res.data);
if (data.code === 0) {
resolve(data.data);
} else {
reject(data.msg || "上传失败");
}
},
fail: (err) => {
console.error("上传失败:", err);
reject(err);
}
});
});
};
const handleSubmit = async () => {
if (!formData.rectifyPlan) {
common_vendor.index.showToast({ title: "请输入整改方案", icon: "none" });
return;
}
if (!formData.rectifyResult) {
common_vendor.index.showToast({ title: "请输入整改完成情况", icon: "none" });
return;
}
const attachments = fileList1.value.map((file) => {
let url = "";
if (typeof file.url === "string") {
url = file.url;
} else if (file.url && typeof file.url === "object") {
url = file.url.url || file.url.path || "";
}
const fileName = typeof url === "string" && url ? url.split("/").pop() : file.name || "";
return {
fileName: fileName || "",
filePath: url || "",
fileType: file.type || "image/png",
fileSize: file.size || 0
};
});
const params = {
hazardId: hazardId.value,
assignId: assignId.value,
rectifyPlan: formData.rectifyPlan,
rectifyResult: formData.rectifyResult,
planCost: Number(formData.planCost) || 0,
actualCost: Number(formData.actualCost) || 0,
attachments
};
try {
const res = await request_api.submitRectification(params);
if (res.code === 0) {
common_vendor.index.showToast({ title: "提交成功", icon: "success" });
setTimeout(() => {
common_vendor.index.navigateBack();
}, 1500);
} else {
common_vendor.index.showToast({ title: res.msg || "提交失败", icon: "none" });
}
} catch (error) {
console.error("提交整改失败:", error);
common_vendor.index.showToast({ title: "请求失败", icon: "none" });
}
};
common_vendor.onLoad((options) => {
if (options.hazardId) {
hazardId.value = options.hazardId;
}
if (options.assignId) {
assignId.value = options.assignId;
}
});
return (_ctx, _cache) => {
return {
a: common_vendor.o(($event) => formData.rectifyPlan = $event),
b: common_vendor.p({
placeholder: "请输入内容",
modelValue: formData.rectifyPlan
}),
c: common_vendor.o(($event) => formData.rectifyResult = $event),
d: common_vendor.p({
placeholder: "请输入内容",
modelValue: formData.rectifyResult
}),
e: common_vendor.o(($event) => formData.planCost = $event),
f: common_vendor.p({
placeholder: "请输入内容",
type: "number",
modelValue: formData.planCost
}),
g: common_vendor.o(($event) => formData.actualCost = $event),
h: common_vendor.p({
placeholder: "请输入内容",
type: "number",
modelValue: formData.actualCost
}),
i: common_vendor.t(selectedDate.value || "请选择日期"),
j: common_vendor.n(selectedDate.value ? "" : "text-gray"),
k: common_vendor.o(($event) => show.value = true),
l: common_vendor.o(confirmDate),
m: common_vendor.o(($event) => show.value = false),
n: common_vendor.p({
show: show.value,
mode: mode.value
}),
o: common_vendor.f(radiolist1, (item, index, i0) => {
return {
a: index,
b: common_vendor.o(_ctx.radioChange, index),
c: "f18ba0ce-6-" + i0 + ",f18ba0ce-5",
d: common_vendor.p({
shape: "square",
customStyle: {
marginBottom: "8px"
},
label: item.name,
name: item.name
})
};
}),
p: common_vendor.o(_ctx.groupChange),
q: common_vendor.o(($event) => radiovalue1.value = $event),
r: common_vendor.p({
placement: "column",
modelValue: radiovalue1.value
}),
s: common_vendor.o(afterRead),
t: common_vendor.o(deletePic),
v: common_vendor.p({
fileList: fileList1.value,
name: "1",
multiple: true,
maxCount: 10
}),
w: common_vendor.o(handleSubmit)
};
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-f18ba0ce"]]);
wx.createPage(MiniProgramPage);