feat(shop): 完善仓库管理功能

- 添加仓库状态字段到数据模型
- 为表单提交按钮添加加载状态指示器
- 将仓库类型输入框改为单选按钮组,支持中心仓、区域仓、门店仓选项
- 为经纬度输入框添加获取经纬度按钮,集成腾讯地图定位功能
- 添加表单验证规则,包括仓库类型和省市区必填验证
- 设置默认仓库类型为中心仓
- 优化地区选择组件的数据绑定逻辑
- 重置表单时清除地区选择值
This commit is contained in:
2026-01-30 18:13:23 +08:00
parent c6805c1154
commit 47288a444c
2 changed files with 42 additions and 12 deletions

View File

@@ -34,6 +34,8 @@ export interface ShopWarehouse {
sortNumber?: number;
// 是否删除
isDelete?: number;
// 状态
status?: number;
// 租户id
tenantId?: number;
// 创建时间

View File

@@ -5,6 +5,7 @@
:visible="visible"
:maskClosable="false"
:maxable="maxable"
:confirm-loading="loading"
:title="isUpdate ? '编辑仓库' : '添加仓库'"
:body-style="{ paddingBottom: '28px' }"
@update:visible="updateVisible"
@@ -34,11 +35,11 @@
/>
</a-form-item>
<a-form-item label="类型" name="type">
<a-input
allow-clear
placeholder="请输入类型"
v-model:value="form.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
@@ -69,11 +70,14 @@
/>
</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-form-item>
<a-form-item label="备注" name="comments">
<a-textarea
@@ -108,6 +112,7 @@
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);
@@ -142,7 +147,7 @@
id: undefined,
name: undefined,
code: undefined,
type: undefined,
type: '中心仓',
address: undefined,
realName: undefined,
phone: undefined,
@@ -167,13 +172,29 @@
// 表单验证规则
const rules = reactive({
shopWarehouseName: [
name: [
{
required: true,
type: 'string',
message: '请填写仓库名称',
trigger: 'blur'
}
],
type: [
{
required: true,
type: 'string',
message: '请选择仓库类型',
trigger: 'change'
}
],
region: [
{
required: true,
type: 'string',
message: '请选择省/市/区',
trigger: 'change'
}
]
});
@@ -246,12 +267,19 @@
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 }