Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
EMS
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hejie
EMS
Commits
5e5223dc
提交
5e5223dc
authored
4月 22, 2025
作者:
詹银鑫
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 部门管理功能添加
上级
098e0e43
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
51 行增加
和
26 行删除
+51
-26
system.ts
src/api/system.ts
+15
-13
hook.tsx
src/views/systems/dep/utils/hook.tsx
+35
-13
types.ts
src/views/systems/dep/utils/types.ts
+1
-0
没有找到文件。
src/api/system.ts
浏览文件 @
5e5223dc
...
...
@@ -44,19 +44,6 @@ export const getMenuList = (data?: object) => {
return
http
.
request
<
Result
>
(
"post"
,
"/menu"
,
{
data
});
};
// {
// name: "杭州总公司",
// parentId: 0,
// id: 100,
// sort: 0,
// phone: "15888888888",
// principal: faker.person.firstName(),
// email: faker.internet.email(),
// status: 1, // 状态 1 启用 0 停用
// type: 1, // 1 公司 2 分公司 3 部门
// createTime: 1605456000000,
// remark: "这里是备注信息这里是备注信息这里是备注信息这里是备注信息"
// },
/** 获取系统管理-部门管理列表 */
export
const
getDeptList
=
(
data
?:
object
)
=>
{
return
http
.
request
<
Result
>
(
"post"
,
"/api/depart/get-depart-list-by-page"
,
{
...
...
@@ -64,6 +51,21 @@ export const getDeptList = (data?: object) => {
});
};
/** 新增部门-部门管理列表 */
export
const
addDept
=
(
data
?:
object
)
=>
{
return
http
.
request
<
Result
>
(
"post"
,
"/api/depart/add-depart"
,
{
data
});
};
/** 修改部门-部门管理列表 */
export
const
updateDept
=
(
data
?:
object
)
=>
{
return
http
.
request
<
Result
>
(
"post"
,
`/api/depart/modify-depart`
,
{
data
});
};
/** 删除部门-部门管理列表 */
export
const
deleteDept
=
(
data
?:
{
id
:
number
})
=>
{
return
http
.
request
<
Result
>
(
"post"
,
`/api/depart/delete-depart/
${
data
.
id
}
`
);
};
/** 获取系统监控-在线用户列表 */
export
const
getOnlineLogsList
=
(
data
?:
object
)
=>
{
return
http
.
request
<
ResultTable
>
(
"post"
,
"/online-logs"
,
{
data
});
...
...
src/views/systems/dep/utils/hook.tsx
浏览文件 @
5e5223dc
...
...
@@ -2,7 +2,7 @@ import dayjs from "dayjs";
import
editForm
from
"../form.vue"
;
import
{
handleTree
}
from
"@/utils/tree"
;
import
{
message
}
from
"@/utils/message"
;
import
{
getDeptList
}
from
"@/api/system"
;
import
{
getDeptList
,
addDept
,
deleteDept
,
updateDept
}
from
"@/api/system"
;
import
{
usePublicHooks
}
from
"../hooks"
;
import
{
addDialog
}
from
"@/components/ReDialog"
;
import
{
reactive
,
ref
,
onMounted
,
h
}
from
"vue"
;
...
...
@@ -50,11 +50,11 @@ export function useDept() {
formatter
:
({
createTime
})
=>
dayjs
(
createTime
).
format
(
"YYYY-MM-DD HH:mm:ss"
)
},
{
label
:
"备注"
,
prop
:
"remark"
,
minWidth
:
320
},
//
{
//
label: "备注",
//
prop: "remark",
//
minWidth: 320
//
},
{
label
:
"操作"
,
fixed
:
"right"
,
...
...
@@ -77,7 +77,7 @@ export function useDept() {
// loading.value = true;
const
params
=
{
pageNum
:
1
,
pageSize
:
1
0
pageSize
:
20
0
};
const
{
data
}
=
await
getDeptList
(
params
);
// 这里是返回一维数组结构,前端自行处理成树结构,返回格式要求:唯一id加父节点parentId,parentId取父节点id
console
.
log
(
"data"
,
data
);
...
...
@@ -134,6 +134,8 @@ export function useDept() {
beforeSure
:
(
done
,
{
options
})
=>
{
const
FormRef
=
formRef
.
value
.
getRef
();
const
curData
=
options
.
props
.
formInline
as
FormItemProps
;
console
.
log
(
"row.id"
,
row
.
id
);
function
chores
()
{
message
(
`您
${
title
}
了部门名称为
${
curData
.
name
}
的这条数据`
,
{
type
:
"success"
...
...
@@ -146,11 +148,26 @@ export function useDept() {
console
.
log
(
"curData"
,
curData
);
// 表单规则校验通过
if
(
title
===
"新增"
)
{
// 实际开发先调用新增接口,再进行下面操作
chores
();
addDept
(
curData
).
then
(
res
=>
{
if
((
res
as
any
).
code
===
"0"
)
{
chores
();
}
else
{
message
((
res
as
any
).
msg
,
{
type
:
"error"
});
}
});
}
else
{
// 实际开发先调用修改接口,再进行下面操作
chores
();
if
(
!
row
.
id
)
{
message
(
"id不能为空"
,
{
type
:
"error"
});
return
;
}
curData
.
id
=
row
.
id
;
// 修改时需要传入id
updateDept
(
curData
).
then
(
res
=>
{
if
((
res
as
any
).
code
===
"0"
)
{
chores
();
}
else
{
message
((
res
as
any
).
msg
,
{
type
:
"error"
});
}
});
}
}
});
...
...
@@ -159,8 +176,13 @@ export function useDept() {
}
function
handleDelete
(
row
)
{
message
(
`您删除了部门名称为
${
row
.
name
}
的这条数据`
,
{
type
:
"success"
});
onSearch
();
console
.
log
(
"handleDelete"
,
row
.
id
);
deleteDept
({
id
:
row
.
id
}).
then
(
res
=>
{
if
((
res
as
any
).
code
===
"0"
)
{
message
(
`您删除了部门名称为
${
row
.
name
}
的这条数据`
,
{
type
:
"success"
});
onSearch
();
}
});
}
onMounted
(()
=>
{
...
...
src/views/systems/dep/utils/types.ts
浏览文件 @
5e5223dc
...
...
@@ -8,6 +8,7 @@ interface FormItemProps {
sort
:
number
;
status
:
number
;
remark
:
string
;
id
?:
number
;
}
interface
FormProps
{
formInline
:
FormItemProps
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论