From 7bdc705e2540c15bd40c5253ec37472b78104195 Mon Sep 17 00:00:00 2001
From: huangchenhao <123673748@qq.com>
Date: Thu, 13 Nov 2025 10:59:57 +0800
Subject: [PATCH] =?UTF-8?q?=E5=86=B0=E9=9B=AA=E4=B8=93=E9=A2=98App?=
=?UTF-8?q?=E7=AB=AF=20=E7=89=A9=E8=B5=84=E7=AE=A1=E7=90=86=20=E8=AE=BE?=
=?UTF-8?q?=E5=A4=87=E7=AE=A1=E7=90=86=20=E8=AF=A6=E6=83=85=E9=A1=B5?=
=?UTF-8?q?=E9=9D=A2=E5=AE=8C=E5=96=84=20=E7=BC=96=E8=BE=91=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/views/Equipment/EquipmentDetails.vue | 271 ++++++++++++------
.../src/views/Material/MaterialDetails.vue | 115 +++++++-
.../src/views/Material/MaterialManagement.vue | 7 +-
3 files changed, 301 insertions(+), 92 deletions(-)
diff --git a/packages/mobile/src/views/Equipment/EquipmentDetails.vue b/packages/mobile/src/views/Equipment/EquipmentDetails.vue
index 0a2c64d..e3c05d3 100644
--- a/packages/mobile/src/views/Equipment/EquipmentDetails.vue
+++ b/packages/mobile/src/views/Equipment/EquipmentDetails.vue
@@ -63,8 +63,12 @@
-
+
+
@@ -350,14 +354,17 @@
编辑设备信息
+ maxlength="20"
+ show-word-limit
+ >
+
-
-
-
+
+
+
+
+
+
-
-
-
-
-
import "vant/es/toast/style";
import "vant/es/popup/style";
-import { ref, onMounted, toRaw, reactive } from "vue";
+import { ref, onMounted, toRaw, reactive, computed } from "vue";
import { useRouter, useRoute } from "vue-router";
import { showToast, showLoadingToast, showImagePreview } from "vant";
import { request } from "../../../../shared/utils/request";
@@ -666,6 +661,7 @@ const equipmentInfo = ref({});
const yhzInfo = ref({});
const equipmentDetailInfo = ref({});
const photos = ref([]);
+const statusList = ref([]);
// 获取设备详情
const getEquipmentDetailInfo = async () => {
@@ -677,6 +673,7 @@ const getEquipmentDetailInfo = async () => {
if (res.code && res.code === "00000") {
equipmentDetailInfo.value = res.data.equipment;
photos.value = res.data.photos;
+ statusList.value = res.data.statusList;
console.log("设备详情", toRaw(equipmentDetailInfo.value));
} else {
throw new Error(res.data.message);
@@ -711,12 +708,12 @@ const onScrapConfirm = async () => {
try {
console.log("equipmentDetailInfo", toRaw(equipmentDetailInfo.value));
const res = await request({
- url: `/snow-ops-platform/yjsb/update`,
+ url: `/snow-ops-platform/yjsb/updateEquipmentStatus`,
method: "POST",
data: {
- ...equipmentDetailInfo.value,
- sbzt: "报废",
- remark: scrapReason.value,
+ equipmentId: equipmentDetailInfo.value.rid,
+ equipmentStatus: "报废",
+ statusDesc: scrapReason.value,
},
});
if (res.code && res.code === "00000") {
@@ -724,7 +721,7 @@ const onScrapConfirm = async () => {
router.push({
name: "EquipManage",
params: {
- data: encodeURIComponent(JSON.stringify(equipmentInfo.value)),
+ data: encodeURIComponent(JSON.stringify(yhzInfo.value)),
},
});
} else {
@@ -747,12 +744,12 @@ const brokenReason = ref(""); // 损坏原因
const onBrokenConfirm = async () => {
try {
const res = await request({
- url: `/snow-ops-platform/yjsb/update`,
+ url: `/snow-ops-platform/yjsb/updateEquipmentStatus`,
method: "POST",
data: {
- ...equipmentDetailInfo.value,
- sbzt: "损坏", // 修改状态为损坏
- remark: brokenReason.value,
+ equipmentId: equipmentDetailInfo.value.rid,
+ equipmentStatus: "损坏",
+ statusDesc: brokenReason.value,
},
});
if (res.code && res.code === "00000") {
@@ -760,7 +757,7 @@ const onBrokenConfirm = async () => {
router.push({
name: "EquipManage",
params: {
- data: encodeURIComponent(JSON.stringify(equipmentInfo.value)),
+ data: encodeURIComponent(JSON.stringify(yhzInfo.value)),
},
});
} else {
@@ -830,9 +827,10 @@ const onRemarkConfirm = async () => {
url: "/snow-ops-platform/yjsb/update",
method: "POST",
data: {
- ...equipmentDetailInfo.value,
-
- remark: equipmentDetailInfo.value.remark,
+ equipment: {
+ ...equipmentDetailInfo.value,
+ },
+ photos: photos.value,
},
});
if (res.code && res.code === "00000") {
@@ -856,10 +854,53 @@ const onRemarkPopupClose = () => {
const showEditPopup = ref(false);
// 编辑表单
const editForm = reactive({});
-// 打开编辑弹窗
-const onEditPopupOpen = () => {
- Object.assign(editForm, equipmentDetailInfo.value);
+// 获取养护站人员列表
+const getPersonList = async () => {
+ try {
+ const data = {
+ pageNum: 1,
+ pageSize: 9999,
+ yhzid: yhzInfo.value.id,
+ };
+ const res = await request({
+ url: "/snow-ops-platform/yhzry/list",
+ method: "get",
+ params: data,
+ });
+ if (res.code === "00000") {
+ adminOptions.value = res.data.records.map((item) => ({
+ text: item.xm,
+ value: item.userId,
+ }));
+ operatorOptions.value = res.data.records.map((item) => ({
+ text: item.xm,
+ value: item.userId,
+ }));
+ } else {
+ throw new Error("人员信息获取失败");
+ }
+ } catch (error) {
+ console.log(error);
+ showToast({
+ type: "fail",
+ message: error.message,
+ });
+ }
+};
+// 打开编辑弹窗
+const onEditPopupOpen = async () => {
+ await getPersonList();
+ Object.assign(editForm, {
+ equipment: equipmentDetailInfo.value,
+ photos: photos.value,
+ });
+ fileList.value = photos.value.map((photo) => ({
+ url: photo.photoUrl, // 显示用的URL
+ status: "done", // 上传状态为已完成
+ message: "上传成功", // 提示信息
+ serverUrl: photo.photoUrl, // 保留服务器返回的原始URL
+ }));
showEditPopup.value = true;
};
// 关闭编辑弹窗
@@ -917,7 +958,7 @@ const onCategoryConfirm = (value) => {
showCategoryPicker.value = false;
categoryField.value.focus();
} else {
- editForm.sbdl = value.selectedValues[0];
+ editForm.equipment.sbdl = value.selectedValues[0];
showCategoryPicker.value = false;
}
};
@@ -926,32 +967,36 @@ const onTypeConfirm = (value) => {
showTypePicker.value = false;
typeField.value.focus();
} else {
- editForm.sblx = value.selectedValues[0];
+ editForm.equipment.sblx = value.selectedValues[0];
showTypePicker.value = false;
}
};
// 设备管理员
const showAdminPicker = ref(false);
-const adminOptions = [
- { text: "管理员1", value: "管理员1" },
- { text: "管理员2", value: "管理员2" },
- { text: "管理员3", value: "管理员3" },
-];
+const adminOptions = ref([]);
const onAdminConfirm = (value) => {
- editForm.glry = value.selectedValues[0];
+ const selectedOption = adminOptions.value.find(
+ (opt) => opt.value === value.selectedValues[0]
+ );
+ if (selectedOption) {
+ editForm.equipment.glry = selectedOption.text;
+ editForm.equipment.glryid = selectedOption.value;
+ }
showAdminPicker.value = false;
};
// 操作员
const showOperatorPicker = ref(false);
-const operatorOptions = [
- { text: "操作员1", value: "操作员1" },
- { text: "操作员2", value: "操作员2" },
- { text: "操作员3", value: "操作员3" },
-];
+const operatorOptions = ref([]);
const operatorConfirm = (value) => {
- editForm.czy = value.selectedValues[0];
+ const selectedOption = operatorOptions.value.find(
+ (opt) => opt.value === value.selectedValues[0]
+ );
+ if (selectedOption) {
+ editForm.equipment.czy = selectedOption.text;
+ editForm.equipment.czyid = selectedOption.value;
+ }
showOperatorPicker.value = false;
};
@@ -968,16 +1013,19 @@ const onDateConfirm = ({ selectedValues }) => {
};
// 设备状态相关
-const showStatusPicker = ref(false);
-const statusOptions = [
- { text: "完好", value: "完好" },
- { text: "损坏", value: "损坏" },
- { text: "报废", value: "报废" },
-];
-const onStatusConfirm = (value) => {
- editForm.sbzt = value.selectedValues[0];
- showStatusPicker.value = false;
-};
+const latestStatusDesc = computed(() => {
+ if (
+ !equipmentDetailInfo.value.sbzt ||
+ equipmentDetailInfo.value.sbzt === "完好"
+ )
+ return "";
+
+ const records = statusList.value
+ .filter((item) => item.equipmentStatus === equipmentDetailInfo.value.sbzt)
+ .sort((a, b) => new Date(b.reportTime) - new Date(a.reportTime));
+
+ return records.length > 0 ? `${records[0].statusDesc}` : "暂无相关记录";
+});
// 是否应急设备相关
const showEmergencyPicker = ref(false);
@@ -1001,11 +1049,62 @@ const onSubsidyConfirm = (value) => {
showSubsidyPicker.value = false;
};
+// 上传附件相关
+const fileList = ref([]);
+// 文件删除
+const handleDelete = (file) => {
+ if (file.serverUrl) {
+ const index = editForm.photos.findIndex(
+ (p) => p.photoUrl === file.serverUrl
+ );
+ if (index !== -1) {
+ editForm.photos.splice(index, 1);
+ }
+ }
+};
+
+// 文件上传
+const afterRead = async (file) => {
+ try {
+ const toast = showLoadingToast({
+ message: "上传中...",
+ forbidClick: true,
+ duration: 0, // 设置为0表示不会自动关闭
+ });
+ const formData = new FormData();
+ formData.append("file", file.file);
+ const res = await request({
+ url: "/snow-ops-platform/file/upload",
+ method: "post",
+ data: formData,
+ });
+ toast.close();
+ if (res.code === "00000") {
+ editForm.photos.push({ photoUrl: res.data });
+ const index = fileList.value.findIndex((f) => f.file === file.file);
+ if (index !== -1) {
+ fileList.value[index].serverUrl = res.data;
+ }
+
+ console.log("editForm.photos", toRaw(editForm.photos));
+ console.log("fileList.value", fileList.value);
+ } else {
+ throw new Error(res.message);
+ }
+ } catch (error) {
+ toast.close();
+ showToast({
+ type: "fail",
+ message: error.message,
+ });
+ }
+};
+
// 提交修改
const onEditSubmit = async () => {
try {
showLoadingToast({ message: "提交中...", forbidClick: true });
- // console.log('editForm',toRaw(editForm))
+ console.log('editForm',toRaw(editForm))
const res = await request({
url: "/snow-ops-platform/yjsb/update",
diff --git a/packages/mobile/src/views/Material/MaterialDetails.vue b/packages/mobile/src/views/Material/MaterialDetails.vue
index 6f45127..c72e427 100644
--- a/packages/mobile/src/views/Material/MaterialDetails.vue
+++ b/packages/mobile/src/views/Material/MaterialDetails.vue
@@ -28,10 +28,72 @@
-
+
+
+
+
+
+
+ 备注信息
+
+
+
+
+ 取消
+
+
+ 确认
+
+
+
+
@@ -96,6 +158,43 @@ const showImage = (photos) => {
closeable: true,
});
};
+
+// 编辑备注相关
+const showRemarkPopup = ref(false);
+const handleRemarkOpen = () => {
+ showRemarkPopup.value = true;
+};
+const onRemarkPopupClose = () => {
+ getwzDetail();
+ showRemarkPopup.value = false;
+};
+const onRemarkConfirm = async () => {
+ try {
+ const data = {
+ material: wzDetailData.value,
+ photos: photos.value,
+ },
+ res = await request({
+ url: `/snow-ops-platform/yjwz/update`,
+ method: "POST",
+ data,
+ });
+ if (res.code && res.code === "00000") {
+ showToast({
+ message: "备注信息保存成功",
+ type: "success",
+ });
+ onRemarkPopupClose();
+ } else {
+ throw new Error(res.message);
+ }
+ } catch (error) {
+ showToast({
+ message: error.message,
+ type: "fail",
+ });
+ }
+};
\ No newline at end of file
diff --git a/packages/mobile/src/views/Material/MaterialManagement.vue b/packages/mobile/src/views/Material/MaterialManagement.vue
index 0fd20ea..d8d4f87 100644
--- a/packages/mobile/src/views/Material/MaterialManagement.vue
+++ b/packages/mobile/src/views/Material/MaterialManagement.vue
@@ -34,12 +34,11 @@
>
+
+ 添加物资
+
-
- 添加物资
-
-