Przeglądaj źródła

feat(@six/wisdom-legacy): 成果管理 - 论著静态页面新增

Co-authored-by: Cursor <cursoragent@cursor.com>
cmj 2 dni temu
rodzic
commit
87f9abf195

+ 1 - 0
apps/wisdom-legacy/src/api/outcome/index.ts

@@ -1,3 +1,4 @@
 export * from './medical-case-library.api';
+export * from './monograph.api';
 export * from './paper.api';
 export * from './treatment-plan.api';

+ 123 - 0
apps/wisdom-legacy/src/api/outcome/monograph.api.ts

@@ -0,0 +1,123 @@
+import type { MonographSubmitVO, MonographVO } from './monograph.schema';
+
+import type { PageQueryMethodArgs } from '#/request/schema';
+
+import { getEnvelopeData, httpClient } from '#/request';
+import {
+  pageQueryArgsTransform,
+  paginateTransform,
+  transform,
+} from '#/request/schema';
+
+import {
+  mockDeleteMonographMethod,
+  mockEditMonographMethod,
+  mockGetMonographMethod,
+  mockListMonographMethod,
+  USE_MONOGRAPH_MOCK,
+} from './monograph.mock';
+import {
+  decodeMonograph,
+  encodeMonograph,
+  encodeMonographQuery,
+} from './monograph.schema';
+
+export { USE_MONOGRAPH_MOCK } from './monograph.mock';
+export type {
+  MonographCategory,
+  MonographQueryVO,
+  MonographSubmitVO,
+  MonographVO,
+} from './monograph.schema';
+export {
+  getMonographCategoryLabel,
+  MONOGRAPH_CATEGORY_OPTIONS,
+  MonographVOSchema,
+} from './monograph.schema';
+
+/** 论著分页列表 */
+export function listMonographMethod(...args: PageQueryMethodArgs) {
+  if (USE_MONOGRAPH_MOCK) {
+    return mockListMonographMethod(...args) as any;
+  }
+
+  const { params, data } = pageQueryArgsTransform(args, encodeMonographQuery);
+  return httpClient.Post(
+    `/wis-pc/outcome/monographManage/page`,
+    { ...params, ...data },
+    {
+      params,
+      hitSource: /^outcome-monograph:(edit|delete)/,
+      transform: paginateTransform(decodeMonograph),
+    },
+  );
+}
+
+/** 新增论著 */
+export function createMonographMethod(vo: MonographSubmitVO) {
+  if (USE_MONOGRAPH_MOCK) {
+    return mockEditMonographMethod(vo) as any;
+  }
+
+  return httpClient.Post(
+    `/wis-pc/outcome/monographManage/add`,
+    encodeMonograph(vo),
+    {
+      name: 'outcome-monograph:edit',
+      transform: getEnvelopeData<null | string>,
+    },
+  );
+}
+
+/** 修改论著 */
+export function updateMonographMethod(vo: MonographSubmitVO) {
+  if (USE_MONOGRAPH_MOCK) {
+    return mockEditMonographMethod(vo) as any;
+  }
+
+  return httpClient.Post(
+    `/wis-pc/outcome/monographManage/update`,
+    encodeMonograph(vo),
+    {
+      name: 'outcome-monograph:edit',
+      transform: getEnvelopeData<null | string>,
+    },
+  );
+}
+
+/** 新增 / 修改论著 */
+export function editMonographMethod(vo: MonographSubmitVO) {
+  return vo.id ? updateMonographMethod(vo) : createMonographMethod(vo);
+}
+
+/** 论著详情 */
+export function getMonographMethod(vo: Partial<MonographVO>) {
+  if (USE_MONOGRAPH_MOCK) {
+    return mockGetMonographMethod(vo) as any;
+  }
+
+  return httpClient.Post(
+    `/wis-pc/outcome/monographManage/detail/${vo.id}`,
+    {},
+    {
+      hitSource: /^outcome-monograph:edit/,
+      transform: transform(decodeMonograph),
+    },
+  );
+}
+
+/** 删除论著 */
+export function deleteMonographMethod(vo: Pick<MonographVO, 'id'>) {
+  if (USE_MONOGRAPH_MOCK) {
+    return mockDeleteMonographMethod(vo) as any;
+  }
+
+  return httpClient.Post(
+    `/wis-pc/outcome/monographManage/delete/${vo.id}`,
+    {},
+    {
+      name: 'outcome-monograph:delete',
+      meta: { ignoreError: true },
+    },
+  );
+}

+ 263 - 0
apps/wisdom-legacy/src/api/outcome/monograph.mock.ts

@@ -0,0 +1,263 @@
+import type {
+  MonographCategory,
+  MonographDTO,
+  MonographSubmitVO,
+  MonographVO,
+} from './monograph.schema';
+
+import type { PageQueryMethodArgs } from '#/request/schema';
+import type { PageVO } from '#/request/schema/record';
+
+import { pageQueryArgsTransform } from '#/request/schema';
+
+import {
+  decodeMonograph,
+  encodeMonograph,
+  encodeMonographQuery,
+} from './monograph.schema';
+
+/** 后端接口就绪后改为 false */
+export const USE_MONOGRAPH_MOCK = true;
+
+type MethodLike<T> = PromiseLike<T> & {
+  send?: (force?: boolean) => PromiseLike<T>;
+};
+
+const MOCK_PDF_URL =
+  'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf';
+
+const SEED_RECORDS: Omit<
+  MonographDTO,
+  'createTime' | 'id' | 'personalStudioId' | 'updateTime'
+>[] = [
+  {
+    category: 'textbook',
+    title: '中医内科学(第三版)',
+    author: '王教授 主编',
+    publisher: '中国中医药出版社',
+    publishDate: '2025-08',
+    isbn: '978-7-5132-6789-0',
+    description:
+      '全国高等中医药院校规划教材,系统阐述中医内科疾病的诊治理论与临床实践,涵盖常见内科疾病的病因病机、辨证论治及现代研究进展。',
+    viewCount: 1250,
+    commentCount: 23,
+    createBy: '王刚',
+    fileUrl: MOCK_PDF_URL,
+  },
+  {
+    category: 'academic',
+    title: '伤寒论条文解',
+    author: '张仲景 著,李教授 校注',
+    publisher: '人民卫生出版社',
+    publishDate: '2024-06',
+    isbn: '978-7-117-34567-8',
+    description:
+      '以经典条文为主线,结合历代医家注释与现代临床体会,深入解读《伤寒论》核心思想与辨证体系。',
+    viewCount: 890,
+    commentCount: 15,
+    createBy: '张许',
+    fileUrl: MOCK_PDF_URL,
+  },
+  {
+    category: 'popular_science',
+    title: '中医养生智慧',
+    author: '陈医师 著',
+    publisher: '科学出版社',
+    publishDate: '2025-03',
+    isbn: '978-7-03-45678-9',
+    description:
+      '面向大众的中医养生科普读物,介绍四季养生、情志调摄、饮食起居等实用养生方法,语言通俗易懂。',
+    viewCount: 2100,
+    commentCount: 45,
+    createBy: '李虎',
+    fileUrl: MOCK_PDF_URL,
+  },
+  {
+    category: 'reference',
+    title: '中药学大辞典',
+    author: '中国药学会 编',
+    publisher: '上海科学技术出版社',
+    publishDate: '2023-12',
+    isbn: '978-7-5323-7890-1',
+    description:
+      '收录常用中药及民族药条目,详述性味归经、功效主治、用法用量及现代药理研究,是中医药工作者必备工具书。',
+    viewCount: 560,
+    commentCount: 8,
+    createBy: '王刚',
+    fileUrl: MOCK_PDF_URL,
+  },
+  {
+    category: 'academic',
+    title: '针灸学理论与实践',
+    author: '刘教授 主编',
+    publisher: '中国中医药出版社',
+    publishDate: '2024-09',
+    isbn: '978-7-5132-5678-2',
+    description:
+      '系统论述针灸学基础理论、经络腧穴、刺灸方法及临床各科常见病证的针灸治疗方案,附大量临床案例。',
+    viewCount: 720,
+    commentCount: 12,
+    createBy: '张许',
+    fileUrl: MOCK_PDF_URL,
+  },
+  {
+    category: 'textbook',
+    title: '方剂学(第二版)',
+    author: '赵主任 主编',
+    publisher: '高等教育出版社',
+    publishDate: '2025-01',
+    isbn: '978-7-04-01234-5',
+    description:
+      '高等院校中医药类专业核心教材,介绍方剂组成原则、各类方剂的功用主治及临床应用要点。',
+    viewCount: 980,
+    commentCount: 18,
+    createBy: '李虎',
+    fileUrl: MOCK_PDF_URL,
+  },
+];
+
+function createInitialStore(): MonographDTO[] {
+  const records: MonographDTO[] = [];
+  for (let index = 0; index < 28; index += 1) {
+    const seed = SEED_RECORDS[index % SEED_RECORDS.length] ?? SEED_RECORDS[0];
+    if (!seed) continue;
+    const day = String((index % 28) + 1).padStart(2, '0');
+    const month = String((index % 12) + 1).padStart(2, '0');
+    records.push({
+      ...seed,
+      id: String(index + 1),
+      personalStudioId: '327477138296832',
+      createTime: `2026-${month}-${day}T10:00:00`,
+      updateTime: `2026-05-${day}T10:00:00`,
+    });
+  }
+  return records;
+}
+
+let nextId = 100;
+let store = createInitialStore();
+
+function delay<T>(runner: () => Promise<T> | T, ms = 120): MethodLike<T> {
+  const run = async () => {
+    await new Promise((resolve) => setTimeout(resolve, ms));
+    return runner();
+  };
+  const promise = run();
+  return Object.assign(promise, { send: run });
+}
+
+function matchKeyword(record: MonographDTO, keyword?: string) {
+  if (!keyword) return true;
+  const text = [
+    record.title,
+    record.author,
+    record.isbn,
+    record.publisher,
+    record.description,
+    record.createBy,
+  ]
+    .filter(Boolean)
+    .join(' ');
+  return text.includes(keyword);
+}
+
+function matchWorkroom(record: MonographDTO, workroomId?: string) {
+  if (!workroomId) return true;
+  return String(record.personalStudioId ?? '') === String(workroomId);
+}
+
+function matchCategory(record: MonographDTO, category?: MonographCategory) {
+  if (!category) return true;
+  return record.category === category;
+}
+
+function toVo(dto: MonographDTO): MonographVO {
+  return decodeMonograph(dto);
+}
+
+export function mockListMonographMethod(...args: PageQueryMethodArgs) {
+  const { params, data } = pageQueryArgsTransform(args, encodeMonographQuery);
+  const pageNum = Number(params.pageNum ?? 1);
+  const pageSize = Number(params.pageSize ?? 10);
+  const keyword = data.mixture;
+  const workroomId = data.personalStudioId?.toString();
+  const category = data.category;
+
+  const filtered = store.filter(
+    (record) =>
+      matchKeyword(record, keyword) &&
+      matchWorkroom(record, workroomId) &&
+      matchCategory(record, category),
+  );
+  const start = (pageNum - 1) * pageSize;
+  const items = filtered
+    .slice(start, start + pageSize)
+    .map((record) => toVo(record));
+
+  const result: PageVO<MonographVO> = {
+    total: filtered.length,
+    items,
+  };
+  return delay(() => result);
+}
+
+export function mockGetMonographMethod(vo: Partial<MonographVO>) {
+  return delay(() => {
+    const record = store.find((item) => String(item.id) === String(vo.id));
+    if (!record) {
+      throw new Error('论著不存在');
+    }
+    return toVo(record);
+  });
+}
+
+export function mockEditMonographMethod(vo: MonographSubmitVO) {
+  return delay(() => {
+    const dto = encodeMonograph(vo);
+    const now = new Date().toISOString();
+
+    if (vo.id) {
+      const index = store.findIndex(
+        (item) => String(item.id) === String(vo.id),
+      );
+      if (index === -1) {
+        throw new Error('论著不存在');
+      }
+      store[index] = {
+        ...store[index],
+        ...dto,
+        updateTime: now,
+      };
+      return String(vo.id);
+    }
+
+    const id = String(nextId++);
+    store.unshift({
+      ...dto,
+      id,
+      viewCount: 0,
+      commentCount: 0,
+      createBy: dto.createBy ?? '当前用户',
+      createTime: now,
+      updateTime: now,
+    });
+    return id;
+  });
+}
+
+export function mockDeleteMonographMethod(vo: Pick<MonographVO, 'id'>) {
+  return delay(() => {
+    const before = store.length;
+    store = store.filter((item) => String(item.id) !== String(vo.id));
+    if (store.length === before) {
+      throw new Error('论著不存在');
+    }
+    return null;
+  });
+}
+
+/** 仅用于本地调试,重置 mock 数据 */
+export function resetMonographMockStore() {
+  nextId = 100;
+  store = createInitialStore();
+}

+ 158 - 0
apps/wisdom-legacy/src/api/outcome/monograph.schema.ts

@@ -0,0 +1,158 @@
+import type {
+  AuditRecordDTO,
+  AuditRecordVO,
+} from '#/request/schema/audit-record';
+
+import { z } from '#/adapter/form';
+import { decodeList } from '#/request/schema';
+import { decodeAuditRecord } from '#/request/schema/audit-record';
+
+// ---------------------------------------------------------------------------
+// 枚举
+// ---------------------------------------------------------------------------
+
+export type MonographCategory =
+  | 'academic'
+  | 'popular_science'
+  | 'reference'
+  | 'textbook';
+
+export const MONOGRAPH_CATEGORY_OPTIONS = [
+  { label: '教材', value: 'textbook' },
+  { label: '学术专著', value: 'academic' },
+  { label: '科普著作', value: 'popular_science' },
+  { label: '工具书', value: 'reference' },
+] as const satisfies ReadonlyArray<{
+  label: string;
+  value: MonographCategory;
+}>;
+
+export function getMonographCategoryLabel(category?: MonographCategory) {
+  return (
+    MONOGRAPH_CATEGORY_OPTIONS.find((item) => item.value === category)?.label ??
+    ''
+  );
+}
+
+// ---------------------------------------------------------------------------
+// DTO
+// ---------------------------------------------------------------------------
+
+export interface MonographDTO extends AuditRecordDTO {
+  id?: number | string;
+  personalStudioId?: number | string;
+  category?: MonographCategory;
+  title?: string;
+  author?: string;
+  publisher?: string;
+  publishDate?: string;
+  isbn?: string;
+  description?: string;
+  fileUrl?: string;
+  viewCount?: number;
+  commentCount?: number;
+}
+
+export interface MonographQueryDTO {
+  mixture?: string;
+  personalStudioId?: number | string;
+  category?: MonographCategory;
+  pageNum?: number;
+  pageSize?: number;
+}
+
+// ---------------------------------------------------------------------------
+// VO
+// ---------------------------------------------------------------------------
+
+export interface MonographVO extends AuditRecordVO {
+  id?: string;
+  workroomId: string;
+  category: MonographCategory;
+  title: string;
+  author: string;
+  publisher: string;
+  publishDate: string;
+  isbn: string;
+  description?: string;
+  pdfUrl?: string;
+  viewCount?: number;
+  commentCount?: number;
+}
+
+export type MonographSubmitVO = MonographVO;
+
+export interface MonographQueryVO {
+  keyword?: string;
+  workroomId?: string;
+  category?: MonographCategory;
+}
+
+// ---------------------------------------------------------------------------
+// Schema
+// ---------------------------------------------------------------------------
+
+export const MonographVOSchema = z.object({
+  id: z.string().optional(),
+  workroomId: z.string().min(1, '工作室不能为空'),
+  category: z.enum(['textbook', 'academic', 'popular_science', 'reference'], {
+    message: '请选择类别',
+  }),
+  title: z.string().min(1, '请输入论著标题'),
+  author: z.string().min(1, '请输入作者'),
+  publisher: z.string().min(1, '请输入出版社'),
+  publishDate: z.string().min(1, '请选择出版日期'),
+  isbn: z.string().min(1, '请输入ISBN'),
+  description: z.string().optional(),
+});
+
+// ---------------------------------------------------------------------------
+// 编解码
+// ---------------------------------------------------------------------------
+
+export function decodeMonograph(dto: MonographDTO): MonographVO {
+  return {
+    ...decodeAuditRecord(dto),
+    id: dto.id?.toString(),
+    workroomId: dto.personalStudioId?.toString() ?? '',
+    category: dto.category ?? 'textbook',
+    title: dto.title ?? '',
+    author: dto.author ?? '',
+    publisher: dto.publisher ?? '',
+    publishDate: dto.publishDate ?? '',
+    isbn: dto.isbn ?? '',
+    description: dto.description,
+    pdfUrl: dto.fileUrl,
+    viewCount: dto.viewCount ?? 0,
+    commentCount: dto.commentCount ?? 0,
+  };
+}
+
+export function encodeMonographQuery(
+  query: Partial<MonographQueryVO>,
+): MonographQueryDTO {
+  return {
+    mixture: query.keyword,
+    personalStudioId: query.workroomId,
+    category: query.category,
+  };
+}
+
+export function encodeMonograph(vo: MonographSubmitVO): MonographDTO {
+  return {
+    id: vo.id,
+    personalStudioId: vo.workroomId,
+    category: vo.category,
+    title: vo.title,
+    author: vo.author,
+    publisher: vo.publisher,
+    publishDate: vo.publishDate,
+    isbn: vo.isbn,
+    description: vo.description,
+    fileUrl: vo.pdfUrl,
+  };
+}
+
+export function decodeMonographList(dto: MonographDTO[]) {
+  return decodeList(dto, decodeMonograph);
+}

+ 3 - 0
apps/wisdom-legacy/src/locales/langs/zh-CN/outcome.json

@@ -7,5 +7,8 @@
   },
   "paper": {
     "name": "论文"
+  },
+  "monograph": {
+    "name": "论著"
   }
 }

+ 2 - 1
apps/wisdom-legacy/src/router/routes/modules/outcome.route.ts

@@ -5,6 +5,7 @@ const medicalCaseLibrary = () =>
   import('#/views/outcome/MedicalCaseLibraryList.vue');
 const treatmentPlan = () => import('#/views/outcome/TreatmentPlanList.vue');
 const paper = () => import('#/views/outcome/PaperList.vue');
+const monograph = () => import('#/views/outcome/MonographList.vue');
 
 const routes: RouteRecordRaw[] = [
   {
@@ -51,7 +52,7 @@ const routes: RouteRecordRaw[] = [
           icon: 'carbon:user',
           title: '论著',
         },
-        component: placeholder,
+        component: monograph,
       },
       {
         path: '/outcome/research-report',

+ 236 - 0
apps/wisdom-legacy/src/views/outcome/MonographList.vue

@@ -0,0 +1,236 @@
+<script setup lang="ts">
+import type { MonographCategory, MonographVO } from '#/api/outcome';
+
+import { computed, ref, shallowRef, triggerRef, watch } from 'vue';
+
+import { Page } from '@vben/common-ui';
+import { Plus } from '@vben/icons';
+
+import {
+  Button,
+  Empty,
+  Input,
+  message,
+  Pagination,
+  Select,
+  Spin,
+} from 'ant-design-vue';
+import { storeToRefs } from 'pinia';
+
+import { useShell } from '#/adapter/shell';
+import { invokeMethod } from '#/adapter/vxe-table/proxy/invoke-method';
+import {
+  deleteMonographMethod,
+  listMonographMethod,
+  MONOGRAPH_CATEGORY_OPTIONS,
+} from '#/api/outcome';
+import { useWorkroomStore } from '#/stores';
+
+import MonographCard from './components/MonographCard.vue';
+import MonographEdit from './modules/MonographEdit.vue';
+
+const workroomStore = useWorkroomStore();
+const { workroomId } = storeToRefs(workroomStore);
+
+const keyword = ref('');
+const searchKeyword = ref('');
+const category = ref<'' | MonographCategory>('');
+const pageNum = ref(1);
+const pageSize = ref(10);
+const loading = ref(false);
+const pageData = ref<{ items: MonographVO[]; total: number }>({
+  total: 0,
+  items: [],
+});
+
+const deletingIds = shallowRef(new Set<string>());
+
+const categoryOptions = [
+  { label: '全部类别', value: '' },
+  ...MONOGRAPH_CATEGORY_OPTIONS,
+];
+
+async function loadList() {
+  if (!workroomId.value) {
+    pageData.value = { total: 0, items: [] };
+    loading.value = false;
+    return;
+  }
+
+  loading.value = true;
+  try {
+    pageData.value = await invokeMethod(
+      listMonographMethod(pageNum.value, pageSize.value, {
+        $filters: [],
+        $sorts: [],
+        keyword: searchKeyword.value || undefined,
+        workroomId: workroomId.value,
+        category: category.value || undefined,
+      }),
+      { force: true },
+    );
+  } finally {
+    loading.value = false;
+  }
+}
+
+const items = computed(() => pageData.value.items);
+const total = computed(() => pageData.value.total);
+
+const [Edit, editApi] = useShell('modal', {
+  connectedComponent: MonographEdit,
+});
+
+function isDeleting(id?: string) {
+  return id ? deletingIds.value.has(id) : false;
+}
+
+function setDeleting(id: string, value: boolean) {
+  if (value) {
+    deletingIds.value.add(id);
+  } else {
+    deletingIds.value.delete(id);
+  }
+  triggerRef(deletingIds);
+}
+
+async function openCreate() {
+  const result = await editApi
+    .setData({
+      workroomId: workroomId.value,
+      category: category.value ?? 'textbook',
+    } as MonographVO)
+    .open<{ id?: string }>(Promise.withResolvers());
+  if (result?.id) {
+    pageNum.value = 1;
+    await loadList();
+  }
+}
+
+async function openEdit(row: MonographVO) {
+  const result = await editApi
+    .setData(row)
+    .open<{ id?: string }>(Promise.withResolvers());
+  if (result?.id) {
+    await loadList();
+  }
+}
+
+function openView(row: MonographVO) {
+  if (row.pdfUrl) {
+    window.open(row.pdfUrl, '_blank');
+  } else {
+    message.warning('暂无PDF文件');
+  }
+}
+
+async function handleDelete(row: MonographVO) {
+  if (!row.id || isDeleting(row.id)) return;
+  setDeleting(row.id, true);
+  try {
+    await invokeMethod(deleteMonographMethod(row), { force: true });
+    message.success('删除成功');
+    if (items.value.length <= 1 && pageNum.value > 1) {
+      pageNum.value -= 1;
+    }
+    await loadList();
+  } finally {
+    setDeleting(row.id, false);
+  }
+}
+
+function onSearch() {
+  searchKeyword.value = keyword.value.trim();
+  pageNum.value = 1;
+}
+
+function onPageChange(page: number, size: number) {
+  pageNum.value = page;
+  pageSize.value = size;
+}
+
+watch(category, () => {
+  pageNum.value = 1;
+});
+
+watch(workroomId, () => {
+  pageNum.value = 1;
+});
+
+watch(
+  [pageNum, pageSize, searchKeyword, category, workroomId],
+  () => {
+    void loadList();
+  },
+  { immediate: true },
+);
+</script>
+
+<template>
+  <Page auto-content-height title="论著管理">
+    <Edit />
+
+    <template #extra>
+      <Button type="primary" @click="openCreate()">
+        <Plus class="size-4" />
+        添加论著
+      </Button>
+    </template>
+
+    <div class="flex h-full flex-col gap-4">
+      <div class="flex flex-wrap items-center gap-3">
+        <Input.Search
+          v-model:value="keyword"
+          allow-clear
+          class="min-w-[240px] flex-1"
+          placeholder="搜索书名、作者、ISBN或出版社..."
+          @search="onSearch"
+        />
+        <Select
+          v-model:value="category"
+          :options="categoryOptions"
+          class="w-36"
+        />
+      </div>
+
+      <Spin :spinning="loading">
+        <div class="min-h-48">
+          <Empty
+            v-if="!loading && items.length === 0"
+            :image="Empty.PRESENTED_IMAGE_SIMPLE"
+            description="暂无论著数据"
+          >
+            <Button type="primary" @click="openCreate()">添加论著</Button>
+          </Empty>
+
+          <div v-else class="flex flex-col gap-4">
+            <MonographCard
+              v-for="item in items"
+              :key="item.id"
+              :data="item"
+              :deleting="isDeleting(item.id)"
+              @edit="openEdit"
+              @view="openView"
+              @delete="handleDelete"
+            />
+          </div>
+        </div>
+      </Spin>
+
+      <div
+        v-if="total > 0"
+        class="mt-auto flex flex-wrap items-center justify-between gap-3 border-t pt-4"
+      >
+        <span class="text-sm text-foreground/70">共 {{ total }} 条记录</span>
+        <Pagination
+          :current="pageNum"
+          :page-size="pageSize"
+          :total="total"
+          :show-size-changer="false"
+          show-less-items
+          @change="onPageChange"
+        />
+      </div>
+    </div>
+  </Page>
+</template>

+ 116 - 0
apps/wisdom-legacy/src/views/outcome/components/MonographCard.vue

@@ -0,0 +1,116 @@
+<script setup lang="ts">
+import type { MonographVO } from '#/api/outcome';
+
+import {
+  BookOutlined,
+  CommentOutlined,
+  DeleteOutlined,
+  EditOutlined,
+  EyeOutlined,
+} from '@ant-design/icons-vue';
+import { Button, Card, Popconfirm, Tag } from 'ant-design-vue';
+
+import { getMonographCategoryLabel } from '#/api/outcome';
+
+const { data, deleting } = defineProps<{
+  data: MonographVO;
+  deleting?: boolean;
+}>();
+
+const emit = defineEmits<{
+  delete: [MonographVO];
+  edit: [MonographVO];
+  view: [MonographVO];
+}>();
+
+function formatMeta(item: MonographVO) {
+  return [item.author, item.publisher, item.publishDate]
+    .filter(Boolean)
+    .join(' • ');
+}
+</script>
+
+<template>
+  <Card class="monograph-card" :bordered="true">
+    <div class="flex gap-4">
+      <div
+        class="flex size-16 shrink-0 items-center justify-center rounded-lg bg-primary/10"
+      >
+        <BookOutlined class="text-2xl text-primary" />
+      </div>
+
+      <div class="min-w-0 flex-1">
+        <div class="mb-2 flex items-start justify-between gap-3">
+          <h3 class="text-base font-semibold leading-6 text-foreground">
+            {{ data.title }}
+          </h3>
+          <Tag color="processing" class="shrink-0">
+            {{ getMonographCategoryLabel(data.category) }}
+          </Tag>
+        </div>
+
+        <p class="mb-1 text-sm text-foreground/70">
+          {{ formatMeta(data) }}
+        </p>
+
+        <p class="mb-2 text-sm text-foreground/70">ISBN: {{ data.isbn }}</p>
+
+        <p
+          v-if="data.description"
+          class="mb-3 line-clamp-2 text-sm text-foreground/55"
+        >
+          {{ data.description }}
+        </p>
+
+        <div
+          class="flex flex-wrap items-center justify-between gap-3 border-t pt-3"
+        >
+          <div
+            class="flex flex-wrap items-center gap-4 text-sm text-foreground/60"
+          >
+            <span class="inline-flex items-center gap-1">
+              <EyeOutlined />
+              {{ data.viewCount ?? 0 }} 次浏览
+            </span>
+            <span class="inline-flex items-center gap-1">
+              <CommentOutlined />
+              {{ data.commentCount ?? 0 }} 条评论
+            </span>
+          </div>
+
+          <div class="flex flex-wrap items-center gap-1">
+            <Button type="link" class="!px-2" @click="emit('view', data)">
+              <EyeOutlined />
+              查看详情
+            </Button>
+            <Button
+              type="link"
+              class="!px-2 !text-primary"
+              @click="emit('edit', data)"
+            >
+              <EditOutlined />
+              编辑
+            </Button>
+            <Popconfirm
+              title="确定删除该论著吗?"
+              :ok-button-props="{ loading: deleting, danger: true }"
+              :cancel-button-props="{ disabled: deleting }"
+              @confirm="emit('delete', data)"
+            >
+              <Button type="link" danger class="!px-2" :disabled="deleting">
+                <DeleteOutlined />
+                删除
+              </Button>
+            </Popconfirm>
+          </div>
+        </div>
+      </div>
+    </div>
+  </Card>
+</template>
+
+<style scoped>
+.monograph-card :deep(.ant-card-body) {
+  padding: 20px 24px;
+}
+</style>

+ 177 - 0
apps/wisdom-legacy/src/views/outcome/modules/MonographEdit.vue

@@ -0,0 +1,177 @@
+<script setup lang="ts">
+import type { UploadFile, UploadProps } from 'ant-design-vue';
+
+import type { MonographSubmitVO } from '#/api/outcome';
+
+import { ref } from 'vue';
+
+import { InboxOutlined } from '@ant-design/icons-vue';
+import { Alert, message, Upload, UploadDragger } from 'ant-design-vue';
+
+import { useEditShell } from '#/adapter/shell';
+import { invokeMethod } from '#/adapter/vxe-table/proxy/invoke-method';
+import { uploadFileMethod } from '#/api/common';
+import { useWorkroomStore } from '#/stores';
+
+import { monographForm } from '../monograph.data';
+
+const workroomStore = useWorkroomStore();
+
+const PDF_MAX_SIZE = 50 * 1024 * 1024;
+
+const pdfFileList = ref<UploadFile[]>([]);
+const pdfUrl = ref<string>();
+const pdfUploading = ref(false);
+
+function createUploadFile(url: string | undefined, name: string): UploadFile[] {
+  if (!url) return [];
+  return [
+    {
+      uid: '-1',
+      name,
+      status: 'done',
+      url,
+    },
+  ];
+}
+
+function resetUploads() {
+  pdfFileList.value = [];
+  pdfUrl.value = void 0;
+  pdfUploading.value = false;
+}
+
+async function uploadImmediately(file: File) {
+  const uploadFile: UploadFile = {
+    uid: `${Date.now()}`,
+    name: file.name,
+    status: 'uploading',
+    percent: 0,
+  };
+  pdfFileList.value = [uploadFile];
+  pdfUploading.value = true;
+
+  try {
+    const url = await invokeMethod(uploadFileMethod(file), { force: true });
+    if (!url) {
+      throw new Error('upload empty url');
+    }
+    pdfUrl.value = url;
+    pdfFileList.value = [
+      {
+        ...uploadFile,
+        status: 'done',
+        url,
+      },
+    ];
+  } catch {
+    pdfUrl.value = void 0;
+    pdfFileList.value = [
+      {
+        ...uploadFile,
+        status: 'error',
+      },
+    ];
+    message.error(`${file.name} 上传失败,请重试`);
+  } finally {
+    pdfUploading.value = false;
+  }
+}
+
+const { Form, Shell, api } = useEditShell<MonographSubmitVO>(monographForm, {
+  onLoaded(model) {
+    api.shell.setState({
+      title: model.id ? '编辑论著' : '添加论著',
+    });
+  },
+  handleLoad(model) {
+    resetUploads();
+    pdfUrl.value = model.pdfUrl;
+    pdfFileList.value = createUploadFile(model.pdfUrl, '论著.pdf');
+    return model;
+  },
+  handleSubmit(values) {
+    const workroomId = values.workroomId || workroomStore.workroomId;
+    if (!workroomId) {
+      message.error('请先选择工作室');
+      throw new Error('workroom required');
+    }
+    if (pdfUploading.value) {
+      message.warning('文件上传中,请稍候');
+      throw new Error('uploading');
+    }
+    if (!pdfUrl.value) {
+      message.error('请上传论著PDF文件');
+      throw new Error('pdf required');
+    }
+
+    return {
+      ...values,
+      workroomId,
+      pdfUrl: pdfUrl.value,
+    };
+  },
+  onClosed: resetUploads,
+});
+
+const beforePdfUpload: UploadProps['beforeUpload'] = (file) => {
+  const isPdf =
+    file.type === 'application/pdf' || file.name.toLowerCase().endsWith('.pdf');
+  if (!isPdf) {
+    message.error('仅支持PDF格式文件');
+    return Upload.LIST_IGNORE;
+  }
+  if (file.size > PDF_MAX_SIZE) {
+    message.error('文件大小不能超过50MB');
+    return Upload.LIST_IGNORE;
+  }
+  void uploadImmediately(file);
+  return false;
+};
+
+function onPdfRemove() {
+  pdfUrl.value = void 0;
+}
+</script>
+
+<template>
+  <Shell>
+    <div class="mx-4">
+      <Form />
+
+      <div class="pb-4">
+        <div class="mb-2 text-sm">
+          <span class="text-destructive mr-1">*</span>
+          论著PDF文件
+        </div>
+        <UploadDragger
+          v-model:file-list="pdfFileList"
+          :before-upload="beforePdfUpload"
+          :max-count="1"
+          accept=".pdf,application/pdf"
+          @remove="onPdfRemove"
+        >
+          <p class="ant-upload-drag-icon">
+            <InboxOutlined />
+          </p>
+          <p class="ant-upload-text">点击上传或拖拽PDF文件到此处</p>
+          <p class="ant-upload-hint">
+            仅支持PDF格式文件,建议文件大小不超过50MB
+          </p>
+        </UploadDragger>
+      </div>
+
+      <Alert type="warning" show-icon class="mb-4">
+        <template #message>版权声明</template>
+        <template #description>
+          <ul class="mb-0 list-disc pl-4 text-sm">
+            <li>请确保上传的论著已获得合法授权</li>
+            <li>请尊重著作权人的知识产权</li>
+            <li>仅限于学术交流和研究使用</li>
+            <li>如涉及版权纠纷,上传者需承担相应责任</li>
+          </ul>
+        </template>
+      </Alert>
+    </div>
+  </Shell>
+</template>

+ 113 - 0
apps/wisdom-legacy/src/views/outcome/monograph.data.ts

@@ -0,0 +1,113 @@
+import type { MonographVO } from '#/api/outcome';
+
+import { getPopupContainer } from '@vben/utils';
+
+import { defineEditShell } from '#/adapter/shell/edit';
+import {
+  editMonographMethod,
+  getMonographMethod,
+  MONOGRAPH_CATEGORY_OPTIONS,
+  MonographVOSchema,
+} from '#/api/outcome';
+
+export const monographForm = defineEditShell<MonographVO>({
+  scope: 'outcome.monograph',
+  title: '论著',
+  submit: editMonographMethod,
+  load: getMonographMethod,
+  shell: {
+    type: 'modal',
+    class: '!w-[640px]',
+    confirmText: '提交论著',
+  },
+  form: {
+    layout: 'vertical',
+    wrapperClass: 'grid-cols-2',
+  },
+  schema: [
+    {
+      component: 'Input',
+      fieldName: 'title',
+      label: '论著标题',
+      formItemClass: 'col-span-2',
+      componentProps: {
+        placeholder: '请输入论著标题',
+      },
+      rules: MonographVOSchema.shape.title,
+    },
+    {
+      component: 'Input',
+      fieldName: 'author',
+      label: '作者',
+      formItemClass: 'col-span-2',
+      componentProps: {
+        placeholder: '例如:王教授 主编 或 张主任,李医师 著',
+      },
+      rules: MonographVOSchema.shape.author,
+    },
+    {
+      component: 'Input',
+      fieldName: 'publisher',
+      label: '出版社',
+      componentProps: {
+        placeholder: '例如:中国中医药出版社',
+      },
+      rules: MonographVOSchema.shape.publisher,
+    },
+    {
+      component: 'DatePicker',
+      fieldName: 'publishDate',
+      label: '出版日期',
+      componentProps: {
+        class: 'w-full',
+        format: 'YYYY-MM',
+        picker: 'month',
+        placeholder: '----年--月',
+        valueFormat: 'YYYY-MM',
+        getPopupContainer,
+      },
+      rules: MonographVOSchema.shape.publishDate,
+    },
+    {
+      component: 'Input',
+      fieldName: 'isbn',
+      label: 'ISBN',
+      componentProps: {
+        placeholder: '例如:978-7-5132-6789-0',
+      },
+      rules: MonographVOSchema.shape.isbn,
+    },
+    {
+      component: 'Select',
+      fieldName: 'category',
+      label: '类别',
+      componentProps: {
+        options: [...MONOGRAPH_CATEGORY_OPTIONS],
+        placeholder: '请选择类别',
+        getPopupContainer,
+      },
+      rules: MonographVOSchema.shape.category,
+    },
+    {
+      component: 'Textarea',
+      fieldName: 'description',
+      label: '内容简介',
+      formItemClass: 'col-span-2',
+      componentProps: {
+        placeholder: '请简要介绍论著的主要内容、特色和适用对象...',
+        rows: 4,
+        showCount: false,
+      },
+      help: '简要介绍论著的研究内容、学术价值和应用领域',
+    },
+    {
+      component: 'Input',
+      fieldName: 'workroomId',
+      dependencies: {
+        show: false,
+        triggerFields: ['workroomId'],
+      },
+      rules: MonographVOSchema.shape.workroomId,
+    },
+  ],
+});