优化用户页面

This commit is contained in:
icssoa 2022-05-17 15:00:06 +08:00
parent fdfd2d8ea5
commit 9572a73791
3 changed files with 34 additions and 55 deletions

View File

@ -19,7 +19,7 @@ export default defineComponent({
// base64 // base64
const base64 = ref<string>(""); const base64 = ref<string>("");
// svg1233 // svg
const svg = ref<string>(""); const svg = ref<string>("");
function refresh() { function refresh() {

View File

@ -17,8 +17,8 @@
</li> </li>
<li v-show="isDrag" class="no"> <li v-show="isDrag" class="no">
<el-button type="text" @click="treeOrder(true)">保存</el-button> <el-button type="text" @click="treeOrder(true)" size="small">保存</el-button>
<el-button type="text" @click="treeOrder(false)">取消</el-button> <el-button type="text" @click="treeOrder(false)" size="small">取消</el-button>
</li> </li>
</ul> </ul>
</div> </div>
@ -68,7 +68,7 @@ import { deepTree, revDeepTree } from "/@/cool/utils";
import { isArray } from "lodash"; import { isArray } from "lodash";
import { ContextMenu, useForm } from "@cool-vue/crud"; import { ContextMenu, useForm } from "@cool-vue/crud";
import { Refresh, Operation, MoreFilled } from "@element-plus/icons-vue"; import { Refresh, Operation, MoreFilled } from "@element-plus/icons-vue";
import { useBaseStore } from "/$/base"; import { useBaseStore, checkPerm } from "/$/base";
export default defineComponent({ export default defineComponent({
name: "dept-tree", name: "dept-tree",
@ -181,7 +181,7 @@ export default defineComponent({
], ],
form: e, form: e,
on: { on: {
submit: (data: any, { done, close }: any) => { submit(data, { done, close }) {
service.base.sys.department[method]({ service.base.sys.department[method]({
id: e.id, id: e.id,
parentId: e.parentId, parentId: e.parentId,
@ -295,13 +295,13 @@ export default defineComponent({
} }
// //
const prem = service.base.sys.department._permission; const perm = service.base.sys.department.permission;
ContextMenu.open(e, { ContextMenu.open(e, {
list: [ list: [
{ {
label: "新增", label: "新增",
hidden: (n && n.level >= props.level) || !prem.add, hidden: (n && n.level >= props.level) || !checkPerm(perm.add),
callback(done) { callback(done) {
rowEdit({ rowEdit({
name: "", name: "",
@ -313,7 +313,7 @@ export default defineComponent({
}, },
{ {
label: "编辑", label: "编辑",
hidden: !prem.update, hidden: !checkPerm(perm.update),
callback(done) { callback(done) {
rowEdit(d); rowEdit(d);
done(); done();
@ -321,7 +321,7 @@ export default defineComponent({
}, },
{ {
label: "删除", label: "删除",
hidden: !d.parentId || !prem.delete, hidden: !d.parentId || !checkPerm(perm.delete),
callback(done) { callback(done) {
rowDel(d); rowDel(d);
done(); done();
@ -329,7 +329,7 @@ export default defineComponent({
}, },
{ {
label: "新增成员", label: "新增成员",
hidden: !service.base.sys.user.permission.add, hidden: !checkPerm(perm.add),
callback(done) { callback(done) {
emit("user-add", d); emit("user-add", d);
done(); done();

View File

@ -49,8 +49,9 @@
> >
<!-- 权限 --> <!-- 权限 -->
<template #column-roleName="{ scope }"> <template #column-roleName="{ scope }">
<template v-if="scope.row.roleName">
<el-tag <el-tag
v-for="(item, index) in scope.row.roleNameList" v-for="(item, index) in scope.row.roleName.split(',')"
:key="index" :key="index"
disable-transitions disable-transitions
size="small" size="small"
@ -59,6 +60,7 @@
>{{ item }}</el-tag >{{ item }}</el-tag
> >
</template> </template>
</template>
<!-- 单个转移 --> <!-- 单个转移 -->
<template #slot-btn="{ scope }"> <template #slot-btn="{ scope }">
@ -115,22 +117,7 @@ const dept = ref<any[]>([]);
// cl-crud // cl-crud
const Crud = useCrud( const Crud = useCrud(
{ {
service: service.base.sys.user, service: service.base.sys.user
async onRefresh(params, { next, render }) {
const { list } = await next(params);
render(
list.map((e: any) => {
if (e.roleName) {
e.roleNameList = e.roleName.split(",");
}
e.status = Boolean(e.status);
return e;
})
);
}
}, },
(app) => { (app) => {
app.refresh(); app.refresh();
@ -175,7 +162,15 @@ const Table = useTable({
prop: "roleName", prop: "roleName",
label: "角色", label: "角色",
headerAlign: "center", headerAlign: "center",
minWidth: 200 minWidth: 120
},
{
prop: "status",
label: "状态",
minWidth: 120,
component: {
name: "cl-switch"
}
}, },
{ {
prop: "phone", prop: "phone",
@ -187,23 +182,6 @@ const Table = useTable({
label: "备注", label: "备注",
minWidth: 150 minWidth: 150
}, },
{
prop: "status",
label: "状态",
minWidth: 120,
dict: [
{
label: "启用",
value: 1,
type: "success"
},
{
label: "禁用",
value: 0,
type: "danger"
}
]
},
{ {
prop: "createTime", prop: "createTime",
label: "创建时间", label: "创建时间",
@ -213,7 +191,7 @@ const Table = useTable({
{ {
type: "op", type: "op",
buttons: ["slot-btn", "edit", "delete"], buttons: ["slot-btn", "edit", "delete"],
width: 180 width: 240
} }
] ]
}); });
@ -494,6 +472,8 @@ async function toMove(e?: any) {
} }
.icon { .icon {
display: flex;
align-items: center;
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
@ -502,7 +482,6 @@ async function toMove(e?: any) {
background-color: #fff; background-color: #fff;
height: 40px; height: 40px;
width: 80px; width: 80px;
line-height: 40px;
padding-left: 10px; padding-left: 10px;
} }
} }