From d9cc26fa4fb895e7f479d926ed56f114af94ba0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=B0=8F=E6=B0=91?= Date: Sun, 11 Feb 2024 14:32:44 +0800 Subject: [PATCH] feat: add desc page demo (#328) * feat: add desc page demo * types: add description types --- .../src/pages/demo/page/desc/basic/data.tsx | 188 ++++++++++++++++++ .../src/pages/demo/page/desc/basic/index.vue | 78 ++++++++ .../src/pages/demo/page/desc/high/data.tsx | 61 ++++++ .../src/pages/demo/page/desc/high/index.vue | 105 ++++++++++ packages/components/src/description/typing.ts | 41 +++- packages/locale/src/lang/en/routes.ts | 3 + packages/locale/src/lang/zh-CN/routes.ts | 3 + .../router/src/routes/modules/demo/pages.ts | 32 ++- 8 files changed, 508 insertions(+), 3 deletions(-) create mode 100644 apps/admin/src/pages/demo/page/desc/basic/data.tsx create mode 100644 apps/admin/src/pages/demo/page/desc/basic/index.vue create mode 100644 apps/admin/src/pages/demo/page/desc/high/data.tsx create mode 100644 apps/admin/src/pages/demo/page/desc/high/index.vue diff --git a/apps/admin/src/pages/demo/page/desc/basic/data.tsx b/apps/admin/src/pages/demo/page/desc/basic/data.tsx new file mode 100644 index 00000000..541e0902 --- /dev/null +++ b/apps/admin/src/pages/demo/page/desc/basic/data.tsx @@ -0,0 +1,188 @@ +import { DescItem } from '@vben/components' + +export const refundData = { + a1: '1000000000', + a2: '已取货', + a3: '1234123421', + a4: '3214321432', +} + +export const personData = { + b1: '付小小', + b2: '18100000000', + b3: '菜鸟仓储', + b4: '浙江省杭州市西湖区万塘路18号', + b5: '无', +} +export const refundSchema: DescItem[] = [ + { + field: 'a1', + label: '取货单号', + }, + { + field: 'a2', + label: '状态', + }, + { + field: 'a3', + label: '销售单号', + }, + { + field: 'a4', + label: '子订单', + }, +] +export const personSchema: DescItem[] = [ + { + field: 'b1', + label: '用户姓名', + }, + { + field: 'b2', + label: '联系电话', + }, + { + field: 'b3', + label: '常用快递', + }, + { + field: 'b4', + label: '取货地址', + }, + { + field: 'b5', + label: '备注', + }, +] + +export const refundTableSchema = [ + { + title: '商品编号', + minWidth: 150, + field: 't1', + slots: { + default: 't1_default', + }, + }, + { + title: '商品名称', + minWidth: 150, + field: 't2', + }, + { + title: '商品条码', + minWidth: 150, + field: 't3', + }, + { + title: '单价 ', + minWidth: 150, + field: 't4', + }, + { + title: '数量(件) ', + minWidth: 150, + field: 't5', + }, + { + title: '金额', + minWidth: 150, + field: 't6', + }, +] +export const refundTimeTableSchema = [ + { + title: '时间', + minWidth: 150, + field: 't1', + }, + { + title: '当前进度', + minWidth: 150, + field: 't2', + }, + { + title: '状态', + minWidth: 150, + field: 't3', + slots: { + default: 't3_default', + }, + }, + { + title: '操作员ID', + field: 't4', + minWidth: 150, + }, + { + title: '耗时', + field: 't5', + minWidth: 150, + }, +] + +export const refundTableData: any[] = [ + { + t1: 1234561, + t2: '矿泉水 550ml', + t3: '12421432143214321', + t4: '2.00', + t5: 1, + t6: 2.0, + }, + { + t1: 1234562, + t2: '矿泉水 550ml', + t3: '12421432143214321', + t4: '2.00', + t5: 2, + t6: 2.0, + }, + { + t1: 1234562, + t2: '矿泉水 550ml', + t3: '12421432143214321', + t4: '2.00', + t5: 2, + t6: 2.0, + }, + { + t1: 1234562, + t2: '矿泉水 550ml', + t3: '12421432143214321', + t4: '2.00', + t5: 2, + t6: 2.0, + }, +] + +export const refundTimeTableData: any[] = [ + { + t1: '2017-10-01 14:10', + t2: '联系客户', + t3: '进行中', + t4: '取货员 ID1234', + t5: '5mins', + }, + { + t1: '2017-10-01 14:10', + t2: '取货员出发', + t3: '成功', + t4: '取货员 ID1234', + t5: '5mins', + }, + { + t1: '2017-10-01 14:10', + t2: '取货员接单', + t3: '成功', + t4: '系统', + t5: '5mins', + }, + { + t1: '2017-10-01 14:10', + t2: '申请审批通过', + t3: '成功', + t4: '用户', + t5: '1h', + }, +] diff --git a/apps/admin/src/pages/demo/page/desc/basic/index.vue b/apps/admin/src/pages/demo/page/desc/basic/index.vue new file mode 100644 index 00000000..030acca9 --- /dev/null +++ b/apps/admin/src/pages/demo/page/desc/basic/index.vue @@ -0,0 +1,78 @@ + + + diff --git a/apps/admin/src/pages/demo/page/desc/high/data.tsx b/apps/admin/src/pages/demo/page/desc/high/data.tsx new file mode 100644 index 00000000..f7b77166 --- /dev/null +++ b/apps/admin/src/pages/demo/page/desc/high/data.tsx @@ -0,0 +1,61 @@ +export const refundTimeTableSchema = [ + { + title: '时间', + minWidth: 150, + field: 't1', + }, + { + title: '当前进度', + minWidth: 150, + field: 't2', + }, + { + title: '状态', + minWidth: 150, + field: 't3', + slots: { + default: 't3_default', + }, + }, + { + title: '操作员ID ', + minWidth: 150, + field: 't4', + }, + { + title: '耗时', + minWidth: 150, + field: 't5', + }, +] + +export const refundTimeTableData: any[] = [ + { + t1: '2017-10-01 14:10', + t2: '联系客户', + t3: '进行中', + t4: '取货员 ID1234', + t5: '5mins', + }, + { + t1: '2017-10-01 14:10', + t2: '取货员出发', + t3: '成功', + t4: '取货员 ID1234', + t5: '5mins', + }, + { + t1: '2017-10-01 14:10', + t2: '取货员接单', + t3: '成功', + t4: '系统', + t5: '5mins', + }, + { + t1: '2017-10-01 14:10', + t2: '申请审批通过', + t3: '成功', + t4: '用户', + t5: '1h', + }, +] diff --git a/apps/admin/src/pages/demo/page/desc/high/index.vue b/apps/admin/src/pages/demo/page/desc/high/index.vue new file mode 100644 index 00000000..5608d5c2 --- /dev/null +++ b/apps/admin/src/pages/demo/page/desc/high/index.vue @@ -0,0 +1,105 @@ + + + diff --git a/packages/components/src/description/typing.ts b/packages/components/src/description/typing.ts index 8b28d8ff..1e3ef15c 100644 --- a/packages/components/src/description/typing.ts +++ b/packages/components/src/description/typing.ts @@ -1,4 +1,9 @@ -import type { VNode, CSSProperties } from 'vue' +import type { + VNode, + CSSProperties, + ExtractPublicPropTypes, + PropType, +} from 'vue' declare type Recordable = Record @@ -18,7 +23,39 @@ export interface DescItem { ) => VNode | undefined | JSX.Element | Element | string | number } -export interface DescriptionProps { +export const descriptionsProps = { + title: String, + column: { + type: Number, + default: 3, + }, + columns: Number, + labelPlacement: { + type: String as PropType<'left' | 'top'>, + default: 'top', + }, + labelAlign: { + type: String as PropType<'left' | 'right' | 'center'>, + default: 'left', + }, + separator: { + type: String, + default: ':', + }, + size: { + type: String as PropType<'small' | 'medium' | 'large'>, + default: 'medium', + }, + bordered: Boolean, + labelClass: String, + labelStyle: [Object, String] as PropType, + contentClass: String, + contentStyle: [Object, String] as PropType, +} as const + +export type DescriptionsProps = ExtractPublicPropTypes + +export interface DescriptionProps extends DescriptionsProps { useContainer?: boolean /** * item configuration diff --git a/packages/locale/src/lang/en/routes.ts b/packages/locale/src/lang/en/routes.ts index 3962d861..4641ddcf 100644 --- a/packages/locale/src/lang/en/routes.ts +++ b/packages/locale/src/lang/en/routes.ts @@ -91,6 +91,9 @@ export default { account: 'Account', accountCenter: 'Center', accountSetting: 'Setting', + desc: 'Details', + descBasic: 'Basic Details', + descHigh: 'Advanced Details', }, transition: 'Transition', steps: { diff --git a/packages/locale/src/lang/zh-CN/routes.ts b/packages/locale/src/lang/zh-CN/routes.ts index a85492c1..6643c65a 100644 --- a/packages/locale/src/lang/zh-CN/routes.ts +++ b/packages/locale/src/lang/zh-CN/routes.ts @@ -92,6 +92,9 @@ export default { account: '个人页', accountCenter: '个人中心', accountSetting: '个人设置', + desc: '详情页', + descBasic: '基础详情页', + descHigh: '高级详情页', }, transition: '过渡动画', steps: { diff --git a/packages/router/src/routes/modules/demo/pages.ts b/packages/router/src/routes/modules/demo/pages.ts index 143c334e..2ccdf7cc 100644 --- a/packages/router/src/routes/modules/demo/pages.ts +++ b/packages/router/src/routes/modules/demo/pages.ts @@ -66,7 +66,8 @@ const pages: RouteRecordItem = { { path: 'setting', name: 'AccountSettingPage', - component: () => import('@/pages/demo/page/account/setting/index.vue'), + component: () => + import('@/pages/demo/page/account/setting/index.vue'), meta: { title: 'routes.demo.page.accountSetting', }, @@ -143,6 +144,35 @@ const pages: RouteRecordItem = { ], }, // =============================exception end============================= + // =============================desc start============================= + { + path: 'desc', + name: 'DescPage', + component: getParentLayout('DescPage'), + redirect: '/pages/desc/basic', + meta: { + title: 'routes.demo.page.desc', + }, + children: [ + { + path: 'basic', + name: 'DescBasicPage', + component: () => import('@/pages/demo/page/desc/basic/index.vue'), + meta: { + title: 'routes.demo.page.descBasic', + }, + }, + { + path: 'high', + name: 'DescHighPage', + component: () => import('@/pages/demo/page/desc/high/index.vue'), + meta: { + title: 'routes.demo.page.descHigh', + }, + }, + ], + }, + // =============================desc end============================= ], }