diff --git a/frontend/src/components/MobileCardList.vue b/frontend/src/components/MobileCardList.vue index 2aaa6b7..ca2c595 100644 --- a/frontend/src/components/MobileCardList.vue +++ b/frontend/src/components/MobileCardList.vue @@ -1,14 +1,11 @@ diff --git a/frontend/src/components/MobileCardListWithCheckbox.vue b/frontend/src/components/MobileCardListWithCheckbox.vue new file mode 100644 index 0000000..3e824ad --- /dev/null +++ b/frontend/src/components/MobileCardListWithCheckbox.vue @@ -0,0 +1,101 @@ + + + diff --git a/frontend/src/components/README.md b/frontend/src/components/README.md new file mode 100644 index 0000000..44b9a2d --- /dev/null +++ b/frontend/src/components/README.md @@ -0,0 +1,235 @@ +# 表单布局组件说明 + +本项目提供了四种表单布局组件和一个通用按钮组件,用于不同场景下的数据展示和交互: + +## 1. TableFormLayout.vue + +PC端表格布局组件,适用于不需要checkbox的普通表格展示。 + +### 使用方法 + +```vue + + + + + + +``` + +### 属性 + +- `items`: 要展示的数据数组 +- `columns`: 列配置数组,每个列对象包含 `title`、`field`、`sortable`(可选)、`class`(可选) +- `idField`: (可选) 指定数据项的ID字段名,默认为 'id' +- `keyField`: (可选) 指定数据项的唯一键字段名,用于v-for的key +- `hasCheckbox`: (可选) 是否显示复选框,默认为false + +### 事件 + +- `sort`: 当点击可排序列时触发,参数为字段名 +- `update:checkedItems`: 当选中项变化时触发,参数为选中项的ID数组 +- `all-checked-change`: 当全选/取消全选时触发,参数为是否全选 + +## 2. TableFormLayoutWithCheckbox.vue + +PC端表格布局组件,带有checkbox功能,适用于需要多选的表格(如绑定关系管理页面)。 + +### 使用方法 + +```vue + + + + +``` + +### 属性 + +- `items`: 要展示的数据数组 +- `columns`: 列配置数组 +- `idField`: (可选) 指定数据项的ID字段名,默认为 'id' +- `keyField`: (可选) 指定数据项的唯一键字段名,用于v-for的key +- `modelValue`: (可选) 选中项的ID数组,支持v-model双向绑定 + +### 事件 + +- `update:modelValue`: 当选中项变化时触发,参数为选中项的ID数组 +- `sort`: 当点击可排序列时触发,参数为字段名 +- `all-checked-change`: 当全选/取消全选时触发,参数为是否全选 + +## 3. MobileCardList.vue + +移动端卡片布局组件,适用于不需要checkbox的普通卡片展示。 + +### 使用方法 + +```vue + + + + + + + + + + +``` + +### 属性 + +- `items`: 要展示的数据数组 +- `idField`: (可选) 指定数据项的ID字段名,默认为 'id' +- `keyField`: (可选) 指定数据项的唯一键字段名,用于v-for的key + +### 插槽 + +- `title`: 卡片标题 +- `status`: 状态指示器 +- `content`: 卡片主要内容 +- `tags`: (可选) 标签/分类 +- `actions`: 操作按钮 + +## 4. MobileCardListWithCheckbox.vue + +移动端卡片布局组件,带有checkbox功能,适用于需要多选的卡片(如绑定关系管理页面)。 + +### 使用方法 + +```vue + + + + + +``` + +### 属性 + +- `items`: 要展示的数据数组 +- `idField`: (可选) 指定数据项的ID字段名,默认为 'id' +- `keyField`: (可选) 指定数据项的唯一键字段名,用于v-for的key +- `modelValue`: (可选) 选中项的ID数组,支持v-model双向绑定 + +### 事件 + +- `update:modelValue`: 当选中项变化时触发,参数为选中项的ID数组 + +## 5. TableButton.vue + +通用按钮组件,适用于表格和卡片中的操作按钮。 + +### 使用方法 + +```vue + +默认按钮 + + + + + 编辑 + + + +次要按钮 +成功按钮 +危险按钮 +警告按钮 +信息按钮 + + +超小按钮 +小按钮 +中按钮 +大按钮 + + +移动端按钮 + + +禁用按钮 +``` + +### 属性 + +- `variant`: (可选) 按钮变体类型,可选值为 'primary'、'secondary'、'success'、'danger'、'warning'、'info',默认为 'primary' +- `size`: (可选) 按钮尺寸,可选值为 'xs'、'sm'、'md'、'lg',默认为 'md' +- `disabled`: (可选) 是否禁用,默认为 false +- `className`: (可选) 自定义CSS类名 +- `isMobile`: (可选) 是否为移动端尺寸,默认为 false + +### 事件 + +- `click`: 当按钮被点击时触发 + +## 使用建议 + +1. 对于普通的数据展示页面(如用户管理、岗位管理等),使用 `TableFormLayout` 和 `MobileCardList` +2. 对于需要多选功能的页面(如角色绑定、部门绑定等),使用 `TableFormLayoutWithCheckbox` 和 `MobileCardListWithCheckbox` +3. 对于表格和卡片中的操作按钮,使用 `TableButton` 组件 +4. 根据屏幕尺寸自动切换布局: + ```vue + +
+ + + +
+ + + + ``` diff --git a/frontend/src/components/TableButton.vue b/frontend/src/components/TableButton.vue new file mode 100644 index 0000000..c046c8c --- /dev/null +++ b/frontend/src/components/TableButton.vue @@ -0,0 +1,83 @@ + + + diff --git a/frontend/src/components/TableFormLayout.vue b/frontend/src/components/TableFormLayout.vue new file mode 100644 index 0000000..e387c28 --- /dev/null +++ b/frontend/src/components/TableFormLayout.vue @@ -0,0 +1,188 @@ + + + diff --git a/frontend/src/views/BindDepartmentView.vue b/frontend/src/views/BindDepartmentView.vue index af0ed2a..85516c7 100644 --- a/frontend/src/views/BindDepartmentView.vue +++ b/frontend/src/views/BindDepartmentView.vue @@ -1,135 +1,93 @@