|
@@ -5,8 +5,8 @@ const propOpts = inject(symbolKeys.searchFrom, {
|
|
|
searchFormRowItems: ref([]),
|
|
searchFormRowItems: ref([]),
|
|
|
searchFormItems: ref([]),
|
|
searchFormItems: ref([]),
|
|
|
queryParams: ref({}),
|
|
queryParams: ref({}),
|
|
|
- searchFormSpan: 4,
|
|
|
|
|
- tableSearchBtnSpan: 1.5
|
|
|
|
|
|
|
+ showSearchBtn: true,
|
|
|
|
|
+ showSearchBtnText: true
|
|
|
})
|
|
})
|
|
|
const searchFormRef = ref<any>()
|
|
const searchFormRef = ref<any>()
|
|
|
const { searchFormRowItems, searchFormItems, queryParams } = propOpts
|
|
const { searchFormRowItems, searchFormItems, queryParams } = propOpts
|
|
@@ -15,7 +15,7 @@ const formSlotSuffix = inject(symbolKeys.formSlotSuffix, "tool-form_")
|
|
|
|
|
|
|
|
const _searchFormItems = computed(() => {
|
|
const _searchFormItems = computed(() => {
|
|
|
if (propOpts.searchFormItems || propOpts.searchFormRowItems) {
|
|
if (propOpts.searchFormItems || propOpts.searchFormRowItems) {
|
|
|
- const items = searchFormItems.value ?? []
|
|
|
|
|
|
|
+ const items = searchFormItems.value || []
|
|
|
if (
|
|
if (
|
|
|
!items.find((v) => {
|
|
!items.find((v) => {
|
|
|
return v.field == "searchbtn"
|
|
return v.field == "searchbtn"
|
|
@@ -26,9 +26,9 @@ const _searchFormItems = computed(() => {
|
|
|
component: "slot",
|
|
component: "slot",
|
|
|
span: 1.5
|
|
span: 1.5
|
|
|
})
|
|
})
|
|
|
- return items
|
|
|
|
|
|
|
+ return items as any
|
|
|
}
|
|
}
|
|
|
- return propOpts.searchFormItems
|
|
|
|
|
|
|
+ return propOpts.searchFormItems as any
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
// form表单的插槽 需要tool-form_开头,并去除tool-form_传递给VbForm组件
|
|
// form表单的插槽 需要tool-form_开头,并去除tool-form_传递给VbForm组件
|
|
@@ -51,56 +51,40 @@ function resetForm() {
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
<template>
|
|
|
- <VbForm
|
|
|
|
|
- v-if="searchFormRowItems || searchFormItems"
|
|
|
|
|
- ref="searchFormRef"
|
|
|
|
|
- v-model:data="queryParams"
|
|
|
|
|
- :row-items="searchFormRowItems"
|
|
|
|
|
- :items="_searchFormItems"
|
|
|
|
|
- :span="propOpts.searchFormSpan">
|
|
|
|
|
- <template v-for="(_, name) in $slots" #[`${formatterFormSlot(name)}`]>
|
|
|
|
|
- <slot v-if="name.toString().search(formSlotSuffix) == 0" :name="name" />
|
|
|
|
|
- </template>
|
|
|
|
|
- <template #searchbtn>
|
|
|
|
|
|
|
+ <div class="w-100 d-flex">
|
|
|
|
|
+ <div class="w-100 me-2">
|
|
|
|
|
+ <VbForm
|
|
|
|
|
+ v-if="searchFormRowItems || searchFormItems"
|
|
|
|
|
+ ref="searchFormRef"
|
|
|
|
|
+ v-model:data="queryParams"
|
|
|
|
|
+ :row-items="searchFormRowItems"
|
|
|
|
|
+ :items="_searchFormItems">
|
|
|
|
|
+ <template v-for="(_, name) in $slots" #[`${formatterFormSlot(name)}`]>
|
|
|
|
|
+ <slot v-if="name.toString().search(formSlotSuffix) == 0" :name="name" />
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </VbForm>
|
|
|
|
|
+ <el-form
|
|
|
|
|
+ v-else-if="$slots['table-search-form']"
|
|
|
|
|
+ ref="searchFormRef"
|
|
|
|
|
+ :inline="true"
|
|
|
|
|
+ :model="propOpts.queryParams"
|
|
|
|
|
+ label-width="100px"
|
|
|
|
|
+ class="el-row mb-3">
|
|
|
|
|
+ <slot name="table-search-form" />
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div v-if="propOpts.showSearchBtn" class="mb-3 d-flex">
|
|
|
<slot v-if="$slots.searchbtn" name="searchbtn"></slot>
|
|
<slot v-if="$slots.searchbtn" name="searchbtn"></slot>
|
|
|
- <el-col v-else :span="propOpts.tableSearchBtnSpan">
|
|
|
|
|
|
|
+ <template v-else>
|
|
|
<el-button class="btn btn-primary" @click="query">
|
|
<el-button class="btn btn-primary" @click="query">
|
|
|
- <template #icon>
|
|
|
|
|
- <VbIcon icon-name="magnifier" icon-type="solid"></VbIcon>
|
|
|
|
|
- </template>
|
|
|
|
|
- 搜索
|
|
|
|
|
|
|
+ <VbIcon icon-name="magnifier" icon-type="solid"></VbIcon>
|
|
|
|
|
+ <span class="ms-2" v-if="propOpts.showSearchBtnText">搜索</span>
|
|
|
</el-button>
|
|
</el-button>
|
|
|
<el-button class="btn btn-light-primary" @click="resetForm">
|
|
<el-button class="btn btn-light-primary" @click="resetForm">
|
|
|
- <template #icon>
|
|
|
|
|
- <VbIcon icon-name="arrows-loop" icon-type="solid"></VbIcon>
|
|
|
|
|
- </template>
|
|
|
|
|
- 重置
|
|
|
|
|
|
|
+ <VbIcon icon-name="arrows-loop" icon-type="solid"></VbIcon>
|
|
|
|
|
+ <span class="ms-2" v-if="propOpts.showSearchBtnText">重置</span>
|
|
|
</el-button>
|
|
</el-button>
|
|
|
- </el-col>
|
|
|
|
|
- </template>
|
|
|
|
|
- </VbForm>
|
|
|
|
|
- <el-form
|
|
|
|
|
- v-else-if="$slots['table-search-form']"
|
|
|
|
|
- ref="searchFormRef"
|
|
|
|
|
- :inline="true"
|
|
|
|
|
- :model="propOpts.queryParams"
|
|
|
|
|
- class="el-row mb-3">
|
|
|
|
|
- <slot name="table-search-form" />
|
|
|
|
|
- <el-col :span="propOpts.tableSearchBtnSpan">
|
|
|
|
|
- <el-form-item>
|
|
|
|
|
- <el-button class="btn btn-primary" @click="query">
|
|
|
|
|
- <template #icon>
|
|
|
|
|
- <VbIcon icon-name="magnifier" icon-type="solid"></VbIcon>
|
|
|
|
|
- </template>
|
|
|
|
|
- 搜索
|
|
|
|
|
- </el-button>
|
|
|
|
|
- <el-button class="btn btn-light-primary" @click="resetForm">
|
|
|
|
|
- <template #icon>
|
|
|
|
|
- <VbIcon icon-name="arrows-loop" icon-type="solid"></VbIcon>
|
|
|
|
|
- </template>
|
|
|
|
|
- 重置
|
|
|
|
|
- </el-button>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-col>
|
|
|
|
|
- </el-form>
|
|
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
</template>
|
|
</template>
|