diff --git a/src/hooks/web/useCrudSchemas.ts b/src/hooks/web/useCrudSchemas.ts index 984e57c5..4cfe1eaf 100644 --- a/src/hooks/web/useCrudSchemas.ts +++ b/src/hooks/web/useCrudSchemas.ts @@ -9,6 +9,7 @@ import { TableColumn } from '@/types/table' import { DescriptionsSchema } from '@/types/descriptions' import { ComponentOptions, ComponentProps } from '@/types/components' import { DictTag } from '@/components/DictTag' +import { cloneDeep } from 'lodash-es' export type CrudSchema = Omit & { isSearch?: boolean // 是否在查询显示 @@ -306,3 +307,12 @@ const filterOptions = (options: Recordable, labelField?: string) => { return v }) } + +// 将 tableColumns 指定 fields 放到最前面 +export const sortTableColumns = (tableColumns: TableColumn[], field: string) => { + const fieldIndex = tableColumns.findIndex((item) => item.field === field) + const fieldColumn = cloneDeep(tableColumns[fieldIndex]) + tableColumns.splice(fieldIndex, 1) + // 添加到开头 + tableColumns.unshift(fieldColumn) +} diff --git a/src/views/mall/promotion/combination/index.vue b/src/views/mall/promotion/combination/index.vue index db231d70..f15863b1 100644 --- a/src/views/mall/promotion/combination/index.vue +++ b/src/views/mall/promotion/combination/index.vue @@ -98,7 +98,6 @@ const handleDelete = (id: number) => { tableMethods.delList(id, false) } -// TODO @puhui999:要不还是使用原生的 element plus 做。感觉 crud schema 复杂界面,做起来麻烦 /** 初始化 **/ onMounted(() => { /** diff --git a/src/views/mall/promotion/seckill/activity/SeckillActivityForm.vue b/src/views/mall/promotion/seckill/activity/SeckillActivityForm.vue index 049ab6b4..c4950f6e 100644 --- a/src/views/mall/promotion/seckill/activity/SeckillActivityForm.vue +++ b/src/views/mall/promotion/seckill/activity/SeckillActivityForm.vue @@ -45,6 +45,7 @@