1.18整合
This commit is contained in:
@@ -6,17 +6,17 @@ if (!Array) {
|
||||
const _easycom_up_upload2 = common_vendor.resolveComponent("up-upload");
|
||||
const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
|
||||
const _easycom_up_choose2 = common_vendor.resolveComponent("up-choose");
|
||||
const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
|
||||
const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
|
||||
(_easycom_up_upload2 + _easycom_up_input2 + _easycom_up_choose2 + _easycom_u_popup2 + _easycom_up_textarea2)();
|
||||
const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
|
||||
(_easycom_up_upload2 + _easycom_up_input2 + _easycom_up_choose2 + _easycom_up_textarea2 + _easycom_u_popup2)();
|
||||
}
|
||||
const _easycom_up_upload = () => "../../uni_modules/uview-plus/components/u-upload/u-upload.js";
|
||||
const _easycom_up_input = () => "../../uni_modules/uview-plus/components/u-input/u-input.js";
|
||||
const _easycom_up_choose = () => "../../uni_modules/uview-plus/components/u-choose/u-choose.js";
|
||||
const _easycom_u_popup = () => "../../uni_modules/uview-plus/components/u-popup/u-popup.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_upload + _easycom_up_input + _easycom_up_choose + _easycom_u_popup + _easycom_up_textarea)();
|
||||
(_easycom_up_upload + _easycom_up_input + _easycom_up_choose + _easycom_up_textarea + _easycom_u_popup)();
|
||||
}
|
||||
const _sfc_main = {
|
||||
__name: "Inspection",
|
||||
@@ -51,39 +51,53 @@ const _sfc_main = {
|
||||
// 隐患等级索引
|
||||
description: "",
|
||||
// 隐患描述
|
||||
tagIndex: 0
|
||||
tagIndex: 0,
|
||||
// 隐患标签索引
|
||||
source: ""
|
||||
// 隐患来源
|
||||
});
|
||||
const lng = common_vendor.ref(0);
|
||||
const lat = common_vendor.ref(0);
|
||||
const showAddressPopup = common_vendor.ref(false);
|
||||
const addressKeyword = common_vendor.ref("");
|
||||
const selectedAddress = common_vendor.ref("");
|
||||
const tempSelectedAddress = common_vendor.ref("");
|
||||
const addressList = common_vendor.ref([
|
||||
"湖南省湘西土家族苗族自治州吉首市人民北路105号",
|
||||
"湖南省湘西土家族苗族自治州吉首市人民南路100号",
|
||||
"湖南省湘西土家族苗族自治州吉首市团结广场",
|
||||
"湖南省湘西土家族苗族自治州吉首市火车站"
|
||||
]);
|
||||
const filteredAddressList = common_vendor.computed(() => {
|
||||
if (!addressKeyword.value)
|
||||
return addressList.value;
|
||||
return addressList.value.filter((item) => item.includes(addressKeyword.value));
|
||||
});
|
||||
const confirmAddress = () => {
|
||||
if (tempSelectedAddress.value) {
|
||||
selectedAddress.value = tempSelectedAddress.value;
|
||||
}
|
||||
showAddressPopup.value = false;
|
||||
const chooseLocation = () => {
|
||||
console.log("chooseLocation called");
|
||||
showAddPopup.value = false;
|
||||
setTimeout(() => {
|
||||
common_vendor.index.chooseLocation({
|
||||
success: (res) => {
|
||||
console.log("选择位置成功:", res);
|
||||
selectedAddress.value = res.address + (res.name ? `(${res.name})` : "");
|
||||
lng.value = res.longitude;
|
||||
lat.value = res.latitude;
|
||||
showAddPopup.value = true;
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error("选择位置失败:", err);
|
||||
showAddPopup.value = true;
|
||||
if (err.errMsg && err.errMsg.indexOf("cancel") === -1) {
|
||||
common_vendor.index.showToast({
|
||||
title: "选择位置失败",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 300);
|
||||
};
|
||||
const handleAdd = async () => {
|
||||
var _a;
|
||||
if (!formData.title) {
|
||||
common_vendor.index.showToast({ title: "请输入隐患标题", icon: "none" });
|
||||
common_vendor.index.showToast({
|
||||
title: "请输入隐患标题",
|
||||
icon: "none"
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (fileList1.value.length === 0) {
|
||||
common_vendor.index.showToast({ title: "请上传隐患图片/视频", icon: "none" });
|
||||
common_vendor.index.showToast({
|
||||
title: "请上传隐患图片/视频",
|
||||
icon: "none"
|
||||
});
|
||||
return;
|
||||
}
|
||||
fileList1.value.map((file) => {
|
||||
@@ -103,6 +117,7 @@ const _sfc_main = {
|
||||
});
|
||||
const selectedTag = tagOptions.value[formData.tagIndex];
|
||||
const tagId = selectedTag ? selectedTag.id : null;
|
||||
console.log("innnn", sourceOptions);
|
||||
const params = {
|
||||
title: formData.title,
|
||||
//标题
|
||||
@@ -122,8 +137,8 @@ const _sfc_main = {
|
||||
//关联任务ID
|
||||
checkPointId: checkPointId.value,
|
||||
//关联检查点ID
|
||||
source: "cillum labore veniam"
|
||||
//隐患来源
|
||||
source: ((_a = sourceOptions.value[formData.source]) == null ? void 0 : _a.title) || ""
|
||||
//隐患来源(随手拍、企业自查、行业互查、专家诊查)
|
||||
};
|
||||
try {
|
||||
const res = await request_api.addHiddenDanger(params);
|
||||
@@ -139,12 +154,19 @@ const _sfc_main = {
|
||||
formData.tagIndex = 0;
|
||||
selectedAddress.value = "";
|
||||
fileList1.value = [];
|
||||
fetchHiddenDangerList();
|
||||
} else {
|
||||
common_vendor.index.showToast({ title: res.msg || "新增失败", icon: "none" });
|
||||
common_vendor.index.showToast({
|
||||
title: res.msg || "新增失败",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
common_vendor.index.showToast({ title: "请求失败", icon: "none" });
|
||||
common_vendor.index.showToast({
|
||||
title: "请求失败",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
};
|
||||
const hiddenDangerList = common_vendor.ref([]);
|
||||
@@ -152,16 +174,24 @@ const _sfc_main = {
|
||||
try {
|
||||
const res = await request_api.getMyHiddenDangerList();
|
||||
if (res.code === 0) {
|
||||
hiddenDangerList.value = res.data;
|
||||
hiddenDangerList.value = res.data.records;
|
||||
} else {
|
||||
common_vendor.index.showToast({ title: res.msg || "获取隐患列表失败", icon: "none" });
|
||||
common_vendor.index.showToast({
|
||||
title: res.msg || "获取隐患列表失败",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
common_vendor.index.showToast({ title: "请求失败", icon: "none" });
|
||||
common_vendor.index.showToast({
|
||||
title: "请求失败",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
};
|
||||
fetchHiddenDangerList();
|
||||
common_vendor.onShow(() => {
|
||||
fetchHiddenDangerList();
|
||||
});
|
||||
const details = (item) => {
|
||||
common_vendor.index.navigateTo({
|
||||
url: `/pages/hiddendanger/view?hazardId=${item.hazardId}&assignId=${item.assignId}`
|
||||
@@ -172,9 +202,14 @@ const _sfc_main = {
|
||||
url: `/pages/hiddendanger/rectification?hazardId=${item.hazardId}&assignId=${item.assignId}`
|
||||
});
|
||||
};
|
||||
const acceptance = () => {
|
||||
const acceptance = (item) => {
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/hiddendanger/acceptance"
|
||||
url: `/pages/hiddendanger/acceptance?hazardId=${item.hazardId}&assignId=${item.assignId}&rectifyId=${item.rectifyId}`
|
||||
});
|
||||
};
|
||||
const assignHazard = (item) => {
|
||||
common_vendor.index.navigateTo({
|
||||
url: `/pages/hiddendanger/assignment?hazardId=${item.hazardId}&assignId=${item.assignId}`
|
||||
});
|
||||
};
|
||||
const fileList1 = common_vendor.ref([]);
|
||||
@@ -210,7 +245,7 @@ const _sfc_main = {
|
||||
filePath,
|
||||
name: "file",
|
||||
header: {
|
||||
"Authorization": request_request.AUTH_TOKEN
|
||||
"Authorization": request_request.getToken()
|
||||
},
|
||||
success: (res) => {
|
||||
const data = JSON.parse(res.data);
|
||||
@@ -237,33 +272,88 @@ const _sfc_main = {
|
||||
title: item.name
|
||||
}));
|
||||
} else {
|
||||
common_vendor.index.showToast({ title: res.msg || "获取标签列表失败", icon: "none" });
|
||||
common_vendor.index.showToast({
|
||||
title: res.msg || "获取标签列表失败",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
common_vendor.index.showToast({ title: "请求失败", icon: "none" });
|
||||
common_vendor.index.showToast({
|
||||
title: "请求失败",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
};
|
||||
fetchTagOptions();
|
||||
const levelOptions = common_vendor.ref([
|
||||
{ id: 1, title: "轻微隐患" },
|
||||
{ id: 2, title: "一般隐患" },
|
||||
{ id: 3, title: "重大隐患" }
|
||||
{
|
||||
id: 1,
|
||||
title: "轻微隐患"
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: "一般隐患"
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
title: "重大隐患"
|
||||
}
|
||||
]);
|
||||
const sourceOptions = common_vendor.ref([
|
||||
{
|
||||
id: 1,
|
||||
title: "随手拍"
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: "企业自查"
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
title: "行业互查"
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
title: "专家诊查"
|
||||
}
|
||||
]);
|
||||
common_vendor.watch(() => formData.source, (newVal) => {
|
||||
const selected = sourceOptions.value[newVal];
|
||||
console.log("隐患来源选择结果:", {
|
||||
索引: newVal,
|
||||
选中项: selected,
|
||||
id: selected == null ? void 0 : selected.id,
|
||||
title: selected == null ? void 0 : selected.title
|
||||
});
|
||||
});
|
||||
return (_ctx, _cache) => {
|
||||
return {
|
||||
a: common_vendor.f(hiddenDangerList.value, (item, k0, i0) => {
|
||||
return {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.t(item.title),
|
||||
b: common_vendor.t(item.statusName),
|
||||
c: common_vendor.t(item.levelName),
|
||||
d: common_vendor.t(item.address),
|
||||
e: common_vendor.t(item.createdAt),
|
||||
f: common_vendor.o(($event) => details(item), item.hazardId),
|
||||
g: common_vendor.o(($event) => Rectification(item), item.hazardId),
|
||||
h: common_vendor.o(($event) => acceptance(), item.hazardId),
|
||||
i: item.hazardId
|
||||
};
|
||||
d: item.levelName === "轻微隐患" ? 1 : "",
|
||||
e: item.levelName === "一般隐患" ? 1 : "",
|
||||
f: item.levelName === "重大隐患" ? 1 : "",
|
||||
g: common_vendor.t(item.address),
|
||||
h: common_vendor.t(item.createdAt),
|
||||
i: common_vendor.o(($event) => details(item), item.hazardId),
|
||||
j: item.statusName === "待整改" || item.statusName === "待验收"
|
||||
}, item.statusName === "待整改" || item.statusName === "待验收" ? {
|
||||
k: common_vendor.o(($event) => Rectification(item), item.hazardId)
|
||||
} : {}, {
|
||||
l: item.statusName === "待验收"
|
||||
}, item.statusName === "待验收" ? {
|
||||
m: common_vendor.o(($event) => acceptance(item), item.hazardId)
|
||||
} : {}, {
|
||||
n: item.statusName === "待交办"
|
||||
}, item.statusName === "待交办" ? {
|
||||
o: common_vendor.o(($event) => assignHazard(item), item.hazardId)
|
||||
} : {}, {
|
||||
p: item.hazardId
|
||||
});
|
||||
}),
|
||||
b: common_vendor.o(($event) => showAddPopup.value = true),
|
||||
c: common_vendor.o(($event) => showAddPopup.value = false),
|
||||
@@ -289,43 +379,32 @@ const _sfc_main = {
|
||||
["item-height"]: "72rpx",
|
||||
modelValue: formData.level
|
||||
}),
|
||||
k: common_vendor.t(selectedAddress.value || "请选择地址"),
|
||||
l: common_vendor.n(selectedAddress.value ? "" : "text-gray"),
|
||||
m: common_vendor.o(($event) => showAddressPopup.value = true),
|
||||
n: common_vendor.o(($event) => showAddressPopup.value = true),
|
||||
o: common_vendor.o(($event) => showAddressPopup.value = false),
|
||||
p: addressKeyword.value,
|
||||
q: common_vendor.o(($event) => addressKeyword.value = $event.detail.value),
|
||||
r: common_vendor.f(filteredAddressList.value, (item, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(item),
|
||||
b: index,
|
||||
c: common_vendor.o(($event) => tempSelectedAddress.value = item, index),
|
||||
d: tempSelectedAddress.value === item ? 1 : ""
|
||||
};
|
||||
k: common_vendor.o(($event) => formData.source = $event),
|
||||
l: common_vendor.p({
|
||||
options: sourceOptions.value,
|
||||
wrap: false,
|
||||
["item-width"]: "183rpx",
|
||||
["item-height"]: "72rpx",
|
||||
modelValue: formData.source
|
||||
}),
|
||||
s: common_vendor.o(($event) => showAddressPopup.value = false),
|
||||
t: common_vendor.o(confirmAddress),
|
||||
v: common_vendor.o(($event) => showAddressPopup.value = false),
|
||||
w: common_vendor.p({
|
||||
show: showAddressPopup.value,
|
||||
mode: "center",
|
||||
round: "20"
|
||||
}),
|
||||
x: common_vendor.o(($event) => formData.description = $event),
|
||||
y: common_vendor.p({
|
||||
m: common_vendor.t(selectedAddress.value || "请选择地址"),
|
||||
n: common_vendor.n(selectedAddress.value ? "" : "text-gray"),
|
||||
o: common_vendor.o(chooseLocation),
|
||||
p: common_vendor.o(chooseLocation),
|
||||
q: common_vendor.o(($event) => formData.description = $event),
|
||||
r: common_vendor.p({
|
||||
placeholder: "请输入内容",
|
||||
modelValue: formData.description
|
||||
}),
|
||||
z: common_vendor.o(($event) => formData.tagIndex = $event),
|
||||
A: common_vendor.p({
|
||||
s: common_vendor.o(($event) => formData.tagIndex = $event),
|
||||
t: common_vendor.p({
|
||||
options: tagOptions.value,
|
||||
modelValue: formData.tagIndex
|
||||
}),
|
||||
B: common_vendor.o(($event) => showAddPopup.value = false),
|
||||
C: common_vendor.o(handleAdd),
|
||||
D: common_vendor.o(($event) => showAddPopup.value = false),
|
||||
E: common_vendor.p({
|
||||
v: common_vendor.o(($event) => showAddPopup.value = false),
|
||||
w: common_vendor.o(handleAdd),
|
||||
x: common_vendor.o(($event) => showAddPopup.value = false),
|
||||
y: common_vendor.p({
|
||||
show: showAddPopup.value,
|
||||
mode: "center",
|
||||
round: "20"
|
||||
|
||||
Reference in New Issue
Block a user