fix(ui): 修复剩余 TS strict 编译错误及类型定义

- EditableTable.d.ts: fixed 类型调整,新增 extraprops
  - FormItem.d.ts: 新增 disabled、onClick 属性
  - EditableTable/Form/FormItem/FormLayout: 添加参数类型注解
  - DataDashboard: screenData 类型修正 + 隐式 any 修复
  - api/datacollection: 新增 index.d.ts 声明文件
  - patientList/receipt: 补充缺失函数声明
This commit is contained in:
wangjian963
2026-06-26 12:10:03 +08:00
parent 3236375154
commit a679fc1700
10 changed files with 36 additions and 23 deletions

View File

@@ -0,0 +1,4 @@
export function collectClinicalData(data: any): Promise<any>;
export function collectOperationalData(data: any): Promise<any>;
export function getRealtimeData(): Promise<any>;
export function getHistoricalData(params?: any): Promise<any>;

View File

@@ -183,7 +183,7 @@
style="width: 100%"
:class="row.error ? 'error-border' : ''"
@change="
async (value) => {
async (value: any) => {
const checkBeforeChange = col.extraprops?.checkBeforeChange;
if (checkBeforeChange && typeof checkBeforeChange === 'function') {
const result = await checkBeforeChange(row, rowIndex, value);
@@ -399,7 +399,7 @@ watch(
{ deep: true }
);
const handleAdd = (index) => {
const handleAdd = (index: number) => {
const newRow = { ...props.defaultRow };
tableData.value.splice(index + 1, 0, newRow);
nextTick(() => {
@@ -407,7 +407,7 @@ const handleAdd = (index) => {
});
};
const handleDelete = (index) => {
const handleDelete = (index: number) => {
if (tableData.value.length === 1) {
Object.keys(tableData.value[0]).forEach((key) => {
tableData.value[0][key] = '';
@@ -484,13 +484,13 @@ const handleSearch = () => {
// 搜索逻辑已在 computed 中处理
};
const validate = (callback) => {
const validate = (callback: any) => {
if (formRef.value) {
return formRef.value.validate(callback);
}
};
const validateField = (props, callback) => {
const validateField = (props: any, callback: any) => {
if (formRef.value) {
return formRef.value.validateField(props, callback);
}
@@ -502,7 +502,7 @@ const resetFields = () => {
}
};
const clearValidate = (props) => {
const clearValidate = (props: any) => {
if (formRef.value) {
formRef.value.clearValidate(props);
}

View File

@@ -15,8 +15,8 @@
<FormItem
:item="item"
:model-value="model[item.prop]"
@update:model-value="(value) => (model[item.prop] = value)"
@change="(value) => item.onChange && item.onChange(value)"
@update:model-value="(value: any) => (model[item.prop] = value)"
@change="(value: any) => item.onChange && item.onChange(value)"
>
<template
v-for="(_, slotName) in $slots"
@@ -65,14 +65,14 @@ const normalizedFormItems = computed(() =>
);
// 表单验证
const validate = (callback) => {
const validate = (callback: any) => {
if (formRef.value) {
return formRef.value.validate(callback);
}
};
// 验证指定字段
const validateField = (props, callback) => {
const validateField = (props: any, callback: any) => {
if (formRef.value) {
return formRef.value.validateField(props, callback);
}
@@ -86,14 +86,14 @@ const resetFields = () => {
};
// 清除验证
const clearValidate = (props) => {
const clearValidate = (props: any) => {
if (formRef.value) {
formRef.value.clearValidate(props);
}
};
// 滚动到指定字段
const scrollToField = (prop) => {
const scrollToField = (prop: any) => {
if (formRef.value) {
formRef.value.scrollToField(prop);
}

View File

@@ -27,7 +27,7 @@
:filterable="item.filterable !== false"
:collapse-tags="item.collapseTags !== false"
@change="handleChange"
@update:model-value="(value) => handleUpdateWithCheck(value, item.checkBeforeChange)"
@update:model-value="(value: any) => handleUpdateWithCheck(value, item.checkBeforeChange)"
>
<el-option
v-for="option in item.options || []"

View File

@@ -19,7 +19,7 @@
:item="item"
:model-value="model[item.prop]"
@update:model-value="
async (value) => {
async (value: any) => {
if (item.onChange && typeof item.onChange === 'function') {
const result = await item.onChange(value);
if (result === false) {
@@ -82,13 +82,13 @@ const normalizedFormItems = computed(() =>
}))
);
const validate = (callback) => {
const validate = (callback: any) => {
if (formRef.value) {
return formRef.value.validate(callback);
}
};
const validateField = (props, callback) => {
const validateField = (props: any, callback: any) => {
if (formRef.value) {
return formRef.value.validateField(props, callback);
}
@@ -100,13 +100,13 @@ const resetFields = () => {
}
};
const clearValidate = (props) => {
const clearValidate = (props: any) => {
if (formRef.value) {
formRef.value.clearValidate(props);
}
};
const scrollToField = (prop) => {
const scrollToField = (prop: any) => {
if (formRef.value) {
formRef.value.scrollToField(prop);
}

View File

@@ -13,7 +13,7 @@ export interface EditableTableColumn {
/** 最小宽度 */
minWidth?: string | number;
/** 是否固定列 */
fixed?: boolean | 'left' | 'right';
fixed?: 'left' | 'right';
/** 对齐方式 */
align?: 'left' | 'center' | 'right';
/** 列类型 */
@@ -56,6 +56,8 @@ export interface EditableTableColumn {
onInput?: (row: Record<string, any>, index: number) => void;
/** 变更回调 */
onChange?: (row: Record<string, any>, index: number, value?: any) => void;
/** 额外属性 */
extraprops?: Record<string, any>;
}
/**

View File

@@ -10,6 +10,8 @@ export interface FormItemOption {
value: string | number | boolean | null | undefined;
/** 是否禁用该选项 */
disabled?: boolean;
/** 点击回调 */
onClick?: (...args: any[]) => void;
}
/**
@@ -67,6 +69,8 @@ export interface FormItemConfig {
checkBeforeChange?: boolean;
/** 格式化函数text 类型,用于格式化显示的文本) */
formatter?: (value: any) => string;
/** 是否禁用 */
disabled?: boolean;
}
/**

View File

@@ -108,9 +108,9 @@ import { getRealtimeData, getHistoricalData } from '@/api/datacollection'
const loading = ref(false)
const period = ref('month')
const screenData = ref({})
const screenData = ref<Record<string, any>>({})
function formatMoney(val) {
function formatMoney(val: any) {
if (!val) return '0.00'
return (val / 10000).toFixed(2)
}
@@ -118,11 +118,11 @@ function formatMoney(val) {
function loadData() {
loading.value = true
if (period.value === 'all') {
getRealtimeData().then(res => {
getRealtimeData().then((res: any) => {
screenData.value = res.data || {}
}).finally(() => { loading.value = false })
} else {
getHistoricalData({ period: period.value }).then(res => {
getHistoricalData({ period: period.value }).then((res: any) => {
screenData.value = res.data || {}
}).finally(() => { loading.value = false })
}

View File

@@ -115,6 +115,8 @@
</template>
<script setup lang="ts">
import {onMounted, reactive, ref} from 'vue'
declare function getPatInfoSenior(params: any): Promise<any>;
const statusFormatter = ref<any>(null);
// const { proxy } = getCurrentInstance();
const emits = defineEmits(['settling', 'paying'])

View File

@@ -277,6 +277,7 @@ const invoiceSkipVisible = ref(false)
const close = () => {
visible.value = false
}
const collectFeeCancel = (row: any) => {};
const submitForm = () => {
ElMessage({
message: '打印发票!',