From a416e86ca58d32db8862d8f4680e813d73cc6d88 Mon Sep 17 00:00:00 2001 From: huangchenhao <123673748@qq.com> Date: Thu, 6 Nov 2025 09:40:14 +0800 Subject: [PATCH] =?UTF-8?q?App=E7=AB=AF=20=E6=B7=BB=E5=8A=A0=E7=89=A9?= =?UTF-8?q?=E8=B5=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/Material/MaterialManagement.vue | 175 +++++++++++++++++- 1 file changed, 172 insertions(+), 3 deletions(-) diff --git a/packages/mobile/src/views/Material/MaterialManagement.vue b/packages/mobile/src/views/Material/MaterialManagement.vue index ef3949f..318671c 100644 --- a/packages/mobile/src/views/Material/MaterialManagement.vue +++ b/packages/mobile/src/views/Material/MaterialManagement.vue @@ -46,11 +46,112 @@ position="bottom" closeable close-on-click-overlay - :style="{ height: '80%' }" + :style="{ height: '60%' }" @close="onPopupClose" > - @@ -71,6 +172,22 @@ const searchValue = ref(""); // 搜索框输入值 const showPopup = ref(false); // 控制弹出层显示隐藏 const yhzDetail = ref({}); // 养护站详情数据 const materialList = ref([]); // 物资列表数据 +const INIT_FORM = { + rid: "", + rkrq: "", // 入库日期 + rkdw: "", // 入库单位 + sl: 0, // 数量 + dw: "", // 单位 + cfdd: "", // 存放地点 + fzr: "", // 负责人 + lxdh: "", // 联系电话 + ye: "", // 余量 + qxmc: "", // 区县名称 + wzmc: "", // 物资名称 + fzrid: "", // 负责人id + yhzid: "", // 养护站id +}; +const form = reactive({ ...INIT_FORM }); // 表单 // 根据养护站rid获取物资列表 const getMaterialList = async (wzmc) => { @@ -106,9 +223,57 @@ const getMaterialList = async (wzmc) => { // 组件挂载时获取数据 onMounted(() => { yhzDetail.value = JSON.parse(decodeURIComponent(route.params.data)); + console.log("yhzDetail", toRaw(yhzDetail.value)); getMaterialList(); }); +// 购置日期 +const showTimePicker = ref(false); +const currentDate = ref([ + new Date().getFullYear(), + new Date().getMonth() + 1, + new Date().getDate(), +]); +const onDateConfirm = ({ selectedValues }) => { + form.rkrq = selectedValues.join("-"); + showTimePicker.value = false; +}; + +const handleSubmit = async () => { + try { + showLoadingToast({ + message: "正在保存", + forbidClick: true, + loadingType: "spinner", + }); + form.yhzid = yhzDetail.value.id; + form.qxmc = yhzDetail.value.qxmc; + console.log("form", toRaw(form)); + const res = await request({ + url: "/snow-ops-platform/yjwz/add", + method: "post", + data: toRaw(form), + }); + if (res.code && res.code === "00000") { + showToast({ + type: "success", + message: "新增成功", + }); + onPopupClose(); + Object.assign(form, { ...INIT_FORM }); + getMaterialList(searchValue.value); + } else { + throw new Error(res.message); + } + } catch (error) { + console.log(error); + showToast({ + type: "error", + message: error.message || "新增失败", + }); + } +}; + watch( () => searchValue.value, (newVal, oldVal) => { @@ -182,5 +347,9 @@ const onPopupClose = () => { .status-danger { background-color: #ee0a24; } + +.materialAddForm { + padding: 16px 16px 80px 16px; +} \ No newline at end of file