mirror of
				https://github.com/continew-org/continew-admin-ui.git
				synced 2025-10-31 22:57:15 +08:00 
			
		
		
		
	refactor: 调整 eslint.config.js,优化代码格式
This commit is contained in:
		| @@ -3,7 +3,7 @@ import { useRoute, useRouter } from 'vue-router' | ||||
| import { type FormInstance, Message, Modal } from '@arco-design/web-vue' | ||||
| import { isEqual } from 'lodash-es' | ||||
|  | ||||
| type Option<T> = { | ||||
| interface Option<T> { | ||||
|   key?: string | ||||
|   formRef?: Ref<FormInstance> | ||||
|   initApi: () => Promise<ApiRes<T>> | ||||
| @@ -49,7 +49,7 @@ export function useFormCurd<T = any>(option: Option<T>) { | ||||
|     () => route.query, | ||||
|     () => { | ||||
|       initForm() | ||||
|     } | ||||
|     }, | ||||
|   ) | ||||
|  | ||||
|   watch( | ||||
| @@ -61,7 +61,7 @@ export function useFormCurd<T = any>(option: Option<T>) { | ||||
|         isChanged.value = true | ||||
|       } | ||||
|     }, | ||||
|     { immediate: true, deep: true } | ||||
|     { immediate: true, deep: true }, | ||||
|   ) | ||||
|  | ||||
|   const save = async () => { | ||||
| @@ -92,7 +92,7 @@ export function useFormCurd<T = any>(option: Option<T>) { | ||||
|         hideCancel: false, | ||||
|         onOk: () => { | ||||
|           router.back() | ||||
|         } | ||||
|         }, | ||||
|       }) | ||||
|     } else { | ||||
|       router.back() | ||||
|   | ||||
| @@ -12,7 +12,7 @@ export function useBreakpoint() { | ||||
|     md: 768, // >=768 | ||||
|     lg: 992, // >=992 | ||||
|     xl: 1200, // >=1200 | ||||
|     xxl: 1600 // >=1600 | ||||
|     xxl: 1600, // >=1600 | ||||
|   }) | ||||
|  | ||||
|   const arr = breakpoints.current() as ComputedRef<Breakpoint[]> | ||||
|   | ||||
| @@ -21,7 +21,7 @@ export const useDownload = async (api: () => Promise<any>, isNotify = true, temp | ||||
|     if (isNotify && !res?.code) { | ||||
|       Notification.warning({ | ||||
|         title: '温馨提示', | ||||
|         content: '如果数据庞大会导致下载缓慢哦,请您耐心等待!' | ||||
|         content: '如果数据庞大会导致下载缓慢哦,请您耐心等待!', | ||||
|       }) | ||||
|     } | ||||
|     if (res.status !== 200 || res.data == null || !(res.data instanceof Blob)) { | ||||
|   | ||||
| @@ -14,6 +14,6 @@ export function useLoading(initValue = false) { | ||||
|   return { | ||||
|     loading, | ||||
|     setLoading, | ||||
|     toggle | ||||
|     toggle, | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -3,7 +3,7 @@ import { useBreakpoint } from '@/hooks' | ||||
|  | ||||
| type Callback = () => void | ||||
|  | ||||
| export type Options = { | ||||
| export interface Options { | ||||
|   defaultPageSize: number | ||||
|   defaultSizeOptions: number[] | ||||
| } | ||||
| @@ -27,7 +27,7 @@ export function usePagination(callback: Callback, options: Options = { defaultPa | ||||
|       pagination.current = 1 | ||||
|       pagination.pageSize = size | ||||
|       callback && callback() | ||||
|     } | ||||
|     }, | ||||
|   }) | ||||
|  | ||||
|   watch( | ||||
| @@ -36,7 +36,7 @@ export function usePagination(callback: Callback, options: Options = { defaultPa | ||||
|       pagination.simple = ['xs'].includes(breakpoint.value) | ||||
|       pagination.showTotal = !['xs'].includes(breakpoint.value) | ||||
|     }, | ||||
|     { immediate: true } | ||||
|     { immediate: true }, | ||||
|   ) | ||||
|  | ||||
|   const changeCurrent = pagination.onChange | ||||
| @@ -54,6 +54,6 @@ export function usePagination(callback: Callback, options: Options = { defaultPa | ||||
|     pagination, | ||||
|     changeCurrent, | ||||
|     changePageSize, | ||||
|     setTotal | ||||
|     setTotal, | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -5,7 +5,7 @@ import { useLoading } from '@/hooks' | ||||
| export function useRequest<T>( | ||||
|   api: () => Promise<AxiosResponse<ApiRes<T>>>, | ||||
|   defaultValue = [] as unknown as T, | ||||
|   isLoading = true | ||||
|   isLoading = true, | ||||
| ) { | ||||
|   const { loading, setLoading } = useLoading(isLoading) | ||||
|   const response = ref<T>(defaultValue) | ||||
|   | ||||
| @@ -11,7 +11,7 @@ interface Options<T, U> { | ||||
|   paginationOption?: paginationOptions | ||||
| } | ||||
|  | ||||
| type PaginationParams = { page: number, size: number } | ||||
| interface PaginationParams { page: number, size: number } | ||||
| type Api<T> = (params: PaginationParams) => Promise<ApiRes<PageRes<T[]>>> | Promise<ApiRes<T[]>> | ||||
|  | ||||
| export function useTable<T extends U, U = T>(api: Api<T>, options?: Options<T, U>) { | ||||
| @@ -60,7 +60,7 @@ export function useTable<T extends U, U = T>(api: Api<T>, options?: Options<T, U | ||||
|   // 删除 | ||||
|   const handleDelete = async <T>( | ||||
|     deleteApi: () => Promise<ApiRes<T>>, | ||||
|     options?: { title?: string, content?: string, successTip?: string, showModal?: boolean } | ||||
|     options?: { title?: string, content?: string, successTip?: string, showModal?: boolean }, | ||||
|   ): Promise<boolean | undefined> => { | ||||
|     const onDelete = async () => { | ||||
|       try { | ||||
| @@ -85,7 +85,7 @@ export function useTable<T extends U, U = T>(api: Api<T>, options?: Options<T, U | ||||
|       okButtonProps: { status: 'danger' }, | ||||
|       hideCancel: false, | ||||
|       maskClosable: false, | ||||
|       onBeforeOk: onDelete | ||||
|       onBeforeOk: onDelete, | ||||
|     }) | ||||
|   } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user