提交 4069f78a authored 作者: lidongxu's avatar lidongxu

style(user/authrole): 修复样式问题

同上
上级 9486bf69
<template> <template>
<div class="app-container"> <div class="app-container">
<div class="container">
<h4 class="form-header h4">基本信息</h4> <h4 class="form-header h4">基本信息</h4>
<el-form :model="form" label-width="80px"> <el-form :model="form"
label-width="80px">
<el-row> <el-row>
<el-col :span="8" :offset="2"> <el-col :span="8"
<el-form-item label="用户昵称" prop="nickName"> :offset="2">
<el-input v-model="form.nickName" disabled /> <el-form-item label="用户昵称"
prop="nickName">
<el-input v-model="form.nickName"
disabled />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8" :offset="2"> <el-col :span="8"
<el-form-item label="登录账号" prop="userName"> :offset="2">
<el-input v-model="form.userName" disabled /> <el-form-item label="登录账号"
prop="userName">
<el-input v-model="form.userName"
disabled />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<h4 class="form-header h4">角色信息</h4> <h4 class="form-header h4">角色信息</h4>
<el-table v-loading="loading" :row-key="getRowKey" @row-click="clickRow" ref="roleRef" @selection-change="handleSelectionChange" :data="roles.slice((pageNum - 1) * pageSize, pageNum * pageSize)"> <el-table v-loading="loading"
<el-table-column label="序号" width="55" type="index" align="center"> :row-key="getRowKey"
@row-click="clickRow"
ref="roleRef"
@selection-change="handleSelectionChange"
:data="roles.slice((pageNum - 1) * pageSize, pageNum * pageSize)">
<el-table-column label="序号"
width="55"
type="index"
align="center">
<template #default="scope"> <template #default="scope">
<span>{{ (pageNum - 1) * pageSize + scope.$index + 1 }}</span> <span>{{ (pageNum - 1) * pageSize + scope.$index + 1 }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column type="selection" :reserve-selection="true" width="55"></el-table-column> <el-table-column type="selection"
<el-table-column label="角色编号" align="center" prop="roleId" /> :reserve-selection="true"
<el-table-column label="角色名称" align="center" prop="roleName" /> width="55"></el-table-column>
<el-table-column label="权限字符" align="center" prop="roleKey" /> <el-table-column label="角色编号"
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> align="center"
prop="roleId" />
<el-table-column label="角色名称"
align="center"
prop="roleName" />
<el-table-column label="权限字符"
align="center"
prop="roleKey" />
<el-table-column label="创建时间"
align="center"
prop="createTime"
width="180">
<template #default="scope"> <template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination v-show="total > 0" :total="total" v-model:page="pageNum" v-model:limit="pageSize" /> <pagination v-show="total > 0"
:total="total"
v-model:page="pageNum"
v-model:limit="pageSize" />
<el-form label-width="100px"> <el-form label-width="100px">
<div style="text-align: center;margin-left:-120px;margin-top:30px;"> <div style="text-align: center;margin-left:-120px;margin-top:30px;">
<el-button type="primary" @click="submitForm()">提交</el-button> <el-button type="primary"
@click="submitForm()">提交</el-button>
<el-button @click="close()">返回</el-button> <el-button @click="close()">返回</el-button>
</div> </div>
</el-form> </el-form>
</div> </div>
</div>
</template> </template>
<script setup name="AuthRole"> <script setup
import { getAuthRole, updateAuthRole } from "@/api"; name="AuthRole">
import { getAuthRole, updateAuthRole } from "@/api";
const route = useRoute(); const route = useRoute();
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const loading = ref(true); const loading = ref(true);
const total = ref(0); const total = ref(0);
const pageNum = ref(1); const pageNum = ref(1);
const pageSize = ref(10); const pageSize = ref(10);
const roleIds = ref([]); const roleIds = ref([]);
const roles = ref([]); const roles = ref([]);
const form = ref({ const form = ref({
nickName: undefined, nickName: undefined,
userName: undefined, userName: undefined,
userId: undefined userId: undefined
}); });
/** 单击选中行数据 */ /** 单击选中行数据 */
function clickRow(row) { function clickRow(row) {
proxy.$refs["roleRef"].toggleRowSelection(row); proxy.$refs["roleRef"].toggleRowSelection(row);
}; };
/** 多选框选中数据 */ /** 多选框选中数据 */
function handleSelectionChange(selection) { function handleSelectionChange(selection) {
roleIds.value = selection.map(item => item.roleId); roleIds.value = selection.map(item => item.roleId);
}; };
/** 保存选中的数据编号 */ /** 保存选中的数据编号 */
function getRowKey(row) { function getRowKey(row) {
return row.roleId; return row.roleId;
}; };
/** 关闭按钮 */ /** 关闭按钮 */
function close() { function close() {
const obj = { path: "/system/user" }; const obj = { path: "/system/user" };
proxy.$tab.closeOpenPage(obj); proxy.$tab.closeOpenPage(obj);
}; };
/** 提交按钮 */ /** 提交按钮 */
function submitForm() { function submitForm() {
const userId = form.value.userId; const userId = form.value.userId;
const rIds = roleIds.value.join(","); const rIds = roleIds.value.join(",");
updateAuthRole({ userId: userId, roleIds: rIds }).then(response => { updateAuthRole({ userId: userId, roleIds: rIds }).then(response => {
proxy.$modal.msgSuccess("授权成功"); proxy.$modal.msgSuccess("授权成功");
close(); close();
}); });
}; };
(() => { (() => {
const userId = route.params && route.params.userId; const userId = route.params && route.params.userId;
if (userId) { if (userId) {
loading.value = true; loading.value = true;
...@@ -112,5 +145,5 @@ function submitForm() { ...@@ -112,5 +145,5 @@ function submitForm() {
loading.value = false; loading.value = false;
}); });
} }
})(); })();
</script> </script>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论