FEAT => 本次更新项目为:
This commit is contained in:
@@ -100,7 +100,7 @@ export default function AccountSelection({
|
|||||||
textOverflow: "ellipsis",
|
textOverflow: "ellipsis",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{acc.userName}({acc.realName})- {acc.departmentName}
|
【{acc.realName}】 {acc.userName}
|
||||||
</div>
|
</div>
|
||||||
{!readonly && (
|
{!readonly && (
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export interface ContentItem {
|
|||||||
|
|
||||||
// 组件属性接口
|
// 组件属性接口
|
||||||
export interface ContentSelectionProps {
|
export interface ContentSelectionProps {
|
||||||
selectedContent: ContentItem[];
|
selectedOptions: ContentItem[];
|
||||||
onSelect: (selectedItems: ContentItem[]) => void;
|
onSelect: (selectedItems: ContentItem[]) => void;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ const formatDate = (dateStr?: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default function ContentSelection({
|
export default function ContentSelection({
|
||||||
selectedContent,
|
selectedOptions,
|
||||||
onSelect,
|
onSelect,
|
||||||
placeholder = "选择内容库",
|
placeholder = "选择内容库",
|
||||||
className = "",
|
className = "",
|
||||||
@@ -57,7 +57,7 @@ export default function ContentSelection({
|
|||||||
// 删除已选内容库
|
// 删除已选内容库
|
||||||
const handleRemoveLibrary = (id: number) => {
|
const handleRemoveLibrary = (id: number) => {
|
||||||
if (readonly) return;
|
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) => {
|
const handleLibraryToggle = (library: ContentItem) => {
|
||||||
if (readonly) return;
|
if (readonly) return;
|
||||||
const newSelected = selectedContent.some(c => c.id === library.id)
|
const newSelected = selectedOptions.some(c => c.id === library.id)
|
||||||
? selectedContent.filter(c => c.id !== library.id)
|
? selectedOptions.filter(c => c.id !== library.id)
|
||||||
: [...selectedContent, library];
|
: [...selectedOptions, library];
|
||||||
onSelect(newSelected);
|
onSelect(newSelected);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 获取显示文本
|
// 获取显示文本
|
||||||
const getDisplayText = () => {
|
const getDisplayText = () => {
|
||||||
if (selectedContent.length === 0) return "";
|
if (selectedOptions.length === 0) return "";
|
||||||
return `已选择 ${selectedContent.length} 个内容库`;
|
return `已选择 ${selectedOptions.length} 个内容库`;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 确认选择
|
// 确认选择
|
||||||
const handleConfirm = () => {
|
const handleConfirm = () => {
|
||||||
if (onConfirm) {
|
if (onConfirm) {
|
||||||
onConfirm(selectedContent);
|
onConfirm(selectedOptions);
|
||||||
}
|
}
|
||||||
setRealVisible(false);
|
setRealVisible(false);
|
||||||
};
|
};
|
||||||
@@ -161,7 +161,7 @@ export default function ContentSelection({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{/* 已选内容库列表窗口 */}
|
{/* 已选内容库列表窗口 */}
|
||||||
{showSelectedList && selectedContent.length > 0 && (
|
{showSelectedList && selectedOptions.length > 0 && (
|
||||||
<div
|
<div
|
||||||
className={style.selectedListWindow}
|
className={style.selectedListWindow}
|
||||||
style={{
|
style={{
|
||||||
@@ -173,7 +173,7 @@ export default function ContentSelection({
|
|||||||
background: "#fff",
|
background: "#fff",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{selectedContent.map(item => (
|
{selectedOptions.map(item => (
|
||||||
<div
|
<div
|
||||||
key={item.id}
|
key={item.id}
|
||||||
className={style.selectedListRow}
|
className={style.selectedListRow}
|
||||||
@@ -243,7 +243,7 @@ export default function ContentSelection({
|
|||||||
currentPage={currentPage}
|
currentPage={currentPage}
|
||||||
totalPages={totalPages}
|
totalPages={totalPages}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
selectedCount={selectedContent.length}
|
selectedCount={selectedOptions.length}
|
||||||
onPageChange={setCurrentPage}
|
onPageChange={setCurrentPage}
|
||||||
onCancel={() => setRealVisible(false)}
|
onCancel={() => setRealVisible(false)}
|
||||||
onConfirm={handleConfirm}
|
onConfirm={handleConfirm}
|
||||||
@@ -260,7 +260,7 @@ export default function ContentSelection({
|
|||||||
{libraries.map(item => (
|
{libraries.map(item => (
|
||||||
<label key={item.id} className={style.libraryItem}>
|
<label key={item.id} className={style.libraryItem}>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={selectedContent.map(c => c.id).includes(item.id)}
|
checked={selectedOptions.map(c => c.id).includes(item.id)}
|
||||||
onChange={() => !readonly && handleLibraryToggle(item)}
|
onChange={() => !readonly && handleLibraryToggle(item)}
|
||||||
disabled={readonly}
|
disabled={readonly}
|
||||||
className={style.checkboxWrapper}
|
className={style.checkboxWrapper}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export interface GroupSelectionItem {
|
|||||||
|
|
||||||
// 组件属性接口
|
// 组件属性接口
|
||||||
export interface GroupSelectionProps {
|
export interface GroupSelectionProps {
|
||||||
selectedGroups: GroupSelectionItem[];
|
selectedOptions: GroupSelectionItem[];
|
||||||
onSelect: (groups: GroupSelectionItem[]) => void;
|
onSelect: (groups: GroupSelectionItem[]) => void;
|
||||||
onSelectDetail?: (groups: WechatGroup[]) => void;
|
onSelectDetail?: (groups: WechatGroup[]) => void;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import style from "./index.module.scss";
|
|||||||
import SelectionPopup from "./selectionPopup";
|
import SelectionPopup from "./selectionPopup";
|
||||||
import { GroupSelectionProps } from "./data";
|
import { GroupSelectionProps } from "./data";
|
||||||
export default function GroupSelection({
|
export default function GroupSelection({
|
||||||
selectedGroups,
|
selectedOptions,
|
||||||
onSelect,
|
onSelect,
|
||||||
onSelectDetail,
|
onSelectDetail,
|
||||||
placeholder = "选择群聊",
|
placeholder = "选择群聊",
|
||||||
@@ -24,7 +24,7 @@ export default function GroupSelection({
|
|||||||
// 删除已选群聊
|
// 删除已选群聊
|
||||||
const handleRemoveGroup = (id: string) => {
|
const handleRemoveGroup = (id: string) => {
|
||||||
if (readonly) return;
|
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 = () => {
|
const getDisplayText = () => {
|
||||||
if (selectedGroups.length === 0) return "";
|
if (selectedOptions.length === 0) return "";
|
||||||
return `已选择 ${selectedGroups.length} 个群聊`;
|
return `已选择 ${selectedOptions.length} 个群聊`;
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -67,7 +67,7 @@ export default function GroupSelection({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{/* 已选群聊列表窗口 */}
|
{/* 已选群聊列表窗口 */}
|
||||||
{showSelectedList && selectedGroups.length > 0 && (
|
{showSelectedList && selectedOptions.length > 0 && (
|
||||||
<div
|
<div
|
||||||
className={style.selectedListWindow}
|
className={style.selectedListWindow}
|
||||||
style={{
|
style={{
|
||||||
@@ -79,7 +79,7 @@ export default function GroupSelection({
|
|||||||
background: "#fff",
|
background: "#fff",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{selectedGroups.map(group => (
|
{selectedOptions.map(group => (
|
||||||
<div key={group.id} className={style.selectedListRow}>
|
<div key={group.id} className={style.selectedListRow}>
|
||||||
<div className={style.selectedListRowContent}>
|
<div className={style.selectedListRowContent}>
|
||||||
<Avatar src={group.avatar} />
|
<Avatar src={group.avatar} />
|
||||||
@@ -115,7 +115,7 @@ export default function GroupSelection({
|
|||||||
<SelectionPopup
|
<SelectionPopup
|
||||||
visible={realVisible}
|
visible={realVisible}
|
||||||
onVisibleChange={setRealVisible}
|
onVisibleChange={setRealVisible}
|
||||||
selectedGroups={selectedGroups}
|
selectedOptions={selectedOptions}
|
||||||
onSelect={onSelect}
|
onSelect={onSelect}
|
||||||
onSelectDetail={onSelectDetail}
|
onSelectDetail={onSelectDetail}
|
||||||
readonly={readonly}
|
readonly={readonly}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ const ComponentTest: React.FC = () => {
|
|||||||
<div style={{ padding: "16px 0" }}>
|
<div style={{ padding: "16px 0" }}>
|
||||||
<h3 style={{ marginBottom: 16 }}>ContentSelection 组件测试</h3>
|
<h3 style={{ marginBottom: 16 }}>ContentSelection 组件测试</h3>
|
||||||
<ContentSelection
|
<ContentSelection
|
||||||
selectedContent={selectedContent}
|
selectedOptions={selectedContent}
|
||||||
onSelect={setSelectedContent}
|
onSelect={setSelectedContent}
|
||||||
placeholder="请选择内容库"
|
placeholder="请选择内容库"
|
||||||
showSelectedList={true}
|
showSelectedList={true}
|
||||||
@@ -84,7 +84,7 @@ const ComponentTest: React.FC = () => {
|
|||||||
<div style={{ padding: "16px 0" }}>
|
<div style={{ padding: "16px 0" }}>
|
||||||
<h3 style={{ marginBottom: 16 }}>GroupSelection 组件测试</h3>
|
<h3 style={{ marginBottom: 16 }}>GroupSelection 组件测试</h3>
|
||||||
<GroupSelection
|
<GroupSelection
|
||||||
selectedGroups={selectedGroups}
|
selectedOptions={selectedGroups}
|
||||||
onSelect={setSelectedGroups}
|
onSelect={setSelectedGroups}
|
||||||
placeholder="请选择微信群组"
|
placeholder="请选择微信群组"
|
||||||
showSelectedList={true}
|
showSelectedList={true}
|
||||||
|
|||||||
Reference in New Issue
Block a user