Files
biz-pc-cloud-zax/src/api/admin/sysUserRelation.ts
T
2026-07-20 17:51:14 +08:00

111 lines
2.2 KiB
TypeScript
Executable File

import request from "/@/utils/request"
export interface RelationGraphNode {
nodeId: string
parentNodeId?: string
root: boolean
repeated: boolean
userId: string
username?: string
name?: string
nickname?: string
displayName: string
avatar?: string
gender?: number
userCount?: number
relationCount?: number
relationId?: string
subjectUserId?: string
objectUserId?: string
relationTypeId?: string
relationCode?: string
relationName?: string
category?: string
directedFlag?: string
relationDirection?: "subject-to-object" | "object-to-subject"
userRoleName?: string
parentRoleName?: string
relationDescription?: string
effectiveTime?: string
expireTime?: string
remark?: string
children?: RelationGraphNode[]
}
export interface RelationCreateUserForm {
subjectUserId?: string
objectUserId?: string
relationTypeId: string
effectiveTime?: string
expireTime?: string
remark?: string
username: string
password: string
phone?: string
name: string
nickname?: string
email?: string
avatar?: string
deptId?: string
role?: string[]
post?: string[]
gender?: number
staffingType?: string
lockFlag?: string
identityTypes: string[]
studentInfo?: {
studentNo: string
schoolName: string
className: string
extJson: string
}
}
export interface RelationCreateForm {
subjectUserId: string
objectUserId: string
relationTypeId: string
effectiveTime?: string
expireTime?: string
remark?: string
}
export interface RelationUpdateForm extends RelationCreateForm {
relationId: string
}
// 关系图谱
export function getRelationGraph(userId?: string) {
return request({
url: "/admin/sysUserRelation/graph/" + userId,
method: "get",
})
}
// 创建用户并建立关系
export function createRelationUser(data: RelationCreateUserForm) {
return request({
url: "/admin/sysUserRelation/create-user",
method: "post",
data,
})
}
// 为两个已有用户建立关系
export function createRelation(data: RelationCreateForm) {
return request({
url: "/admin/sysUserRelation/create",
method: "post",
data,
})
}
// 修改已有用户关系
export function updateRelation(data: RelationUpdateForm) {
return request({
url: "/admin/sysUserRelation/update",
method: "put",
data,
})
}