This commit is contained in:
Ray.Hao
2025-04-22 00:03:50 +08:00
4 changed files with 12 additions and 12 deletions

View File

@@ -26,7 +26,7 @@
v-on="item.events || {}"
/>
<component
:is="componentMap.get(item?.type ?? 'input')"
:is="componentMap.get(item.type)"
v-else
v-model.trim="queryParams[item.prop]"
v-bind="{ style: { width: '100%' }, ...item.attrs }"
@@ -71,7 +71,7 @@ const emit = defineEmits<{
resetClick: [queryParams: IObject];
}>();
// 组件映射表
const componentMap = new Map<ISearchComponent, Component>([
const componentMap = new Map<ISearchComponent, any>([
/* eslint-disable */
// @ts-ignore
["input", markRaw(ElInput)], // @ts-ignore

View File

@@ -44,7 +44,7 @@ export interface ISearchConfig {
// 标签冒号(默认false)
colon?: boolean;
// 表单项(默认:[])
formItems?: IFormItems;
formItems?: IFormItems<ISearchComponent>;
// 是否开启展开和收缩(默认true)
isExpandable?: boolean;
// 默认展示的表单项数量(默认3)
@@ -176,7 +176,7 @@ export interface IModalConfig<T = any> {
// form组件属性
form?: IForm;
// 表单项
formItems: IFormItems;
formItems: IFormItems<IComponentType>;
// 提交之前处理
beforeSubmit?: (data: T) => void;
// 提交的网络请求函数(需返回promise)
@@ -186,9 +186,9 @@ export interface IModalConfig<T = any> {
export type IForm = Partial<Omit<FormProps, "model" | "rules">>;
// 表单项
export type IFormItems = Array<{
export type IFormItems<T = IComponentType> = Array<{
// 组件类型(如input,select,radio,custom等)
type: IComponentType;
type: T;
// 标签提示
tips?: string | IObject;
// 标签文本
@@ -226,5 +226,5 @@ export interface IPageForm {
// form组件属性
form?: IForm;
// 表单项
formItems: IFormItems;
formItems: IFormItems<IComponentType>;
}

View File

@@ -18,7 +18,7 @@ function usePage() {
contentRef.value?.fetchPageData({ ...queryParams, ...filterParams }, true);
}
// 新增
function handleAddClick(RefImpl?: Ref<PageContentInstance>) {
function handleAddClick(RefImpl?: Ref<PageModalInstance>) {
if (RefImpl) {
RefImpl?.value.setModalVisible();
RefImpl?.value.handleDisabled(false);
@@ -31,7 +31,7 @@ function usePage() {
async function handleEditClick(
row: IObject,
callback?: (result?: IObject) => IObject,
RefImpl?: Ref<PageContentInstance>
RefImpl?: Ref<PageModalInstance>
) {
if (RefImpl) {
RefImpl.value?.setModalVisible();
@@ -49,7 +49,7 @@ function usePage() {
async function handleViewClick(
row: IObject,
callback?: (result?: IObject) => IObject,
RefImpl?: Ref<PageContentInstance>
RefImpl?: Ref<PageModalInstance>
) {
if (RefImpl) {
RefImpl.value?.setModalVisible();