|
|
@@ -1,6 +1,176 @@
|
|
|
<template>
|
|
|
- <div>角色页面</div>
|
|
|
+ <ContentWrap>
|
|
|
+ <!-- 搜索工作栏 -->
|
|
|
+ <el-form
|
|
|
+ class="-mb-15px"
|
|
|
+ :model="queryParams"
|
|
|
+ ref="queryFormRef"
|
|
|
+ :inline="true"
|
|
|
+ label-width="68px"
|
|
|
+ >
|
|
|
+ <el-form-item label="角色名称" prop="roleName">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.roleName"
|
|
|
+ placeholder="请输入角色名称"
|
|
|
+ clearable
|
|
|
+ class="!w-240px"
|
|
|
+ @keyup.enter="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button @click="handleQuery">
|
|
|
+ <Icon icon="ep:search" class="mr-5px" />
|
|
|
+ 搜索
|
|
|
+ </el-button>
|
|
|
+ <el-button @click="resetQuery">
|
|
|
+ <Icon icon="ep:refresh" class="mr-5px" />
|
|
|
+ 重置
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ plain
|
|
|
+ @click="openForm('create')"
|
|
|
+ v-hasPermi="['iscs:map:create']"
|
|
|
+ >
|
|
|
+ <Icon icon="ep:plus" class="mr-5px" />
|
|
|
+ 新增
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ plain
|
|
|
+ :disabled="multiple"
|
|
|
+ @click="handleDelete"
|
|
|
+ v-hasPermi="['iscs:map:delete']"
|
|
|
+ >
|
|
|
+ <Icon icon="ep:delete" class="mr-5px" />
|
|
|
+ 批量删除
|
|
|
+ </el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </ContentWrap>
|
|
|
+ <!-- 列表 -->
|
|
|
+ <ContentWrap>
|
|
|
+ <el-table v-loading="loading" :data="tableList" @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column type="selection" width="55" align="center" />
|
|
|
+ <el-table-column label="编号" align="center" prop="id" />
|
|
|
+ <el-table-column label="名称" align="center" prop="roleName" />
|
|
|
+ <el-table-column label="页面" align="center" prop="pageType" />
|
|
|
+ <el-table-column label="操作" align="center">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-button
|
|
|
+ link
|
|
|
+ type="primary"
|
|
|
+ @click="openForm('update', scope.row.id)"
|
|
|
+ v-hasPermi="['iscs:map:update']"
|
|
|
+ >
|
|
|
+ 编辑
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ link
|
|
|
+ type="danger"
|
|
|
+ @click="handleDelete(scope.row.id)"
|
|
|
+ v-hasPermi="['iscs:map:delete']"
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <!-- 分页 -->
|
|
|
+ <Pagination
|
|
|
+ :total="total"
|
|
|
+ v-model:page="queryParams.pageNo"
|
|
|
+ v-model:limit="queryParams.pageSize"
|
|
|
+ @pagination="getList"
|
|
|
+ />
|
|
|
+ </ContentWrap>
|
|
|
</template>
|
|
|
-<script setup lang="ts"></script>
|
|
|
+<script setup lang="ts">
|
|
|
+import * as rolePageApi from '@/api/system/rolePage/index'
|
|
|
+
|
|
|
+
|
|
|
+const router = useRouter()
|
|
|
+const message = useMessage() // 消息弹窗
|
|
|
+const { t } = useI18n() // 国际化
|
|
|
+const loading = ref(true) // 列表的加载中
|
|
|
+const total = ref(0) // 列表的总页数
|
|
|
+const tableList=ref([])
|
|
|
+const queryFormRef = ref() // 搜索的表单
|
|
|
+const ids = ref() // 选中的数据
|
|
|
+const multiple = ref(true) // 非多个禁用
|
|
|
+const formRef = ref()
|
|
|
+const queryParams = reactive({
|
|
|
+ pageNo: 1,
|
|
|
+ pageSize: -1,
|
|
|
+ roleName:'',
|
|
|
+})
|
|
|
+
|
|
|
+onMounted(()=>{
|
|
|
+ getList()
|
|
|
+})
|
|
|
+
|
|
|
+// 获取数据
|
|
|
+const getList=async()=>{
|
|
|
+ loading.value = true
|
|
|
+ try{
|
|
|
+ const data=await rolePageApi.getRolePagePage(queryParams)
|
|
|
+ tableList.value=data.list
|
|
|
+ // console.log(data,'youshuju')
|
|
|
+ }finally{
|
|
|
+ loading.value =false
|
|
|
+ }
|
|
|
+}
|
|
|
+// 搜索
|
|
|
+const handleQuery=()=>{
|
|
|
+ queryParams.pageNo = 1
|
|
|
+ getList()
|
|
|
+}
|
|
|
+
|
|
|
+// 重置
|
|
|
+const resetQuery=()=>{
|
|
|
+ queryFormRef.value?.resetFields()
|
|
|
+ handleQuery()
|
|
|
+}
|
|
|
+
|
|
|
+// 表格数据选择
|
|
|
+const handleSelectionChange=(selection:any[])=>{
|
|
|
+ ids.value=selection.map((item)=>item.id)
|
|
|
+ multiple.value=!selection.length
|
|
|
+}
|
|
|
+
|
|
|
+// 新增修改
|
|
|
+const openForm=(type:string,id?:number)=>{
|
|
|
+ if(type=='create'){
|
|
|
+ router.push({
|
|
|
+ name:'createForm',
|
|
|
+ query:{type:'create'}
|
|
|
+ })
|
|
|
+ }else if(type=='update'){
|
|
|
+ router.push({
|
|
|
+ name:'updateForm',
|
|
|
+ query:{id:id,type:'update'}
|
|
|
+ })
|
|
|
+ }
|
|
|
+ console.log(formRef.value)
|
|
|
+}
|
|
|
+
|
|
|
+// 删除
|
|
|
+const handleDelete=async(id?:number)=>{
|
|
|
+ try{
|
|
|
+ await message.delConfirm()
|
|
|
+ // 类型守卫处理
|
|
|
+ const realId = id instanceof PointerEvent
|
|
|
+ ? ids.value
|
|
|
+ : id || ids.value;
|
|
|
+ await rolePageApi.deleteRolePageList(realId)
|
|
|
+ message.success(t('common.delSuccess'))
|
|
|
+ await getList()
|
|
|
+ }catch(error){
|
|
|
+ console.error('删除失败:', error)
|
|
|
+ message.error(t('common.delFailed'))
|
|
|
+ }
|
|
|
+ console.log(formRef.value)
|
|
|
+}
|
|
|
+</script>
|
|
|
|
|
|
<style scoped lang="scss"></style>
|