eslint fixed and 页面权限配置 and 默认权限数据加载.

This commit is contained in:
许晓东
2023-05-17 22:29:04 +08:00
parent b08be2aa65
commit 7e98a58f60
37 changed files with 686 additions and 297 deletions

View File

@@ -98,7 +98,10 @@ export default {
this.loading = false;
if (res.code == 0) {
this.$message.success(res.msg);
this.$emit("closeCreateUserDialog", { refresh: true, data: res.data });
this.$emit("closeCreateUserDialog", {
refresh: true,
data: res.data,
});
} else {
notification.error({
message: "error",

View File

@@ -31,24 +31,9 @@ const columns = [
width: "12%",
slots: { title: "type" },
scopedSlots: { customRender: "type" },
}
},
];
const rowSelection = {
onChange: (selectedRowKeys, selectedRows) => {
console.log(
`selectedRowKeys: ${selectedRowKeys}`,
"selectedRows: ",
selectedRows
);
},
onSelect: (record, selected, selectedRows) => {
console.log(record, selected, selectedRows);
},
onSelectAll: (selected, selectedRows, changeRows) => {
console.log(selected, selectedRows, changeRows);
},
};
import { UserManageApi } from "@/utils/api";
import notification from "ant-design-vue/lib/notification";
@@ -60,7 +45,6 @@ export default {
loading: false,
data: [],
columns,
rowSelection,
expandedRowKeys: [],
};
},

View File

@@ -26,7 +26,7 @@
cancel-text="取消"
@confirm="deleteRole(item)"
>
<a :style="{ display: 'flex' }">
<a :style="{ display: 'flex' }" v-action:user-manage:role:del>
<a-icon type="delete" />
</a>
</a-popconfirm>
@@ -35,7 +35,9 @@
<span
:style="{ margin: '25px', fontSize: '15px', display: 'block' }"
>
<a @click="addRole()"><a-icon type="plus" /> 新增角色</a>
<a @click="addRole()" v-action:user-manage:role:save
><a-icon type="plus" /> 新增角色</a
>
</span>
</a-col>
<a-col :md="20">
@@ -116,7 +118,11 @@
</div>
</a-form-item>
<a-form-item>
<a-button type="primary" :loading="loading" @click="onSave()"
<a-button
type="primary"
:loading="loading"
@click="onSave()"
v-action:user-manage:role:save
>保存</a-button
>
</a-form-item>
@@ -212,8 +218,8 @@ export default {
const btnArr = [self];
btn.children = btnArr;
const selected = btn.children
.map((bc) => bc.id)
.filter((id) => idSet.has(id));
.map((bc) => bc.id)
.filter((id) => idSet.has(id));
btn.selected = selected || [];
btn.selectAll = btn.selected.length == btn.children.length;
}

View File

@@ -32,7 +32,10 @@
</a-form>
</div>
<div class="operation-row-button">
<a-button type="primary" @click="openCreateUserDialog()"
<a-button
type="primary"
@click="openCreateUserDialog()"
v-action:user-manage:user:add
>新增用户</a-button
>
</div>
@@ -49,7 +52,11 @@
cancel-text="取消"
@confirm="deleteUser(record)"
>
<a-button size="small" href="javascript:;" class="operation-btn"
<a-button
size="small"
href="javascript:;"
class="operation-btn"
v-action:user-manage:user:del
>删除
</a-button>
</a-popconfirm>
@@ -59,7 +66,11 @@
cancel-text="取消"
@confirm="resetPassword(record)"
>
<a-button size="small" href="javascript:;" class="operation-btn"
<a-button
size="small"
href="javascript:;"
class="operation-btn"
v-action:user-manage:user:reset-pass
>重置密码
</a-button>
</a-popconfirm>
@@ -68,6 +79,7 @@
href="javascript:;"
class="operation-btn"
@click="openUpdateUserRoleDialog(record)"
v-action:user-manage:user:change-role
>分配角色
</a-button>
</div>

View File

@@ -2,16 +2,32 @@
<div class="content">
<a-spin :spinning="loading">
<a-tabs default-active-key="1" size="large" tabPosition="top">
<a-tab-pane key="1" tab="用户列表">
<a-tab-pane
key="1"
tab="用户列表"
v-if="isAuthorized('user-manage:user')"
>
<User></User>
</a-tab-pane>
<a-tab-pane key="2" tab="角色列表">
<a-tab-pane
key="2"
tab="角色列表"
v-if="isAuthorized('user-manage:role')"
>
<Role></Role>
</a-tab-pane>
<a-tab-pane key="3" tab="权限列表">
<a-tab-pane
key="3"
tab="权限列表"
v-if="isAuthorized('user-manage:permission')"
>
<Permission></Permission>
</a-tab-pane>
<a-tab-pane key="4" tab="个人设置">
<a-tab-pane
key="4"
tab="个人设置"
v-if="isAuthorized('user-manage:setting')"
>
<UserSetting></UserSetting>
</a-tab-pane>
</a-tabs>
@@ -24,6 +40,7 @@ import Permission from "@/views/user/Permission.vue";
import Role from "@/views/user/Role.vue";
import User from "@/views/user/User.vue";
import UserSetting from "@/views/user/UserSetting.vue";
import { isAuthorized } from "@/utils/auth";
export default {
name: "UserManage",
components: { Permission, Role, User, UserSetting },
@@ -33,7 +50,7 @@ export default {
topicList: [],
};
},
methods: {},
methods: { isAuthorized },
created() {},
};
</script>