瀏覽代碼

fix(@six/wisdom-legacy): 成果管理 - 知识产权页面接口对接

cmj 2 天之前
父節點
當前提交
5f48818f16

+ 5 - 5
apps/wisdom-legacy/src/api/outcome/intellectual-property.api.ts

@@ -53,7 +53,7 @@ export function listIntellectualPropertyMethod(...args: PageQueryMethodArgs) {
     encodeIntellectualPropertyQuery,
   );
   return httpClient.Post(
-    `/wis-pc/outcome/intellectualPropertyManage/page`,
+    `/wis-pc/outcome/keopManage/page`,
     { ...params, ...data },
     {
       params,
@@ -72,7 +72,7 @@ export function createIntellectualPropertyMethod(
   }
 
   return httpClient.Post(
-    `/wis-pc/outcome/intellectualPropertyManage/add`,
+    `/wis-pc/outcome/keopManage/add`,
     encodeIntellectualProperty(vo),
     {
       name: 'outcome-intellectual-property:edit',
@@ -90,7 +90,7 @@ export function updateIntellectualPropertyMethod(
   }
 
   return httpClient.Post(
-    `/wis-pc/outcome/intellectualPropertyManage/update`,
+    `/wis-pc/outcome/keopManage/update`,
     encodeIntellectualProperty(vo),
     {
       name: 'outcome-intellectual-property:edit',
@@ -117,7 +117,7 @@ export function getIntellectualPropertyMethod(
   }
 
   return httpClient.Post(
-    `/wis-pc/outcome/intellectualPropertyManage/detail/${vo.id}`,
+    `/wis-pc/outcome/keopManage/detail/${vo.id}`,
     {},
     {
       hitSource: /^outcome-intellectual-property:edit/,
@@ -135,7 +135,7 @@ export function deleteIntellectualPropertyMethod(
   }
 
   return httpClient.Post(
-    `/wis-pc/outcome/intellectualPropertyManage/delete/${vo.id}`,
+    `/wis-pc/outcome/keopManage/delete/${vo.id}`,
     {},
     {
       name: 'outcome-intellectual-property:delete',

+ 59 - 52
apps/wisdom-legacy/src/api/outcome/intellectual-property.mock.ts

@@ -12,13 +12,15 @@ import type { PageVO } from '#/request/schema/record';
 import { pageQueryArgsTransform } from '#/request/schema';
 
 import {
+  decodeGrantStatus,
   decodeIntellectualProperty,
+  decodePatentType,
   encodeIntellectualProperty,
   encodeIntellectualPropertyQuery,
 } from './intellectual-property.schema';
 
 /** 后端接口就绪后改为 false */
-export const USE_INTELLECTUAL_PROPERTY_MOCK = true;
+export const USE_INTELLECTUAL_PROPERTY_MOCK = false;
 
 type MethodLike<T> = PromiseLike<T> & {
   send?: (force?: boolean) => PromiseLike<T>;
@@ -32,73 +34,73 @@ const SEED_RECORDS: Omit<
   'createTime' | 'id' | 'personalStudioId' | 'updateTime'
 >[] = [
   {
-    patentNumber: 'CN202310123456.7',
-    title: '一种治疗慢性胃炎的中药复方制剂',
-    patentType: 'invention',
-    inventors: '张三, 李四, 王五',
-    applicationDate: '2023-03-15',
-    status: 'rejected',
-    authorizationDate: '2024-06-20',
+    patentCode: 'CN202310123456.7',
+    patentName: '一种治疗慢性胃炎的中药复方制剂',
+    type: '0',
+    inventor: '张三, 李四, 王五',
+    applyTime: '2023-03-15T00:00:00',
+    grantStatus: '1',
+    grantTime: '2024-06-20T00:00:00',
     commentCount: 5,
     createBy: '张三',
     fileUrl: MOCK_PDF_URL,
   },
   {
-    patentNumber: 'CN202410234567.8',
-    title: '基于人工智能的中医诊断辅助系统',
-    patentType: 'invention',
-    inventors: '赵六, 钱七',
-    applicationDate: '2024-01-10',
-    status: 'under_review',
-    authorizationDate: '2025-02-28',
+    patentCode: 'CN202410234567.8',
+    patentName: '基于人工智能的中医诊断辅助系统',
+    type: '0',
+    inventor: '赵六, 钱七',
+    applyTime: '2024-01-10T00:00:00',
+    grantStatus: '0',
+    grantTime: '2025-02-28T00:00:00',
     commentCount: 3,
     createBy: '赵六',
     fileUrl: MOCK_PDF_URL,
   },
   {
-    patentNumber: 'CN202210345678.9',
-    title: '改进型针灸治疗仪',
-    patentType: 'utility_model',
-    inventors: '孙八, 周九',
-    applicationDate: '2022-08-22',
-    status: 'authorized',
-    authorizationDate: '2023-05-18',
+    patentCode: 'CN202210345678.9',
+    patentName: '改进型针灸治疗仪',
+    type: '1',
+    inventor: '孙八, 周九',
+    applyTime: '2022-08-22T00:00:00',
+    grantStatus: '2',
+    grantTime: '2023-05-18T00:00:00',
     commentCount: 8,
     createBy: '孙八',
     fileUrl: MOCK_PDF_URL,
   },
   {
-    patentNumber: 'CN202310456789.0',
-    title: '一种中药提取装置',
-    patentType: 'utility_model',
-    inventors: '吴十, 郑十一',
-    applicationDate: '2023-06-01',
-    status: 'authorized',
-    authorizationDate: '2024-03-12',
+    patentCode: 'CN202310456789.0',
+    patentName: '一种中药提取装置',
+    type: '1',
+    inventor: '吴十, 郑十一',
+    applyTime: '2023-06-01T00:00:00',
+    grantStatus: '2',
+    grantTime: '2024-03-12T00:00:00',
     commentCount: 2,
     createBy: '吴十',
     fileUrl: MOCK_PDF_URL,
   },
   {
-    patentNumber: 'CN202410567890.1',
-    title: '便携式脉诊仪外观设计',
-    patentType: 'design',
-    inventors: '王十二',
-    applicationDate: '2024-02-14',
-    status: 'under_review',
-    authorizationDate: '2025-01-20',
+    patentCode: 'CN202410567890.1',
+    patentName: '便携式脉诊仪外观设计',
+    type: '2',
+    inventor: '王十二',
+    applyTime: '2024-02-14T00:00:00',
+    grantStatus: '0',
+    grantTime: '2025-01-20T00:00:00',
     commentCount: 1,
     createBy: '王十二',
     fileUrl: MOCK_PDF_URL,
   },
   {
-    patentNumber: 'CN202210678901.2',
-    title: '一种艾灸烟雾净化装置',
-    patentType: 'utility_model',
-    inventors: '李十三, 张十四',
-    applicationDate: '2022-11-05',
-    status: 'authorized',
-    authorizationDate: '2023-09-30',
+    patentCode: 'CN202210678901.2',
+    patentName: '一种艾灸烟雾净化装置',
+    type: '1',
+    inventor: '李十三, 张十四',
+    applyTime: '2022-11-05T00:00:00',
+    grantStatus: '2',
+    grantTime: '2023-09-30T00:00:00',
     commentCount: 6,
     createBy: '李十三',
     fileUrl: MOCK_PDF_URL,
@@ -138,9 +140,9 @@ function delay<T>(runner: () => Promise<T> | T, ms = 120): MethodLike<T> {
 function matchKeyword(record: IntellectualPropertyDTO, keyword?: string) {
   if (!keyword) return true;
   const text = [
-    record.title,
-    record.patentNumber,
-    record.inventors,
+    record.patentName,
+    record.patentCode,
+    record.inventor,
     record.createBy,
   ]
     .filter(Boolean)
@@ -158,12 +160,15 @@ function matchPatentType(
   patentType?: PatentType,
 ) {
   if (!patentType) return true;
-  return record.patentType === patentType;
+  return decodePatentType(record.type) === patentType;
 }
 
-function matchStatus(record: IntellectualPropertyDTO, status?: PatentStatus) {
+function matchGrantStatus(
+  record: IntellectualPropertyDTO,
+  status?: PatentStatus,
+) {
   if (!status) return true;
-  return record.status === status;
+  return decodeGrantStatus(record.grantStatus) === status;
 }
 
 function toVo(dto: IntellectualPropertyDTO): IntellectualPropertyVO {
@@ -181,15 +186,17 @@ export function mockListIntellectualPropertyMethod(
   const pageSize = Number(params.pageSize ?? 10);
   const keyword = data.mixture;
   const workroomId = data.personalStudioId?.toString();
-  const patentType = data.patentType;
-  const status = data.status;
+  const patentType = data.type ? decodePatentType(data.type) : undefined;
+  const status = data.grantStatus
+    ? decodeGrantStatus(data.grantStatus)
+    : undefined;
 
   const filtered = store.filter(
     (record) =>
       matchKeyword(record, keyword) &&
       matchWorkroom(record, workroomId) &&
       matchPatentType(record, patentType) &&
-      matchStatus(record, status),
+      matchGrantStatus(record, status),
   );
   const start = (pageNum - 1) * pageSize;
   const items = filtered

+ 102 - 26
apps/wisdom-legacy/src/api/outcome/intellectual-property.schema.ts

@@ -15,6 +15,36 @@ export type PatentType = 'design' | 'invention' | 'utility_model';
 
 export type PatentStatus = 'authorized' | 'rejected' | 'under_review';
 
+/** 后端 `type` 字段,对应字典:智慧传承系统-专利类型 */
+export type PatentTypeDTO = '0' | '1' | '2';
+
+/** 后端 `grantStatus` 字段:0-审查中 1-已驳回 2-已授权 */
+export type GrantStatusDTO = '0' | '1' | '2';
+
+const PATENT_TYPE_TO_DTO: Record<PatentType, PatentTypeDTO> = {
+  invention: '0',
+  utility_model: '1',
+  design: '2',
+};
+
+const PATENT_TYPE_FROM_DTO: Record<PatentTypeDTO, PatentType> = {
+  '0': 'invention',
+  '1': 'utility_model',
+  '2': 'design',
+};
+
+const GRANT_STATUS_TO_DTO: Record<PatentStatus, GrantStatusDTO> = {
+  under_review: '0',
+  rejected: '1',
+  authorized: '2',
+};
+
+const GRANT_STATUS_FROM_DTO: Record<GrantStatusDTO, PatentStatus> = {
+  '0': 'under_review',
+  '1': 'rejected',
+  '2': 'authorized',
+};
+
 export const PATENT_TYPE_OPTIONS = [
   { label: '发明专利', value: 'invention' },
   { label: '实用新型', value: 'utility_model' },
@@ -60,29 +90,75 @@ export function getPatentStatusColor(status?: PatentStatus) {
   }
 }
 
+export function decodePatentType(type?: number | string): PatentType {
+  const normalized = type?.toString();
+  if (normalized === '0' || normalized === '1' || normalized === '2') {
+    return PATENT_TYPE_FROM_DTO[normalized];
+  }
+  return 'invention';
+}
+
+export function decodeGrantStatus(grantStatus?: number | string): PatentStatus {
+  const normalized = grantStatus?.toString();
+  if (normalized === '0' || normalized === '1' || normalized === '2') {
+    return GRANT_STATUS_FROM_DTO[normalized];
+  }
+  return 'under_review';
+}
+
+function encodePatentType(type: PatentType): PatentTypeDTO {
+  return PATENT_TYPE_TO_DTO[type];
+}
+
+function encodeGrantStatus(status: PatentStatus): GrantStatusDTO {
+  return GRANT_STATUS_TO_DTO[status];
+}
+
+function formatDateTime(date: string) {
+  if (!date) return date;
+  if (/^\d{4}-\d{2}-\d{2}$/.test(date)) {
+    return `${date}T00:00:00`;
+  }
+  return date;
+}
+
+function formatDateOnly(dateTime?: string) {
+  if (!dateTime) return '';
+  return dateTime.slice(0, 10);
+}
+
 // ---------------------------------------------------------------------------
 // DTO
 // ---------------------------------------------------------------------------
 
+/** 知识产权 DTO,对应 `OutcomeKnowledgeOwnershipDetail` */
 export interface IntellectualPropertyDTO extends AuditRecordDTO {
   id?: number | string;
+  status?: string;
+  remark?: string;
   personalStudioId?: number | string;
-  patentNumber?: string;
-  title?: string;
-  patentType?: PatentType;
-  inventors?: string;
-  applicationDate?: string;
-  status?: PatentStatus;
-  authorizationDate?: string;
   fileUrl?: string;
+  downloadCount?: number;
+  browseCount?: number;
   commentCount?: number;
+  praiseCount?: number;
+  patentCode?: string;
+  patentName?: string;
+  /** 专利类型,详见字典:智慧传承系统-专利类型 */
+  type?: PatentTypeDTO | string;
+  inventor?: string;
+  applyTime?: string;
+  /** 授权状态 0-审查中 1-已驳回 2-已授权 */
+  grantStatus?: GrantStatusDTO | string;
+  grantTime?: string;
 }
 
 export interface IntellectualPropertyQueryDTO {
   mixture?: string;
   personalStudioId?: number | string;
-  patentType?: PatentType;
-  status?: PatentStatus;
+  type?: PatentTypeDTO | string;
+  status?: string;
+  grantStatus?: GrantStatusDTO | string;
   pageNum?: number;
   pageSize?: number;
 }
@@ -145,13 +221,13 @@ export function decodeIntellectualProperty(
     ...decodeAuditRecord(dto),
     id: dto.id?.toString(),
     workroomId: dto.personalStudioId?.toString() ?? '',
-    patentNumber: dto.patentNumber ?? '',
-    title: dto.title ?? '',
-    patentType: dto.patentType ?? 'invention',
-    inventors: dto.inventors ?? '',
-    applicationDate: dto.applicationDate ?? '',
-    status: dto.status ?? 'under_review',
-    authorizationDate: dto.authorizationDate ?? '',
+    patentNumber: dto.patentCode ?? '',
+    title: dto.patentName ?? '',
+    patentType: decodePatentType(dto.type),
+    inventors: dto.inventor ?? '',
+    applicationDate: formatDateOnly(dto.applyTime),
+    status: decodeGrantStatus(dto.grantStatus),
+    authorizationDate: formatDateOnly(dto.grantTime),
     pdfUrl: dto.fileUrl,
     commentCount: dto.commentCount ?? 0,
   };
@@ -163,8 +239,8 @@ export function encodeIntellectualPropertyQuery(
   return {
     mixture: query.keyword,
     personalStudioId: query.workroomId,
-    patentType: query.patentType,
-    status: query.status,
+    type: query.patentType ? encodePatentType(query.patentType) : undefined,
+    grantStatus: query.status ? encodeGrantStatus(query.status) : undefined,
   };
 }
 
@@ -174,14 +250,14 @@ export function encodeIntellectualProperty(
   return {
     id: vo.id,
     personalStudioId: vo.workroomId,
-    patentNumber: vo.patentNumber,
-    title: vo.title,
-    patentType: vo.patentType,
-    inventors: vo.inventors,
-    applicationDate: vo.applicationDate,
-    status: vo.status,
-    authorizationDate: vo.authorizationDate,
-    fileUrl: vo.pdfUrl,
+    fileUrl: vo.pdfUrl ?? '',
+    patentCode: vo.patentNumber,
+    patentName: vo.title,
+    type: encodePatentType(vo.patentType),
+    inventor: vo.inventors,
+    applyTime: formatDateTime(vo.applicationDate),
+    grantStatus: encodeGrantStatus(vo.status),
+    grantTime: formatDateTime(vo.authorizationDate),
   };
 }
 

+ 2 - 0
apps/wisdom-legacy/src/views/outcome/intellectual-property.data.ts

@@ -50,6 +50,7 @@ export const intellectualPropertyForm = defineEditShell<IntellectualPropertyVO>(
         fieldName: 'patentType',
         label: '专利类型',
         componentProps: {
+          class: 'w-full',
           options: [...PATENT_TYPE_OPTIONS],
           placeholder: '请选择专利类型',
           getPopupContainer,
@@ -83,6 +84,7 @@ export const intellectualPropertyForm = defineEditShell<IntellectualPropertyVO>(
         fieldName: 'status',
         label: '授权状态',
         componentProps: {
+          class: 'w-full',
           options: [...PATENT_STATUS_OPTIONS],
           placeholder: '请选择授权状态',
           getPopupContainer,