refactor: 整理发布模块目录为 agent 与 editor 分层

This commit is contained in:
2026-09-22 11:37:08 +08:00
parent 21cd9778ae
commit 0dc8e383a6
16 changed files with 38 additions and 27 deletions
@@ -0,0 +1,6 @@
-- 发布草稿编辑页:路径与组件对齐 views/.../publish/editor/index.vue
UPDATE `sys_menu`
SET `path` = '/pdd/goods/publish/editor/:draftId',
`component` = '/channel/pdd/goods/publish/editor/index'
WHERE `id` = 12037
OR `route_name` = 'PddGoodsPublishDeskEdit';
@@ -836,7 +836,7 @@ SELECT 12036, (SELECT id FROM `sys_menu` WHERE `id` = 52 OR `title` = '拼多多
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `id` = 12036 OR `route_name` = 'PddGoodsPublishDesk');
INSERT INTO `sys_menu` (`id`, `parent_id`, `super`, `route_name`, `title`, `path`, `component`, `redirect`, `icon`, `type`, `visible`, `status`, `keep_alive`, `order`)
SELECT 12037, (SELECT id FROM `sys_menu` WHERE `id` = 52 OR `title` = '拼多多' LIMIT 1), 0, 'PddGoodsPublishDeskEdit', '编辑发布草稿', '/pdd/goods/publish/edit/:draftId', '/channel/pdd/goods/publish/edit', '', '', 'embedded', 0, 1, 0, 99
SELECT 12037, (SELECT id FROM `sys_menu` WHERE `id` = 52 OR `title` = '拼多多' LIMIT 1), 0, 'PddGoodsPublishDeskEdit', '编辑发布草稿', '/pdd/goods/publish/editor/:draftId', '/channel/pdd/goods/publish/editor/index', '', '', 'embedded', 0, 1, 0, 99
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM `sys_menu` WHERE `id` = 12037 OR `route_name` = 'PddGoodsPublishDeskEdit');
INSERT IGNORE INTO `sys_menu_permission` (`menu_id`, `permission_id`)
@@ -7,8 +7,9 @@ import type { RouteRecordRaw } from 'vue-router';
const staticRoutes: RouteRecordRaw[] = [
{
name: 'PddGoodsPublishDeskEdit',
path: '/pdd/goods/publish/edit/:draftId',
component: () => import('#/views/channel/pdd/goods/publish/edit.vue'),
path: '/pdd/goods/publish/editor/:draftId',
component: () =>
import('#/views/channel/pdd/goods/publish/editor/index.vue'),
meta: {
title: '编辑发布草稿',
hideInMenu: true,
@@ -23,7 +23,7 @@ import {
type AgentVO,
} from '#/api/agent';
import type { PublishEditorAgentApi } from './publish-agent-commands';
import type { PublishEditorAgentApi } from './commands';
defineOptions({ name: 'PddPublishAgentPanel' });
@@ -44,16 +44,16 @@ import {
import { getProductPageApi } from '#/api/ec/product';
import SpecAxesCard from './SpecAxesCard.vue';
import SkuTableCard from './SkuTableCard.vue';
import SpecAxesCard from './components/SpecAxesCard.vue';
import SkuTableCard from './components/SkuTableCard.vue';
import type { SpecAxis, SpecCatalogItem, SkuRow } from './types';
import { createEmptyPublishForm } from './types';
import { usePublishAgent } from './use-publish-agent';
import { usePublishCategory } from './use-publish-category';
import { usePublishDraft } from './use-publish-draft';
import { usePublishImages } from './use-publish-images';
import { usePublishSku } from './use-publish-sku';
import { usePublishSpecs } from './use-publish-specs';
import { usePublishAgent } from './composables/use-publish-agent';
import { usePublishCategory } from './composables/use-publish-category';
import { usePublishDraft } from './composables/use-publish-draft';
import { usePublishImages } from './composables/use-publish-images';
import { usePublishSku } from './composables/use-publish-sku';
import { usePublishSpecs } from './composables/use-publish-specs';
defineOptions({ name: 'PddPublishEditor' });
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import type { UploadFile, UploadProps } from 'ant-design-vue';
import type { SkuRow } from './types';
import type { SkuRow } from '../types';
import { PlusOutlined } from '@ant-design/icons-vue';
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import type { SpecAxis, SpecCatalogItem } from './types';
import type { SpecAxis, SpecCatalogItem } from '../types';
import { createIconifyIcon } from '@vben/icons';
import { MinusOutlined, PlusOutlined } from '@ant-design/icons-vue';
@@ -3,13 +3,13 @@ import type { Ref } from 'vue';
import type {
ClientToolResult,
PublishFormSnapshot,
} from '../publish-agent-commands';
} from '../../agent/commands';
import type {
PublishFormFields,
SpecAxis,
SpecCatalogItem,
SkuRow,
} from './types';
} from '../types';
/**
* 智能体命令面:读表单快照 + 执行 ui_*(含 skuAssignments / 槽位 id 复用)。
@@ -27,7 +27,7 @@ import type {
PublishFormFields,
SpecAxis,
SpecCatalogItem,
} from './types';
} from '../types';
/**
* 类目树 / Cascader / 发布权 / 模板与运费加载。
@@ -24,7 +24,7 @@ import type {
SpecAxis,
SpecCatalogItem,
SkuRow,
} from './types';
} from '../types';
type EmitDraft = {
(e: 'draft-saved', draftId: number): void;
@@ -9,7 +9,7 @@ import { FileCategory } from '#/constants/file-category';
import { getFileAccessUrlApi } from '#/api/sys/file';
import { uploadFile, uploadFiles } from '#/utils/upload-file';
import type { PersistedUpload, SkuRow } from './types';
import type { PersistedUpload, SkuRow } from '../types';
/**
* 轮播/详情/SKU 缩略图本地预览与持久化上传。
@@ -14,7 +14,7 @@ import {
getProductSkuPageApi,
} from '#/api/ec/product/sku';
import type { SpecAxis, SkuRow } from './types';
import type { SpecAxis, SkuRow } from '../types';
type SpecHelpers = {
effectiveSpecSlots: (axis: SpecAxis) => SpecAxis['selectedValues'];
@@ -8,8 +8,8 @@ import { Modal as AntModal, message } from 'ant-design-vue';
import type { PddGoodsPublishVO } from '#/api/channel/pdd/goods';
import type { SpecAxis, SpecCatalogItem, SkuRow } from './types';
import { createSpecValueSlotFactory } from './types';
import type { SpecAxis, SpecCatalogItem, SkuRow } from '../types';
import { createSpecValueSlotFactory } from '../types';
/**
* 销售规格目录/轴 CRUD、槽位合并与 Sortable。
@@ -1,4 +1,8 @@
<script lang="ts" setup>
/**
* 发布编辑页路由入口(editor/index):Page 布局 + 左侧表单 + 右侧 Agent。
* 表单实现见同目录 PddPublishEditor;智能体见 ../agent。
*/
import { computed, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
@@ -6,9 +10,9 @@ import { Page } from '@vben/common-ui';
import { useColSidebarLayout } from '#/store/col-sidebar-layout';
import PddPublishAgentPanel from './PddPublishAgentPanel.vue';
import PddPublishEditor from './editor/PddPublishEditor.vue';
import type { PublishEditorAgentApi } from './publish-agent-commands';
import PddPublishAgentPanel from '../agent/PddPublishAgentPanel.vue';
import type { PublishEditorAgentApi } from '../agent/commands';
import PddPublishEditor from './PddPublishEditor.vue';
defineOptions({ name: 'PddGoodsPublishDeskEdit' });
@@ -323,14 +323,14 @@ async function createDraft() {
skuCount: 0,
});
message.success('已创建系统草稿');
await router.push(`/pdd/goods/publish/edit/${draft.id}`);
await router.push(`/pdd/goods/publish/editor/${draft.id}`);
} catch (e: any) {
message.error(e?.message || '创建失败');
}
}
function openEdit(id: number) {
void router.push(`/pdd/goods/publish/edit/${id}`).catch((err) => {
void router.push(`/pdd/goods/publish/editor/${id}`).catch((err) => {
console.error(err);
message.error('无法打开编辑页,请刷新后再试');
});