Initial import of weiyuan frontend
This commit is contained in:
@@ -0,0 +1,630 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { timestamp2string } from '../../helpers/utils';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
Button,
|
||||
Tag,
|
||||
Progress,
|
||||
Form,
|
||||
Toast,
|
||||
Empty,
|
||||
Spin,
|
||||
Typography,
|
||||
} from '@douyinfe/semi-ui';
|
||||
import {
|
||||
Wallet,
|
||||
Key,
|
||||
FileClock,
|
||||
Plus,
|
||||
RefreshCw,
|
||||
Pencil,
|
||||
Clock,
|
||||
TrendingUp,
|
||||
Coins,
|
||||
KeyRound,
|
||||
} from 'lucide-react';
|
||||
import { API } from '../../helpers/api';
|
||||
import { showError } from '../../helpers';
|
||||
import {
|
||||
renderQuota,
|
||||
getCurrencyConfig,
|
||||
displayAmountToQuota,
|
||||
} from '../../helpers/render';
|
||||
import OrgHero from './components/OrgHero';
|
||||
import OrgModal from './components/OrgModal';
|
||||
import OrgNicknameModal from './components/OrgNicknameModal';
|
||||
import OrgPasswordModal from './components/OrgPasswordModal';
|
||||
import { orgStatusColor } from './components/orgStatus';
|
||||
import OrgPanel from './components/OrgPanel';
|
||||
import StatCard from './components/OrgStatCard';
|
||||
|
||||
// 时段问候(工作台 hero 签名区的 eyebrow)
|
||||
const getGreeting = (t) => {
|
||||
const hour = new Date().getHours();
|
||||
if (hour < 6) return t('凌晨好');
|
||||
if (hour < 12) return t('早上好');
|
||||
if (hour < 14) return t('中午好');
|
||||
if (hour < 18) return t('下午好');
|
||||
return t('晚上好');
|
||||
};
|
||||
|
||||
const { Text, Title } = Typography;
|
||||
const getOrgHeaders = (orgId) => ({ 'X-Org-Id': String(orgId) });
|
||||
const PERIODIC_QUOTA_PERIODS = new Set(['daily', 'weekly', 'monthly']);
|
||||
|
||||
const isPeriodicQuotaPeriod = (period) => PERIODIC_QUOTA_PERIODS.has(period);
|
||||
const safeQuotaNumber = (value) => Math.max(0, Number(value || 0));
|
||||
|
||||
const quotaPeriodResetHint = (t, period) => {
|
||||
switch (period) {
|
||||
case 'daily':
|
||||
return t('每日 00:00 重置(企业时区)');
|
||||
case 'weekly':
|
||||
return t('每周一 00:00 重置(企业时区)');
|
||||
case 'monthly':
|
||||
return t('自然月:每月 1 日 00:00 重置');
|
||||
default:
|
||||
return t('按周期重置');
|
||||
}
|
||||
};
|
||||
|
||||
const quotaPeriodLimitLabel = (t, period) => {
|
||||
switch (period) {
|
||||
case 'daily':
|
||||
return t('每日个人上限');
|
||||
case 'weekly':
|
||||
return t('每周个人上限');
|
||||
case 'monthly':
|
||||
return t('每月个人上限');
|
||||
default:
|
||||
return t('个人终身上限');
|
||||
}
|
||||
};
|
||||
|
||||
const roleLabel = (t, role) =>
|
||||
role === 'owner'
|
||||
? t('所有者')
|
||||
: role === 'admin'
|
||||
? t('管理员')
|
||||
: role === 'super_admin'
|
||||
? t('超级管理员')
|
||||
: t('成员');
|
||||
|
||||
const reqStatusTag = (t, status) => {
|
||||
const map = {
|
||||
pending: { text: t('待审批') },
|
||||
approved: { text: t('已通过') },
|
||||
rejected: { text: t('已拒绝') },
|
||||
canceled: { text: t('已取消') },
|
||||
expired: { text: t('已过期') },
|
||||
};
|
||||
const s = map[status] || { text: status };
|
||||
return <Tag color={orgStatusColor(status)}>{s.text}</Tag>;
|
||||
};
|
||||
|
||||
const isFeatureEnabled = (flags, key) => {
|
||||
const value = flags?.[key];
|
||||
return value === true || value === 'true' || value === '1' || value === 1;
|
||||
};
|
||||
|
||||
// 用量趋势小块:窗口标题 + 消耗 + 请求数
|
||||
const UsageBlock = ({ t, title, data }) => (
|
||||
<div className='flex-1 min-w-[140px] rounded-lg border border-[var(--border-subtle)] bg-[var(--surface-card)] px-4 py-3'>
|
||||
<div className='text-xs font-medium text-gray-500 dark:text-gray-400 mb-1'>
|
||||
{title}
|
||||
</div>
|
||||
<div className='text-lg font-semibold tabular-nums text-[var(--text-primary)]'>
|
||||
{renderQuota(data?.quota || 0, 2)}
|
||||
</div>
|
||||
<div className='text-xs text-gray-500 mt-0.5'>
|
||||
{t('请求数')} {data?.requests || 0} · {t('Token 总量')}{' '}
|
||||
{data?.tokens || 0}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
// 企业工作台:员工自助门户(§36.1)——个人额度/用量统计/令牌/申请。
|
||||
const OrgWorkbench = ({ orgId, orgRole, featureFlags }) => {
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
const [summary, setSummary] = useState(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [projects, setProjects] = useState([]);
|
||||
const [reqModal, setReqModal] = useState(false);
|
||||
const [formApi, setFormApi] = useState(null);
|
||||
const [nickModal, setNickModal] = useState(false);
|
||||
// 自助改密(方案 §12.8)
|
||||
const [pwdModal, setPwdModal] = useState(false);
|
||||
const [approvers, setApprovers] = useState([]);
|
||||
|
||||
const approvalEnabled = isFeatureEnabled(featureFlags, 'approval');
|
||||
const projectEnabled = isFeatureEnabled(featureFlags, 'project');
|
||||
const role = orgRole || summary?.member?.role;
|
||||
|
||||
const fetchSummary = useCallback(
|
||||
async (silent = false) => {
|
||||
if (!orgId) return;
|
||||
if (!silent) setLoading(true);
|
||||
try {
|
||||
const res = await API.get('/api/org/me/summary', {
|
||||
headers: getOrgHeaders(orgId),
|
||||
});
|
||||
if (res.data.success) {
|
||||
setSummary(res.data.data);
|
||||
} else {
|
||||
showError(res.data.message);
|
||||
}
|
||||
} catch (err) {
|
||||
showError(err.message);
|
||||
} finally {
|
||||
if (!silent) setLoading(false);
|
||||
}
|
||||
},
|
||||
[orgId],
|
||||
);
|
||||
|
||||
const fetchProjects = useCallback(async () => {
|
||||
if (!orgId || !projectEnabled) {
|
||||
setProjects([]);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const res = await API.get('/api/org/project', {
|
||||
headers: getOrgHeaders(orgId),
|
||||
});
|
||||
if (res.data.success) setProjects(res.data.data || []);
|
||||
} catch {
|
||||
/* 忽略:提额申请仍可选部门 */
|
||||
}
|
||||
}, [orgId, projectEnabled]);
|
||||
|
||||
useEffect(() => {
|
||||
fetchSummary();
|
||||
fetchProjects();
|
||||
}, [fetchSummary, fetchProjects]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!orgId) return undefined;
|
||||
|
||||
let lastRefreshAt = 0;
|
||||
const refreshSilently = () => {
|
||||
const now = Date.now();
|
||||
if (now - lastRefreshAt < 5000) return;
|
||||
lastRefreshAt = now;
|
||||
fetchSummary(true);
|
||||
};
|
||||
const handleVisibilityChange = () => {
|
||||
if (document.visibilityState === 'visible') {
|
||||
refreshSilently();
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('focus', refreshSilently);
|
||||
document.addEventListener('visibilitychange', handleVisibilityChange);
|
||||
const timer = window.setInterval(() => {
|
||||
if (document.visibilityState === 'visible') {
|
||||
refreshSilently();
|
||||
}
|
||||
}, 60000);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('focus', refreshSilently);
|
||||
document.removeEventListener('visibilitychange', handleVisibilityChange);
|
||||
window.clearInterval(timer);
|
||||
};
|
||||
}, [orgId, fetchSummary]);
|
||||
|
||||
const quotaLimit = safeQuotaNumber(summary?.my_quota?.quota_limit);
|
||||
const usedQuota = safeQuotaNumber(summary?.my_quota?.used_quota);
|
||||
const totalUsedQuota = safeQuotaNumber(
|
||||
summary?.my_quota?.total_used_quota ?? usedQuota,
|
||||
);
|
||||
const quotaPeriod = summary?.my_quota?.quota_period || 'none';
|
||||
const resetSource = summary?.reset_source || '';
|
||||
const resetAt = safeQuotaNumber(summary?.reset_at);
|
||||
const usage = summary?.usage || {};
|
||||
const quotaIsPeriodic = isPeriodicQuotaPeriod(quotaPeriod);
|
||||
const quotaResetHint = quotaPeriodResetHint(t, quotaPeriod);
|
||||
|
||||
const quotaPercent = useMemo(() => {
|
||||
if (!quotaLimit || quotaLimit <= 0) return 0;
|
||||
return Math.min(100, Math.round((usedQuota / quotaLimit) * 100));
|
||||
}, [quotaLimit, usedQuota]);
|
||||
|
||||
// 可用额度:有个人上限时 = 上限-已用;无个人上限时不展示整个企业池数字
|
||||
// (会被成员误读为「我的额度」),仅提示从共享池扣减。
|
||||
const availableDisplay = useMemo(() => {
|
||||
if (quotaLimit > 0) {
|
||||
return renderQuota(Math.max(0, quotaLimit - usedQuota), 2);
|
||||
}
|
||||
return t('共享企业池');
|
||||
}, [quotaLimit, usedQuota, t]);
|
||||
|
||||
const availableHint =
|
||||
quotaLimit > 0
|
||||
? quotaIsPeriodic
|
||||
? t('当前周期个人额度剩余')
|
||||
: t('个人额度上限内剩余')
|
||||
: t('未设个人上限,从企业统一额度池扣减');
|
||||
|
||||
const quotaUsageLabel = quotaIsPeriodic
|
||||
? t('本周期已用额度')
|
||||
: t('总已用额度');
|
||||
const quotaLimitLabel = quotaPeriodLimitLabel(t, quotaPeriod);
|
||||
const quotaLimitHint =
|
||||
quotaLimit > 0
|
||||
? quotaIsPeriodic
|
||||
? `${quotaLimitLabel} ${renderQuota(quotaLimit, 2)} · ${quotaResetHint}`
|
||||
: `${quotaLimitLabel} ${renderQuota(quotaLimit, 2)}`
|
||||
: t('未设个人上限');
|
||||
const resetHint =
|
||||
resetAt > 0
|
||||
? resetSource === 'member_quota'
|
||||
? quotaResetHint
|
||||
: resetSource === 'budget'
|
||||
? t('按预算周期重置')
|
||||
: t('按周期重置')
|
||||
: quotaIsPeriodic
|
||||
? quotaResetHint
|
||||
: t('无重置周期');
|
||||
const resetValue =
|
||||
resetAt > 0
|
||||
? timestamp2string(resetAt)
|
||||
: quotaIsPeriodic
|
||||
? t('待初始化')
|
||||
: t('不重置');
|
||||
|
||||
// 提额输入单位:跟随站点展示货币(TOKENS 模式下为原始额度单位)。
|
||||
// 每次 render 重新读取,不能用空依赖 memo:货币配置由 /api/status 异步写入
|
||||
// localStorage,冻结快照会导致 label 单位与提交时的换算口径脱节
|
||||
const deltaCurrency = getCurrencyConfig();
|
||||
const deltaIsToken = deltaCurrency.type === 'TOKENS';
|
||||
const deltaLabel = deltaIsToken
|
||||
? t('提额数量(额度单位)')
|
||||
: `${t('提额数量')}(${deltaCurrency.symbol})`;
|
||||
|
||||
// 提额申请目标选项:优先申请个人额度;部门/项目属于预算额度,周期可能不同。
|
||||
const subjectOptions = useMemo(() => {
|
||||
const opts = [];
|
||||
if (summary?.member?.id && quotaLimit > 0) {
|
||||
opts.push({
|
||||
label: `${t('我的个人额度')}(${quotaLimitLabel})`,
|
||||
value: `member:${summary.member.id}`,
|
||||
});
|
||||
}
|
||||
if (summary?.member?.department_id) {
|
||||
opts.push({
|
||||
label: `${t('部门')}:${summary.member.department_name || '#' + summary.member.department_id}`,
|
||||
value: `department:${summary.member.department_id}`,
|
||||
});
|
||||
}
|
||||
projects.forEach((p) => {
|
||||
opts.push({ label: `${t('项目')}:${p.name}`, value: `project:${p.id}` });
|
||||
});
|
||||
return opts;
|
||||
}, [summary, projects, quotaLimit, quotaLimitLabel, t]);
|
||||
|
||||
const openReqModal = async () => {
|
||||
setReqModal(true);
|
||||
try {
|
||||
const res = await API.get('/api/org/me/approvers', {
|
||||
headers: getOrgHeaders(orgId),
|
||||
});
|
||||
if (res.data.success) setApprovers(res.data.data?.approvers || []);
|
||||
} catch {
|
||||
/* 忽略:无上级候选时仅保留「企业管理员」默认项 */
|
||||
}
|
||||
};
|
||||
|
||||
const submitRequest = async () => {
|
||||
if (!formApi) return;
|
||||
let values;
|
||||
try {
|
||||
values = await formApi.validate();
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
const [subject_type, subject_id] = String(values.subject).split(':');
|
||||
try {
|
||||
const res = await API.post(
|
||||
'/api/org/requests',
|
||||
{
|
||||
request_type: 'quota',
|
||||
subject_type,
|
||||
subject_id: parseInt(subject_id, 10),
|
||||
cycle_quota_delta: displayAmountToQuota(values.delta),
|
||||
approver_member_id: values.approver || 0,
|
||||
reason: values.reason || '',
|
||||
},
|
||||
{ headers: getOrgHeaders(orgId) },
|
||||
);
|
||||
if (res.data.success) {
|
||||
Toast.success(t('提额申请已提交,等待管理员审批'));
|
||||
setReqModal(false);
|
||||
fetchSummary();
|
||||
} else {
|
||||
showError(res.data.message);
|
||||
}
|
||||
} catch (err) {
|
||||
showError(err.message);
|
||||
}
|
||||
};
|
||||
|
||||
const openNickModal = () => {
|
||||
setNickModal(true);
|
||||
};
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<div className='flex items-center justify-center h-full'>
|
||||
<Spin size='large' />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const memberName =
|
||||
summary?.member?.display_name || summary?.member?.username || '';
|
||||
|
||||
return (
|
||||
<div className='org-stagger p-4 sm:p-6 lg:p-8 space-y-5'>
|
||||
{/* 签名时刻:hero 问候区(每页至多一个签名渐变区,见方案 A+ 冲击力护栏) */}
|
||||
<OrgHero
|
||||
eyebrow={`${getGreeting(t)}${memberName ? ',' + memberName : ''}`}
|
||||
title={summary?.organization?.name || t('企业工作台')}
|
||||
subtitle={`${t('个人工作台')} · ${t('我的角色')}:${roleLabel(t, role)}${summary?.member?.department_name ? ' · ' + summary.member.department_name : ''}`}
|
||||
actions={
|
||||
<>
|
||||
<Button
|
||||
theme='light'
|
||||
icon={<Pencil size={14} />}
|
||||
onClick={openNickModal}
|
||||
>
|
||||
{t('编辑昵称')}
|
||||
</Button>
|
||||
<Button
|
||||
theme='light'
|
||||
icon={<KeyRound size={14} />}
|
||||
onClick={() => setPwdModal(true)}
|
||||
>
|
||||
{t('修改密码')}
|
||||
</Button>
|
||||
<Button
|
||||
theme='light'
|
||||
icon={<RefreshCw size={14} />}
|
||||
loading={loading}
|
||||
onClick={() => {
|
||||
fetchSummary();
|
||||
fetchProjects();
|
||||
}}
|
||||
>
|
||||
{t('刷新')}
|
||||
</Button>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
|
||||
{/* 关键指标卡组 */}
|
||||
<div className='grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-4'>
|
||||
<StatCard
|
||||
icon={Coins}
|
||||
label={quotaUsageLabel}
|
||||
value={renderQuota(usedQuota, 2)}
|
||||
hint={quotaLimitHint}
|
||||
/>
|
||||
<StatCard
|
||||
icon={Wallet}
|
||||
label={t('可用额度')}
|
||||
value={availableDisplay}
|
||||
hint={availableHint}
|
||||
/>
|
||||
<StatCard
|
||||
icon={Clock}
|
||||
label={t('额度重置时间')}
|
||||
value={resetValue}
|
||||
hint={resetHint}
|
||||
/>
|
||||
<StatCard
|
||||
icon={FileClock}
|
||||
label={t('待处理申请')}
|
||||
countTo={summary?.pending_request_count ?? 0}
|
||||
hint={t('我提交的提额申请')}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* 我的额度进度 + 我的令牌 */}
|
||||
<div className='grid grid-cols-1 md:grid-cols-3 gap-4'>
|
||||
<OrgPanel className='md:col-span-2'>
|
||||
<div className='flex items-center gap-2 mb-3'>
|
||||
<Wallet size={18} className='text-brand-deep' />
|
||||
<Text strong>{t('我的额度')}</Text>
|
||||
</div>
|
||||
{quotaLimit > 0 ? (
|
||||
<>
|
||||
<Progress
|
||||
percent={quotaPercent}
|
||||
stroke={
|
||||
quotaPercent >= 90 ? 'var(--semi-color-danger)' : undefined
|
||||
}
|
||||
style={{ marginBottom: 8 }}
|
||||
/>
|
||||
<Text type='tertiary' size='small'>
|
||||
{quotaIsPeriodic ? t('本周期已用') : t('已用')}{' '}
|
||||
{renderQuota(usedQuota, 2)} / {renderQuota(quotaLimit, 2)}
|
||||
{quotaIsPeriodic
|
||||
? ` · ${t('累计已用')} ${renderQuota(totalUsedQuota, 2)}`
|
||||
: ''}
|
||||
</Text>
|
||||
</>
|
||||
) : (
|
||||
<Text type='tertiary' size='small'>
|
||||
{t('未设个人上限,使用企业统一额度池')}
|
||||
</Text>
|
||||
)}
|
||||
<div className='mt-2'>
|
||||
<Text type='tertiary' size='small'>
|
||||
{t('实际可用还受所在部门/项目及企业预算约束。')}
|
||||
</Text>
|
||||
</div>
|
||||
<div className='mt-3'>
|
||||
<Button
|
||||
size='small'
|
||||
icon={<Plus size={14} />}
|
||||
onClick={openReqModal}
|
||||
disabled={!approvalEnabled || subjectOptions.length === 0}
|
||||
>
|
||||
{t('申请提额')}
|
||||
</Button>
|
||||
</div>
|
||||
</OrgPanel>
|
||||
|
||||
<OrgPanel>
|
||||
<div className='flex items-center gap-2 mb-3'>
|
||||
<Key size={18} className='text-brand-deep' />
|
||||
<Text strong>{t('我的令牌')}</Text>
|
||||
</div>
|
||||
<Title heading={2} style={{ margin: '4px 0' }}>
|
||||
{summary?.token_count ?? 0}
|
||||
</Title>
|
||||
<Button
|
||||
size='small'
|
||||
theme='light'
|
||||
onClick={() => navigate('/org/tokens')}
|
||||
>
|
||||
{t('管理令牌')}
|
||||
</Button>
|
||||
</OrgPanel>
|
||||
</div>
|
||||
|
||||
{/* 个人用量趋势 */}
|
||||
<OrgPanel>
|
||||
<div className='flex items-center gap-2 mb-3'>
|
||||
<TrendingUp size={18} className='text-brand-deep' />
|
||||
<Text strong>{t('个人用量趋势')}</Text>
|
||||
</div>
|
||||
<div className='flex flex-wrap gap-4'>
|
||||
<UsageBlock t={t} title={t('今日')} data={usage.today} />
|
||||
<UsageBlock t={t} title={t('近 7 天')} data={usage.last7d} />
|
||||
<UsageBlock t={t} title={t('近 30 天')} data={usage.last30d} />
|
||||
<UsageBlock t={t} title={t('累计')} data={usage.total} />
|
||||
</div>
|
||||
</OrgPanel>
|
||||
|
||||
{/* 最近申请 */}
|
||||
<OrgPanel>
|
||||
<div className='flex items-center gap-2 mb-3'>
|
||||
<FileClock size={18} className='text-brand-deep' />
|
||||
<Text strong>{t('最近申请')}</Text>
|
||||
</div>
|
||||
{summary?.recent_requests?.length ? (
|
||||
<div className='flex flex-col divide-y divide-[var(--semi-color-border)]'>
|
||||
{summary.recent_requests.map((r) => (
|
||||
<div
|
||||
key={r.id}
|
||||
className='flex items-center justify-between py-2.5'
|
||||
>
|
||||
<div>
|
||||
<Text>
|
||||
{r.request_type === 'quota'
|
||||
? t('提额申请')
|
||||
: r.request_type}
|
||||
{r.reason ? ` · ${r.reason}` : ''}
|
||||
</Text>
|
||||
<div>
|
||||
<Text type='tertiary' size='small'>
|
||||
{r.created_at ? timestamp2string(r.created_at) : ''}
|
||||
</Text>
|
||||
</div>
|
||||
</div>
|
||||
{reqStatusTag(t, r.status)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<Empty description={t('暂无申请记录')} />
|
||||
)}
|
||||
</OrgPanel>
|
||||
|
||||
{/* 提额申请弹窗 */}
|
||||
<OrgModal
|
||||
title={t('申请提额')}
|
||||
visible={reqModal}
|
||||
onOk={submitRequest}
|
||||
onCancel={() => setReqModal(false)}
|
||||
okText={t('提交申请')}
|
||||
cancelText={t('取消')}
|
||||
>
|
||||
<Form getFormApi={setFormApi}>
|
||||
<Form.Select
|
||||
field='subject'
|
||||
label={t('提额对象')}
|
||||
initValue={subjectOptions[0]?.value}
|
||||
optionList={subjectOptions}
|
||||
rules={[{ required: true, message: t('请选择提额对象') }]}
|
||||
style={{ width: '100%' }}
|
||||
/>
|
||||
<Text type='tertiary' size='small'>
|
||||
{t(
|
||||
'个人额度用于解除您自己的使用上限;部门/项目额度属于预算上限,可能有独立周期。',
|
||||
)}
|
||||
</Text>
|
||||
<Form.InputNumber
|
||||
field='delta'
|
||||
label={deltaLabel}
|
||||
min={deltaIsToken ? 1 : 0.01}
|
||||
precision={deltaIsToken ? 0 : 2}
|
||||
suffix={deltaIsToken ? null : deltaCurrency.symbol}
|
||||
rules={[{ required: true, message: t('请输入提额数量') }]}
|
||||
style={{ width: '100%' }}
|
||||
/>
|
||||
<Form.Select
|
||||
field='approver'
|
||||
label={t('审批人')}
|
||||
initValue={0}
|
||||
optionList={[
|
||||
{ label: t('企业管理员(默认)'), value: 0 },
|
||||
...approvers.map((a) => ({
|
||||
label: `${t('上级')}:${a.name}`,
|
||||
value: a.member_id,
|
||||
})),
|
||||
]}
|
||||
style={{ width: '100%' }}
|
||||
/>
|
||||
<Form.TextArea field='reason' label={t('申请理由')} maxCount={200} />
|
||||
</Form>
|
||||
</OrgModal>
|
||||
|
||||
{/* 编辑昵称弹窗(共享组件,与个人设置页共用) */}
|
||||
<OrgNicknameModal
|
||||
visible={nickModal}
|
||||
onClose={() => setNickModal(false)}
|
||||
orgId={orgId}
|
||||
currentName={summary?.member?.display_name || ''}
|
||||
onSuccess={() => fetchSummary()}
|
||||
/>
|
||||
|
||||
{/* 自助改密(方案 §12.8,共享组件) */}
|
||||
<OrgPasswordModal visible={pwdModal} onClose={() => setPwdModal(false)} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default OrgWorkbench;
|
||||
Reference in New Issue
Block a user