From 7643153d78712755d7ad48948fae4ecd541d42ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Sat, 7 Feb 2026 18:33:49 +0800 Subject: [PATCH] =?UTF-8?q?feat(shop):=20=E5=B0=86=E4=BB=93=E5=BA=93?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD=E9=87=8D=E6=9E=84=E4=B8=BA?= =?UTF-8?q?=E5=BA=97=E9=93=BA=E5=9B=B4=E6=A0=8F=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 重命名 shopWarehouse 组件为 shopStoreFence - 替换仓库相关API调用为围栏相关API调用 - 更新表格列配置,将仓库字段改为围栏字段 - 修改编辑弹窗组件,调整表单项和验证规则 - 移除级联选择组件,改为单独的省市区输入框 - 更新删除操作的API接口调用 - 修改组件名称和相关数据类型引用 --- .../components/search.vue | 0 .../index.vue | 75 ++++-------- .../components/shopStoreWarehouseEdit.vue} | 112 +++++++----------- 3 files changed, 66 insertions(+), 121 deletions(-) rename src/views/shop/{shopWarehouse => shopStoreFence}/components/search.vue (100%) rename src/views/shop/{shopWarehouse => shopStoreFence}/index.vue (76%) rename src/views/shop/{shopWarehouse/components/shopWarehouseEdit.vue => shopStoreWarehouse/components/shopStoreWarehouseEdit.vue} (71%) diff --git a/src/views/shop/shopWarehouse/components/search.vue b/src/views/shop/shopStoreFence/components/search.vue similarity index 100% rename from src/views/shop/shopWarehouse/components/search.vue rename to src/views/shop/shopStoreFence/components/search.vue diff --git a/src/views/shop/shopWarehouse/index.vue b/src/views/shop/shopStoreFence/index.vue similarity index 76% rename from src/views/shop/shopWarehouse/index.vue rename to src/views/shop/shopStoreFence/index.vue index 2817e64..7de47da 100644 --- a/src/views/shop/shopWarehouse/index.vue +++ b/src/views/shop/shopStoreFence/index.vue @@ -44,7 +44,7 @@ - + @@ -60,17 +60,17 @@ } from 'ele-admin-pro/es/ele-pro-table/types'; import Search from './components/search.vue'; import {getPageTitle} from '@/utils/common'; - import ShopWarehouseEdit from './components/shopWarehouseEdit.vue'; - import { pageShopWarehouse, removeShopWarehouse, removeBatchShopWarehouse } from '@/api/shop/shopWarehouse'; - import type { ShopWarehouse, ShopWarehouseParam } from '@/api/shop/shopWarehouse/model'; + import ShopStoreFenceEdit from './components/shopStoreFenceEdit.vue'; + import { pageShopStoreFence, removeShopStoreFence, removeBatchShopStoreFence } from '@/api/shop/shopStoreFence'; + import type { ShopStoreFence, ShopStoreFenceParam } from '@/api/shop/shopStoreFence/model'; // 表格实例 const tableRef = ref | null>(null); // 表格选中数据 - const selection = ref([]); + const selection = ref([]); // 当前编辑数据 - const current = ref(null); + const current = ref(null); // 是否显示编辑弹窗 const showEdit = ref(false); // 是否显示批量移动弹窗 @@ -89,7 +89,7 @@ if (filters) { where.status = filters.status; } - return pageShopWarehouse({ + return pageShopStoreFence({ ...where, ...orders, page, @@ -100,59 +100,32 @@ // 完整的列配置(包含所有字段) const columns = ref([ { - title: '自增ID', - dataIndex: 'id', - key: 'id', - width: 90, - }, - { - title: '仓库名称', + title: '围栏名称', dataIndex: 'name', key: 'name' }, - { - title: '仓库编号', - dataIndex: 'code', - key: 'code' - }, { title: '类型', dataIndex: 'type', key: 'type' }, { - title: '仓库地址', - dataIndex: 'address', - key: 'address' + title: '排序', + dataIndex: 'sortNumber', + key: 'sortNumber' }, // { - // title: '联系人', - // dataIndex: 'realName', - // key: 'realName' - // }, - // { - // title: '联系电话', - // dataIndex: 'phone', - // key: 'phone' - // }, - // { - // title: '经纬度', - // dataIndex: 'lngAndLat', - // key: 'lngAndLat', - // ellipsis: true - // }, - // { // title: '备注', // dataIndex: 'comments', // key: 'comments', // ellipsis: true // }, - // { - // title: '排序号', - // dataIndex: 'sortNumber', - // key: 'sortNumber', - // width: 120 - // }, + { + title: '状态', + dataIndex: 'status', + key: 'status', + width: 120 + }, { title: '创建时间', dataIndex: 'createTime', @@ -174,13 +147,13 @@ ]); /* 搜索 */ - const reload = (where?: ShopWarehouseParam) => { + const reload = (where?: ShopStoreFenceParam) => { selection.value = []; tableRef?.value?.reload({ where: where }); }; /* 打开编辑弹窗 */ - const openEdit = (row?: ShopWarehouse) => { + const openEdit = (row?: ShopStoreFence) => { current.value = row ?? null; showEdit.value = true; }; @@ -191,9 +164,9 @@ }; /* 删除单个 */ - const remove = (row: ShopWarehouse) => { + const remove = (row: ShopStoreFence) => { const hide = message.loading('请求中..', 0); - removeShopWarehouse(row.id) + removeShopStoreFence(row.id) .then((msg) => { hide(); message.success(msg); @@ -218,7 +191,7 @@ maskClosable: true, onOk: () => { const hide = message.loading('请求中..', 0); - removeBatchShopWarehouse(selection.value.map((d) => d.id)) + removeBatchShopStoreFence(selection.value.map((d) => d.id)) .then((msg) => { hide(); message.success(msg); @@ -238,7 +211,7 @@ }; /* 自定义行属性 */ - const customRow = (record: ShopWarehouse) => { + const customRow = (record: ShopStoreFence) => { return { // 行点击事件 onClick: () => { @@ -255,7 +228,7 @@ diff --git a/src/views/shop/shopWarehouse/components/shopWarehouseEdit.vue b/src/views/shop/shopStoreWarehouse/components/shopStoreWarehouseEdit.vue similarity index 71% rename from src/views/shop/shopWarehouse/components/shopWarehouseEdit.vue rename to src/views/shop/shopStoreWarehouse/components/shopStoreWarehouseEdit.vue index f88b012..0f25bb5 100644 --- a/src/views/shop/shopWarehouse/components/shopWarehouseEdit.vue +++ b/src/views/shop/shopStoreWarehouse/components/shopStoreWarehouseEdit.vue @@ -5,7 +5,6 @@ :visible="visible" :maskClosable="false" :maxable="maxable" - :confirm-loading="loading" :title="isUpdate ? '编辑仓库' : '添加仓库'" :body-style="{ paddingBottom: '28px' }" @update:visible="updateVisible" @@ -30,22 +29,15 @@ - - 中心仓 - 区域仓 - 门店仓 - - - - @@ -55,7 +47,7 @@ v-model:value="form.address" /> - + + + + + + + + + + - - - 获取经纬度 - + (); const emit = defineEmits<{ @@ -140,27 +148,25 @@ // 表格选中数据 const formRef = ref(null); const images = ref([]); - const regions = ref(); // 用户信息 - const form = reactive({ + const form = reactive({ id: undefined, name: undefined, code: undefined, - type: '中心仓', + type: undefined, address: undefined, realName: undefined, phone: undefined, + province: undefined, + city: undefined, + region: undefined, lngAndLat: undefined, userId: undefined, isDelete: undefined, tenantId: undefined, createTime: undefined, updateTime: undefined, - province: undefined, - city: undefined, - region: undefined, - status: 0, comments: '', sortNumber: 100 }); @@ -172,29 +178,13 @@ // 表单验证规则 const rules = reactive({ - name: [ + shopStoreWarehouseName: [ { required: true, type: 'string', message: '请填写仓库名称', trigger: 'blur' } - ], - type: [ - { - required: true, - type: 'string', - message: '请选择仓库类型', - trigger: 'change' - } - ], - region: [ - { - required: true, - type: 'string', - message: '请选择省/市/区', - trigger: 'change' - } ] }); @@ -214,17 +204,6 @@ const { resetFields } = useForm(form, rules); - // 级联选择回填到表单字段,保持提交参数仍然是 province/city/region - watch( - regions, - (val) => { - form.province = val?.[0]; - form.city = val?.[1]; - form.region = val?.[2]; - }, - { immediate: true } - ); - /* 保存编辑 */ const save = () => { if (!formRef.value) { @@ -237,7 +216,7 @@ const formData = { ...form }; - const saveOrUpdate = isUpdate.value ? updateShopWarehouse : addShopWarehouse; + const saveOrUpdate = isUpdate.value ? updateShopStoreWarehouse : addShopStoreWarehouse; saveOrUpdate(formData) .then((msg) => { loading.value = false; @@ -267,19 +246,12 @@ status: 'done' }) } - regions.value = - form.province && form.city && form.region - ? [form.province, form.city, form.region] - : undefined; isUpdate.value = true; } else { isUpdate.value = false; - form.type = '中心仓'; - regions.value = undefined; } } else { resetFields(); - regions.value = undefined; } }, { immediate: true }