From f877097398db1b8b975aec317a40c79f1e5032bd Mon Sep 17 00:00:00 2001 From: molong Date: Tue, 20 Jan 2026 15:51:54 +0800 Subject: [PATCH] =?UTF-8?q?refactor(components):=20=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E5=92=8C=E8=A1=A8=E6=A0=BC=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=B9=B6=E6=9B=B4=E6=96=B0=E7=9B=B8=E5=85=B3=E5=BC=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit feat(components): 新增scForm和scTable组件替代DynamicForm feat(pages): 添加用户管理页面到auth模块 chore(deps): 调整package.json依赖项顺序并添加vue-eslint-parser --- package.json | 5 +- .../{DynamicForm.vue => scForm/index.vue} | 0 src/components/scTable/index.vue | 350 +++++ src/pages/{system => auth}/user/index.vue | 102 +- src/pages/ucenter/components/BasicInfo.vue | 4 +- src/pages/ucenter/components/Password.vue | 4 +- yarn.lock | 1126 +++++------------ 7 files changed, 750 insertions(+), 841 deletions(-) rename src/components/{DynamicForm.vue => scForm/index.vue} (100%) create mode 100644 src/components/scTable/index.vue rename src/pages/{system => auth}/user/index.vue (53%) diff --git a/package.json b/package.json index e423703..e88a4cd 100644 --- a/package.json +++ b/package.json @@ -30,12 +30,13 @@ "@eslint/js": "^9.39.2", "@vitejs/plugin-vue": "^6.0.3", "@vue/eslint-config-prettier": "^10.2.0", - "sass-embedded": "^1.97.2", "eslint": "^9.39.2", "eslint-plugin-vue": "~10.6.2", "globals": "^17.0.0", "prettier": "3.7.4", + "sass-embedded": "^1.97.2", "vite": "^7.3.0", - "vite-plugin-vue-devtools": "^8.0.5" + "vite-plugin-vue-devtools": "^8.0.5", + "vue-eslint-parser": "^10.2.0" } } diff --git a/src/components/DynamicForm.vue b/src/components/scForm/index.vue similarity index 100% rename from src/components/DynamicForm.vue rename to src/components/scForm/index.vue diff --git a/src/components/scTable/index.vue b/src/components/scTable/index.vue new file mode 100644 index 0000000..8cef357 --- /dev/null +++ b/src/components/scTable/index.vue @@ -0,0 +1,350 @@ + + + + + diff --git a/src/pages/system/user/index.vue b/src/pages/auth/user/index.vue similarity index 53% rename from src/pages/system/user/index.vue rename to src/pages/auth/user/index.vue index 278fa70..8e3cfb6 100644 --- a/src/pages/system/user/index.vue +++ b/src/pages/auth/user/index.vue @@ -9,41 +9,28 @@
- - - - - - - 全部 - 正常 - 禁用 - - - - - 查询 - 重置 - - - +
- - @@ -52,45 +39,66 @@ import { ref, onMounted } from 'vue' import { message } from 'ant-design-vue' import { PlusOutlined } from '@ant-design/icons-vue' +import ScTable from '@/components/scTable/index.vue' +import ScForm from '@/components/scForm/index.vue' const columns = [ { title: 'ID', dataIndex: 'id', key: 'id', - width: 80 + width: 80, }, { title: '用户名', dataIndex: 'username', - key: 'username' + key: 'username', }, { title: '昵称', dataIndex: 'nickname', - key: 'nickname' + key: 'nickname', }, { title: '状态', dataIndex: 'status', key: 'status', - width: 100 + width: 100, }, { title: '创建时间', dataIndex: 'createTime', - key: 'createTime' + key: 'createTime', + }, +] + +// 搜索表单配置 +const formItems = [ + { + field: 'username', + label: '用户名', + type: 'input', + placeholder: '请输入用户名', + allowClear: true, }, { - title: '操作', - key: 'action', - width: 150 - } + field: 'status', + label: '状态', + type: 'select', + placeholder: '请选择状态', + options: [ + { label: '全部', value: '' }, + { label: '正常', value: 1 }, + { label: '禁用', value: 0 }, + ], + allowClear: true, + style: 'width: 120px', + }, ] const searchForm = ref({ username: '', - status: '' + status: '', }) const dataSource = ref([]) @@ -100,7 +108,7 @@ const pagination = ref({ pageSize: 10, total: 0, showSizeChanger: true, - showTotal: (total) => `共 ${total} 条` + showTotal: (total) => `共 ${total} 条`, }) // 模拟数据 @@ -110,15 +118,15 @@ const mockData = [ username: 'admin', nickname: '管理员', status: 1, - createTime: '2024-01-01 10:00:00' + createTime: '2024-01-01 10:00:00', }, { id: 2, username: 'user', nickname: '普通用户', status: 1, - createTime: '2024-01-02 10:00:00' - } + createTime: '2024-01-02 10:00:00', + }, ] const loadData = () => { @@ -138,7 +146,7 @@ const handleSearch = () => { const handleReset = () => { searchForm.value = { username: '', - status: '' + status: '', } loadData() } diff --git a/src/pages/ucenter/components/BasicInfo.vue b/src/pages/ucenter/components/BasicInfo.vue index 04ac4d0..d7b6e05 100644 --- a/src/pages/ucenter/components/BasicInfo.vue +++ b/src/pages/ucenter/components/BasicInfo.vue @@ -1,12 +1,12 @@