From c9270b0f96760aa535573b39707b1bede60c0a53 Mon Sep 17 00:00:00 2001 From: huangchenhao <123673748@qq.com> Date: Thu, 13 Nov 2025 16:22:30 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=86=B0=E9=9B=AA=E4=B8=93=E9=A2=98Pc?= =?UTF-8?q?=E6=AE=B5=20=E7=89=A9=E8=B5=84=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/src/component/MyDialog/index.vue | 1 - .../screen/src/component/MyDrawer/index.js | 3 + .../screen/src/component/MyDrawer/index.vue | 100 +++++++++++++++++ .../views/MaterialManagement/addDialog.vue | 61 +++------- .../views/MaterialManagement/detailDialog.vue | 105 +++++++++++------- .../src/views/MaterialManagement/index.js | 104 ++++++++++------- .../src/views/MaterialManagement/index.vue | 16 ++- 7 files changed, 259 insertions(+), 131 deletions(-) create mode 100644 packages/screen/src/component/MyDrawer/index.js create mode 100644 packages/screen/src/component/MyDrawer/index.vue diff --git a/packages/screen/src/component/MyDialog/index.vue b/packages/screen/src/component/MyDialog/index.vue index 9deb614..4ef33b8 100644 --- a/packages/screen/src/component/MyDialog/index.vue +++ b/packages/screen/src/component/MyDialog/index.vue @@ -12,7 +12,6 @@ v-bind="componentProps" @vue:mounted="handleComponentMount" /> - diff --git a/packages/screen/src/views/MaterialManagement/detailDialog.vue b/packages/screen/src/views/MaterialManagement/detailDialog.vue index f5575ad..9a4cbed 100644 --- a/packages/screen/src/views/MaterialManagement/detailDialog.vue +++ b/packages/screen/src/views/MaterialManagement/detailDialog.vue @@ -1,52 +1,68 @@ @@ -60,4 +76,9 @@ const props = defineProps({ \ No newline at end of file diff --git a/packages/screen/src/views/MaterialManagement/index.js b/packages/screen/src/views/MaterialManagement/index.js index e159898..9537dc3 100644 --- a/packages/screen/src/views/MaterialManagement/index.js +++ b/packages/screen/src/views/MaterialManagement/index.js @@ -16,6 +16,7 @@ const filterText = ref(''); // 树节点过滤条件 const tableData = ref([]); const qxmc = ref(''); // 区县名称 const yhzid = ref(''); // 养护站id +const yhzmc = ref(''); // 养护站名称 const filterData = reactive({ wzmc: '', }); // 表格过滤条件 @@ -42,19 +43,38 @@ const model = reactive({ const dialogType = ref(''); // 弹窗类型 const dialogRef = ref(null); // 弹窗实例 +const drawerVisible = ref(false); // 抽屉显示状态 +const drawer = reactive({ + title: '', + content: null, + props: {}, + onCancel: null, + onConfirm: null, + direction: 'rtl', + size: '50%' +}); // 抽屉内容 +const drawerType = ref(''); // 抽屉类型 +const drawerRef = ref(null); // 抽屉实例 + + + const INIT_FORM = { - rkrq: "", - rkdw: "", - sl: "", - dw: "", - cfdd: "", - fzr: "", - lxdh: "", - ye: "", - qxmc: "", - wzmc: "", - fzrid: "", - yhzid: "", + material: { + rkrq: "", + rkdw: "", + sl: "", + dw: "", + cfdd: "", + fzr: "", + lxdh: "", + ye: "", + qxmc: "", + wzmc: "", + fzrid: "", + yhzid: "", + yhzmc: "", + }, + photos: [], }; // 表单初始值 const form = reactive({ ...INIT_FORM }); // 表单 @@ -96,7 +116,8 @@ const getTreeData = async () => { children: qx.yhzList.map(site => ({ id: site.id, name: `${site.mc}(${site.wzsl})`, - type: 'site' + type: 'site', + rawName: site.mc, // 原始名称 })), rawName: qx.qxmc, // 原始名称 }) @@ -116,18 +137,21 @@ const handleNodeClick = (data, node) => { if (data.type === 'area' && node.expanded === false) { console.log('树节点关闭', node.expanded) yhzid.value = ''; // 重置养护站id + yhzmc.value = ''; // 重置养护站名称 qxmc.value = ''; // 重置区县名称 return; } if (data.type === 'area') { console.log('你点击的是区县', data.id) yhzid.value = ''; // 重置养护站id + yhzmc.value = ''; // 重置养护站名称 qxmc.value = data.id; // 保存区县名称 } if (data.type === 'site') { console.log('你点击的是站点', data.name) yhzid.value = data.id; // 保存养护站id + yhzmc.value = data.rawName; // 保存养护站名称 qxmc.value = ''; // 重置区县名称 } }; @@ -170,37 +194,25 @@ const columns = [ prop: 'ye', label: '余量', }, - { - prop: 'rkdw', - label: '入库单位', - }, - { - prop: 'rkrq', - label: '入库日期', - }, - { - prop: 'sl', - label: '数量', - }, { prop: 'dw', label: '单位', }, - { - prop: 'cfdd', - label: '存放地点', - }, { prop: 'fzr', label: '负责人', }, { - prop: 'lxdh', - label: '联系电话', + prop: 'rkrName', + label: '入库人', }, { - prop: 'qxmc', - label: '所属区县', + prop: 'rkrq', + label: '入库日期', + }, + { + prop: 'yhzMc', + label: '所属服务站', }, { label: "操作", @@ -305,20 +317,20 @@ const getDetailData = async (row) => { } if (res.code === '00000') { if (dialogType.value === 'detail') { - model.title = `物资详情`; - model.content = DetailDialog; - model.props = { - detailData: res.data.material, + drawer.title = `物资详情`; + drawer.content = DetailDialog; + drawer.props = { + detailData: res.data, }; - model.onCancel = () => { + drawer.onCancel = () => { dialogType.value = ''; - modelVisible.value = false; + drawerVisible.value = false; }; - model.onConfirm = () => { + drawer.onConfirm = () => { dialogType.value = ''; - modelVisible.value = false; + drawerVisible.value = false; }; - modelVisible.value = true; + drawerVisible.value = true; } if (dialogType.value === 'edit') { model.title = `编辑物资`; @@ -353,6 +365,8 @@ const openAddModel = () => { model.title = `新增物资`; model.content = AddDialog; Object.assign(form, INIT_FORM); + form.material.yhzid = yhzid.value; + form.material.yhzmc = yhzmc.value; model.props = { detailData: {}, form: form, @@ -441,7 +455,7 @@ export default () => { await getTreeData(); await getyhzwzList(); const rowData = (decodeURIComponent(route.params?.data)); - if (rowData !== 'undefined' && rowData!== 'null' && rowData !== '' ) { + if (rowData !== 'undefined' && rowData !== 'null' && rowData !== '') { const JSONData = JSON.parse(rowData); filterText.value = JSONData.mc; }; @@ -462,5 +476,9 @@ export default () => { dialogRef, model, openAddModel, + drawerVisible, + drawer, + drawerRef, + yhzid, } } \ No newline at end of file diff --git a/packages/screen/src/views/MaterialManagement/index.vue b/packages/screen/src/views/MaterialManagement/index.vue index 855ae16..36f32bf 100644 --- a/packages/screen/src/views/MaterialManagement/index.vue +++ b/packages/screen/src/views/MaterialManagement/index.vue @@ -28,7 +28,7 @@
- 新增物资 +
@@ -65,9 +76,10 @@ import scriptFn from "./index.js"; import DynamicTable from "../../component/DynamicTable"; import MyDialog from "../../component/MyDialog"; +import MyDrawer from "../../component/MyDrawer/index.js"; const script = scriptFn(); -const { treeRef, dialogRef } = script; +const { treeRef, dialogRef, drawerRef } = script;