Compare commits

...
3 Commits
13 changed files with 1297 additions and 497 deletions
+5
View File
@@ -0,0 +1,5 @@
# 根目录仅薄脚本入口;勿提交本地依赖与锁外产物
node_modules/
.DS_Store
*.log
.pnpm-store/
+16 -1
View File
@@ -1,6 +1,21 @@
# AGENTS.md
电商 DMB / ECBI 系统。根目录**不是统一工作区**:各 app 各自构建、各自装依赖,根目录无 package.json。提交走 git(分支 `dev`),commit message 用中文 conventional 格式(`feat:`/`fix:`/`refactor:`/`sql:` 前缀)。
电商 DMB / ECBI 系统。根目录**不是业务 monorepo**:各 app 各自构建、各自装依赖;根 `package.json` 只做开发启动薄封装(仅 `concurrently`)。`pnpm-workspace.yaml` 的 `packages: []` 用于阻断向上解析到家目录 workspace,**不要**把 `apps/*` 写进去。提交走 git(分支 `dev`),commit message 用中文 conventional 格式(`feat:`/`fix:`/`refactor:`/`sql:` 前缀)。
## 本地一键启动(根目录)
先各自装好依赖(`apps/web` 的 `pnpm install`、`apps/agent` 的 venv、Server 环境变量等),再在仓库根:
```bash
pnpm install # 仅安装 concurrently
pnpm dev # 并行:web + server + agent
pnpm dev:web-server # 只要前后端
pnpm dev:web # 仅前端
pnpm dev:server # 仅 Java(./mvnw spring-boot:run)
pnpm dev:agent # 仅 Agent(需 apps/agent/.venv)
```
Server 仍依赖本机 `DB_*` / Redis / `JWT_SECRET` 等;Agent 读 `apps/agent/.env.dev`。
## 目录一览
@@ -0,0 +1,48 @@
-- 快递报价编辑页:后端动态路由(embedded,不进侧栏)
INSERT INTO `sys_menu` (
`id`, `parent_id`, `super`, `route_name`, `title`, `path`, `component`,
`redirect`, `icon`, `type`, `visible`, `status`, `keep_alive`, `order`
)
SELECT
14022,
(SELECT id FROM `sys_menu` WHERE `id` = 7 OR `title` = '经营店铺' OR `route_name` = 'ShopCatalog' LIMIT 1),
0,
'ExpressQuoteEdit',
'快递报价单编辑',
'/ec/warehouse/express-quote/edit/:id?',
'/ec/warehouse/express-quote/edit/index',
'',
'lucide:file-pen-line',
'embedded',
0,
1,
0,
8
FROM DUAL
WHERE NOT EXISTS (
SELECT 1 FROM `sys_menu` WHERE `id` = 14022 OR `route_name` = 'ExpressQuoteEdit'
);
-- 菜单权限:读写创建更新(打开编辑页)
INSERT IGNORE INTO `sys_menu_permission` (`menu_id`, `permission_id`)
SELECT m.id, p.id
FROM `sys_menu` m
JOIN `sys_permission` p ON p.code IN (
'ec:express-quote:read',
'ec:express-quote:create',
'ec:express-quote:update'
)
WHERE m.route_name = 'ExpressQuoteEdit' OR m.id = 14022;
-- 已开通快递报价列表的公司同步开通编辑页
INSERT IGNORE INTO `org_company_menu` (`company_id`, `menu_id`, `status`)
SELECT DISTINCT cm.`company_id`, 14022, 1
FROM `org_company_menu` cm
WHERE cm.`menu_id` = 14021;
-- 已有快递报价菜单的岗位同步开通
INSERT IGNORE INTO `org_position_menu` (`position_id`, `menu_id`)
SELECT pm.`position_id`, 14022
FROM `org_position_menu` pm
WHERE pm.`menu_id` = 14021;
@@ -0,0 +1,47 @@
-- 发货仓库 / 快递报价从「经营店铺」拆到一级目录「发货物流」
INSERT INTO `sys_menu` (
`id`, `parent_id`, `super`, `route_name`, `title`, `path`, `component`,
`redirect`, `icon`, `type`, `visible`, `status`, `keep_alive`, `order`
)
SELECT
14019,
NULL,
0,
'FreightCatalog',
'发货物流',
'/freight',
'',
'',
'lucide:truck',
'catalog',
1,
1,
0,
6
FROM DUAL
WHERE NOT EXISTS (
SELECT 1 FROM `sys_menu` WHERE `id` = 14019 OR `route_name` = 'FreightCatalog'
);
-- 子菜单改挂到发货物流(含编辑页 embedded)
UPDATE `sys_menu`
SET `parent_id` = 14019
WHERE `id` IN (14020, 14021, 14022)
OR `route_name` IN (
'WarehouseManagement',
'ExpressQuoteManagement',
'ExpressQuoteEdit'
);
-- 已开通仓/报价子菜单的公司补挂父目录,避免侧栏断树
INSERT IGNORE INTO `org_company_menu` (`company_id`, `menu_id`, `status`)
SELECT DISTINCT cm.`company_id`, 14019, 1
FROM `org_company_menu` cm
WHERE cm.`menu_id` IN (14020, 14021, 14022);
-- 已有子菜单的岗位补挂父目录
INSERT IGNORE INTO `org_position_menu` (`position_id`, `menu_id`)
SELECT DISTINCT pm.`position_id`, 14019
FROM `org_position_menu` pm
WHERE pm.`menu_id` IN (14020, 14021, 14022);
@@ -727,6 +727,10 @@ INSERT INTO `sys_menu` (`id`, `parent_id`, `super`, `route_name`, `title`, `path
SELECT 14006, NULL, 0, 'ProductCatalog', '经营商品', '/product', '', '', 'icon-park-outline:ad-product', 'catalog', 1, 1, 0, 5
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `id` = 14006 OR `route_name` = 'ProductCatalog');
INSERT INTO `sys_menu` (`id`, `parent_id`, `super`, `route_name`, `title`, `path`, `component`, `redirect`, `icon`, `type`, `visible`, `status`, `keep_alive`, `order`)
SELECT 14019, NULL, 0, 'FreightCatalog', '发货物流', '/freight', '', '', 'lucide:truck', 'catalog', 1, 1, 0, 6
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `id` = 14019 OR `route_name` = 'FreightCatalog');
INSERT INTO `sys_menu` (`id`, `parent_id`, `super`, `route_name`, `title`, `path`, `component`, `redirect`, `icon`, `type`, `visible`, `status`, `keep_alive`, `order`)
SELECT 2, (SELECT id FROM `sys_menu` WHERE `id` = 1 OR `title` = '系统设置' LIMIT 1), 1, 'MenuManagement', '系统菜单', '/sys/menu', '/sys/menu/index', '', 'lucide:menu', 'menu', 1, 1, 0, 1
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `id` = 2 OR `route_name` = 'MenuManagement');
@@ -798,6 +802,11 @@ INSERT INTO `sys_menu` (`id`, `parent_id`, `super`, `route_name`, `title`, `path
SELECT 43, (SELECT id FROM `sys_menu` WHERE `id` = 6 OR `title` = '电商页面' LIMIT 1), 0, 'ProductOverview', '商品概览', '/ec/product/overview/:id', '/ec/product/overview/index', '', 'lets-icons:chart', 'embedded', 0, 1, 1, 2
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `id` = 43 OR `route_name` = 'ProductOverview');
INSERT INTO `sys_menu` (`id`, `parent_id`, `super`, `route_name`, `title`, `path`, `component`, `redirect`, `icon`, `type`, `visible`, `status`, `keep_alive`, `order`)
SELECT 14022, (SELECT id FROM `sys_menu` WHERE `id` = 14019 OR `title` = '发货物流' OR `route_name` = 'FreightCatalog' LIMIT 1), 0,
'ExpressQuoteEdit', '快递报价单编辑', '/ec/warehouse/express-quote/edit/:id?', '/ec/warehouse/express-quote/edit/index', '', 'lucide:file-pen-line', 'embedded', 0, 1, 0, 8
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `id` = 14022 OR `route_name` = 'ExpressQuoteEdit');
INSERT INTO `sys_menu` (`id`, `parent_id`, `super`, `route_name`, `title`, `path`, `component`, `redirect`, `icon`, `type`, `visible`, `status`, `keep_alive`, `order`)
SELECT 53, (SELECT id FROM `sys_menu` WHERE `id` = 6 OR `title` = '电商页面' LIMIT 1), 0, 'PlatformOverview', '平台概览', '/ec/platform/overview/:code', '/ec/platform/overview/index', '', 'lucide:layers', 'embedded', 0, 1, 1, 4
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `id` = 53 OR `route_name` = 'PlatformOverview');
+25 -1
View File
@@ -15,6 +15,28 @@ import { $t } from '#/locales';
const forbiddenComponent = () => import('#/views/_core/fallback/forbidden.vue');
/** 编辑类 embedded 路由:侧栏高亮回列表菜单 */
const ACTIVE_PATH_BY_ROUTE_NAME: Record<string, string> = {
ExpressQuoteEdit: '/ec/warehouse/express-quote',
};
/** 就地写入 activePath,避免 mapTree 展开 meta 后 title 被推断成 string | undefined */
function enrichRouteMeta(
routes: RouteRecordStringComponent[],
): RouteRecordStringComponent[] {
for (const node of routes) {
const name = String(node.name ?? '');
const activePath = ACTIVE_PATH_BY_ROUTE_NAME[name];
if (activePath && node.meta) {
node.meta.activePath = activePath;
}
if (node.children?.length) {
enrichRouteMeta(node.children as RouteRecordStringComponent[]);
}
}
return routes;
}
/** 将 glob key 规范成与后端 component 一致的 /xxx/index.vue */
function normalizePageKey(path: string): string {
const normalized = path.replace(/^(\.\/|\.\.\/)+/, '');
@@ -83,7 +105,9 @@ async function generateAccess(
}
try {
const routes = await getUserMenuApi();
return filterMissingPageRoutes(routes || [], pageMap, layoutMap);
return enrichRouteMeta(
filterMissingPageRoutes(routes || [], pageMap, layoutMap),
);
} catch (error) {
console.error('❌ 获取用户菜单路由失败:', error);
throw error;
@@ -1,486 +0,0 @@
<script lang="ts" setup>
import type { ExpressQuoteDTO, ExpressQuoteVO } from '#/api/ec/express-quote';
import { computed, reactive, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import {
Button,
Form,
FormItem,
Input,
InputNumber,
message,
Select,
Switch,
} from 'ant-design-vue';
import {
createExpressQuoteApi,
getExpressCarriersApi,
getExpressProvincesApi,
getExpressQuoteDetailApi,
updateExpressQuoteApi,
upsertExpressQuoteVersionApi,
} from '#/api/ec/express-quote';
const emit = defineEmits<{ success: [] }>();
interface BandRow {
weightFromG: number;
weightToG: number | null;
priceMode: string;
flatAmount: number;
firstWeightG: number;
firstAmount: number;
continuePerKg: number;
}
interface RegionRow {
regionName: string;
zoneLabel: string;
provinces: string[];
isDefault: boolean;
bands: BandRow[];
}
function emptyBand(fromG = 0): BandRow {
return {
weightFromG: fromG,
weightToG: null,
priceMode: 'FLAT_TICKET',
flatAmount: 0,
firstWeightG: 0,
firstAmount: 0,
continuePerKg: 0,
};
}
function emptyRegion(): RegionRow {
return {
regionName: '默认区',
zoneLabel: '',
provinces: [],
isDefault: true,
bands: [emptyBand(0)],
};
}
const isEdit = ref(false);
const editingId = ref<number>();
const carriers = ref<ExpressQuoteVO.CarrierOption[]>([]);
const provinces = ref<ExpressQuoteVO.ProvinceOption[]>([]);
const form = reactive({
code: '',
name: '',
carrierCode: 'ZTO',
billingMode: 'FLAT',
status: 1,
remark: '',
effectiveFrom: new Date().toISOString().slice(0, 10),
flatAmount: 0,
unitScope: 'ORDER',
pricePerKg: 0,
minAmount: undefined as number | undefined,
volumeDivisor: 6000,
useVolumetric: false,
weightRound: 'NONE',
regions: [emptyRegion()] as RegionRow[],
});
const isRegion = computed(() => form.billingMode === 'REGION_WEIGHT');
const isFlat = computed(() => form.billingMode === 'FLAT');
const isPerKg = computed(() => form.billingMode === 'PER_KG');
const provinceOptions = computed(() =>
provinces.value.map((p) => ({ value: p.code, label: p.name })),
);
const [Modal, modalApi] = useVbenModal({
onConfirm: handleSubmit,
onOpenChange: (open) => {
if (!open) reset();
},
});
function reset() {
Object.assign(form, {
code: '',
name: '',
carrierCode: 'ZTO',
billingMode: 'FLAT',
status: 1,
remark: '',
effectiveFrom: new Date().toISOString().slice(0, 10),
flatAmount: 0,
unitScope: 'ORDER',
pricePerKg: 0,
minAmount: undefined,
volumeDivisor: 6000,
useVolumetric: false,
weightRound: 'NONE',
});
form.regions = [emptyRegion()];
isEdit.value = false;
editingId.value = undefined;
}
async function ensureMeta() {
if (!carriers.value.length) {
carriers.value = await getExpressCarriersApi();
}
if (!provinces.value.length) {
provinces.value = await getExpressProvincesApi();
}
}
function fillFromVersion(v?: ExpressQuoteVO.Version) {
if (!v) return;
form.effectiveFrom = v.effectiveFrom;
form.flatAmount = v.flatAmount ?? 0;
form.unitScope = v.unitScope || 'ORDER';
form.pricePerKg = v.pricePerKg ?? 0;
form.minAmount = v.minAmount;
form.volumeDivisor = v.volumeDivisor ?? 6000;
form.useVolumetric = v.useVolumetric === 1;
form.weightRound = v.weightRound || 'NONE';
if (v.regions?.length) {
form.regions = v.regions.map((r) => ({
regionName: r.regionName,
zoneLabel: r.zoneLabel || '',
provinces: r.provinces ? [...r.provinces] : [],
isDefault: r.isDefault === 1,
bands:
r.bands?.length ?
r.bands.map((b) => ({
weightFromG: b.weightFromG ?? 0,
weightToG: b.weightToG ?? null,
priceMode: b.priceMode || 'FLAT_TICKET',
flatAmount: b.flatAmount ?? 0,
firstWeightG: b.firstWeightG ?? 0,
firstAmount: b.firstAmount ?? 0,
continuePerKg: b.continuePerKg ?? 0,
}))
: [emptyBand(0)],
}));
}
}
async function open(edit: boolean, row?: ExpressQuoteVO.Info) {
await ensureMeta();
isEdit.value = edit;
if (edit && row) {
editingId.value = row.id;
const detail = await getExpressQuoteDetailApi(row.id);
form.code = detail.code;
form.name = detail.name;
form.carrierCode = detail.carrierCode;
form.billingMode = detail.billingMode;
form.status = detail.status;
form.remark = detail.remark || '';
fillFromVersion(detail.currentVersion);
} else {
reset();
}
modalApi.setState({
title: edit ? '编辑报价单' : '新建报价单',
class: form.billingMode === 'REGION_WEIGHT' ? 'w-[920px]' : 'w-[640px]',
});
modalApi.open();
}
function addRegion() {
form.regions.push({
regionName: `分区${form.regions.length + 1}`,
zoneLabel: '',
provinces: [],
isDefault: false,
bands: [emptyBand(0)],
});
}
function removeRegion(idx: number) {
if (form.regions.length <= 1) {
message.warning('至少保留一个分区');
return;
}
form.regions.splice(idx, 1);
}
function addBand(region: RegionRow) {
const last = region.bands[region.bands.length - 1];
const nextFrom =
last?.weightToG != null ? last.weightToG + 1 : (last?.weightFromG ?? 0) + 1000;
region.bands.push(emptyBand(nextFrom));
}
function removeBand(region: RegionRow, idx: number) {
if (region.bands.length <= 1) {
message.warning('每分区至少一条重量带');
return;
}
region.bands.splice(idx, 1);
}
function buildVersion(): ExpressQuoteDTO.VersionUpsert {
const version: ExpressQuoteDTO.VersionUpsert = {
effectiveFrom: form.effectiveFrom,
volumeDivisor: form.volumeDivisor,
useVolumetric: form.useVolumetric ? 1 : 0,
weightRound: form.weightRound,
};
if (form.billingMode === 'FLAT') {
version.flatAmount = form.flatAmount;
version.unitScope = form.unitScope;
} else if (form.billingMode === 'PER_KG') {
version.pricePerKg = form.pricePerKg;
version.minAmount = form.minAmount;
} else {
version.regions = form.regions.map((r, i) => ({
regionName: r.regionName.trim() || `分区${i + 1}`,
zoneLabel: r.zoneLabel.trim() || undefined,
provinces: r.provinces,
isDefault: r.isDefault ? 1 : 0,
sortOrder: i,
bands: r.bands.map((b, bi) => ({
weightFromG: b.weightFromG ?? 0,
weightToG: b.weightToG,
priceMode: b.priceMode,
flatAmount: b.priceMode === 'FLAT_TICKET' ? b.flatAmount : undefined,
firstWeightG: b.priceMode === 'FIRST_PLUS_KG' ? b.firstWeightG : undefined,
firstAmount: b.priceMode === 'FIRST_PLUS_KG' ? b.firstAmount : undefined,
continuePerKg: b.priceMode === 'FIRST_PLUS_KG' ? b.continuePerKg : undefined,
sortOrder: bi,
})),
}));
}
return version;
}
async function handleSubmit() {
if (!form.name.trim() || (!isEdit.value && !form.code.trim())) {
message.warning('请填写编码与名称');
return;
}
if (isRegion.value) {
for (const r of form.regions) {
if (!r.bands.length) {
message.warning(`分区「${r.regionName}」至少一条重量带`);
return;
}
}
}
modalApi.setState({ confirming: true });
try {
if (isEdit.value && editingId.value) {
await updateExpressQuoteApi(editingId.value, {
name: form.name.trim(),
carrierCode: form.carrierCode,
status: form.status,
remark: form.remark || undefined,
});
if (form.effectiveFrom) {
await upsertExpressQuoteVersionApi(editingId.value, buildVersion());
}
message.success('已更新');
} else {
await createExpressQuoteApi({
code: form.code.trim(),
name: form.name.trim(),
carrierCode: form.carrierCode,
billingMode: form.billingMode,
status: form.status,
remark: form.remark || undefined,
initialVersion: buildVersion(),
});
message.success('创建成功');
}
modalApi.close();
emit('success');
} finally {
modalApi.setState({ confirming: false });
}
}
defineExpose({ open });
</script>
<template>
<Modal>
<Form layout="vertical" class="max-h-[75vh] overflow-y-auto px-1">
<FormItem v-if="!isEdit" label="报价编码" required>
<Input v-model:value="form.code" />
</FormItem>
<FormItem label="名称" required>
<Input v-model:value="form.name" />
</FormItem>
<div class="grid grid-cols-2 gap-3">
<FormItem label="承运商" required>
<Select
v-model:value="form.carrierCode"
:options="carriers.map((c) => ({ value: c.code, label: c.name }))"
/>
</FormItem>
<FormItem label="计费模式" required>
<Select
v-model:value="form.billingMode"
:disabled="isEdit"
:options="[
{ value: 'FLAT', label: '一口价 FLAT' },
{ value: 'PER_KG', label: '按千克 PER_KG' },
{ value: 'REGION_WEIGHT', label: '分区×重量带' },
]"
/>
</FormItem>
</div>
<FormItem label="状态">
<Select
v-model:value="form.status"
:options="[
{ label: '启用', value: 1 },
{ label: '停用', value: 0 },
]"
/>
</FormItem>
<FormItem label="生效日(版本)" required>
<Input v-model:value="form.effectiveFrom" placeholder="yyyy-MM-dd" />
</FormItem>
<template v-if="isFlat">
<div class="grid grid-cols-2 gap-3">
<FormItem label="一口价(元)">
<InputNumber v-model:value="form.flatAmount" :min="0" class="w-full" />
</FormItem>
<FormItem label="计费单位">
<Select
v-model:value="form.unitScope"
:options="[
{ value: 'ORDER', label: '每单' },
{ value: 'PIECE', label: '每件' },
]"
/>
</FormItem>
</div>
</template>
<template v-if="isPerKg">
<div class="grid grid-cols-2 gap-3">
<FormItem label="元/kg">
<InputNumber v-model:value="form.pricePerKg" :min="0" class="w-full" />
</FormItem>
<FormItem label="最低消费">
<InputNumber v-model:value="form.minAmount" :min="0" class="w-full" />
</FormItem>
</div>
</template>
<template v-if="isRegion">
<div class="mb-2 flex items-center justify-between">
<span class="text-sm text-muted-foreground">目的分区 × 重量带(对齐承运商报价矩阵)</span>
<Button size="small" type="dashed" @click="addRegion">添加分区</Button>
</div>
<div
v-for="(region, ri) in form.regions"
:key="ri"
class="mb-3 rounded border border-border p-3"
>
<div class="mb-2 flex items-start justify-between gap-2">
<div class="grid flex-1 grid-cols-3 gap-2">
<FormItem label="分区名" class="mb-0">
<Input v-model:value="region.regionName" />
</FormItem>
<FormItem label="价区标签" class="mb-0">
<Input v-model:value="region.zoneLabel" placeholder="一类/二类…" />
</FormItem>
<FormItem label="默认分区" class="mb-0">
<Switch v-model:checked="region.isDefault" />
</FormItem>
</div>
<Button size="small" danger type="link" @click="removeRegion(ri)">删除</Button>
</div>
<FormItem label="目的地(省或市)" class="mb-2">
<Select
v-model:value="region.provinces"
mode="tags"
allow-clear
show-search
option-filter-prop="label"
:options="provinceOptions"
placeholder="选省或输入市名如深圳市"
/>
</FormItem>
<div class="mb-1 flex items-center justify-between">
<span class="text-xs text-muted-foreground">重量带</span>
<Button size="small" type="link" @click="addBand(region)">加带</Button>
</div>
<div
v-for="(band, bi) in region.bands"
:key="bi"
class="mb-2 grid grid-cols-12 items-end gap-2 rounded bg-muted/40 p-2"
>
<FormItem label="从(克)" class="col-span-2 mb-0">
<InputNumber v-model:value="band.weightFromG" :min="0" class="w-full" />
</FormItem>
<FormItem label="到(克)" class="col-span-2 mb-0">
<InputNumber
v-model:value="band.weightToG"
:min="0"
class="w-full"
placeholder="空=无上限"
/>
</FormItem>
<FormItem label="方式" class="col-span-3 mb-0">
<Select
v-model:value="band.priceMode"
:options="[
{ value: 'FLAT_TICKET', label: '元/票' },
{ value: 'FIRST_PLUS_KG', label: '首重+续重/kg' },
]"
/>
</FormItem>
<template v-if="band.priceMode === 'FLAT_TICKET'">
<FormItem label="元/票" class="col-span-3 mb-0">
<InputNumber v-model:value="band.flatAmount" :min="0" class="w-full" />
</FormItem>
</template>
<template v-else>
<FormItem label="首重克" class="col-span-1 mb-0">
<InputNumber v-model:value="band.firstWeightG" :min="0" class="w-full" />
</FormItem>
<FormItem label="首重价" class="col-span-2 mb-0">
<InputNumber v-model:value="band.firstAmount" :min="0" class="w-full" />
</FormItem>
<FormItem label="续重元/kg" class="col-span-2 mb-0">
<InputNumber v-model:value="band.continuePerKg" :min="0" class="w-full" />
</FormItem>
</template>
<div class="col-span-2 flex justify-end pb-1">
<Button size="small" type="link" danger @click="removeBand(region, bi)">
删带
</Button>
</div>
</div>
</div>
</template>
<div class="grid grid-cols-3 gap-3">
<FormItem label="启用体积重">
<Switch v-model:checked="form.useVolumetric" />
</FormItem>
<FormItem label="体积重除数">
<InputNumber v-model:value="form.volumeDivisor" :min="1" class="w-full" />
</FormItem>
<FormItem label="计费重取整">
<Select
v-model:value="form.weightRound"
:options="[
{ value: 'NONE', label: '不取整' },
{ value: 'CEIL_KG', label: '向上整千克' },
]"
/>
</FormItem>
</div>
<FormItem label="备注">
<Input.TextArea v-model:value="form.remark" :rows="2" />
</FormItem>
</Form>
</Modal>
</template>
@@ -0,0 +1,353 @@
<script lang="ts" setup>
/**
* 分区×重量带编辑:动态嵌套用 antd Card/Table;左侧 Anchor 快速跳转分区。
*/
import { computed, nextTick, ref } from 'vue';
import {
Anchor,
Button,
Card,
Input,
InputNumber,
Select,
Space,
Switch,
Table,
message,
} from 'ant-design-vue';
export interface BandRow {
weightFromG: number;
weightToG: number | null;
priceMode: string;
flatAmount: number;
firstWeightG: number;
firstAmount: number;
continuePerKg: number;
}
export interface RegionRow {
regionName: string;
zoneLabel: string;
provinces: string[];
isDefault: boolean;
bands: BandRow[];
}
const props = defineProps<{
modelValue: RegionRow[];
provinceOptions: { label: string; value: string }[];
}>();
const emit = defineEmits<{
'update:modelValue': [value: RegionRow[]];
}>();
defineOptions({ name: 'RegionBandEditor' });
const scrollRef = ref<HTMLElement | null>(null);
const regions = computed({
get: () => props.modelValue,
set: (v) => emit('update:modelValue', v),
});
const anchorItems = computed(() =>
regions.value.map((r, i) => ({
key: `region-${i}`,
href: `#quote-region-${i}`,
title: r.zoneLabel || r.regionName || `分区${i + 1}`,
})),
);
function getScrollContainer() {
return scrollRef.value || window;
}
const bandColumnDefs = [
{ title: '从(克)', key: 'from', width: 110 },
{ title: '到(克)', key: 'to', width: 110 },
{ title: '方式', key: 'mode', width: 150 },
{ title: '价格', key: 'price' },
{ title: '操作', key: 'action', width: 72 },
];
function emptyBand(fromG = 0): BandRow {
return {
weightFromG: fromG,
weightToG: null,
priceMode: 'FLAT_TICKET',
flatAmount: 0,
firstWeightG: 0,
firstAmount: 0,
continuePerKg: 0,
};
}
function addRegion() {
const nextIndex = regions.value.length;
regions.value = [
...regions.value,
{
regionName: `分区${nextIndex + 1}`,
zoneLabel: '',
provinces: [],
isDefault: false,
bands: [emptyBand(0)],
},
];
void nextTick(() => {
document
.getElementById(`quote-region-${nextIndex}`)
?.scrollIntoView({ behavior: 'smooth', block: 'start' });
});
}
function removeRegion(idx: number) {
if (regions.value.length <= 1) {
message.warning('至少保留一个分区');
return;
}
const next = [...regions.value];
next.splice(idx, 1);
regions.value = next;
}
function patchRegion(idx: number, patch: Partial<RegionRow>) {
const next = [...regions.value];
const cur = next[idx];
if (!cur) return;
next[idx] = { ...cur, ...patch };
regions.value = next;
}
function addBand(ri: number) {
const region = regions.value[ri];
if (!region) return;
const last = region.bands[region.bands.length - 1];
const nextFrom =
last?.weightToG != null ? last.weightToG + 1 : (last?.weightFromG ?? 0) + 1000;
patchRegion(ri, { bands: [...region.bands, emptyBand(nextFrom)] });
}
function removeBand(ri: number, bi: number) {
const region = regions.value[ri];
if (!region) return;
if (region.bands.length <= 1) {
message.warning('每分区至少一条重量带');
return;
}
const bands = [...region.bands];
bands.splice(bi, 1);
patchRegion(ri, { bands });
}
function patchBand(ri: number, bi: number, patch: Partial<BandRow>) {
const region = regions.value[ri];
if (!region) return;
const bands = region.bands.map((b, i) => (i === bi ? { ...b, ...patch } : b));
patchRegion(ri, { bands });
}
function onAnchorClick(e: Event) {
e.preventDefault();
}
</script>
<template>
<Card
size="small"
title="目的分区 × 重量带"
class="flex h-full min-h-0 flex-col overflow-hidden"
:body-style="{
flex: '1 1 0%',
minHeight: 0,
overflow: 'hidden',
display: 'flex',
flexDirection: 'column',
padding: '12px',
}"
>
<template #extra>
<Button size="small" type="dashed" @click="addRegion">添加分区</Button>
</template>
<div class="flex min-h-0 flex-1 gap-3">
<aside
class="w-36 shrink-0 overflow-y-auto border-r border-border pr-2 pt-1"
>
<div class="mb-2 text-xs text-muted-foreground">分区导航</div>
<Anchor
:affix="false"
:items="anchorItems"
:get-container="getScrollContainer"
@click="onAnchorClick"
/>
</aside>
<div ref="scrollRef" class="min-h-0 min-w-0 flex-1 overflow-y-auto">
<Card
v-for="(region, ri) in regions"
:id="`quote-region-${ri}`"
:key="ri"
size="small"
class="mb-3 shrink-0 scroll-mt-2"
:title="region.regionName || `分区${ri + 1}`"
>
<template #extra>
<Button type="link" danger size="small" @click="removeRegion(ri)">
删除分区
</Button>
</template>
<div class="mb-3 grid grid-cols-1 gap-3 md:grid-cols-4">
<div>
<div class="mb-1 text-xs text-muted-foreground">分区名</div>
<Input
:value="region.regionName"
@update:value="(v) => patchRegion(ri, { regionName: String(v) })"
/>
</div>
<div>
<div class="mb-1 text-xs text-muted-foreground">价区标签</div>
<Input
:value="region.zoneLabel"
placeholder="一类/二类…"
@update:value="(v) => patchRegion(ri, { zoneLabel: String(v) })"
/>
</div>
<div>
<div class="mb-1 text-xs text-muted-foreground">默认分区</div>
<Switch
:checked="region.isDefault"
@update:checked="(v) => patchRegion(ri, { isDefault: !!v })"
/>
</div>
<div class="md:col-span-4">
<div class="mb-1 text-xs text-muted-foreground">
目的地(省或市)
</div>
<Select
class="w-full"
mode="tags"
allow-clear
show-search
option-filter-prop="label"
:options="provinceOptions"
:value="region.provinces"
placeholder="选省或输入市名如深圳市"
@update:value="
(v) => patchRegion(ri, { provinces: (v as string[]) || [] })
"
/>
</div>
</div>
<div class="mb-2 flex justify-end">
<Button size="small" type="link" @click="addBand(ri)">
加重量带
</Button>
</div>
<Table
size="small"
:pagination="false"
:columns="bandColumnDefs"
:data-source="region.bands"
:row-key="(_r: BandRow, i: number) => `${ri}-${i}`"
>
<template #bodyCell="{ column, index }">
<template v-if="column.key === 'from'">
<InputNumber
class="w-full"
:min="0"
:value="region.bands[index]?.weightFromG"
@update:value="
(v) => patchBand(ri, index, { weightFromG: Number(v ?? 0) })
"
/>
</template>
<template v-else-if="column.key === 'to'">
<InputNumber
class="w-full"
:min="0"
placeholder="空=无上限"
:value="region.bands[index]?.weightToG ?? undefined"
@update:value="
(v) =>
patchBand(ri, index, {
weightToG: v == null ? null : Number(v),
})
"
/>
</template>
<template v-else-if="column.key === 'mode'">
<Select
class="w-full"
:value="region.bands[index]?.priceMode"
:options="[
{ value: 'FLAT_TICKET', label: '元/票' },
{ value: 'FIRST_PLUS_KG', label: '首重+续重/kg' },
]"
@update:value="
(v) => patchBand(ri, index, { priceMode: String(v) })
"
/>
</template>
<template v-else-if="column.key === 'price'">
<InputNumber
v-if="region.bands[index]?.priceMode === 'FLAT_TICKET'"
class="w-full"
:min="0"
addon-after="元/票"
:value="region.bands[index]?.flatAmount"
@update:value="
(v) => patchBand(ri, index, { flatAmount: Number(v ?? 0) })
"
/>
<Space v-else wrap>
<InputNumber
class="w-28"
:min="0"
addon-after="首重克"
:value="region.bands[index]?.firstWeightG"
@update:value="
(v) =>
patchBand(ri, index, { firstWeightG: Number(v ?? 0) })
"
/>
<InputNumber
class="w-28"
:min="0"
addon-after="首重价"
:value="region.bands[index]?.firstAmount"
@update:value="
(v) =>
patchBand(ri, index, { firstAmount: Number(v ?? 0) })
"
/>
<InputNumber
class="w-28"
:min="0"
addon-after="续/kg"
:value="region.bands[index]?.continuePerKg"
@update:value="
(v) =>
patchBand(ri, index, { continuePerKg: Number(v ?? 0) })
"
/>
</Space>
</template>
<template v-else-if="column.key === 'action'">
<Button
type="link"
danger
size="small"
@click="removeBand(ri, index)"
>
删除
</Button>
</template>
</template>
</Table>
</Card>
</div>
</div>
</Card>
</template>
@@ -0,0 +1,557 @@
<script lang="ts" setup>
import type { ExpressQuoteDTO, ExpressQuoteVO } from '#/api/ec/express-quote';
import { computed, onMounted, ref, watch } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { ColPage } from '@vben/common-ui';
import { useTabs } from '@vben/hooks';
import { Button, Card, Empty, message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import {
createExpressQuoteApi,
getExpressCarriersApi,
getExpressProvincesApi,
getExpressQuoteDetailApi,
updateExpressQuoteApi,
upsertExpressQuoteVersionApi,
} from '#/api/ec/express-quote';
import { formatOverviewTabTitle } from '#/utils/overview-tab-title';
import RegionBandEditor, {
type RegionRow,
} from './components/RegionBandEditor.vue';
defineOptions({ name: 'ExpressQuoteEdit' });
const route = useRoute();
const router = useRouter();
const { setTabTitle, closeCurrentTab } = useTabs();
const quoteId = computed(() => {
const raw = route.params.id;
const id = raw ? Number(raw) : 0;
return Number.isFinite(id) && id > 0 ? id : undefined;
});
const isEdit = computed(() => quoteId.value != null);
const loading = ref(false);
const saving = ref(false);
const pageTitle = ref('快递报价单编辑「新建」');
const provinces = ref<ExpressQuoteVO.ProvinceOption[]>([]);
const regions = ref<RegionRow[]>([
{
regionName: '默认区',
zoneLabel: '',
provinces: [],
isDefault: true,
bands: [
{
weightFromG: 0,
weightToG: null,
priceMode: 'FLAT_TICKET',
flatAmount: 0,
firstWeightG: 0,
firstAmount: 0,
continuePerKg: 0,
},
],
},
]);
const provinceOptions = computed(() =>
provinces.value.map((p) => ({ value: p.code, label: p.name })),
);
/** 编辑页乐观按分区模式,避免首屏按 FLAT 分栏约束被拉成对半 */
const billingMode = ref(isEdit.value ? 'REGION_WEIGHT' : 'FLAT');
const isRegion = computed(() => billingMode.value === 'REGION_WEIGHT');
async function syncTabTitle(name?: string) {
let rawName = name;
if (rawName == null) {
try {
const values = await formApi.getValues();
rawName = values.name ? String(values.name) : undefined;
} catch {
rawName = undefined;
}
}
const title = formatOverviewTabTitle(
'快递报价单编辑',
rawName,
isEdit.value ? `#${quoteId.value}` : '新建',
);
pageTitle.value = title;
await setTabTitle(title);
}
/** 分区模式左栏贴最小宽;与 billingMode 乐观初始值对齐 */
const leftWidth = ref(isEdit.value ? 22 : 50);
function syncLeftWidthByMode() {
leftWidth.value = isRegion.value ? 22 : 50;
}
/** 外层 Card 撑满列高,body 内滚动 */
const cardBodyScrollStyle = {
flex: '1 1 0%',
minHeight: 0,
overflowY: 'auto' as const,
display: 'flex',
flexDirection: 'column' as const,
};
watch(isRegion, () => {
syncLeftWidthByMode();
});
const [BaseForm, formApi] = useVbenForm({
layout: 'vertical',
compact: true,
commonConfig: {
componentProps: { class: 'w-full' },
labelClass: 'w-full',
},
wrapperClass: 'grid-cols-1',
showDefaultActions: false,
handleValuesChange(values, fieldsChanged) {
if (fieldsChanged.includes('billingMode') && values.billingMode) {
billingMode.value = String(values.billingMode);
}
if (fieldsChanged.includes('name')) {
void syncTabTitle(String(values.name ?? ''));
}
},
schema: [
{
component: 'Input',
fieldName: 'code',
label: '报价编码',
rules: 'required',
dependencies: {
show: () => !isEdit.value,
triggerFields: ['name'],
},
},
{
component: 'Input',
fieldName: 'name',
label: '名称',
rules: 'required',
},
{
component: 'ApiSelect',
fieldName: 'carrierCode',
label: '承运商',
rules: 'selectRequired',
defaultValue: 'ZTO',
componentProps: {
api: getExpressCarriersApi,
afterFetch: (data: ExpressQuoteVO.CarrierOption[]) =>
(data || []).map((c) => ({ label: c.name, value: c.code })),
immediate: true,
},
},
{
component: 'Select',
fieldName: 'billingMode',
label: '计费模式',
rules: 'selectRequired',
defaultValue: 'FLAT',
componentProps: {
options: [
{ value: 'FLAT', label: '一口价 FLAT' },
{ value: 'PER_KG', label: '按千克 PER_KG' },
{ value: 'REGION_WEIGHT', label: '分区×重量带' },
],
},
dependencies: {
disabled: () => isEdit.value,
triggerFields: ['name'],
},
},
{
component: 'Select',
fieldName: 'status',
label: '状态',
defaultValue: 1,
componentProps: {
options: [
{ label: '启用', value: 1 },
{ label: '停用', value: 0 },
],
},
},
{
component: 'DatePicker',
fieldName: 'effectiveFrom',
label: '生效日(版本)',
rules: 'required',
defaultValue: new Date().toISOString().slice(0, 10),
componentProps: {
valueFormat: 'YYYY-MM-DD',
class: 'w-full',
},
},
{
component: 'InputNumber',
fieldName: 'flatAmount',
label: '一口价(元)',
defaultValue: 0,
dependencies: {
if: (values) => values.billingMode === 'FLAT',
triggerFields: ['billingMode'],
},
},
{
component: 'Select',
fieldName: 'unitScope',
label: '计费单位',
defaultValue: 'ORDER',
componentProps: {
options: [
{ value: 'ORDER', label: '每单' },
{ value: 'PIECE', label: '每件' },
],
},
dependencies: {
if: (values) => values.billingMode === 'FLAT',
triggerFields: ['billingMode'],
},
},
{
component: 'InputNumber',
fieldName: 'pricePerKg',
label: '元/kg',
defaultValue: 0,
dependencies: {
if: (values) => values.billingMode === 'PER_KG',
triggerFields: ['billingMode'],
},
},
{
component: 'InputNumber',
fieldName: 'minAmount',
label: '最低消费',
dependencies: {
if: (values) => values.billingMode === 'PER_KG',
triggerFields: ['billingMode'],
},
},
{
component: 'Switch',
fieldName: 'useVolumetric',
label: '启用体积重',
defaultValue: false,
},
{
component: 'InputNumber',
fieldName: 'volumeDivisor',
label: '体积重除数',
defaultValue: 6000,
},
{
component: 'Select',
fieldName: 'weightRound',
label: '计费重取整',
defaultValue: 'NONE',
componentProps: {
options: [
{ value: 'NONE', label: '不取整' },
{ value: 'CEIL_KG', label: '向上整千克' },
],
},
},
{
component: 'Textarea',
fieldName: 'remark',
label: '备注',
componentProps: { rows: 2 },
},
],
});
function fillRegionsFromVersion(v?: ExpressQuoteVO.Version) {
if (!v?.regions?.length) {
regions.value = [
{
regionName: '默认区',
zoneLabel: '',
provinces: [],
isDefault: true,
bands: [
{
weightFromG: 0,
weightToG: null,
priceMode: 'FLAT_TICKET',
flatAmount: 0,
firstWeightG: 0,
firstAmount: 0,
continuePerKg: 0,
},
],
},
];
return;
}
regions.value = v.regions.map((r) => ({
regionName: r.regionName,
zoneLabel: r.zoneLabel || '',
provinces: r.provinces ? [...r.provinces] : [],
isDefault: r.isDefault === 1,
bands:
r.bands?.length ?
r.bands.map((b) => ({
weightFromG: b.weightFromG ?? 0,
weightToG: b.weightToG ?? null,
priceMode: b.priceMode || 'FLAT_TICKET',
flatAmount: b.flatAmount ?? 0,
firstWeightG: b.firstWeightG ?? 0,
firstAmount: b.firstAmount ?? 0,
continuePerKg: b.continuePerKg ?? 0,
}))
: [
{
weightFromG: 0,
weightToG: null,
priceMode: 'FLAT_TICKET',
flatAmount: 0,
firstWeightG: 0,
firstAmount: 0,
continuePerKg: 0,
},
],
}));
}
async function loadDetail() {
loading.value = true;
try {
if (!provinces.value.length) {
provinces.value = await getExpressProvincesApi();
}
if (!quoteId.value) {
await formApi.resetForm();
await formApi.setValues({
carrierCode: 'ZTO',
billingMode: 'FLAT',
status: 1,
effectiveFrom: new Date().toISOString().slice(0, 10),
flatAmount: 0,
unitScope: 'ORDER',
volumeDivisor: 6000,
useVolumetric: false,
weightRound: 'NONE',
});
billingMode.value = 'FLAT';
fillRegionsFromVersion();
await syncTabTitle('新建');
return;
}
const detail = await getExpressQuoteDetailApi(quoteId.value);
billingMode.value = detail.billingMode;
const v = detail.currentVersion;
await formApi.setValues({
code: detail.code,
name: detail.name,
carrierCode: detail.carrierCode,
billingMode: detail.billingMode,
status: detail.status,
remark: detail.remark || '',
effectiveFrom: v?.effectiveFrom || new Date().toISOString().slice(0, 10),
flatAmount: v?.flatAmount ?? 0,
unitScope: v?.unitScope || 'ORDER',
pricePerKg: v?.pricePerKg ?? 0,
minAmount: v?.minAmount,
volumeDivisor: v?.volumeDivisor ?? 6000,
useVolumetric: v?.useVolumetric === 1,
weightRound: v?.weightRound || 'NONE',
});
fillRegionsFromVersion(v);
await syncTabTitle(detail.name);
} catch (error) {
console.error(error);
message.error('加载报价单失败');
} finally {
syncLeftWidthByMode();
loading.value = false;
}
}
function buildVersion(
values: Record<string, unknown>,
): ExpressQuoteDTO.VersionUpsert {
const mode = String(values.billingMode);
const version: ExpressQuoteDTO.VersionUpsert = {
effectiveFrom: String(values.effectiveFrom),
volumeDivisor: Number(values.volumeDivisor ?? 6000),
useVolumetric: values.useVolumetric ? 1 : 0,
weightRound: String(values.weightRound || 'NONE'),
remark: values.remark ? String(values.remark) : undefined,
};
if (mode === 'FLAT') {
version.flatAmount = Number(values.flatAmount ?? 0);
version.unitScope = String(values.unitScope || 'ORDER');
} else if (mode === 'PER_KG') {
version.pricePerKg = Number(values.pricePerKg ?? 0);
version.minAmount =
values.minAmount == null ? undefined : Number(values.minAmount);
} else {
version.regions = regions.value.map((r, i) => ({
regionName: r.regionName.trim() || `分区${i + 1}`,
zoneLabel: r.zoneLabel.trim() || undefined,
provinces: r.provinces,
isDefault: r.isDefault ? 1 : 0,
sortOrder: i,
bands: r.bands.map((b, bi) => ({
weightFromG: b.weightFromG ?? 0,
weightToG: b.weightToG,
priceMode: b.priceMode,
flatAmount: b.priceMode === 'FLAT_TICKET' ? b.flatAmount : undefined,
firstWeightG:
b.priceMode === 'FIRST_PLUS_KG' ? b.firstWeightG : undefined,
firstAmount:
b.priceMode === 'FIRST_PLUS_KG' ? b.firstAmount : undefined,
continuePerKg:
b.priceMode === 'FIRST_PLUS_KG' ? b.continuePerKg : undefined,
sortOrder: bi,
})),
}));
}
return version;
}
async function handleSubmit() {
const { valid } = await formApi.validate();
if (!valid) return;
const values = await formApi.getValues();
if (isRegion.value) {
for (const r of regions.value) {
if (!r.bands.length) {
message.warning(`分区「${r.regionName}」至少一条重量带`);
return;
}
}
}
saving.value = true;
try {
if (isEdit.value && quoteId.value) {
await updateExpressQuoteApi(quoteId.value, {
name: String(values.name).trim(),
carrierCode: String(values.carrierCode),
status: Number(values.status),
remark: values.remark ? String(values.remark) : undefined,
});
await upsertExpressQuoteVersionApi(quoteId.value, buildVersion(values));
message.success('已更新');
await syncTabTitle(String(values.name));
} else {
const created = await createExpressQuoteApi({
code: String(values.code).trim(),
name: String(values.name).trim(),
carrierCode: String(values.carrierCode),
billingMode: String(values.billingMode),
status: Number(values.status),
remark: values.remark ? String(values.remark) : undefined,
initialVersion: buildVersion(values),
});
message.success('创建成功');
await router.replace(`/ec/warehouse/express-quote/edit/${created.id}`);
}
} finally {
saving.value = false;
}
}
async function handleBack() {
await closeCurrentTab();
await router.push('/ec/warehouse/express-quote');
}
onMounted(() => {
void loadDetail();
});
watch(
() => route.params.id,
() => {
void loadDetail();
},
);
</script>
<template>
<div class="express-quote-edit-page min-h-0">
<ColPage
v-model:left-width="leftWidth"
auto-content-height
:loading="loading"
:left-min-width="isRegion ? 22 : 40"
:left-max-width="isRegion ? 40 : 72"
:right-width="100 - leftWidth"
:left-collapsible="false"
resizable
split-line
content-class="!flex !min-h-0 !flex-col !overflow-hidden !p-3"
>
<template #left>
<Card
size="small"
title="基本信息"
class="flex h-full min-h-0 flex-col overflow-hidden"
:body-style="cardBodyScrollStyle"
>
<BaseForm />
</Card>
</template>
<div class="h-full min-h-0 min-w-0">
<RegionBandEditor
v-if="isRegion"
v-model="regions"
:province-options="provinceOptions"
/>
<Card
v-else
size="small"
title="分区报价"
class="flex h-full min-h-0 flex-col overflow-hidden"
:body-style="cardBodyScrollStyle"
>
<Empty
class="py-16"
description="当前为一口价 / 按千克模式,无需配置目的分区。切换为「分区×重量带」后在此编辑。"
/>
</Card>
</div>
<template #footer>
<div class="flex w-full justify-end gap-2 px-1 py-1">
<Button @click="handleBack">返回列表</Button>
<Button type="primary" :loading="saving" @click="handleSubmit">
保存
</Button>
</div>
</template>
</ColPage>
</div>
</template>
<style scoped>
/**
* 内容区高度由 Page autoContentHeight 按「视口 − footer」算出;
* 分栏只填满该剩余高度,勿再用 !h-full 盖掉 calc。
*/
.express-quote-edit-page :deep([data-panel-group]) {
height: 100%;
min-height: 0;
flex: 1 1 0%;
}
.express-quote-edit-page :deep(.ant-card) {
max-height: 100%;
}
.express-quote-edit-page :deep(.ant-card-head) {
flex-shrink: 0;
}
</style>
@@ -4,6 +4,7 @@ import type { ExpressQuoteDTO, ExpressQuoteVO } from '#/api/ec/express-quote';
import type { PageQueryDTO } from '#/types/common';
import { computed, ref } from 'vue';
import { useRouter } from 'vue-router';
import { Page } from '@vben/common-ui';
import { createIconifyIcon } from '@vben/icons';
@@ -23,22 +24,27 @@ import {
} from '#/composables/use-vxe-action-column';
import ExpressQuoteDetailDrawer from './components/ExpressQuoteDetailDrawer.vue';
import ExpressQuoteFormModal from './components/ExpressQuoteFormModal.vue';
import ExpressQuoteImportModal from './components/ExpressQuoteImportModal.vue';
defineOptions({ name: 'ExpressQuoteManagement' });
const router = useRouter();
const PlusIcon = createIconifyIcon('lucide:plus');
const loading = ref(false);
const formModalRef = ref<InstanceType<typeof ExpressQuoteFormModal> | null>(
null,
);
const importModalRef = ref<InstanceType<typeof ExpressQuoteImportModal> | null>(
null,
);
const detailDrawerRef = ref<InstanceType<
typeof ExpressQuoteDetailDrawer
> | null>(null);
function goCreate() {
void router.push('/ec/warehouse/express-quote/edit');
}
function goEdit(row: ExpressQuoteVO.Info) {
void router.push(`/ec/warehouse/express-quote/edit/${row.id}`);
}
const searchForm = ref({
keywords: '',
billingMode: undefined as string | undefined,
@@ -194,7 +200,7 @@ async function handleDelete(row: ExpressQuoteVO.Info) {
<Button @click="importModalRef?.open()">导入</Button>
</PermissionGate>
<PermissionGate code="ec:express-quote:create">
<Button type="primary" @click="formModalRef?.open(false)">
<Button type="primary" @click="goCreate">
<PlusIcon />
新建报价
</Button>
@@ -220,9 +226,7 @@ async function handleDelete(row: ExpressQuoteVO.Info) {
</Button>
</PermissionGate>
<PermissionGate code="ec:express-quote:update">
<Button size="small" @click="formModalRef?.open(true, row)">
编辑/调价
</Button>
<Button size="small" @click="goEdit(row)">编辑/调价</Button>
</PermissionGate>
<PermissionGate code="ec:express-quote:delete">
<Popconfirm title="确定删除?" @confirm="handleDelete(row)">
@@ -232,7 +236,6 @@ async function handleDelete(row: ExpressQuoteVO.Info) {
</Space>
</template>
</Grid>
<ExpressQuoteFormModal ref="formModalRef" @success="gridApi.reload()" />
<ExpressQuoteImportModal
ref="importModalRef"
@success="gridApi.reload()"
+16
View File
@@ -0,0 +1,16 @@
{
"name": "ecom-dmb",
"private": true,
"description": "根目录仅作开发启动入口,不是 pnpm monorepo;各 app 仍各自装依赖",
"packageManager": "pnpm@11.21.0",
"scripts": {
"dev": "concurrently -k -n web,server,agent -c cyan,green,magenta \"pnpm dev:web\" \"pnpm dev:server\" \"pnpm dev:agent\"",
"dev:web-server": "concurrently -k -n web,server -c cyan,green \"pnpm dev:web\" \"pnpm dev:server\"",
"dev:web": "pnpm -C apps/web dev",
"dev:server": "cd apps/server && ./mvnw spring-boot:run",
"dev:agent": "sh -c 'cd apps/agent && test -x .venv/bin/uvicorn || { echo \"[dev:agent] 缺少 .venv,请先: cd apps/agent && python -m venv .venv && .venv/bin/pip install -r requirements.txt\"; exit 1; }; exec .venv/bin/uvicorn api.main:app --reload --host 0.0.0.0 --port 8200'"
},
"devDependencies": {
"concurrently": "^9.2.1"
}
}
+206
View File
@@ -0,0 +1,206 @@
lockfileVersion: '9.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
importers:
.:
devDependencies:
concurrently:
specifier: ^9.2.1
version: 9.2.5
packages:
ansi-regex@5.0.1:
resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==}
engines: {node: '>=8'}
ansi-styles@4.3.0:
resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==}
engines: {node: '>=8'}
chalk@4.1.2:
resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==}
engines: {node: '>=10'}
cliui@8.0.1:
resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==}
engines: {node: '>=12'}
color-convert@2.0.1:
resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==}
engines: {node: '>=7.0.0'}
color-name@1.1.4:
resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
concurrently@9.2.5:
resolution: {integrity: sha512-YMZlvWrTPQEhjKp60XSmMGt60+pffbv6DyRnOMvVO98+J7aF8w8Ui9FhdcOwvSixc/kyR6SoVvmejcn/2lZBqg==}
engines: {node: '>=18'}
hasBin: true
emoji-regex@8.0.0:
resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==}
escalade@3.2.0:
resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==}
engines: {node: '>=6'}
get-caller-file@2.0.5:
resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==}
engines: {node: 6.* || 8.* || >= 10.*}
has-flag@4.0.0:
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
engines: {node: '>=8'}
is-fullwidth-code-point@3.0.0:
resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==}
engines: {node: '>=8'}
require-directory@2.1.1:
resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==}
engines: {node: '>=0.10.0'}
rxjs@7.8.2:
resolution: {integrity: sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==}
shell-quote@1.12.0:
resolution: {integrity: sha512-PcByqNyT/38F2kDNi006HAMRJaULuBzq/FOsw3qdZvX/GA9W/jamDaRskgHjubHiftXK5sIFxLNkvrXUwcof6Q==}
engines: {node: '>= 0.4'}
string-width@4.2.3:
resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==}
engines: {node: '>=8'}
strip-ansi@6.0.1:
resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==}
engines: {node: '>=8'}
supports-color@7.2.0:
resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==}
engines: {node: '>=8'}
supports-color@8.1.1:
resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==}
engines: {node: '>=10'}
tree-kill@1.2.2:
resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==}
hasBin: true
tslib@2.8.1:
resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
wrap-ansi@7.0.0:
resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==}
engines: {node: '>=10'}
y18n@5.0.8:
resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==}
engines: {node: '>=10'}
yargs-parser@21.1.1:
resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==}
engines: {node: '>=12'}
yargs@17.7.2:
resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==}
engines: {node: '>=12'}
snapshots:
ansi-regex@5.0.1: {}
ansi-styles@4.3.0:
dependencies:
color-convert: 2.0.1
chalk@4.1.2:
dependencies:
ansi-styles: 4.3.0
supports-color: 7.2.0
cliui@8.0.1:
dependencies:
string-width: 4.2.3
strip-ansi: 6.0.1
wrap-ansi: 7.0.0
color-convert@2.0.1:
dependencies:
color-name: 1.1.4
color-name@1.1.4: {}
concurrently@9.2.5:
dependencies:
chalk: 4.1.2
rxjs: 7.8.2
shell-quote: 1.12.0
supports-color: 8.1.1
tree-kill: 1.2.2
yargs: 17.7.2
emoji-regex@8.0.0: {}
escalade@3.2.0: {}
get-caller-file@2.0.5: {}
has-flag@4.0.0: {}
is-fullwidth-code-point@3.0.0: {}
require-directory@2.1.1: {}
rxjs@7.8.2:
dependencies:
tslib: 2.8.1
shell-quote@1.12.0: {}
string-width@4.2.3:
dependencies:
emoji-regex: 8.0.0
is-fullwidth-code-point: 3.0.0
strip-ansi: 6.0.1
strip-ansi@6.0.1:
dependencies:
ansi-regex: 5.0.1
supports-color@7.2.0:
dependencies:
has-flag: 4.0.0
supports-color@8.1.1:
dependencies:
has-flag: 4.0.0
tree-kill@1.2.2: {}
tslib@2.8.1: {}
wrap-ansi@7.0.0:
dependencies:
ansi-styles: 4.3.0
string-width: 4.2.3
strip-ansi: 6.0.1
y18n@5.0.8: {}
yargs-parser@21.1.1: {}
yargs@17.7.2:
dependencies:
cliui: 8.0.1
escalade: 3.2.0
get-caller-file: 2.0.5
require-directory: 2.1.1
string-width: 4.2.3
y18n: 5.0.8
yargs-parser: 21.1.1
+3
View File
@@ -0,0 +1,3 @@
# 仅把本仓库根当作独立 workspace,阻断向上解析到 ~/.
# 不把 apps/* 纳入;web/server/agent 仍各自装依赖。
packages: []