diff --git a/kinit-admin/package.json b/kinit-admin/package.json index 3e31bab..af18792 100644 --- a/kinit-admin/package.json +++ b/kinit-admin/package.json @@ -1,6 +1,6 @@ { "name": "vue-element-plus-admin", - "version": "1.8.5", + "version": "1.8.6", "description": "一套基于vue3、element-plus、typesScript、vite3的后台集成方案。", "author": "Archer <502431556@qq.com>", "private": false, diff --git a/kinit-admin/src/App.vue b/kinit-admin/src/App.vue index feb301d..afc1cfd 100644 --- a/kinit-admin/src/App.vue +++ b/kinit-admin/src/App.vue @@ -13,7 +13,7 @@ const prefixCls = getPrefixCls('app') const appStore = useAppStore() -// 手动添加mate标签 +// 添加mate标签 const addMeta = (name: string, content: string) => { const meta = document.createElement('meta') meta.content = content @@ -34,10 +34,6 @@ const setSystemConfig = async () => { res.data.web_basic.web_desc || 'Kinit 是一套开箱即用的中后台解决方案,可以作为新项目的启动模版。' ) - // 接入百度统计 - if (res.data.web_baidu.web_baidu) { - eval(res.data.web_baidu.web_baidu) - } } } diff --git a/kinit-admin/src/components/Search/src/Search.vue b/kinit-admin/src/components/Search/src/Search.vue index 7971e3b..6f41f98 100644 --- a/kinit-admin/src/components/Search/src/Search.vue +++ b/kinit-admin/src/components/Search/src/Search.vue @@ -38,7 +38,11 @@ const props = defineProps({ expand: propTypes.bool.def(false), // 伸缩的界限字段 expandField: propTypes.string.def(''), - inline: propTypes.bool.def(true) + inline: propTypes.bool.def(true), + model: { + type: Object as PropType, + default: () => ({}) + } }) const emit = defineEmits(['search', 'reset']) @@ -74,7 +78,9 @@ const newSchema = computed(() => { return schema }) -const { register, elFormRef, methods } = useForm() +const { register, elFormRef, methods } = useForm({ + model: props.model || {} +}) const search = async () => { await unref(elFormRef)?.validate(async (isValid) => { diff --git a/kinit-admin/src/components/Table/src/Table.vue b/kinit-admin/src/components/Table/src/Table.vue index c5ef94d..fef74cd 100644 --- a/kinit-admin/src/components/Table/src/Table.vue +++ b/kinit-admin/src/components/Table/src/Table.vue @@ -10,7 +10,6 @@ import { TableColumn, TableSlotDefault, Pagination, TableSetPropsType } from '.. import { useAppStore } from '@/store/modules/app' const appStore = useAppStore() -const mobile = appStore.getMobile export default defineComponent({ name: 'Table', @@ -116,10 +115,10 @@ export default defineComponent({ small: false, background: false, pagerCount: 7, - layout: mobile + layout: appStore.getMobile ? 'prev, pager, next, ->, total' : 'sizes, prev, pager, next, jumper, ->, total', - limits: [10, 20, 30, 40, 50, 100], + pageSizes: [10, 20, 30, 40, 50, 100], disabled: false, hideOnSinglePage: false, total: 10 diff --git a/kinit-admin/src/hooks/web/useForm.ts b/kinit-admin/src/hooks/web/useForm.ts index bf8ab02..8cea76d 100644 --- a/kinit-admin/src/hooks/web/useForm.ts +++ b/kinit-admin/src/hooks/web/useForm.ts @@ -42,6 +42,9 @@ export const useForm = (props?: FormProps) => { setProps: async (props: FormProps = {}) => { const form = await getForm() form?.setProps(props) + if (props.model) { + form?.setValues(props.model) + } }, setValues: async (data: Recordable) => { diff --git a/kinit-admin/src/hooks/web/useTable.ts b/kinit-admin/src/hooks/web/useTable.ts index a793cf5..93c08a7 100644 --- a/kinit-admin/src/hooks/web/useTable.ts +++ b/kinit-admin/src/hooks/web/useTable.ts @@ -5,7 +5,6 @@ import { get } from 'lodash-es' import type { TableProps } from '@/components/Table/src/types' import { useI18n } from '@/hooks/web/useI18n' import { TableSetPropsType } from '@/types/table' -import { columns } from 'element-plus/es/components/table-v2/src/common' const { t } = useI18n() @@ -23,6 +22,8 @@ interface UseTableConfig { data: string count?: string } + // 默认传递的参数 + defaultParams?: Recordable props?: TableProps } @@ -36,6 +37,12 @@ interface TableObject { currentRow: Nullable } +type TableOrderChange = { + column: Recordable + prop: string + order: string | null +} + export const useTable = (config?: UseTableConfig) => { const tableObject = reactive>({ // 页数 @@ -47,7 +54,9 @@ export const useTable = (config?: UseTableConfig) => { // 表格数据 tableData: [], // AxiosConfig 配置 - params: {}, + params: { + ...(config?.defaultParams || {}) + }, // 加载中 loading: true, // 当前行的数据 @@ -137,6 +146,15 @@ export const useTable = (config?: UseTableConfig) => { const table = await getTable() return (table?.selections || []) as T[] }, + // 设置表格排序 + setOrderParams: (data: TableOrderChange) => { + tableObject.page = 1 + tableObject.params = Object.assign(tableObject.params, { + v_order: data.order, + v_order_field: data.prop + }) + methods.getList() + }, // 与Search组件结合 setSearchParams: (data: Recordable) => { tableObject.page = 1 diff --git a/kinit-admin/src/views/vadmin/auth/menu/index.vue b/kinit-admin/src/views/vadmin/auth/menu/index.vue index 207ad56..ac4ea25 100644 --- a/kinit-admin/src/views/vadmin/auth/menu/index.vue +++ b/kinit-admin/src/views/vadmin/auth/menu/index.vue @@ -35,9 +35,6 @@ const { register, elTableRef, tableObject, methods } = useTable({ delListApi: delMenuListApi, response: { data: 'data' - }, - props: { - columns } }) @@ -149,6 +146,7 @@ watch( :data="tableObject.tableData" :loading="tableObject.loading" :selection="false" + :columns="columns" :border="true" :size="tableSize" row-key="id" diff --git a/kinit-admin/src/views/vadmin/auth/role/index.vue b/kinit-admin/src/views/vadmin/auth/role/index.vue index bf362b2..968d596 100644 --- a/kinit-admin/src/views/vadmin/auth/role/index.vue +++ b/kinit-admin/src/views/vadmin/auth/role/index.vue @@ -26,9 +26,6 @@ const { register, elTableRef, tableObject, methods } = useTable({ response: { data: 'data', count: 'count' - }, - props: { - columns } }) @@ -136,6 +133,7 @@ watch( v-model:page="tableObject.page" :data="tableObject.tableData" :loading="tableObject.loading" + :columns="columns" :size="tableSize" :border="true" :selection="false" diff --git a/kinit-admin/src/views/vadmin/auth/user/components/user.data.ts b/kinit-admin/src/views/vadmin/auth/user/components/user.data.ts index a3b6fb5..c17c3e5 100644 --- a/kinit-admin/src/views/vadmin/auth/user/components/user.data.ts +++ b/kinit-admin/src/views/vadmin/auth/user/components/user.data.ts @@ -206,7 +206,6 @@ export const searchSchema = reactive([ value: false } ] - }, - value: true + } } ]) diff --git a/kinit-admin/src/views/vadmin/auth/user/index.vue b/kinit-admin/src/views/vadmin/auth/user/index.vue index b7ef72d..778683f 100644 --- a/kinit-admin/src/views/vadmin/auth/user/index.vue +++ b/kinit-admin/src/views/vadmin/auth/user/index.vue @@ -62,8 +62,8 @@ const { register, elTableRef, tableObject, methods } = useTable({ data: 'data', count: 'count' }, - props: { - columns + defaultParams: { + is_active: true } }) @@ -199,16 +199,16 @@ const handleCommand = (command: string) => { delDatas(null, true) } } - -// 表格排序 -const tableSortChange = async (data: any) => { - console.log(data) -}