From ffc797ae318e4cc18479c0edf6f12260c63a5932 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 12 Aug 2023 16:25:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=9F=8E=EF=BC=9A=201.=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E7=A7=92=E6=9D=80=E6=B4=BB=E5=8A=A8=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=95=86=E5=93=81=E7=9A=84=E7=A7=92=E6=9D=80=E4=BB=B7?= =?UTF-8?q?=E6=A0=BC=EF=BC=8C=E4=BC=9A=E5=AD=98=E5=9C=A8=20*100=20?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit ff8bde207ddb0d46cc2bba1cbc03250242f7251e) --- src/hooks/web/useCrudSchemas.ts | 10 ++++++ .../mall/promotion/combination/index.vue | 1 - .../seckill/activity/SeckillActivityForm.vue | 34 ++++++++++--------- .../mall/promotion/seckill/activity/index.vue | 21 ++++-------- 4 files changed, 35 insertions(+), 31 deletions(-) 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 @@