From cc1143cf5a5ca83ee7834f771c94732092434025 Mon Sep 17 00:00:00 2001 From: cshaptx4869 <994774638@qq.com> Date: Thu, 9 May 2024 21:29:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20:sparkles:=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E9=80=89=E6=8B=A9=E7=BB=84=E4=BB=B6=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/demo/table-select/config/select.ts | 112 +++++++++++++++++++ src/views/demo/table-select/index.vue | 51 +++++++++ 2 files changed, 163 insertions(+) create mode 100644 src/views/demo/table-select/config/select.ts create mode 100644 src/views/demo/table-select/index.vue diff --git a/src/views/demo/table-select/config/select.ts b/src/views/demo/table-select/config/select.ts new file mode 100644 index 00000000..a944d644 --- /dev/null +++ b/src/views/demo/table-select/config/select.ts @@ -0,0 +1,112 @@ +import UserAPI from "@/api/user"; +import type { ISelectConfig } from "@/components/TableSelect/index.vue"; + +const selectConfig: ISelectConfig = { + pk: "id", + width: "70%", + placeholder: "请选择用户", + formItems: [ + { + type: "input", + label: "关键字", + prop: "keywords", + attrs: { + placeholder: "用户名/昵称/手机号", + clearable: true, + style: { + width: "200px", + }, + }, + }, + { + type: "tree-select", + label: "部门", + prop: "deptId", + attrs: { + placeholder: "请选择", + data: [ + { + value: 1, + label: "有来技术", + children: [ + { + value: 2, + label: "研发部门", + }, + { + value: 3, + label: "测试部门", + }, + ], + }, + ], + filterable: true, + "check-strictly": true, + "render-after-expand": false, + clearable: true, + style: { + width: "150px", + }, + }, + }, + { + type: "select", + label: "状态", + prop: "status", + attrs: { + placeholder: "全部", + clearable: true, + style: { + width: "100px", + }, + }, + options: [ + { label: "启用", value: 1 }, + { label: "禁用", value: 0 }, + ], + }, + { + type: "date-picker", + label: "创建时间", + prop: "createAt", + attrs: { + type: "daterange", + "range-separator": "~", + "start-placeholder": "开始时间", + "end-placeholder": "截止时间", + "value-format": "YYYY-MM-DD", + style: { + width: "240px", + }, + }, + }, + ], + indexAction: function (params) { + if ("createAt" in params) { + const createAt = params.createAt as string[]; + params.startTime = createAt[0]; + params.endTime = createAt[1]; + delete params.createAt; + } + return UserAPI.getPage(params); + }, + tableColumns: [ + { type: "selection", width: 50, align: "center" }, + { label: "编号", align: "center", prop: "id", width: 100 }, + { label: "用户名", align: "center", prop: "username" }, + { label: "用户昵称", align: "center", prop: "nickname", width: 120 }, + { label: "性别", align: "center", prop: "genderLabel", width: 100 }, + { label: "部门", align: "center", prop: "deptName", width: 120 }, + { label: "手机号码", align: "center", prop: "mobile", width: 120 }, + { + label: "状态", + align: "center", + prop: "status", + templet: "custom", + slotName: "status", + }, + { label: "创建时间", align: "center", prop: "createTime", width: 180 }, + ], +}; + +export default selectConfig; diff --git a/src/views/demo/table-select/index.vue b/src/views/demo/table-select/index.vue new file mode 100644 index 00000000..f3d62757 --- /dev/null +++ b/src/views/demo/table-select/index.vue @@ -0,0 +1,51 @@ + + + +