From 00391b9f6ad9a76f17978b6b51a6f7d14b000d46 Mon Sep 17 00:00:00 2001 From: huangchenhao <123673748@qq.com> Date: Mon, 24 Nov 2025 15:56:23 +0800 Subject: [PATCH] =?UTF-8?q?App=E7=89=A9=E8=B5=84=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/mobile/src/router/index.js | 5 + .../src/views/Material/MaterialConfirm.vue | 96 ++++ .../src/views/Material/MaterialDetails.vue | 418 ++++++++++++++++-- .../src/views/Material/MaterialManagement.vue | 46 ++ 4 files changed, 540 insertions(+), 25 deletions(-) create mode 100644 packages/mobile/src/views/Material/MaterialConfirm.vue diff --git a/packages/mobile/src/router/index.js b/packages/mobile/src/router/index.js index 07a143c..c09dc05 100644 --- a/packages/mobile/src/router/index.js +++ b/packages/mobile/src/router/index.js @@ -46,6 +46,11 @@ const routes = [ name: 'MaterialDetail', component: () => import('../views/Material/MaterialDetails.vue') }, + { + path: '/materialConfirm/:data', + name: 'MaterialConfirm', + component: () => import('../views/Material/MaterialConfirm.vue') + }, { path: '/iceEventManage/:data', name: 'IceEventManage', diff --git a/packages/mobile/src/views/Material/MaterialConfirm.vue b/packages/mobile/src/views/Material/MaterialConfirm.vue new file mode 100644 index 0000000..75c0785 --- /dev/null +++ b/packages/mobile/src/views/Material/MaterialConfirm.vue @@ -0,0 +1,96 @@ + + + + + \ No newline at end of file diff --git a/packages/mobile/src/views/Material/MaterialDetails.vue b/packages/mobile/src/views/Material/MaterialDetails.vue index 27b77e2..18473e6 100644 --- a/packages/mobile/src/views/Material/MaterialDetails.vue +++ b/packages/mobile/src/views/Material/MaterialDetails.vue @@ -23,7 +23,15 @@ > - + + + @@ -35,9 +43,7 @@ - - 备注 - + + + + + + + + + + + + +
+

+ 确认不是本站点物资? +

+ +
+ + 取消 + + + 确认 + +
+
+
+ + + + + + + +
+

+ 确认添加 +

+ +
+

+ 添加到服务站 +

+ + + + + + + +
+ +
+ + 取消 + + + 确认 + +
+
+
@@ -111,11 +303,14 @@ const yhzDetail = ref({}); const wzData = ref([]); const wzDetailData = ref(); // 物资详情数据 const photos = ref([]); // 物资图片数据 +const isConfirm = ref(false); // 是否是在确认物资 +const editForm = reactive({}); onMounted(() => { const data = JSON.parse(decodeURIComponent(route.params.data)); yhzDetail.value = data.yhzDetail; wzData.value = data.material; + isConfirm.value = data.isConfirm; console.log("传递过来的参数:", data); getwzDetail(); }); @@ -129,6 +324,7 @@ const getwzDetail = async () => { }); if (res.code && res.code === "00000") { wzDetailData.value = res.data.material; + // console.log('wzDetailData',toRaw(wzDetailData.value)); photos.value = res.data.photos; } else { throw new Error(res.message); @@ -160,6 +356,8 @@ const showImage = (photos) => { // 编辑备注相关 const showRemarkPopup = ref(false); const handleRemarkOpen = () => { + editForm.material = JSON.parse(JSON.stringify(wzDetailData.value)); + editForm.photos = [...photos.value]; showRemarkPopup.value = true; }; const onRemarkPopupClose = () => { @@ -168,15 +366,11 @@ const onRemarkPopupClose = () => { }; const onRemarkConfirm = async () => { try { - const data = { - material: wzDetailData.value, - photos: photos.value, - }, - res = await request({ - url: `/snow-ops-platform/yjwz/update`, - method: "POST", - data, - }); + const res = await request({ + url: `/snow-ops-platform/yjwz/update`, + method: "POST", + data: editForm, + }); if (res.code && res.code === "00000") { showToast({ message: "备注信息保存成功", @@ -193,6 +387,182 @@ const onRemarkConfirm = async () => { }); } }; + +// 确认物资相关 +const notYHZPopup = ref(false); +const notYHZPopupOpen = () => { + notYHZPopup.value = true; +}; +const notYHZPopupClose = () => { + notYHZPopup.value = false; +}; +const notYHZConfirm = async () => { + try { + const res = await request({ + url: "/snow-ops-platform/yjwz/confirm", + method: "POST", + data: { + rid: wzDetailData.value.rid, + confirmType: 2, // 确认类型 1-确认添加到本站,2-拒绝 + }, + }); + if (res.code === "00000") { + router.push({ + name: "MaterialManage", + params: { data: encodeURIComponent(JSON.stringify(yhzDetail.value)) }, + }); + } else { + throw new Error(res.message); + } + } catch (error) { + showToast({ type: "fail", message: error.message || "操作失败" }); + } +}; + +const addToThisYHZPupup = ref(false); +const adminOptions = ref([]); // 负责人选项 +// 获取养护站人员列表 +const getPersonList = async () => { + try { + const data = { + pageNum: 1, + pageSize: 9999, + yhzid: yhzDetail.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, + })); + } else { + throw new Error("人员信息获取失败"); + } + } catch (error) { + console.log(error); + showToast({ + type: "fail", + message: error.message, + }); + } +}; +// 负责人 +const showAdminPicker = ref(false); +const onAdminConfirm = (value) => { + const selectedOption = adminOptions.value.find( + (opt) => opt.value === value.selectedValues[0] + ); + if (selectedOption) { + editForm.material.fzr = selectedOption.text; + editForm.material.fzrid = selectedOption.value; + } + showAdminPicker.value = false; +}; +const addToThisYHZPopupOpen = async () => { + await getPersonList(); + editForm.material = JSON.parse(JSON.stringify(wzDetailData.value)); + editForm.photos = [...photos.value]; + fileList.value = photos.value.map((photo) => ({ + url: photo.photoUrl, + status: "done", + message: "上传成功", + serverUrl: photo.photoUrl, + })); + addToThisYHZPupup.value = true; +}; +const addToThisYHZPopupClose = () => { + addToThisYHZPupup.value = false; +}; + +const AddToThisTHZConfirm = async () => { + if (!wzDetailData.value.fzr || !wzDetailData.value.fzrid) { + await onRemarkConfirm(); + } + try { + const data = { + rid: wzDetailData.value.rid, + confirmType: 1, // 确认类型 1-确认添加到本站,2-拒绝 + }; + const res = await request({ + url: "/snow-ops-platform/yjwz/confirm", + method: "POST", + data, + }); + if (res.code === "00000") { + showToast({ + message: "操作成功", + type: "success", + }); + addToThisYHZPopupClose(); + router.push({ + name: "MaterialManage", + params: { data: encodeURIComponent(JSON.stringify(yhzDetail.value)) }, + }); + } else { + throw new Error(res.message); + } + } catch (error) { + showToast({ + type: "fail", + message: error.message || "操作失败", + }); + } +}; + +// 上传文件相关 +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, + }); + } +}; \ 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 d777c81..d3ccc7b 100644 --- a/packages/mobile/src/views/Material/MaterialManagement.vue +++ b/packages/mobile/src/views/Material/MaterialManagement.vue @@ -11,6 +11,12 @@ + {{ pendingConfirmList.length }}个物资待确认
@@ -27,6 +33,7 @@ JSON.stringify({ yhzDetail: yhzDetail, material: item, + isConfirm: false, }) ), }, @@ -241,6 +248,43 @@ const getInitForm = () => ({ photos: [], }); const form = reactive(getInitForm()); +const pendingConfirmList = ref([]); // 待确认物资列表 + +// 获取待确认物资列表 +const getPendingConfirmList = async () => { + try { + const data = { + yhzid: yhzDetail.value.id, + pageNum: 1, + pageSize: 9999, + }; + const res = await request({ + url: "/snow-ops-platform/yjwz/pendingConfirmList", + method: "GET", + params: data, + }); + if (res.code === "00000") { + pendingConfirmList.value = res.data.records; + } else { + throw new Error(res.message); + } + } catch (error) { + showToast({ + type: "fail", + message: error.message || "获取待确认物资列表失败", + }); + } +}; + +// 跳转到确认物资页面 +const handleConfirm = () => { + router.push({ + name: "MaterialConfirm", + params: { + data: encodeURIComponent(JSON.stringify(yhzDetail.value)), + }, + }); +}; // 根据养护站rid获取物资列表 const getMaterialList = async (wzmc) => { @@ -278,6 +322,7 @@ onMounted(() => { yhzDetail.value = JSON.parse(decodeURIComponent(route.params.data)); console.log("yhzDetail", toRaw(yhzDetail.value)); getMaterialList(); + getPendingConfirmList(); }); // 购置日期相关 @@ -331,6 +376,7 @@ const handleSubmit = async () => { }); onPopupClose(); getMaterialList(searchValue.value); + getPendingConfirmList(); } else { throw new Error(res.message); }