Skip to content

Commit

Permalink
feat: expose initSearchColumns()
Browse files Browse the repository at this point in the history
  • Loading branch information
kanyxmo committed Apr 9, 2024
1 parent a19b1b6 commit 15f24d7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/components/ma-crud/components/search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,11 @@ const getSearchAllColumns = (cls = []) => {
return sls
}

if (columns.value.length > 0) {
searchColumns.value = cloneDeep(getSearchAllColumns(columns.value).filter( item => item.search === true && ( options.tabs?.dataIndex != item.dataIndex ) ))

const initSearchColumns = () => {
if (columns.value.length > 0) {
searchColumns.value = cloneDeep(getSearchAllColumns(columns.value).filter( item => item.search === true && ( options.tabs?.dataIndex != item.dataIndex ) ))
}
}

const handlerSearch = () => {
Expand Down Expand Up @@ -134,6 +137,8 @@ const getComponentName = (formType) => {
}
}

initSearchColumns()

const setSearchHidden = () => showSearch.value = false
const setSearchDisplay = () => showSearch.value = true
const setSearchLoading = () => searchLoading.value = true
Expand All @@ -142,7 +147,7 @@ const getSearchFormRef = () => searchRef.value
const getSearchColumns = () => searchColumns.value

defineExpose({
getSearchFormRef, getSearchColumns, showSearch, resetSearch,
initSearchColumns, getSearchFormRef, getSearchColumns, showSearch, resetSearch,
setSearchHidden, setSearchDisplay, setSearchLoading, setSearchUnLoading
})
</script>
Expand Down
3 changes: 2 additions & 1 deletion src/components/ma-crud/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,7 @@ const getFormColumns = async (type = 'add') => {
const getCurrentPage = () => requestParams.value[config.request.page]
const getPageSize = () => requestParams.value[config.request.pageSize]
const getTotal = () => total.value
const initSearchColumns = () => crudSearchRef.value.initSearchColumns()

/**
* 获取column属性服务类
Expand All @@ -843,7 +844,7 @@ const getColumnService = (strictMode = true) => {
defineExpose({
refresh, requestData, addAction, editAction, getTableData, setSelecteds,
getCurrentAction, getFormData, getFormColumns, getColumnService, getCurrentPage, getPageSize, getTotal,
requestParams, isRecovery, tableRef,
requestParams, isRecovery, tableRef, initSearchColumns,
crudFormRef, crudSearchRef, crudImportRef, crudSettingRef
})

Expand Down

0 comments on commit 15f24d7

Please sign in to comment.