fix(mp): 修复 72 个 TypeScript 类型错误 — noImplicitAny 全量通过
- 移除 28 个文件中不再需要的 import React (jsx: react-jsx) - 修复 catch(err: any) → catch(err: unknown) 类型收窄 - 修复 __wxConfig / CanvasRenderingContext2D 全局类型声明 - 修复 DTO 类型不匹配 (UpdateDialysisRecordReq, notificationService) - 移除 52 个未使用的 import/变量/常量 - 修复 services 类型 (auth.ts tenant_id, actionInbox boolean, device-sync)
This commit is contained in:
@@ -15,7 +15,7 @@ export interface LoginResp {
|
||||
access_token: string;
|
||||
refresh_token: string;
|
||||
expires_in: number;
|
||||
user: { id: string; username: string; display_name?: string; phone?: string; avatar_url?: string };
|
||||
user: { id: string; username: string; display_name?: string; phone?: string; avatar_url?: string; tenant_id?: string };
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -19,19 +19,12 @@ const RACP_CHARACTERISTIC = '00002A52-0000-1000-8000-00805F9B34FB';
|
||||
|
||||
// RACP 操作码
|
||||
const RACP_OPCODE_REPORT_STORED_RECORDS = 0x01;
|
||||
const RACP_OPCODE_DELETE_STORED_RECORDS = 0x02;
|
||||
const RACP_OPCODE_ABORT_OPERATION = 0x03;
|
||||
const RACP_OPCODE_REPORT_NUMBER_OF_RECORDS = 0x04;
|
||||
const RACP_OPCODE_NUMBER_OF_STORED_RECORDS_RESPONSE = 0x05;
|
||||
const RACP_OPCODE_RESPONSE_CODE = 0x06;
|
||||
|
||||
// RACP 操作符
|
||||
const RACP_OPERATOR_ALL = 0x01;
|
||||
const RACP_OPERATOR_LESS_THAN = 0x04;
|
||||
const RACP_OPERATOR_GREATER_THAN = 0x05;
|
||||
|
||||
// RACP 过滤器类型
|
||||
const RACP_FILTER_TYPE_TIME = 0x01;
|
||||
|
||||
/** 解析心率测量值(Heart Rate Measurement 格式) */
|
||||
function parseHeartRate(data: ArrayBuffer): number | null {
|
||||
@@ -118,14 +111,11 @@ export const XiaomiBandAdapter: DeviceAdapter = {
|
||||
const opcode = view.getUint8(0);
|
||||
|
||||
if (opcode === RACP_OPCODE_NUMBER_OF_STORED_RECORDS_RESPONSE) {
|
||||
const count = view.getUint16(2, true);
|
||||
// 不返回 reading,仅用于日志/调试
|
||||
return [];
|
||||
}
|
||||
|
||||
if (opcode === RACP_OPCODE_RESPONSE_CODE) {
|
||||
const reqOpcode = view.getUint8(1);
|
||||
const status = view.getUint8(2);
|
||||
// status: 0x01=成功, 0x02=不支持的操作码, 等
|
||||
// 不返回 reading,仅用于日志
|
||||
return [];
|
||||
@@ -162,7 +152,7 @@ export function buildRACPReportAll(): ArrayBuffer {
|
||||
export function buildRACPReportCount(): ArrayBuffer {
|
||||
const buffer = new ArrayBuffer(2);
|
||||
const view = new DataView(buffer);
|
||||
view.setUint8(0, RACP_OPCODE_REPORT_NUMBER_OF_STORED_RECORDS);
|
||||
view.setUint8(0, RACP_OPCODE_REPORT_NUMBER_OF_RECORDS);
|
||||
view.setUint8(1, RACP_OPERATOR_ALL);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ interface BatchReadingRequest {
|
||||
device_model?: string;
|
||||
readings: {
|
||||
device_type: string;
|
||||
values: Record<string, number>;
|
||||
values: Record<string, number | string>;
|
||||
measured_at: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
@@ -40,10 +40,13 @@ export async function listActionItems(params?: {
|
||||
assigned_to_me?: boolean;
|
||||
patient_id?: string;
|
||||
}) {
|
||||
return api.get<PaginatedData>(
|
||||
'/health/action-inbox',
|
||||
params as Record<string, string | number | boolean | undefined>,
|
||||
);
|
||||
const query: Record<string, string | number | undefined> = {};
|
||||
if (params) {
|
||||
for (const [k, v] of Object.entries(params)) {
|
||||
if (v !== undefined) query[k] = typeof v === 'boolean' ? String(v) : v;
|
||||
}
|
||||
}
|
||||
return api.get<PaginatedData>('/health/action-inbox', query);
|
||||
}
|
||||
|
||||
export async function getActionThread(sourceRef: string) {
|
||||
@@ -55,7 +58,7 @@ export async function getActionThread(sourceRef: string) {
|
||||
export async function getWorkbenchStats(assignedToMe?: boolean) {
|
||||
return api.get<WorkbenchStats>(
|
||||
'/health/action-inbox/stats',
|
||||
assignedToMe !== undefined ? { assigned_to_me: assignedToMe } : undefined,
|
||||
assignedToMe !== undefined ? { assigned_to_me: String(assignedToMe) } as Record<string, string | number | undefined> : undefined,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,9 @@ export interface CreateDialysisRecordReq {
|
||||
complication_notes?: string;
|
||||
}
|
||||
|
||||
export type UpdateDialysisRecordReq = Omit<CreateDialysisRecordReq, 'patient_id'>;
|
||||
export type UpdateDialysisRecordReq = Omit<CreateDialysisRecordReq, 'patient_id'> & {
|
||||
status?: string;
|
||||
};
|
||||
|
||||
export interface CreateDialysisPrescriptionReq {
|
||||
patient_id: string;
|
||||
@@ -52,7 +54,9 @@ export interface CreateDialysisPrescriptionReq {
|
||||
notes?: string;
|
||||
}
|
||||
|
||||
export type UpdateDialysisPrescriptionReq = Omit<CreateDialysisPrescriptionReq, 'patient_id'>;
|
||||
export type UpdateDialysisPrescriptionReq = Omit<CreateDialysisPrescriptionReq, 'patient_id'> & {
|
||||
status?: string;
|
||||
};
|
||||
|
||||
export interface DialysisStatistics {
|
||||
total_records: number;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { api } from './request';
|
||||
|
||||
export const notificationService = {
|
||||
list: (params?: { page?: number; page_size?: number }) =>
|
||||
api.get('/messages', params as Record<string, string | number | undefined>),
|
||||
list: <T = unknown>(params?: { page?: number; page_size?: number }) =>
|
||||
api.get<T>('/messages', params as Record<string, string | number | undefined>),
|
||||
markRead: (id: string) =>
|
||||
api.put(`/messages/${id}/read`),
|
||||
markAllRead: () =>
|
||||
|
||||
Reference in New Issue
Block a user