feat: type抽离

This commit is contained in:
hongxinzz
2022-10-09 17:12:03 +08:00
parent a62929a8da
commit 8b4fa1aa21
62 changed files with 223 additions and 172 deletions

View File

@@ -1,3 +1,4 @@
import { ConfigGlobalTypes } from '@/types/configGlobal'
import { inject } from 'vue'
export const useConfigGlobal = () => {

View File

@@ -4,6 +4,9 @@ import { findIndex } from '@/utils'
import { useDictStoreWithOut } from '@/store/modules/dict'
import { useI18n } from '@/hooks/web/useI18n'
import type { AxiosPromise } from 'axios'
import { FormSchema } from '@/types/form'
import { TableColumn } from '@/types/table'
import { DescriptionsSchema } from '@/types/descriptions'
export type CrudSchema = Omit<TableColumn, 'children'> & {
search?: CrudSearchParams

View File

@@ -2,6 +2,7 @@ import type { Form, FormExpose } from '@/components/Form'
import type { ElForm } from 'element-plus'
import { ref, unref, nextTick } from 'vue'
import type { FormProps } from '@/components/Form/src/types'
import { FormSchema, FormSetPropsType } from '@/types/form'
export const useForm = (props?: FormProps) => {
// From实例

View File

@@ -1,6 +1,7 @@
import { h } from 'vue'
import type { VNode } from 'vue'
import { Icon } from '@/components/Icon'
import { IconTypes } from '@/types/icon'
export const useIcon = (props: IconTypes): VNode => {
return h(Icon, props)

View File

@@ -4,6 +4,7 @@ import { ref, reactive, watch, computed, unref, nextTick } from 'vue'
import { get } from 'lodash-es'
import type { TableProps } from '@/components/Table/src/types'
import { useI18n } from '@/hooks/web/useI18n'
import { TableSetPropsType } from '@/types/table'
const { t } = useI18n()
@@ -144,17 +145,13 @@ export const useTable = <T = any>(config?: UseTableConfig<T>) => {
},
// 与Search组件结合
setSearchParams: (data: Recordable) => {
tableObject.currentPage = 1
tableObject.params = Object.assign(tableObject.params, {
pageSize: tableObject.pageSize,
pageIndex: 1,
pageIndex: tableObject.currentPage,
...data
})
// 页码不等于1时更新页码重新获取数据页码等于1时重新获取数据
if (tableObject.currentPage !== 1) {
tableObject.currentPage = 1
} else {
methods.getList()
}
methods.getList()
},
// 删除数据
delList: async (ids: string[] | number[], multiple: boolean, message = true) => {