diff --git a/web/src/api/white-list/index.ts b/web/src/api/white-list/index.ts index e7f51681..3ce52f59 100644 --- a/web/src/api/white-list/index.ts +++ b/web/src/api/white-list/index.ts @@ -1,8 +1,7 @@ import { IGetWhiteListsRequest, IIWhiteListsDto, - IPostAddWhiteListsRequest, - IPostUpdateWhiteListsRequest, + IPostAddOrUpdateWhiteListsRequest, IWhiteListsResponse, } from "../../dtos/white-list"; import { Get, Post } from "../http-client"; @@ -16,22 +15,26 @@ export const GetWhiteLists = async (data: IGetWhiteListsRequest) => { ); }; -export const PostAddWhiteList = async (data: IPostAddWhiteListsRequest) => { +export const PostAddWhiteList = async ( + data: IPostAddOrUpdateWhiteListsRequest +) => { return await Post( - "/api/WeChat/work/meeting/whitelist/add", + "/api/WeChat/work/meeting/whitelists/add", data ); }; export const PostUpdateWhiteList = async ( - data: IPostUpdateWhiteListsRequest + data: IPostAddOrUpdateWhiteListsRequest ) => { return await Post( - "/api/WeChat/work/meeting/whitelist/update", + "/api/WeChat/work/meeting/whitelists/update", data ); }; export const PostDeleteWhiteList = async (id: string) => { - return await Post("/api/WeChat/work/meeting/whitelist/delete", { Ids: [id] }); + return await Post("/api/WeChat/work/meeting/whitelist/delete", { + meetingCode: id, + }); }; diff --git a/web/src/dtos/white-list/index.ts b/web/src/dtos/white-list/index.ts index adfc7c26..fad9606f 100644 --- a/web/src/dtos/white-list/index.ts +++ b/web/src/dtos/white-list/index.ts @@ -13,17 +13,17 @@ export interface IIWhiteListsDto { createdDate: string; } -export interface IWhiteListsResponse { - whitelist: IIWhiteListsDto[]; - count: number; +export interface IMeetingGroupsDto { + meetingCode: string; + whitelists: IIWhiteListsDto; } -export interface IPostAddWhiteListsRequest { - MeetingCode: string; - NotifyUserId: string; +export interface IWhiteListsResponse { + groups: IMeetingGroupsDto[]; + count: number; } -export interface IPostUpdateWhiteListsRequest - extends IPostAddWhiteListsRequest { - Id?: string; +export interface IPostAddOrUpdateWhiteListsRequest { + meetingCode: string; + notifyUserIds: string[]; } diff --git a/web/src/pages/meeting-list/index.tsx b/web/src/pages/meeting-list/index.tsx index d9c46213..142752d7 100644 --- a/web/src/pages/meeting-list/index.tsx +++ b/web/src/pages/meeting-list/index.tsx @@ -29,7 +29,10 @@ import ContentCopyIcon from "@mui/icons-material/ContentCopy"; const asyncTootip = (title: string, style: string) => { return ( - + {title}} + className={style} + > {title} ); diff --git a/web/src/pages/meeting-white-list/hook.ts b/web/src/pages/meeting-white-list/hook.ts index 80d70926..ad793910 100644 --- a/web/src/pages/meeting-white-list/hook.ts +++ b/web/src/pages/meeting-white-list/hook.ts @@ -6,7 +6,7 @@ import { PostDeleteWhiteList, PostUpdateWhiteList, } from "../../api/white-list"; -import { IIWhiteListsDto } from "../../dtos/white-list"; +import { IIWhiteListsDto, IMeetingGroupsDto } from "../../dtos/white-list"; import { IAddEditWhiteListDto, IWhiteListsRequest } from "./props"; const useAction = () => { @@ -44,7 +44,7 @@ const useAction = () => { Id: "", }); - const [rows, setRows] = useState([]); + const [rows, setRows] = useState([]); const handleCopyMeetingLink = (link: string) => { if (link) { @@ -65,8 +65,8 @@ const useAction = () => { GetWhiteLists(data) .then((res) => { - if (res && res.whitelist) { - setRows(res.whitelist); + if (res && res.groups) { + setRows(res.groups ?? []); setWhiteListsRequest((prev) => ({ ...prev, rowCount: res.count })); loadingAction.setFalse(); } else { @@ -92,13 +92,14 @@ const useAction = () => { : PostUpdateWhiteList; setUpdateLoading(true); + + const ids = + typeof addEditWhiteListDto.NotifyUserId !== "string" + ? addEditWhiteListDto.NotifyUserId + : addEditWhiteListDto.NotifyUserId.split(",").filter((item) => item); fun({ - MeetingCode: addEditWhiteListDto.MeetingCode, - NotifyUserId: addEditWhiteListDto.NotifyUserId, - Id: - addEditWhiteListDto.type === "edit" - ? addEditWhiteListDto.Id - : undefined, + meetingCode: addEditWhiteListDto.MeetingCode, + notifyUserIds: ids, }) .then((res) => { setAddEditWhiteListDto((prev) => ({ diff --git a/web/src/pages/meeting-white-list/index.module.scss b/web/src/pages/meeting-white-list/index.module.scss index ef6df3ab..2751f84b 100644 --- a/web/src/pages/meeting-white-list/index.module.scss +++ b/web/src/pages/meeting-white-list/index.module.scss @@ -114,3 +114,17 @@ font-size: 1.8rem; cursor: pointer; } + +.userNameItem { + display: flex; + align-items: center; + width: 100%; + position: relative; +} + +.addUsersTips { + margin-top: 0.5rem; + position: absolute; + font-size: 0.85rem; + color: #a19d9d; +} diff --git a/web/src/pages/meeting-white-list/index.tsx b/web/src/pages/meeting-white-list/index.tsx index f9087d07..5d01bf2a 100644 --- a/web/src/pages/meeting-white-list/index.tsx +++ b/web/src/pages/meeting-white-list/index.tsx @@ -10,6 +10,7 @@ import { DialogTitle, Snackbar, TextField, + Tooltip, } from "@mui/material"; import dayjs from "dayjs"; import CloseIcon from "@mui/icons-material/Close"; @@ -18,6 +19,7 @@ import { DataGrid, GridColDef } from "@mui/x-data-grid"; import useAction from "./hook"; import style from "./index.module.scss"; +import { IIWhiteListsDto } from "../../dtos/white-list"; const MeetingWhiteList = () => { const { @@ -57,24 +59,41 @@ const MeetingWhiteList = () => { minWidth: 100, align: "center", headerAlign: "center", - }, - - { - field: "createdDate", - headerName: "创建时间", - align: "center", - headerAlign: "center", - flex: 1, - minWidth: 160, renderCell: (params) => { + let ids = ""; + params.row.whitelists?.map((item: IIWhiteListsDto, index: number) => { + ids += + item.notifyUserId + + (params.row.whitelists.length > 0 && + index !== params.row.whitelists.length - 1 + ? "," + : ""); + }); + return ( - - {dayjs(params.row.createdDate).format("YYYY-MM-DD HH:mm:ss")} - + {ids} + } + > +
+ {params.row.whitelists?.map( + (item: IIWhiteListsDto, index: number) => { + return ( + + {item.notifyUserId} + {params.row.whitelists.length > 0 && + index !== params.row.whitelists.length - 1 && + ","} + + ); + } + )} +
+
); }, }, - { field: "fun", headerName: "操作", @@ -88,13 +107,16 @@ const MeetingWhiteList = () => { size="small" style={{ marginRight: 16 }} onClick={() => { + const ids = params.row.whitelists?.map( + (item: IIWhiteListsDto) => item.notifyUserId + ); setOpenAddWhiteList(true); setAddEditWhiteListDto((prev) => ({ ...prev, MeetingCode: params.row.meetingCode, - NotifyUserId: params.row.notifyUserId, + NotifyUserId: ids, type: "edit", - Id: params.row.id, + Id: params.row.meetingCode, })); }} > @@ -107,7 +129,7 @@ const MeetingWhiteList = () => { confirmDialogAction.setTrue(); setAddEditWhiteListDto((prev) => ({ ...prev, - Id: params.row.id, + Id: params.row.meetingCode, })); }} > @@ -168,6 +190,7 @@ const MeetingWhiteList = () => { loading={loading} paginationMode="server" rowHeight={56} + getRowId={(row) => row.meetingCode} style={{ height: 700, width: "95%" }} rowCount={whiteListsRequest.rowCount} onPageChange={(value) => @@ -226,24 +249,29 @@ const MeetingWhiteList = () => { /> -
-
用户企微名
-
- - setAddEditWhiteListDto((prev) => ({ - ...prev, - NotifyUserId: e.target.value, - })) - } - /> +
+
+
用户企微名
+
+ + setAddEditWhiteListDto((prev) => ({ + ...prev, + NotifyUserId: e.target.value, + })) + } + /> +
+ 使用英文分隔符以添加多个用户到白名单(如:a,b) +
+
@@ -277,7 +305,7 @@ const MeetingWhiteList = () => { id="alert-dialog-title-cancel" sx={{ backgroundColor: "#f2f3f4" }} > - ⚠️提示 + ⚠️ 提示