update: 升级vben5.5.9到5.7.0

This commit is contained in:
2026-09-22 17:09:46 +08:00
parent 345e4a31f8
commit 802f72cd9e
766 changed files with 28468 additions and 15447 deletions
+7 -3
View File
@@ -303,18 +303,22 @@ export function streamAgentChat(options: {
const parsed = JSON.parse(data) as {
toolCallId?: string;
name?: string;
args?: Record<string, unknown>;
args?: unknown;
label?: string;
};
if (parsed.name) {
let toolArgs: Record<string, unknown> = {};
const rawArgs = parsed.args;
if (rawArgs && typeof rawArgs === 'object') {
if (rawArgs && typeof rawArgs === 'object' && !Array.isArray(rawArgs)) {
toolArgs = rawArgs as Record<string, unknown>;
} else if (typeof rawArgs === 'string' && rawArgs.trim()) {
try {
const parsedArgs = JSON.parse(rawArgs) as unknown;
if (parsedArgs && typeof parsedArgs === 'object') {
if (
parsedArgs &&
typeof parsedArgs === 'object' &&
!Array.isArray(parsedArgs)
) {
toolArgs = parsedArgs as Record<string, unknown>;
}
} catch {
@@ -18,7 +18,6 @@ import { getCompanyPageApi } from '#/api/company';
import { getUserPageApi } from '#/api/sys/user';
// 响应式数据
const formRef = ref();
const formData = ref({
companyId: undefined as number | undefined,
userId: undefined as number | undefined,
@@ -375,7 +374,9 @@ defineExpose({
<div class="text-gray-500">
手机号码: {{ selectedUser.phone || '-' }}
</div>
<div class="text-gray-500">角色: {{ selectedUser.role }}</div>
<div class="text-gray-500">
角色: {{ selectedUser.isSuper === 1 ? '超管' : '普通' }}
</div>
<div class="text-gray-500">
状态: {{ selectedUser.status === 1 ? '正常' : '禁用' }}
</div>
@@ -27,6 +27,7 @@ const { hasPermission } = usePermission();
const notifications = ref<NotificationItem[]>([
{
id: 1,
avatar: 'https://avatar.vercel.sh/vercel.svg?text=VB',
date: '3小时前',
isRead: true,
@@ -34,6 +35,7 @@ const notifications = ref<NotificationItem[]>([
title: '收到了 14 份新周报',
},
{
id: 2,
avatar: 'https://avatar.vercel.sh/1',
date: '刚刚',
isRead: false,
@@ -41,6 +43,7 @@ const notifications = ref<NotificationItem[]>([
title: '朱偏右 回复了你',
},
{
id: 3,
avatar: 'https://avatar.vercel.sh/1',
date: '2024-01-01',
isRead: false,
@@ -48,6 +51,7 @@ const notifications = ref<NotificationItem[]>([
title: '曲丽丽 评论了你',
},
{
id: 4,
avatar: 'https://avatar.vercel.sh/satori',
date: '1天前',
isRead: false,
+1 -3
View File
@@ -27,9 +27,7 @@ export const overridesPreferences = defineOverridesPreferences({
navigation: {
accordion: false, // 关闭手风琴模式,允许多个菜单同时展开
},
theme: {
mode: 'light',
},
// 不要在此写死 theme.mode:用户切换深/浅色需持久化到缓存
transition: {
enable: false,
loading: false,
+13 -4
View File
@@ -132,13 +132,22 @@ function setupAccessGuard(router: Router) {
userInfo.homePath || preferences.app.defaultHomePath;
}
// 动态 addRoute 后必须发起一次新导航。
// 若期间有路由增删导致当前导航被取消,return true 只会继续已取消的导航,
// 表现即停在登录页 +「加载菜单中」(生产构建更易复现,开发环境不一定)。
// 不要展开 resolve() 的 matched,避免沿用生成路由前的 404 匹配记录。
const resolved = router.resolve(redirectPath);
// 已在目标页则放行;不要展开 resolve(),以免带上过期的 matched(当时可能命中 404)
if (resolved.name && resolved.name === to.name) {
return true;
if (resolved.name) {
return {
name: resolved.name,
params: resolved.params,
query: resolved.query,
hash: resolved.hash,
replace: true,
};
}
return {
path: resolved.path,
path: resolved.path || redirectPath,
query: resolved.query,
hash: resolved.hash,
replace: true,
@@ -49,6 +49,9 @@ const formSchema = computed((): VbenFormSchema[] => {
:loading="authStore.loginLoading"
:show-forget-password="false"
:show-register="false"
:show-code-login="false"
:show-qrcode-login="false"
:show-third-party-login="false"
@submit="authStore.authLogin"
/>
</template>
@@ -67,7 +67,7 @@ async function handleSubmit() {
return;
}
saving.value = true;
modalApi.setState({ confirming: true });
modalApi.setState({ confirmLoading: true });
try {
if (isEdit.value && editing.value) {
await updateAgentLlmProviderApi(editing.value.id, {
@@ -90,7 +90,7 @@ async function handleSubmit() {
message.error(e?.message || '保存失败');
} finally {
saving.value = false;
modalApi.setState({ confirming: false });
modalApi.setState({ confirmLoading: false });
}
}
@@ -29,7 +29,7 @@ const emit = defineEmits<{ success: [] }>();
type ModelRow = {
model: string;
contextWindow: number | null;
contextWindow: number | undefined;
isDefault: boolean;
enabled: boolean;
};
@@ -63,7 +63,7 @@ function applyProviderModels(detail: AgentVO.LlmProvider) {
modelRows.value = (detail.models || []).map((m) => ({
model: m.model,
contextWindow:
m.contextWindow != null && m.contextWindow > 0 ? m.contextWindow : null,
m.contextWindow != null && m.contextWindow > 0 ? m.contextWindow : undefined,
isDefault: !!m.isDefault,
enabled: m.enabled !== false,
}));
@@ -101,7 +101,7 @@ function toggleProbed(p: AgentVO.ProbedLlmModel, checked: boolean) {
contextWindow:
p.contextWindow != null && p.contextWindow > 0
? p.contextWindow
: null,
: undefined,
isDefault: false,
enabled: true,
});
@@ -143,7 +143,7 @@ function addManual() {
}
modelRows.value.push({
model: id,
contextWindow: null,
contextWindow: undefined,
isDefault: false,
enabled: true,
});
@@ -214,7 +214,7 @@ async function handleSave() {
return;
}
saving.value = true;
modalApi.setState({ confirming: true });
modalApi.setState({ confirmLoading: true });
try {
const models = modelRows.value.map((m) => ({
model: m.model,
@@ -234,7 +234,7 @@ async function handleSave() {
message.error(e?.message || '保存失败');
} finally {
saving.value = false;
modalApi.setState({ confirming: false });
modalApi.setState({ confirmLoading: false });
}
}
@@ -310,11 +310,11 @@ onMounted(() => {
</div>
<div class="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden">
<div class="min-h-0 flex-1 overflow-y-auto">
<div class="flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto">
<Card
size="small"
:body-style="{ padding: '10px 12px' }"
class="mb-2 cursor-pointer !shadow-none hover:border-primary"
class="cursor-pointer !shadow-none hover:border-primary"
:class="allSelected ? 'border-primary bg-primary/5' : undefined"
@click="selectAll"
>
@@ -337,7 +337,7 @@ onMounted(() => {
v-if="showUnassignedFilter"
size="small"
:body-style="{ padding: '10px 12px' }"
class="mb-2 cursor-pointer !shadow-none hover:border-primary"
class="cursor-pointer !shadow-none hover:border-primary"
:class="
unassignedSelected ? 'border-primary bg-primary/5' : undefined
"
@@ -371,19 +371,22 @@ onMounted(() => {
</div>
</Card>
<Spin :spinning="shopsLoading">
<Spin
:spinning="shopsLoading"
wrapper-class-name="pdd-shop-sidebar-list-spin"
>
<Empty
v-if="!shopsLoading && shops.length === 0"
class="py-8"
description="暂无拼多多店铺"
/>
<template v-else>
<div v-else class="flex flex-col gap-2">
<Card
v-for="shop in shops"
:key="shop.id"
size="small"
:body-style="{ padding: '10px 12px' }"
class="group mb-2 cursor-pointer !shadow-none last:mb-0 hover:border-primary"
class="group cursor-pointer !shadow-none hover:border-primary"
:class="
selectedShopId === shop.id
? 'border-primary bg-primary/5'
@@ -433,7 +436,7 @@ onMounted(() => {
</div>
</div>
</Card>
</template>
</div>
</Spin>
</div>
@@ -485,4 +488,13 @@ onMounted(() => {
align-items: center;
overflow: visible;
}
/* Spin 外层参与父级 gap 布局,避免列表项贴在一起 */
:deep(.pdd-shop-sidebar-list-spin),
:deep(.pdd-shop-sidebar-list-spin .ant-spin-container) {
display: flex;
width: 100%;
min-width: 0;
flex-direction: column;
}
</style>
@@ -291,11 +291,11 @@ onMounted(() => {
</div>
<div class="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden">
<div class="min-h-0 flex-1 overflow-y-auto">
<div class="flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto">
<Card
size="small"
:body-style="{ padding: '10px 12px' }"
class="mb-2 cursor-pointer !shadow-none hover:border-primary"
class="cursor-pointer !shadow-none hover:border-primary"
:class="allSelected ? 'border-primary bg-primary/5' : undefined"
@click="selectAll"
>
@@ -314,19 +314,22 @@ onMounted(() => {
</div>
</Card>
<Spin :spinning="shopsLoading">
<Spin
:spinning="shopsLoading"
wrapper-class-name="shop-sidebar-list-spin"
>
<Empty
v-if="!shopsLoading && shops.length === 0"
class="py-8"
description="暂无店铺"
/>
<template v-else>
<div v-else class="flex flex-col gap-2">
<Card
v-for="shop in shops"
:key="shop.id"
size="small"
:body-style="{ padding: '10px 12px' }"
class="group mb-2 cursor-pointer !shadow-none last:mb-0 hover:border-primary"
class="group cursor-pointer !shadow-none hover:border-primary"
:class="
selectedShopId === shop.id
? 'border-primary bg-primary/5'
@@ -352,7 +355,7 @@ onMounted(() => {
</div>
</div>
</Card>
</template>
</div>
</Spin>
</div>
@@ -404,4 +407,12 @@ onMounted(() => {
align-items: center;
overflow: visible;
}
:deep(.shop-sidebar-list-spin),
:deep(.shop-sidebar-list-spin .ant-spin-container) {
display: flex;
width: 100%;
min-width: 0;
flex-direction: column;
}
</style>
@@ -198,7 +198,7 @@ defineExpose({ open, close });
:columns="itemColumns"
:data-source="detail.items || []"
:pagination="false"
:row-key="(r: OrderItemVO.Info) => r.id ?? r.lineNo"
:row-key="(r: OrderItemVO.Info) => r.id ?? r.lineNo ?? String(r)"
size="small"
bordered
:scroll="{ x: 900 }"
@@ -212,11 +212,11 @@ defineExpose({ open, close });
:width="36"
:height="36"
/>
<span>{{ itemTitle(record) }}</span>
<span>{{ itemTitle(record as OrderItemVO.Info) }}</span>
</div>
</template>
<template v-else-if="column.key === 'linkSkuName'">
{{ itemSpec(record) }}
{{ itemSpec(record as OrderItemVO.Info) }}
</template>
<template v-else-if="column.key === 'unitPrice'">
{{ money(record.unitPrice) }}
@@ -965,7 +965,7 @@ const skuColumns = [
record: SkuFormRow;
index: number;
}) => {
const children = [];
const children: ReturnType<typeof h>[] = [];
if (isPersistedSkuId(record.id) && currentProductData.value?.id) {
children.push(
h(
@@ -188,7 +188,7 @@ defineExpose({ open });
ok-text="确认迁入"
cancel-text="取消"
:ok-button-props="{ loading: migratingSkuId === record.id }"
@confirm="confirmMigrate(record)"
@confirm="confirmMigrate(record as ProductSkuVO.Info)"
>
<Button
type="link"
@@ -638,7 +638,7 @@ function valueColumns(spec: DraftSpec) {
dataIndex: 'valueName',
key: 'valueName',
customRender: ({ record }: { record: DraftValue }) =>
h(Select, {
h(Select as any, {
value: record.valueName || undefined,
showSearch: true,
allowClear: true,
@@ -69,11 +69,6 @@ const cellMoney = (v: number | null | undefined) =>
const cellRoi = (v: number | null | undefined) =>
formatNumberCell(v, (n) => n.toFixed(2));
const formatPercent = (value: number | undefined) => {
if (value === undefined || value === null) return '-';
return `${value.toFixed(1)}%`;
};
const computedFooter = computed(() => {
if (!props.data || props.data.length === 0) return null;
const total: SkuData = {
@@ -72,16 +72,19 @@ const formRef = ref();
const isEdit = ref(false);
/** 表单内用 Dayjs,提交时再格式化为 YYYY-MM-DD */
type AdFeeFormState = Omit<AdFeeDTO.Create, 'feeDate'> & {
type AdFeeFormState = Omit<AdFeeDTO.Create, 'feeDate' | 'productId' | 'shopId' | 'feeAmount'> & {
shopId?: number;
productId?: number;
feeAmount?: number;
feeDate?: Dayjs;
};
const formData = ref<AdFeeFormState>({
shopId: undefined as any,
shopId: undefined,
productId: undefined,
campaignName: '',
feeAmount: undefined as any,
feeDate: undefined as any,
feeAmount: undefined,
feeDate: undefined,
remark: '',
});
@@ -166,11 +169,11 @@ const loadProductList = async () => {
const resetFormData = () => {
formData.value = {
shopId: undefined as any,
shopId: undefined,
productId: undefined,
campaignName: '',
feeAmount: undefined as any,
feeDate: undefined as any,
feeAmount: undefined,
feeDate: undefined,
remark: '',
};
};
@@ -190,18 +193,18 @@ const handleOk = async () => {
const feeDate = feeDateToApiString(formData.value.feeDate!);
if (isEdit.value && props.adFeeData) {
const updateData: AdFeeDTO.Update = {
const updateData = {
id: props.adFeeData.id,
...formData.value,
feeDate,
};
} as AdFeeDTO.Update;
await updateAdFeeApi(updateData);
message.success('更新成功');
} else {
await createAdFeeApi({
...formData.value,
feeDate,
});
} as AdFeeDTO.Create);
message.success('创建成功');
}
@@ -615,7 +615,10 @@ function handleEdit(record: ShopListRow) {
}
function handleDelete(record: ShopListRow) {
shopDeleteModalRef.value?.open({ id: record.id, name: record.name });
shopDeleteModalRef.value?.open({
id: record.id,
name: record.name ?? '',
});
}
function handleModalSuccess() {