用户操作权限增加角色权限过滤,优化角色/部门关系树生成,修复验证码空参数不验证问题

This commit is contained in:
孟帅
2023-08-02 17:38:40 +08:00
parent e941e52d3e
commit 3df5236623
28 changed files with 1097 additions and 887 deletions

View File

@@ -33,7 +33,7 @@
password: '123456',
},
{
label: '普通用户',
label: '代理商',
username: 'ameng',
password: '123456',
},

View File

@@ -338,13 +338,13 @@
function addTable() {
showModal.value = true;
formParams.value = cloneDeep(defaultState);
optionsDefaultValue.value = null;
optionsDefaultValue.value = 0;
}
function handleEdit(record: Recordable) {
showModal.value = true;
formParams.value = cloneDeep(record);
formParams.value.children = null;
formParams.value.children = 0;
optionsDefaultValue.value = formParams.value.pid;
}
@@ -370,7 +370,7 @@
});
}
function updateStatus(id, status) {
function updateStatus(id: any, status: any) {
Status({ id: id, status: status })
.then((_res) => {
message.success('操作成功');
@@ -383,10 +383,10 @@
});
}
function confirmForm(e) {
function confirmForm(e: { preventDefault: () => void }) {
e.preventDefault();
formBtnLoading.value = true;
formRef.value.validate((errors) => {
formRef.value.validate((errors: any) => {
if (!errors) {
Edit(formParams.value).then((_res) => {
message.success('操作成功');
@@ -408,17 +408,18 @@
function handleReset(_values: Recordable) {}
const loadDataTable = async (res) => {
const loadDataTable = async (res: Recordable<any>) => {
loading.value = true;
const tmp = await getDeptList({ ...res, ...formRef.value?.formModel });
data.value = tmp?.list;
if (data.value === undefined || data.value === null) {
data.value = [];
}
options.value = [
{
index: 0,
key: 0,
id: 0,
label: '顶级部门',
children: data.value,
},
@@ -431,7 +432,7 @@
await loadDataTable({});
});
function handleUpdateValue(value) {
function handleUpdateValue(value: any) {
formParams.value.pid = value;
}
</script>

View File

@@ -180,19 +180,19 @@ export const options = ref<any>({
export async function loadOptions() {
const dept = await getDeptOption();
if (dept.list !== undefined) {
if (dept.list) {
options.value.dept = dept.list;
}
const role = await getRoleOption();
if (role.list !== undefined) {
if (role.list) {
options.value.role = role.list;
options.value.roleTabs = [{ id: -1, name: '全部' }];
treeDataToCompressed(role.list);
}
const post = await getPostOption();
if (post.list !== undefined && post.list.length > 0) {
if (post.list && post.list.length > 0) {
for (let i = 0; i < post.list.length; i++) {
post.list[i].label = post.list[i].name;
post.list[i].value = post.list[i].id;

View File

@@ -439,15 +439,16 @@
async function loadDeptList() {
const tmp = await getDeptList({});
deptList.value = tmp?.list;
if (deptList.value === undefined || deptList.value === null) {
deptList.value = [];
if (tmp.list) {
deptList.value = tmp.list;
}
}
async function loadDataScopeSelect() {
const option = await DataScopeSelect();
dataScopeOption.value = option.list;
if (option.list) {
dataScopeOption.value = option.list;
}
}
function onUpdateValuePid(value: string | number) {