diff --git a/src/App.vue b/src/App.vue index 77c3cf4..8e4ebff 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,25 +1,16 @@ - - - + + diff --git a/src/api/common/login.ts b/src/api/common/login.ts index e5748eb..71af851 100644 --- a/src/api/common/login.ts +++ b/src/api/common/login.ts @@ -23,6 +23,10 @@ export type LoginByPasswordDTO = { captchaCode: string; /** 验证码对应的缓存key */ captchaCodeKey: string; + /** 企业微信 */ + corpid: string; + code: string; + state: string; }; /** @@ -54,7 +58,7 @@ export interface CurrentUserInfoDTO { email?: string; loginDate?: Date; loginIp?: string; - nickName?: string; + nickname?: string; phoneNumber?: string; postId?: number; postName?: string; @@ -106,3 +110,15 @@ type Result = { export const getAsyncRoutes = () => { return http.request("get", "/getRouters"); }; + +type qyUserinfoQuery = { + // 授权企业id + corpid: string; + // 企业微信 code + code: string; +} + +/** 获取企业微信访问用户身份接口 */ +export const getQyUserinfo = (params: qyUserinfoQuery) => { + return http.request>("get", "/getQyUserinfo", { params }); +}; \ No newline at end of file diff --git a/src/api/qy/qyUser.ts b/src/api/qy/qyUser.ts new file mode 100644 index 0000000..99c41a1 --- /dev/null +++ b/src/api/qy/qyUser.ts @@ -0,0 +1,112 @@ +import { http } from "@/utils/http"; + +/** + * 企业微信用户信息 + */ +export interface QyUserDTO { + /** 用户ID(导出列:用户ID) */ + id?: number; + /** 全局唯一ID(导出列:全局唯一ID) */ + openUserid?: string; + /** 企业用户ID(导出列:企业用户ID) */ + userid?: string; + /** 用户姓名(导出列:用户姓名) */ + name?: string; + /** 手机号码(导出列:手机号码) */ + mobile?: string; + /** 所属部门(导出列:所属部门) */ + department?: string; + /** 部门排序(导出列:部门排序) */ + userOrder?: string; + /** 职务信息(导出列:职务信息) */ + position?: string; + /** 性别(1男 2女,导出列:性别) */ + gender?: string; + /** 邮箱(导出列:邮箱) */ + email?: string; + /** 企业邮箱(导出列:企业邮箱) */ + bizMail?: string; + /** 部门负责人(导出列:部门负责人) */ + isLeaderInDept?: string; + /** 直属上级(导出列:直属上级) */ + directLeader?: string; + /** 头像地址(导出列:头像地址) */ + avatar?: string; + /** 座机号码(导出列:座机号码) */ + telephone?: string; + /** 别名(导出列:别名) */ + alias?: string; + /** 激活状态(导出列:激活状态) */ + status?: string; + /** 个人二维码(导出列:个人二维码) */ + qrCode?: string; + /** 操作人(导出列:操作人) */ + operator?: string; + /** 有效状态(导出列:有效状态) */ + enableStatus?: string; + /** 创建时间(导出列:创建时间) */ + createTimeStr?: string; + /** 企业ID(导出列:企业ID) */ + corpid?: string; + /** 应用ID(导出列:应用ID) */ + appid?: string; +} + +export interface QyUserQuery extends BasePageQuery { + /** 姓名(导出列:姓名) */ + name?: string; + /** 手机号(导出列:联系方式) */ + mobile?: string; + corpid?: string; + mainDepartment?: number; +} + +export interface AddQyUserCommand { + name: string; + mobile: string; + department: string; + corpid: string; +} + +export interface UpdateQyUserCommand extends AddQyUserCommand { + id: number; +} + +/** + * 获取企业微信用户列表 + * @param params 查询参数 + * @returns 分页用户列表 + */ +export const getQyUserListApi = (params: QyUserQuery) => { + return http.request>>("get", "/qywx/users", { + params: { ...params, mainDepartment: params.mainDepartment?.toString() } + }); +}; + +export const addQyUserApi = (data: AddQyUserCommand) => { + return http.request>("post", "/qywx/users", { data }); +}; + +export const updateQyUserApi = (id: number, data: UpdateQyUserCommand) => { + return http.request>("put", `/qywx/users/${id}`, { data }); +}; + +export const deleteQyUserApi = (ids: number[]) => { + return http.request>("delete", `/qywx/users/${ids.join(',')}`); +}; + +/** + * 同步企业微信用户数据 + * @param params 同步参数 + * @param params.corpid 企业ID + * @param params.code 授权code + */ +export const syncQyUserApi = (params: { corpid: string; code: string }) => { + return http.request>("post", "/qywx/users/sync", { + params + }); +}; + +export const exportQyUserExcelApi = (params: QyUserQuery, fileName: string) => { + return http.download("/qywx/users/excel", fileName, { params }); +}; \ No newline at end of file diff --git a/src/api/system/dept.ts b/src/api/system/dept.ts index a5b8dc0..52b370a 100644 --- a/src/api/system/dept.ts +++ b/src/api/system/dept.ts @@ -48,6 +48,11 @@ export const getDeptListApi = (params?: DeptQuery) => { params }); }; +export const getQyDeptListApi = (corpid: string) => { + return http.request>>("get", "/qywx/departments/depts", { + params: { corpid } + }); +}; /** 新增部门 */ export const addDeptApi = (data: DeptRequest) => { diff --git a/src/api/system/user.ts b/src/api/system/user.ts index aeaaf59..a98c654 100644 --- a/src/api/system/user.ts +++ b/src/api/system/user.ts @@ -6,6 +6,7 @@ export interface UserQuery extends BasePageQuery { status?: number; userId?: number; username?: string; + nickname?: string, } /** diff --git a/src/components/QrCodeHover/index.vue b/src/components/QrCodeHover/index.vue index 4dc2dcf..ca4026c 100644 --- a/src/components/QrCodeHover/index.vue +++ b/src/components/QrCodeHover/index.vue @@ -7,16 +7,27 @@
微信扫码访问
+ + 复制链接 + +
diff --git a/src/views/system/qyUser/tree.vue b/src/views/system/qyUser/tree.vue new file mode 100644 index 0000000..83591dd --- /dev/null +++ b/src/views/system/qyUser/tree.vue @@ -0,0 +1,210 @@ + + + + + diff --git a/src/views/system/user/hook.tsx b/src/views/system/user/hook.tsx index 11461fc..42ecab8 100644 --- a/src/views/system/user/hook.tsx +++ b/src/views/system/user/hook.tsx @@ -21,9 +21,10 @@ import { reactive, ref, computed, onMounted, toRaw, h } from "vue"; import { CommonUtils } from "@/utils/common"; import { addDialog } from "@/components/ReDialog"; import { handleTree, setDisabledForTreeOptions } from "@/utils/tree"; -import { getDeptListApi } from "@/api/system/dept"; +import { getQyDeptListApi } from "@/api/system/dept"; import { getPostListApi } from "@/api/system/post"; import { getRoleListApi } from "@/api/system/role"; +import { useWxStore } from "@/store/modules/wx"; export function useHook() { const searchFormParams = reactive({ @@ -31,6 +32,7 @@ export function useHook() { phoneNumber: undefined, status: undefined, username: undefined, + nickname: undefined, timeRangeColumn: "createTime" }); @@ -51,6 +53,8 @@ export function useHook() { const postOptions = ref([]); const roleOptions = ref([]); + const wxStore = useWxStore(); + const columns: TableColumnList = [ { label: "用户编号", @@ -153,10 +157,8 @@ export function useHook() { function onChange({ row, index }) { ElMessageBox.confirm( - `确认要${ - row.status === 0 ? "停用" : "启用" - }${ - row.username + `确认要${row.status === 0 ? "停用" : "启用" + }${row.username }用户吗?`, "系统提示", { @@ -356,7 +358,7 @@ export function useHook() { onMounted(async () => { onSearch(); - const deptResponse = await getDeptListApi(); + const deptResponse = await getQyDeptListApi(wxStore.corpid); deptTreeList.value = await setDisabledForTreeOptions( handleTree(deptResponse.data), "status" diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index 272a71d..73b898e 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -50,13 +50,12 @@ watch(
- - + + + + + - + 搜索 @@ -112,90 +106,42 @@ watch(