feat(shop): 将仓库管理功能重构为店铺围栏管理

- 重命名 shopWarehouse 组件为 shopStoreFence
- 替换仓库相关API调用为围栏相关API调用
- 更新表格列配置,将仓库字段改为围栏字段
- 修改编辑弹窗组件,调整表单项和验证规则
- 移除级联选择组件,改为单独的省市区输入框
- 更新删除操作的API接口调用
- 修改组件名称和相关数据类型引用
This commit is contained in:
2026-02-07 18:33:49 +08:00
parent a6de72d509
commit 7643153d78
3 changed files with 66 additions and 121 deletions

View File

@@ -44,7 +44,7 @@
</a-card>
<!-- 编辑弹窗 -->
<ShopWarehouseEdit v-model:visible="showEdit" :data="current" @done="reload" />
<ShopStoreFenceEdit v-model:visible="showEdit" :data="current" @done="reload" />
</a-page-header>
</template>
@@ -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<InstanceType<typeof EleProTable> | null>(null);
//
const selection = ref<ShopWarehouse[]>([]);
const selection = ref<ShopStoreFence[]>([]);
//
const current = ref<ShopWarehouse | null>(null);
const current = ref<ShopStoreFence | null>(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<ColumnItem[]>([
{
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 @@
<script lang="ts">
export default {
name: 'ShopWarehouse'
name: 'ShopStoreFence'
};
</script>

View File

@@ -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 @@
<a-form-item label="仓库编号" name="code">
<a-input
allow-clear
placeholder="请输入仓库编号"
placeholder="请输入唯一标识"
v-model:value="form.code"
/>
</a-form-item>
<a-form-item label="类型" name="type">
<a-radio-group v-model:value="form.type">
<a-radio value="中心仓">中心仓</a-radio>
<a-radio value="区域仓">区域仓</a-radio>
<a-radio value="门店仓">门店仓</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="省市区" name="region">
<RegionsSelect
v-model:value="regions"
valueField="label"
placeholder="请选择省/市/区"
<a-input
allow-clear
placeholder="请输入类型 中心仓,区域仓,门店仓"
v-model:value="form.type"
/>
</a-form-item>
<a-form-item label="仓库地址" name="address">
@@ -55,7 +47,7 @@
v-model:value="form.address"
/>
</a-form-item>
<a-form-item label="真实姓名" name="realName">
<a-form-item label="仓库管理员" name="realName">
<a-input
allow-clear
placeholder="请输入真实姓名"
@@ -69,15 +61,33 @@
v-model:value="form.phone"
/>
</a-form-item>
<a-form-item label="所在省份" name="province">
<a-input
allow-clear
placeholder="请输入所在省份"
v-model:value="form.province"
/>
</a-form-item>
<a-form-item label="所在城市" name="city">
<a-input
allow-clear
placeholder="请输入所在城市"
v-model:value="form.city"
/>
</a-form-item>
<a-form-item label="所在辖区" name="region">
<a-input
allow-clear
placeholder="请输入所在辖区"
v-model:value="form.region"
/>
</a-form-item>
<a-form-item label="经纬度" name="lngAndLat">
<a-space>
<a-input
allow-clear
placeholder="请输入经纬度"
v-model:value="form.lngAndLat"
/>
<a-button type="primary" @click="openUrl(`https://lbs.qq.com/getPoint/`)">获取经纬度</a-button>
</a-space>
<a-input
allow-clear
placeholder="请输入经纬度"
v-model:value="form.lngAndLat"
/>
</a-form-item>
<a-form-item label="备注" name="comments">
<a-textarea
@@ -104,15 +114,13 @@
import { ref, reactive, watch } from 'vue';
import { Form, message } from 'ant-design-vue';
import { assignObject, uuid } from 'ele-admin-pro';
import { addShopWarehouse, updateShopWarehouse } from '@/api/shop/shopWarehouse';
import { ShopWarehouse } from '@/api/shop/shopWarehouse/model';
import { addShopStoreWarehouse, updateShopStoreWarehouse } from '@/api/shop/shopStoreWarehouse';
import { ShopStoreWarehouse } from '@/api/shop/shopStoreWarehouse/model';
import { useThemeStore } from '@/store/modules/theme';
import { storeToRefs } from 'pinia';
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
import { FormInstance } from 'ant-design-vue/es/form';
import { FileRecord } from '@/api/system/file/model';
import RegionsSelect from "@/components/RegionsSelect/index.vue";
import {openUrl} from "@/utils/common";
//
const isUpdate = ref(false);
@@ -125,7 +133,7 @@
//
visible: boolean;
//
data?: ShopWarehouse | null;
data?: ShopStoreWarehouse | null;
}>();
const emit = defineEmits<{
@@ -140,27 +148,25 @@
//
const formRef = ref<FormInstance | null>(null);
const images = ref<ItemType[]>([]);
const regions = ref<string[]>();
//
const form = reactive<ShopWarehouse>({
const form = reactive<ShopStoreWarehouse>({
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 }