feat: 添加权限管理

This commit is contained in:
2025-02-11 16:37:08 +08:00
parent 0cb6c80d57
commit 6de042b07e
27 changed files with 6095 additions and 94 deletions

View File

@@ -4,7 +4,6 @@ import { handleTree } from "@/utils/tree";
import { message } from "@/utils/message";
import { addDialog } from "@/components/ReDialog";
import { reactive, ref, onMounted, h } from "vue";
import type { FormItemProps } from "../utils/types";
import { cloneDeep } from "@pureadmin/utils";
import type { DepartmentInfo } from "types/system";
import { usePublicHooks } from "../../hooks";
@@ -51,7 +50,7 @@ export const useDepartment = () => {
/**
* 标签样式
*/
const { tagStyle, formatHigherDeptOptions } = usePublicHooks();
const { tagStyle } = usePublicHooks();
/**
* 表格列设置
*/
@@ -126,13 +125,23 @@ export const useDepartment = () => {
formEl.resetFields();
onSearch();
};
const openDialog = (title = "新增", row?: FormItemProps) => {
const formatHigherOptions = treeList => {
// 根据返回数据的status字段值判断追加是否禁用disabled字段返回处理后的树结构用于上级部门级联选择器的展示实际开发中也是如此不可能前端需要的每个字段后端都会返回这时需要前端自行根据后端返回的某些字段做逻辑处理
if (!treeList || !treeList.length) return;
const newTreeList = [];
for (let i = 0; i < treeList.length; i++) {
treeList[i].disabled = treeList[i].status === 0 ? true : false;
formatHigherOptions(treeList[i].children);
newTreeList.push(treeList[i]);
}
return newTreeList;
};
const openDialog = (title = "新增", row?: DepartmentInfo) => {
addDialog({
title: `${title}部门`,
props: {
formInline: {
higherDeptOptions: formatHigherDeptOptions(cloneDeep(dataList.value)),
higherDeptOptions: formatHigherOptions(cloneDeep(dataList.value)),
id: row?.id ?? "",
parent_id: row?.parent_id ?? "",
name: row?.name ?? "",
@@ -151,9 +160,7 @@ export const useDepartment = () => {
contentRenderer: () =>
h(editForm, {
formInline: {
higherDeptOptions: formatHigherDeptOptions(
cloneDeep(dataList.value)
),
higherOptions: formatHigherOptions(cloneDeep(dataList.value)),
id: row?.id ?? "",
parent_id: row?.parent_id ?? "",
name: row?.name ?? "",
@@ -168,7 +175,7 @@ export const useDepartment = () => {
}),
beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef();
const curData = options.props.formInline as FormItemProps;
const curData = options.props.formInline as DepartmentInfo;
function chores() {
message(`${title}了部门名称为${curData.name}的这条数据`, {
type: "success"