135 lines
4.6 KiB
JavaScript
135 lines
4.6 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const request_api = require("../../request/api.js");
|
|
if (!Array) {
|
|
const _easycom_u_radio2 = common_vendor.resolveComponent("u-radio");
|
|
const _easycom_u_radio_group2 = common_vendor.resolveComponent("u-radio-group");
|
|
const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
|
|
(_easycom_u_radio2 + _easycom_u_radio_group2 + _easycom_up_textarea2)();
|
|
}
|
|
const _easycom_u_radio = () => "../../uni_modules/uview-plus/components/u-radio/u-radio.js";
|
|
const _easycom_u_radio_group = () => "../../uni_modules/uview-plus/components/u-radio-group/u-radio-group.js";
|
|
const _easycom_up_textarea = () => "../../uni_modules/uview-plus/components/u-textarea/u-textarea.js";
|
|
if (!Math) {
|
|
(_easycom_u_radio + _easycom_u_radio_group + _easycom_up_textarea)();
|
|
}
|
|
const _sfc_main = {
|
|
__name: "Inspectionresult",
|
|
setup(__props) {
|
|
const oneTableId = common_vendor.ref("");
|
|
const checkData = common_vendor.ref(null);
|
|
const radiolist1 = common_vendor.reactive([
|
|
{
|
|
name: "正常",
|
|
value: 1,
|
|
disabled: false
|
|
},
|
|
{
|
|
name: "异常",
|
|
value: 2,
|
|
disabled: false
|
|
},
|
|
{
|
|
name: "不涉及",
|
|
value: 3,
|
|
disabled: false
|
|
}
|
|
]);
|
|
const radiovalue1 = common_vendor.ref("");
|
|
const groupChange = (n) => {
|
|
console.log("groupChange", n);
|
|
};
|
|
const radioChange = (n) => {
|
|
console.log("radioChange", n);
|
|
};
|
|
const value1 = common_vendor.ref("");
|
|
const handleSubmit = async () => {
|
|
var _a;
|
|
if (!radiovalue1.value) {
|
|
common_vendor.index.showToast({ title: "请选择检查结果", icon: "none" });
|
|
return;
|
|
}
|
|
const selectedItem = radiolist1.find((item) => item.name === radiovalue1.value);
|
|
const resultValue = selectedItem ? selectedItem.value : null;
|
|
if (!resultValue) {
|
|
common_vendor.index.showToast({ title: "请选择检查结果", icon: "none" });
|
|
return;
|
|
}
|
|
try {
|
|
const params = {
|
|
taskId: (_a = checkData.value) == null ? void 0 : _a.taskId,
|
|
result: resultValue,
|
|
remark: value1.value
|
|
};
|
|
console.log("提交参数:", params);
|
|
const res = await request_api.submitCheckResult(params);
|
|
console.log("提交结果:", res);
|
|
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" });
|
|
}
|
|
};
|
|
const getCheckData = async () => {
|
|
try {
|
|
const res = await request_api.enterCheckPlan(oneTableId.value);
|
|
console.log("检查项数据:", res);
|
|
if (res.code === 0) {
|
|
checkData.value = res.data;
|
|
}
|
|
} catch (error) {
|
|
console.error(error);
|
|
}
|
|
};
|
|
common_vendor.onLoad((options) => {
|
|
console.log("接收到的参数:", options);
|
|
if (options.id) {
|
|
oneTableId.value = options.id;
|
|
getCheckData();
|
|
}
|
|
});
|
|
return (_ctx, _cache) => {
|
|
var _a, _b;
|
|
return {
|
|
a: common_vendor.t(((_a = checkData.value) == null ? void 0 : _a.name) || "加载中..."),
|
|
b: ((_b = checkData.value) == null ? void 0 : _b.point) || "",
|
|
c: common_vendor.f(radiolist1, (item, index, i0) => {
|
|
return {
|
|
a: index,
|
|
b: common_vendor.o(radioChange, index),
|
|
c: "643afff0-1-" + i0 + ",643afff0-0",
|
|
d: common_vendor.p({
|
|
customStyle: {
|
|
marginBottom: "8px"
|
|
},
|
|
label: item.name,
|
|
name: item.name
|
|
})
|
|
};
|
|
}),
|
|
d: common_vendor.o(groupChange),
|
|
e: common_vendor.o(($event) => radiovalue1.value = $event),
|
|
f: common_vendor.p({
|
|
placement: "row",
|
|
modelValue: radiovalue1.value
|
|
}),
|
|
g: common_vendor.o(($event) => value1.value = $event),
|
|
h: common_vendor.p({
|
|
placeholder: "请输入备注信息",
|
|
modelValue: value1.value
|
|
}),
|
|
i: common_vendor.o(handleSubmit)
|
|
};
|
|
};
|
|
}
|
|
};
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-643afff0"]]);
|
|
wx.createPage(MiniProgramPage);
|