Bladeren bron

feat(@six/wisdom-legacy): 成果管理 - 获奖页面新增

Co-authored-by: Cursor <cursoragent@cursor.com>
cmj 2 dagen geleden
bovenliggende
commit
f18dc2fcdd

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

@@ -9,3 +9,4 @@ export * from './reading-note.api';
 export * from './research-report.api';
 export * from './treatment-plan.api';
 export * from './video.api';
+export * from './winaward.api';

+ 124 - 0
apps/wisdom-legacy/src/api/outcome/winaward.api.ts

@@ -0,0 +1,124 @@
+import type { WinawardSubmitVO, WinawardVO } from './winaward.schema';
+
+import type { PageQueryMethodArgs } from '#/request/schema';
+
+import { getEnvelopeData, httpClient } from '#/request';
+import {
+  pageQueryArgsTransform,
+  paginateTransform,
+  transform,
+} from '#/request/schema';
+
+import {
+  mockDeleteWinawardMethod,
+  mockEditWinawardMethod,
+  mockGetWinawardMethod,
+  mockListWinawardMethod,
+  USE_WINAWARD_MOCK,
+} from './winaward.mock';
+import {
+  decodeWinaward,
+  encodeWinaward,
+  encodeWinawardQuery,
+} from './winaward.schema';
+
+export { USE_WINAWARD_MOCK } from './winaward.mock';
+export type {
+  WinawardLevel,
+  WinawardQueryVO,
+  WinawardSubmitVO,
+  WinawardVO,
+} from './winaward.schema';
+export {
+  getWinawardLevelColor,
+  getWinawardLevelLabel,
+  WINAWARD_LEVEL_OPTIONS,
+  WinawardVOSchema,
+} from './winaward.schema';
+
+/** 获奖分页列表 */
+export function listWinawardMethod(...args: PageQueryMethodArgs) {
+  if (USE_WINAWARD_MOCK) {
+    return mockListWinawardMethod(...args) as any;
+  }
+
+  const { params, data } = pageQueryArgsTransform(args, encodeWinawardQuery);
+  return httpClient.Post(
+    `/wis-pc/outcome/winawardManage/page`,
+    { ...params, ...data },
+    {
+      params,
+      hitSource: /^outcome-winaward:(edit|delete)/,
+      transform: paginateTransform(decodeWinaward),
+    },
+  );
+}
+
+/** 新增获奖 */
+export function createWinawardMethod(vo: WinawardSubmitVO) {
+  if (USE_WINAWARD_MOCK) {
+    return mockEditWinawardMethod(vo) as any;
+  }
+
+  return httpClient.Post(
+    `/wis-pc/outcome/winawardManage/add`,
+    encodeWinaward(vo),
+    {
+      name: 'outcome-winaward:edit',
+      transform: getEnvelopeData<null | string>,
+    },
+  );
+}
+
+/** 修改获奖 */
+export function updateWinawardMethod(vo: WinawardSubmitVO) {
+  if (USE_WINAWARD_MOCK) {
+    return mockEditWinawardMethod(vo) as any;
+  }
+
+  return httpClient.Post(
+    `/wis-pc/outcome/winawardManage/update`,
+    encodeWinaward(vo),
+    {
+      name: 'outcome-winaward:edit',
+      transform: getEnvelopeData<null | string>,
+    },
+  );
+}
+
+/** 新增 / 修改获奖 */
+export function editWinawardMethod(vo: WinawardSubmitVO) {
+  return vo.id ? updateWinawardMethod(vo) : createWinawardMethod(vo);
+}
+
+/** 获奖详情 */
+export function getWinawardMethod(vo: Partial<WinawardVO>) {
+  if (USE_WINAWARD_MOCK) {
+    return mockGetWinawardMethod(vo) as any;
+  }
+
+  return httpClient.Post(
+    `/wis-pc/outcome/winawardManage/detail/${vo.id}`,
+    {},
+    {
+      hitSource: /^outcome-winaward:edit/,
+      transform: transform(decodeWinaward),
+    },
+  );
+}
+
+/** 删除获奖 */
+export function deleteWinawardMethod(vo: Pick<WinawardVO, 'id'>) {
+  if (USE_WINAWARD_MOCK) {
+    return mockDeleteWinawardMethod(vo) as any;
+  }
+
+  return httpClient.Post(
+    `/wis-pc/outcome/winawardManage/delete/${vo.id}`,
+    {},
+    {
+      name: 'outcome-winaward:delete',
+      meta: { ignoreError: true },
+    },
+  );
+}

+ 233 - 0
apps/wisdom-legacy/src/api/outcome/winaward.mock.ts

@@ -0,0 +1,233 @@
+import type {
+  WinawardDTO,
+  WinawardSubmitVO,
+  WinawardVO,
+} from './winaward.schema';
+
+import type { PageQueryMethodArgs } from '#/request/schema';
+import type { PageVO } from '#/request/schema/record';
+
+import { pageQueryArgsTransform } from '#/request/schema';
+
+import {
+  decodeWinaward,
+  encodeWinaward,
+  encodeWinawardQuery,
+} from './winaward.schema';
+
+/** 后端接口就绪后改为 false */
+export const USE_WINAWARD_MOCK = false;
+
+type MethodLike<T> = PromiseLike<T> & {
+  send?: (force?: boolean) => PromiseLike<T>;
+};
+
+const SEED_RECORDS: Omit<
+  WinawardDTO,
+  'createTime' | 'id' | 'personalStudioId' | 'updateTime'
+>[] = [
+  {
+    name: '国家科技进步奖二等奖',
+    level: '1',
+    issuer: '中华人民共和国科学技术部',
+    winawarder: '王教授,李主任',
+    winawardTime: '2025-11-15',
+    winawardProject: '中医药防治慢性病的临床与基础研究',
+    profile:
+      '本项目系统研究了中医药防治慢性病的理论体系和临床方案,建立了完整的诊疗规范,为中医药现代化提供了重要支撑。',
+    commentCount: 12,
+    createBy: '王教授',
+    fileUrl: '',
+  },
+  {
+    name: '省级中医药科技进步奖一等奖',
+    level: '2',
+    issuer: '省科学技术厅',
+    winawarder: '张医师',
+    winawardTime: '2024-09-20',
+    winawardProject: '经方治疗脾胃病的临床研究',
+    profile:
+      '通过多中心临床研究,验证了经典经方在脾胃病治疗中的有效性和安全性,形成了可推广的诊疗方案。',
+    commentCount: 8,
+    createBy: '张医师',
+    fileUrl: '',
+  },
+  {
+    name: '市级优秀中医药成果奖',
+    level: '3',
+    issuer: '市卫生健康委员会',
+    winawarder: '陈医师,赵医师',
+    winawardTime: '2023-06-10',
+    winawardProject: '社区中医药健康管理服务模式创新',
+    profile:
+      '探索建立了适合基层社区的中医药健康管理服务模式,提升了居民中医药健康素养。',
+    commentCount: 5,
+    createBy: '陈医师',
+    fileUrl: '',
+  },
+];
+
+function createInitialStore(): WinawardDTO[] {
+  const records: WinawardDTO[] = [];
+  for (let index = 0; index < 22; index += 1) {
+    const seed = SEED_RECORDS[index % SEED_RECORDS.length] ?? SEED_RECORDS[0];
+    if (!seed) continue;
+    const year = 2023 + (index % 3);
+    const month = String((index % 12) + 1).padStart(2, '0');
+    const day = String((index % 28) + 1).padStart(2, '0');
+    records.push({
+      ...seed,
+      id: String(index + 1),
+      personalStudioId: '327477138296832',
+      commentCount: (seed.commentCount ?? 0) + (index % 5),
+      winawardTime: `${year}-${month}-${day}`,
+      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: WinawardDTO, keyword?: string) {
+  if (!keyword) return true;
+  const text = [
+    record.name,
+    record.winawarder,
+    record.winawardProject,
+    record.issuer,
+    record.profile,
+  ]
+    .filter(Boolean)
+    .join(' ');
+  return text.includes(keyword);
+}
+
+function matchWorkroom(record: WinawardDTO, workroomId?: string) {
+  if (!workroomId) return true;
+  return String(record.personalStudioId ?? '') === String(workroomId);
+}
+
+function matchLevel(record: WinawardDTO, level?: string) {
+  if (!level) return true;
+  return String(record.level ?? '') === String(level);
+}
+
+function matchYear(record: WinawardDTO, year?: string) {
+  if (!year) return true;
+  const awardYear = record.winawardTime?.slice(0, 4);
+  return awardYear === year;
+}
+
+function sortRecords(records: WinawardDTO[]) {
+  return records.toSorted((a, b) => {
+    const timeA = a.winawardTime ? Date.parse(a.winawardTime) : 0;
+    const timeB = b.winawardTime ? Date.parse(b.winawardTime) : 0;
+    return timeB - timeA;
+  });
+}
+
+function toVo(dto: WinawardDTO): WinawardVO {
+  return decodeWinaward(dto);
+}
+
+export function mockListWinawardMethod(...args: PageQueryMethodArgs) {
+  const { params, data } = pageQueryArgsTransform(args, encodeWinawardQuery);
+  const pageNum = Number(params.pageNum ?? 1);
+  const pageSize = Number(params.pageSize ?? 20);
+  const keyword = data.mixture;
+  const workroomId = data.personalStudioId?.toString();
+  const level = data.level?.toString();
+  const year = data.year?.toString();
+
+  const filtered = sortRecords(
+    store.filter(
+      (record) =>
+        matchKeyword(record, keyword) &&
+        matchWorkroom(record, workroomId) &&
+        matchLevel(record, level) &&
+        matchYear(record, year),
+    ),
+  );
+  const start = (pageNum - 1) * pageSize;
+  const items = filtered
+    .slice(start, start + pageSize)
+    .map((record) => toVo(record));
+
+  const result: PageVO<WinawardVO> = {
+    total: filtered.length,
+    items,
+  };
+  return delay(() => result);
+}
+
+export function mockGetWinawardMethod(vo: Partial<WinawardVO>) {
+  return delay(() => {
+    const record = store.find((item) => String(item.id) === String(vo.id));
+    if (!record) {
+      throw new Error('获奖记录不存在');
+    }
+    return toVo(record);
+  });
+}
+
+export function mockEditWinawardMethod(vo: WinawardSubmitVO) {
+  return delay(() => {
+    const dto = encodeWinaward(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,
+      commentCount: 0,
+      createBy: dto.winawarder ?? '当前用户',
+      createTime: now,
+      updateTime: now,
+    });
+    return id;
+  });
+}
+
+export function mockDeleteWinawardMethod(vo: Pick<WinawardVO, '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 resetWinawardMockStore() {
+  nextId = 100;
+  store = createInitialStore();
+}

+ 195 - 0
apps/wisdom-legacy/src/api/outcome/winaward.schema.ts

@@ -0,0 +1,195 @@
+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 WinawardLevel = 'municipal' | 'national' | 'provincial';
+
+/** 后端 `level` 字段:1-国家级 2-省级 3-市级 */
+export type WinawardLevelDTO = '1' | '2' | '3';
+
+const WINAWARD_LEVEL_TO_DTO: Record<WinawardLevel, WinawardLevelDTO> = {
+  national: '1',
+  provincial: '2',
+  municipal: '3',
+};
+
+const WINAWARD_LEVEL_FROM_DTO: Record<WinawardLevelDTO, WinawardLevel> = {
+  '1': 'national',
+  '2': 'provincial',
+  '3': 'municipal',
+};
+
+export const WINAWARD_LEVEL_OPTIONS = [
+  { label: '国家级', value: 'national', color: 'error' },
+  { label: '省级', value: 'provincial', color: 'processing' },
+  { label: '市级', value: 'municipal', color: 'success' },
+] as const satisfies ReadonlyArray<{
+  color: string;
+  label: string;
+  value: WinawardLevel;
+}>;
+
+export function getWinawardLevelLabel(level?: WinawardLevel) {
+  return (
+    WINAWARD_LEVEL_OPTIONS.find((item) => item.value === level)?.label ?? ''
+  );
+}
+
+export function getWinawardLevelColor(level?: WinawardLevel) {
+  return (
+    WINAWARD_LEVEL_OPTIONS.find((item) => item.value === level)?.color ??
+    'default'
+  );
+}
+
+export function decodeWinawardLevel(level?: number | string): WinawardLevel {
+  const normalized = level?.toString();
+  if (normalized === '1' || normalized === '2' || normalized === '3') {
+    return WINAWARD_LEVEL_FROM_DTO[normalized];
+  }
+  return 'national';
+}
+
+function encodeWinawardLevel(level: WinawardLevel): WinawardLevelDTO {
+  return WINAWARD_LEVEL_TO_DTO[level];
+}
+
+// ---------------------------------------------------------------------------
+// DTO
+// ---------------------------------------------------------------------------
+
+/** 获奖 DTO,对应 `OutcomeWinawardDetail` */
+export interface WinawardDTO extends AuditRecordDTO {
+  id?: number | string;
+  status?: string;
+  remark?: string;
+  personalStudioId?: number | string;
+  fileUrl?: string;
+  downloadCount?: number;
+  browseCount?: number;
+  commentCount?: number;
+  praiseCount?: number;
+  name?: string;
+  level?: string | WinawardLevelDTO;
+  issuer?: string;
+  winawarder?: string;
+  winawardTime?: string;
+  winawardProject?: string;
+  profile?: string;
+}
+
+export interface WinawardQueryDTO {
+  mixture?: string;
+  personalStudioId?: number | string;
+  level?: string | WinawardLevelDTO;
+  year?: string;
+  status?: string;
+  pageNum?: number;
+  pageSize?: number;
+}
+
+// ---------------------------------------------------------------------------
+// VO
+// ---------------------------------------------------------------------------
+
+export interface WinawardVO extends AuditRecordVO {
+  id?: string;
+  workroomId: string;
+  name: string;
+  level: WinawardLevel;
+  issuer: string;
+  awardee: string;
+  awardDate: string;
+  project: string;
+  profile: string;
+  fileUrl?: string;
+  commentCount?: number;
+}
+
+export type WinawardSubmitVO = WinawardVO;
+
+export interface WinawardQueryVO {
+  keyword?: string;
+  workroomId?: string;
+  level?: WinawardLevel;
+  year?: string;
+}
+
+// ---------------------------------------------------------------------------
+// Schema
+// ---------------------------------------------------------------------------
+
+export const WinawardVOSchema = z.object({
+  id: z.string().optional(),
+  workroomId: z.string().min(1, '工作室不能为空'),
+  name: z.string().min(1, '请输入奖项名称'),
+  level: z.enum(['national', 'provincial', 'municipal'], {
+    message: '请选择获奖级别',
+  }),
+  issuer: z.string().min(1, '请输入颁发机构'),
+  awardee: z.string().min(1, '请输入获奖人'),
+  awardDate: z.string().min(1, '请选择获奖时间'),
+  project: z.string().min(1, '请输入获奖项目'),
+  profile: z.string().min(1, '请输入项目简介'),
+  fileUrl: z.string().optional(),
+});
+
+// ---------------------------------------------------------------------------
+// 编解码
+// ---------------------------------------------------------------------------
+
+export function decodeWinaward(dto: WinawardDTO): WinawardVO {
+  return {
+    ...decodeAuditRecord(dto),
+    id: dto.id?.toString(),
+    workroomId: dto.personalStudioId?.toString() ?? '',
+    name: dto.name ?? '',
+    level: decodeWinawardLevel(dto.level),
+    issuer: dto.issuer ?? '',
+    awardee: dto.winawarder ?? '',
+    awardDate: dto.winawardTime ? String(dto.winawardTime).slice(0, 10) : '',
+    project: dto.winawardProject ?? '',
+    profile: dto.profile ?? '',
+    fileUrl: dto.fileUrl,
+    commentCount: dto.commentCount ?? 0,
+  };
+}
+
+export function encodeWinawardQuery(
+  query: Partial<WinawardQueryVO>,
+): WinawardQueryDTO {
+  return {
+    mixture: query.keyword,
+    personalStudioId: query.workroomId,
+    level: query.level ? encodeWinawardLevel(query.level) : undefined,
+    year: query.year || undefined,
+  };
+}
+
+export function encodeWinaward(vo: WinawardSubmitVO): WinawardDTO {
+  return {
+    id: vo.id,
+    personalStudioId: vo.workroomId,
+    fileUrl: vo.fileUrl ?? '',
+    name: vo.name,
+    level: encodeWinawardLevel(vo.level),
+    issuer: vo.issuer,
+    winawarder: vo.awardee,
+    winawardTime: vo.awardDate,
+    winawardProject: vo.project,
+    profile: vo.profile,
+  };
+}
+
+export function decodeWinawardList(dto: WinawardDTO[]) {
+  return decodeList(dto, decodeWinaward);
+}

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

@@ -16,6 +16,7 @@ const newDrugCertificate = () =>
 const video = () => import('#/views/outcome/VideoList.vue');
 const readingNote = () => import('#/views/outcome/ReadingNoteList.vue');
 const experience = () => import('#/views/outcome/ExperienceList.vue');
+const winaward = () => import('#/views/outcome/WinawardList.vue');
 
 const routes: RouteRecordRaw[] = [
   {
@@ -143,7 +144,7 @@ const routes: RouteRecordRaw[] = [
           icon: 'carbon:user',
           title: '获奖',
         },
-        component: placeholder,
+        component: winaward,
       },
       {
         path: '/outcome/medical-talk',

+ 284 - 0
apps/wisdom-legacy/src/views/outcome/WinawardList.vue

@@ -0,0 +1,284 @@
+<script setup lang="ts">
+import type { WinawardLevel, WinawardVO } from '#/api/outcome';
+
+import { computed, h, ref, shallowRef, triggerRef, watch } from 'vue';
+
+import { Page } from '@vben/common-ui';
+import { Plus } from '@vben/icons';
+
+import { watchDebounced } from '@vueuse/core';
+import {
+  Button,
+  Empty,
+  Input,
+  message,
+  Modal,
+  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 {
+  deleteWinawardMethod,
+  getWinawardLevelLabel,
+  listWinawardMethod,
+  WINAWARD_LEVEL_OPTIONS,
+} from '#/api/outcome';
+import { useWorkroomStore } from '#/stores';
+
+import WinawardCard from './components/WinawardCard.vue';
+import WinawardEdit from './modules/WinawardEdit.vue';
+
+const workroomStore = useWorkroomStore();
+const { workroomId } = storeToRefs(workroomStore);
+
+const keyword = ref('');
+const searchKeyword = ref('');
+const level = ref<'' | WinawardLevel>('');
+const year = ref('');
+const pageNum = ref(1);
+const pageSize = ref(20);
+const loading = ref(false);
+const pageData = ref<{ items: WinawardVO[]; total: number }>({
+  total: 0,
+  items: [],
+});
+
+const deletingIds = shallowRef(new Set<string>());
+
+const levelOptions = [
+  { label: '全部级别', value: '' },
+  ...WINAWARD_LEVEL_OPTIONS.map(({ label, value }) => ({ label, value })),
+];
+
+const yearOptions = computed(() => {
+  const currentYear = new Date().getFullYear();
+  const years = [{ label: '全部年份', value: '' }];
+  for (let y = currentYear; y >= currentYear - 10; y -= 1) {
+    years.push({ label: `${y}年`, value: String(y) });
+  }
+  return years;
+});
+
+async function loadList() {
+  if (!workroomId.value) {
+    pageData.value = { total: 0, items: [] };
+    loading.value = false;
+    return;
+  }
+
+  loading.value = true;
+  try {
+    pageData.value = await invokeMethod(
+      listWinawardMethod(pageNum.value, pageSize.value, {
+        $filters: [],
+        $sorts: [],
+        keyword: searchKeyword.value || undefined,
+        workroomId: workroomId.value,
+        level: level.value || undefined,
+        year: year.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: WinawardEdit,
+});
+
+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,
+      level: 'national',
+    } as WinawardVO)
+    .open<{ id?: string }>(Promise.withResolvers());
+  if (result?.id) {
+    pageNum.value = 1;
+    await loadList();
+  }
+}
+
+async function openEdit(row: WinawardVO) {
+  const result = await editApi
+    .setData(row)
+    .open<{ id?: string }>(Promise.withResolvers());
+  if (result?.id) {
+    await loadList();
+  }
+}
+
+function openView(row: WinawardVO) {
+  if (row.fileUrl) {
+    window.open(row.fileUrl, '_blank');
+    return;
+  }
+
+  const meta = [
+    getWinawardLevelLabel(row.level),
+    row.awardee ? `获奖人:${row.awardee}` : '',
+    row.issuer ? `颁发机构:${row.issuer}` : '',
+    row.awardDate ? `获奖时间:${row.awardDate}` : '',
+  ]
+    .filter(Boolean)
+    .join(' · ');
+
+  Modal.info({
+    title: row.name,
+    width: 640,
+    okText: '关闭',
+    content: h('div', { class: 'pt-2' }, [
+      row.project
+        ? h(
+            'p',
+            { class: 'mb-2 text-sm text-foreground/70' },
+            `项目:${row.project}`,
+          )
+        : null,
+      meta ? h('p', { class: 'mb-3 text-sm text-foreground/70' }, meta) : null,
+      h(
+        'div',
+        { class: 'whitespace-pre-wrap text-sm leading-7 text-foreground/85' },
+        row.profile || '暂无简介',
+      ),
+    ]),
+  });
+}
+
+async function handleDelete(row: WinawardVO) {
+  if (!row.id || isDeleting(row.id)) return;
+  setDeleting(row.id, true);
+  try {
+    await invokeMethod(deleteWinawardMethod(row), { force: true });
+    message.success('删除成功');
+    if (items.value.length <= 1 && pageNum.value > 1) {
+      pageNum.value -= 1;
+    }
+    await loadList();
+  } finally {
+    setDeleting(row.id, false);
+  }
+}
+
+function applySearch(value: string) {
+  const next = value.trim();
+  if (next === searchKeyword.value) return;
+  searchKeyword.value = next;
+  pageNum.value = 1;
+}
+
+watchDebounced(keyword, applySearch, { debounce: 300 });
+
+function onSearch() {
+  applySearch(keyword.value);
+}
+
+function onPageChange(page: number, size: number) {
+  pageNum.value = page;
+  pageSize.value = size;
+}
+
+watch([level, year], () => {
+  pageNum.value = 1;
+});
+
+watch(workroomId, () => {
+  pageNum.value = 1;
+});
+
+watch(
+  [pageNum, pageSize, searchKeyword, level, year, 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="搜索奖项名称、获奖人或项目..."
+          @search="onSearch"
+        />
+        <Select v-model:value="level" :options="levelOptions" class="w-36" />
+        <Select v-model:value="year" :options="yearOptions" 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">
+            <WinawardCard
+              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>

+ 159 - 0
apps/wisdom-legacy/src/views/outcome/components/WinawardCard.vue

@@ -0,0 +1,159 @@
+<script setup lang="ts">
+import type { WinawardVO } from '#/api/outcome';
+
+import { computed } from 'vue';
+
+import {
+  CommentOutlined,
+  DeleteOutlined,
+  EditOutlined,
+  EyeOutlined,
+  TrophyOutlined,
+} from '@ant-design/icons-vue';
+import { Button, Card, Popconfirm, Tag } from 'ant-design-vue';
+
+import { getWinawardLevelLabel } from '#/api/outcome';
+
+const { data, deleting } = defineProps<{
+  data: WinawardVO;
+  deleting?: boolean;
+}>();
+
+const emit = defineEmits<{
+  delete: [WinawardVO];
+  edit: [WinawardVO];
+  view: [WinawardVO];
+}>();
+
+const levelLabel = computed(() => getWinawardLevelLabel(data.level));
+
+const levelTagClass = computed(() => {
+  switch (data.level) {
+    case 'municipal': {
+      return 'winaward-level-municipal';
+    }
+    case 'national': {
+      return 'winaward-level-national';
+    }
+    case 'provincial': {
+      return 'winaward-level-provincial';
+    }
+    default: {
+      return '';
+    }
+  }
+});
+</script>
+
+<template>
+  <Card class="winaward-card" :bordered="true">
+    <div class="flex gap-4">
+      <div
+        class="flex size-14 shrink-0 items-center justify-center rounded-lg bg-amber-50"
+      >
+        <TrophyOutlined class="text-2xl text-amber-500" />
+      </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"
+            :title="data.name"
+          >
+            {{ data.name }}
+          </h3>
+          <Tag class="winaward-level-tag shrink-0" :class="levelTagClass">
+            {{ levelLabel }}
+          </Tag>
+        </div>
+
+        <p v-if="data.project" class="mb-2 text-sm text-foreground/70">
+          项目:{{ data.project }}
+        </p>
+
+        <div
+          class="mb-2 flex flex-wrap gap-x-4 gap-y-1 text-sm text-foreground/70"
+        >
+          <span v-if="data.awardee">获奖人:{{ data.awardee }}</span>
+          <span v-if="data.issuer">颁发机构:{{ data.issuer }}</span>
+        </div>
+
+        <p v-if="data.awardDate" class="mb-2 text-sm text-foreground/55">
+          获奖时间:{{ data.awardDate }}
+        </p>
+
+        <p
+          v-if="data.profile"
+          class="mb-3 line-clamp-2 text-sm text-foreground/55"
+        >
+          {{ data.profile }}
+        </p>
+
+        <div
+          class="flex flex-wrap items-center justify-between gap-2 border-t pt-3"
+        >
+          <span
+            class="inline-flex items-center gap-1 text-sm text-foreground/55"
+          >
+            <CommentOutlined />
+            {{ data.commentCount ?? 0 }} 条评论
+          </span>
+
+          <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-text="确定"
+              cancel-text="取消"
+              :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>
+.winaward-card :deep(.ant-card-body) {
+  padding: 20px 24px;
+}
+
+.winaward-level-tag {
+  margin: 0;
+  border: 0;
+}
+
+.winaward-level-national {
+  color: #cf1322;
+  background: #fff1f0;
+}
+
+.winaward-level-provincial {
+  color: #0958d9;
+  background: #e6f4ff;
+}
+
+.winaward-level-municipal {
+  color: #389e0d;
+  background: #f6ffed;
+}
+</style>

+ 165 - 0
apps/wisdom-legacy/src/views/outcome/modules/WinawardEdit.vue

@@ -0,0 +1,165 @@
+<script setup lang="ts">
+import type { UploadFile, UploadProps } from 'ant-design-vue';
+
+import type { WinawardSubmitVO } from '#/api/outcome';
+
+import { ref } from 'vue';
+
+import { InboxOutlined } from '@ant-design/icons-vue';
+import { 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 { winawardForm } from '../winaward.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<WinawardSubmitVO>(winawardForm, {
+  onLoaded(model) {
+    api.shell.setState({
+      title: model.id ? '编辑获奖' : '添加获奖',
+    });
+  },
+  handleLoad(model) {
+    resetUploads();
+    pdfUrl.value = model.fileUrl;
+    pdfFileList.value = createUploadFile(model.fileUrl, '附件.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,
+      fileUrl: 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>
+          附件
+        </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>
+    </div>
+  </Shell>
+</template>

+ 111 - 0
apps/wisdom-legacy/src/views/outcome/winaward.data.ts

@@ -0,0 +1,111 @@
+import type { WinawardVO } from '#/api/outcome';
+
+import { getPopupContainer } from '@vben/utils';
+
+import { defineEditShell } from '#/adapter/shell/edit';
+import {
+  editWinawardMethod,
+  getWinawardMethod,
+  WINAWARD_LEVEL_OPTIONS,
+  WinawardVOSchema,
+} from '#/api/outcome';
+
+export const winawardForm = defineEditShell<WinawardVO>({
+  scope: 'outcome.winaward',
+  title: '获奖',
+  submit: editWinawardMethod,
+  load: getWinawardMethod,
+  shell: {
+    type: 'modal',
+    class: '!w-[640px]',
+    confirmText: '确定',
+  },
+  form: {
+    layout: 'vertical',
+    wrapperClass: 'grid-cols-1',
+  },
+  schema: [
+    {
+      component: 'Input',
+      fieldName: 'name',
+      label: '奖项名称',
+      componentProps: {
+        placeholder: '请输入',
+      },
+      rules: WinawardVOSchema.shape.name,
+    },
+    {
+      component: 'Select',
+      fieldName: 'level',
+      label: '获奖级别',
+      defaultValue: 'national',
+      componentProps: {
+        class: 'w-full',
+        options: [...WINAWARD_LEVEL_OPTIONS],
+        placeholder: '请选择获奖级别',
+        getPopupContainer,
+      },
+      rules: WinawardVOSchema.shape.level,
+    },
+    {
+      component: 'Input',
+      fieldName: 'issuer',
+      label: '颁发机构',
+      componentProps: {
+        placeholder: '请输入',
+      },
+      rules: WinawardVOSchema.shape.issuer,
+    },
+    {
+      component: 'Input',
+      fieldName: 'awardee',
+      label: '获奖人',
+      componentProps: {
+        placeholder: '多人用逗号隔开',
+      },
+      rules: WinawardVOSchema.shape.awardee,
+    },
+    {
+      component: 'DatePicker',
+      fieldName: 'awardDate',
+      label: '获奖时间',
+      componentProps: {
+        class: 'w-full',
+        format: 'YYYY/MM/DD',
+        placeholder: '年/月/日',
+        valueFormat: 'YYYY-MM-DD',
+        getPopupContainer,
+      },
+      rules: WinawardVOSchema.shape.awardDate,
+    },
+    {
+      component: 'Input',
+      fieldName: 'project',
+      label: '获奖项目',
+      componentProps: {
+        placeholder: '请输入',
+      },
+      rules: WinawardVOSchema.shape.project,
+    },
+    {
+      component: 'Textarea',
+      fieldName: 'profile',
+      label: '项目简介',
+      componentProps: {
+        placeholder: '请输入',
+        rows: 4,
+        showCount: false,
+      },
+      rules: WinawardVOSchema.shape.profile,
+    },
+    {
+      component: 'Input',
+      fieldName: 'workroomId',
+      dependencies: {
+        show: false,
+        triggerFields: ['workroomId'],
+      },
+      rules: WinawardVOSchema.shape.workroomId,
+    },
+  ],
+});