FEAT => 本次更新项目为:

This commit is contained in:
超级老白兔
2025-08-08 15:03:45 +08:00
parent 8749a59957
commit 0abddfbfb3
6 changed files with 24 additions and 24 deletions

View File

@@ -100,7 +100,7 @@ export default function AccountSelection({
textOverflow: "ellipsis",
}}
>
{acc.userName}{acc.realName}- {acc.departmentName}
{acc.realName} {acc.userName}
</div>
{!readonly && (
<Button

View File

@@ -7,7 +7,7 @@ export interface ContentItem {
// 组件属性接口
export interface ContentSelectionProps {
selectedContent: ContentItem[];
selectedOptions: ContentItem[];
onSelect: (selectedItems: ContentItem[]) => void;
placeholder?: string;
className?: string;

View File

@@ -34,7 +34,7 @@ const formatDate = (dateStr?: string) => {
};
export default function ContentSelection({
selectedContent,
selectedOptions,
onSelect,
placeholder = "选择内容库",
className = "",
@@ -57,7 +57,7 @@ export default function ContentSelection({
// 删除已选内容库
const handleRemoveLibrary = (id: number) => {
if (readonly) return;
onSelect(selectedContent.filter(c => c.id !== id));
onSelect(selectedOptions.filter(c => c.id !== id));
};
// 受控弹窗逻辑
@@ -120,22 +120,22 @@ export default function ContentSelection({
// 处理内容库选择
const handleLibraryToggle = (library: ContentItem) => {
if (readonly) return;
const newSelected = selectedContent.some(c => c.id === library.id)
? selectedContent.filter(c => c.id !== library.id)
: [...selectedContent, library];
const newSelected = selectedOptions.some(c => c.id === library.id)
? selectedOptions.filter(c => c.id !== library.id)
: [...selectedOptions, library];
onSelect(newSelected);
};
// 获取显示文本
const getDisplayText = () => {
if (selectedContent.length === 0) return "";
return `已选择 ${selectedContent.length} 个内容库`;
if (selectedOptions.length === 0) return "";
return `已选择 ${selectedOptions.length} 个内容库`;
};
// 确认选择
const handleConfirm = () => {
if (onConfirm) {
onConfirm(selectedContent);
onConfirm(selectedOptions);
}
setRealVisible(false);
};
@@ -161,7 +161,7 @@ export default function ContentSelection({
</div>
)}
{/* 已选内容库列表窗口 */}
{showSelectedList && selectedContent.length > 0 && (
{showSelectedList && selectedOptions.length > 0 && (
<div
className={style.selectedListWindow}
style={{
@@ -173,7 +173,7 @@ export default function ContentSelection({
background: "#fff",
}}
>
{selectedContent.map(item => (
{selectedOptions.map(item => (
<div
key={item.id}
className={style.selectedListRow}
@@ -243,7 +243,7 @@ export default function ContentSelection({
currentPage={currentPage}
totalPages={totalPages}
loading={loading}
selectedCount={selectedContent.length}
selectedCount={selectedOptions.length}
onPageChange={setCurrentPage}
onCancel={() => setRealVisible(false)}
onConfirm={handleConfirm}
@@ -260,7 +260,7 @@ export default function ContentSelection({
{libraries.map(item => (
<label key={item.id} className={style.libraryItem}>
<Checkbox
checked={selectedContent.map(c => c.id).includes(item.id)}
checked={selectedOptions.map(c => c.id).includes(item.id)}
onChange={() => !readonly && handleLibraryToggle(item)}
disabled={readonly}
className={style.checkboxWrapper}

View File

@@ -25,7 +25,7 @@ export interface GroupSelectionItem {
// 组件属性接口
export interface GroupSelectionProps {
selectedGroups: GroupSelectionItem[];
selectedOptions: GroupSelectionItem[];
onSelect: (groups: GroupSelectionItem[]) => void;
onSelectDetail?: (groups: WechatGroup[]) => void;
placeholder?: string;

View File

@@ -6,7 +6,7 @@ import style from "./index.module.scss";
import SelectionPopup from "./selectionPopup";
import { GroupSelectionProps } from "./data";
export default function GroupSelection({
selectedGroups,
selectedOptions,
onSelect,
onSelectDetail,
placeholder = "选择群聊",
@@ -24,7 +24,7 @@ export default function GroupSelection({
// 删除已选群聊
const handleRemoveGroup = (id: string) => {
if (readonly) return;
onSelect(selectedGroups.filter(g => g.id !== id));
onSelect(selectedOptions.filter(g => g.id !== id));
};
// 受控弹窗逻辑
@@ -42,8 +42,8 @@ export default function GroupSelection({
// 获取显示文本
const getDisplayText = () => {
if (selectedGroups.length === 0) return "";
return `已选择 ${selectedGroups.length} 个群聊`;
if (selectedOptions.length === 0) return "";
return `已选择 ${selectedOptions.length} 个群聊`;
};
return (
@@ -67,7 +67,7 @@ export default function GroupSelection({
</div>
)}
{/* 已选群聊列表窗口 */}
{showSelectedList && selectedGroups.length > 0 && (
{showSelectedList && selectedOptions.length > 0 && (
<div
className={style.selectedListWindow}
style={{
@@ -79,7 +79,7 @@ export default function GroupSelection({
background: "#fff",
}}
>
{selectedGroups.map(group => (
{selectedOptions.map(group => (
<div key={group.id} className={style.selectedListRow}>
<div className={style.selectedListRowContent}>
<Avatar src={group.avatar} />
@@ -115,7 +115,7 @@ export default function GroupSelection({
<SelectionPopup
visible={realVisible}
onVisibleChange={setRealVisible}
selectedGroups={selectedGroups}
selectedOptions={selectedOptions}
onSelect={onSelect}
onSelectDetail={onSelectDetail}
readonly={readonly}

View File

@@ -58,7 +58,7 @@ const ComponentTest: React.FC = () => {
<div style={{ padding: "16px 0" }}>
<h3 style={{ marginBottom: 16 }}>ContentSelection </h3>
<ContentSelection
selectedContent={selectedContent}
selectedOptions={selectedContent}
onSelect={setSelectedContent}
placeholder="请选择内容库"
showSelectedList={true}
@@ -84,7 +84,7 @@ const ComponentTest: React.FC = () => {
<div style={{ padding: "16px 0" }}>
<h3 style={{ marginBottom: 16 }}>GroupSelection </h3>
<GroupSelection
selectedGroups={selectedGroups}
selectedOptions={selectedGroups}
onSelect={setSelectedGroups}
placeholder="请选择微信群组"
showSelectedList={true}