|
|
@ -16,6 +16,38 @@
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 用户列表 -->
|
|
|
|
|
|
|
|
<el-table :height="tableHeight" :data="tableList" border stripe>
|
|
|
|
|
|
|
|
<el-table-column label="姓名" prop="name"></el-table-column>
|
|
|
|
|
|
|
|
<el-table-column label="性别" prop="sex">
|
|
|
|
|
|
|
|
<!-- 性别默认显示数字,需要添加逻辑转换 -->
|
|
|
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
|
|
|
<el-tag v-if="scope.row.sex == '1'" type="danger" size="default">女</el-tag>
|
|
|
|
|
|
|
|
<el-tag v-if="scope.row.sex == '0'" size="default">男</el-tag>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
<el-table-column label="电话" prop="phone"></el-table-column>
|
|
|
|
|
|
|
|
<el-table-column label="邮箱" prop="email"></el-table-column>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 为表格添加编辑、删除按钮 -->
|
|
|
|
|
|
|
|
<el-table-column label="操作" min-width="100" align="center">
|
|
|
|
|
|
|
|
<template #default>
|
|
|
|
|
|
|
|
<el-button type="primary" size="default" @click="editBtn" icon="Edit">
|
|
|
|
|
|
|
|
编辑
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
<el-button type="danger" size="default" @click="deleteBtn" icon="Delete">删除</el-button>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 为表格添加分页显示 -->
|
|
|
|
|
|
|
|
<el-pagination @size-change="sizeChange" @current-change="currentChange" :current-page.sync="listParm.currentPage"
|
|
|
|
|
|
|
|
:page-sizes="[10, 20, 40, 80, 100]" :page-size="listParm.pageSize"
|
|
|
|
|
|
|
|
layout="total, sizes, prev, pager, next, jumper" :total="listParm.total" background>
|
|
|
|
|
|
|
|
</el-pagination>
|
|
|
|
|
|
|
|
|
|
|
|
</el-main>
|
|
|
|
</el-main>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 新增、编辑按钮弹框 -->
|
|
|
|
<!-- 新增、编辑按钮弹框 -->
|
|
|
@ -25,13 +57,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
|
|
|
|
|
|
|
import { Search, Close, Plus } from '@element-plus/icons-vue'
|
|
|
|
import { Search, Close, Plus, Edit, Delete } from '@element-plus/icons-vue'
|
|
|
|
// 导入useUserTable,获取表格相关业务
|
|
|
|
// 导入useUserTable,获取表格相关业务
|
|
|
|
// 第一次导入在vite-env.d.ts中添加路径别名支持
|
|
|
|
// 第一次导入在vite-env.d.ts中添加路径别名支持
|
|
|
|
import useUserTable from '@/compositions/user/useUserTable';
|
|
|
|
import useUserTable from '@/compositions/user/useUserTable';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 导入onMounted方法
|
|
|
|
|
|
|
|
import { onMounted } from 'vue';
|
|
|
|
|
|
|
|
|
|
|
|
// 获取表格相关业务
|
|
|
|
// 获取表格相关业务
|
|
|
|
const { tableShowBtn, listParm, getList, searchBtn, resetBtn } = useUserTable()
|
|
|
|
const { tableShowBtn,
|
|
|
|
|
|
|
|
listParm,
|
|
|
|
|
|
|
|
getList,
|
|
|
|
|
|
|
|
searchBtn,
|
|
|
|
|
|
|
|
resetBtn,
|
|
|
|
|
|
|
|
tableList,
|
|
|
|
|
|
|
|
sizeChange,
|
|
|
|
|
|
|
|
currentChange,
|
|
|
|
|
|
|
|
tableHeight } = useUserTable()
|
|
|
|
|
|
|
|
|
|
|
|
// 导入useUser,获取增删改相关业务
|
|
|
|
// 导入useUser,获取增删改相关业务
|
|
|
|
import useUser from '@/compositions/user/useUser';
|
|
|
|
import useUser from '@/compositions/user/useUser';
|
|
|
@ -40,6 +83,11 @@ const { showBtn, addBtn, deleteBtn, editBtn } = useUser()
|
|
|
|
|
|
|
|
|
|
|
|
// 导入子组件AddUser,关联新增按钮
|
|
|
|
// 导入子组件AddUser,关联新增按钮
|
|
|
|
import AddUser from './AddUser.vue';
|
|
|
|
import AddUser from './AddUser.vue';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 在组件挂载时加载数据
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
|
|
|
getList()
|
|
|
|
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped></style>
|
|
|
|
<style scoped></style>
|