fix: 吸收 Vue3 低风险交互与局部类型修复

- 三端 ProductList 在 spuIds 为空时跳过商品详情请求
- 三端 FloatingActionButton 点击子项后收起预览面板
- OA 请假 startUserSelectAssignees 改为创建页局部扩展类型,不污染 Leave VO
- 修复 antdv-next FloatingActionButton Image fallback slot 类型
migration
YunaiV 2026-06-21 11:00:40 -07:00
parent e227119f39
commit 4afe56d03b
12 changed files with 76 additions and 55 deletions

View File

@ -12,7 +12,6 @@ export namespace BpmOALeaveApi {
startTime: number; startTime: number;
endTime: number; endTime: number;
createTime: Date; createTime: Date;
startUserSelectAssignees?: Record<string, string[]>;
} }
} }

View File

@ -28,10 +28,14 @@ const { query } = useRoute();
const formLoading = ref(false); // 12 const formLoading = ref(false); // 12
const processTimeLineLoading = ref(false); // const processTimeLineLoading = ref(false); //
type LeaveCreateData = BpmOALeaveApi.Leave & {
startUserSelectAssignees?: Record<string, number[]>;
};
const processDefineKey = 'oa_leave'; // Key const processDefineKey = 'oa_leave'; // Key
const startUserSelectTasks = ref<any>([]); // const startUserSelectTasks = ref<BpmProcessInstanceApi.ApprovalNodeInfo[]>([]); //
const startUserSelectAssignees = ref<any>({}); // const startUserSelectAssignees = ref<Record<string, number[]>>({}); //
const tempStartUserSelectAssignees = ref<any>({}); // const tempStartUserSelectAssignees = ref<Record<string, number[]>>({}); //
const activityNodes = ref<BpmProcessInstanceApi.ApprovalNodeInfo[]>([]); // const activityNodes = ref<BpmProcessInstanceApi.ApprovalNodeInfo[]>([]); //
const processDefinitionId = ref(''); const processDefinitionId = ref('');
@ -65,23 +69,21 @@ async function onSubmit() {
// 1.2 // 1.2
if (startUserSelectTasks.value?.length > 0) { if (startUserSelectTasks.value?.length > 0) {
for (const userTask of startUserSelectTasks.value) { for (const userTask of startUserSelectTasks.value) {
if ( const assignees = startUserSelectAssignees.value[userTask.id];
Array.isArray(startUserSelectAssignees.value[userTask.id]) && if (Array.isArray(assignees) && assignees.length === 0) {
startUserSelectAssignees.value[userTask.id].length === 0
) {
return message.warning(`请选择${userTask.name}的审批人`); return message.warning(`请选择${userTask.name}的审批人`);
} }
} }
} }
// //
const data = (await formApi.getValues()) as BpmOALeaveApi.Leave; const data = (await formApi.getValues()) as LeaveCreateData;
// //
if (startUserSelectTasks.value?.length > 0) { if (startUserSelectTasks.value?.length > 0) {
data.startUserSelectAssignees = startUserSelectAssignees.value; data.startUserSelectAssignees = startUserSelectAssignees.value;
} }
// //
const submitData: BpmOALeaveApi.Leave = { const submitData: LeaveCreateData = {
...data, ...data,
startTime: Number(data.startTime), startTime: Number(data.startTime),
endTime: Number(data.endTime), endTime: Number(data.endTime),
@ -144,11 +146,10 @@ async function getApprovalDetail() {
// //
if (startUserSelectTasks.value?.length > 0) { if (startUserSelectTasks.value?.length > 0) {
for (const node of startUserSelectTasks.value) { for (const node of startUserSelectTasks.value) {
startUserSelectAssignees.value[node.id] = const tempAssignees = tempStartUserSelectAssignees.value[node.id];
tempStartUserSelectAssignees.value[node.id] && startUserSelectAssignees.value[node.id] = tempAssignees?.length
tempStartUserSelectAssignees.value[node.id].length > 0 ? tempAssignees
? tempStartUserSelectAssignees.value[node.id] : [];
: [];
} }
} }
} finally { } finally {
@ -157,8 +158,8 @@ async function getApprovalDetail() {
} }
/** 审批相关:选择发起人 */ /** 审批相关:选择发起人 */
function selectUserConfirm(id: string, userList: any[]) { function selectUserConfirm(id: string, userList: Array<{ id: number }>) {
startUserSelectAssignees.value[id] = userList?.map((item: any) => item.id); startUserSelectAssignees.value[id] = userList.map((item) => item.id);
} }
/** 获取请假数据,用于重新发起时自动填充 */ /** 获取请假数据,用于重新发起时自动填充 */

View File

@ -19,6 +19,10 @@ const expanded = ref(false); // 是否展开
function handleToggleFab() { function handleToggleFab() {
expanded.value = !expanded.value; expanded.value = !expanded.value;
} }
function handleActive() {
expanded.value = false;
}
</script> </script>
<template> <template>
<div <div
@ -35,6 +39,7 @@ function handleToggleFab() {
v-for="(item, index) in property.list" v-for="(item, index) in property.list"
:key="index" :key="index"
class="flex flex-col items-center" class="flex flex-col items-center"
@click="handleActive"
> >
<Image :src="item.imgUrl" :width="28" :height="28" :preview="false"> <Image :src="item.imgUrl" :width="28" :height="28" :preview="false">
<template #error> <template #error>

View File

@ -21,7 +21,9 @@ const spuList = ref<MallSpuApi.Spu[]>([]);
watch( watch(
() => props.property.spuIds, () => props.property.spuIds,
async () => { async () => {
spuList.value = await getSpuDetailList(props.property.spuIds); spuList.value = props.property.spuIds.length > 0
? await getSpuDetailList(props.property.spuIds)
: [];
}, },
{ {
immediate: true, immediate: true,

View File

@ -12,7 +12,6 @@ export namespace BpmOALeaveApi {
startTime: number; startTime: number;
endTime: number; endTime: number;
createTime: Date; createTime: Date;
startUserSelectAssignees?: Record<string, string[]>;
} }
} }

View File

@ -28,10 +28,14 @@ const { query } = useRoute();
const formLoading = ref(false); // 12 const formLoading = ref(false); // 12
const processTimeLineLoading = ref(false); // const processTimeLineLoading = ref(false); //
type LeaveCreateData = BpmOALeaveApi.Leave & {
startUserSelectAssignees?: Record<string, number[]>;
};
const processDefineKey = 'oa_leave'; // Key const processDefineKey = 'oa_leave'; // Key
const startUserSelectTasks = ref<any>([]); // const startUserSelectTasks = ref<BpmProcessInstanceApi.ApprovalNodeInfo[]>([]); //
const startUserSelectAssignees = ref<any>({}); // const startUserSelectAssignees = ref<Record<string, number[]>>({}); //
const tempStartUserSelectAssignees = ref<any>({}); // const tempStartUserSelectAssignees = ref<Record<string, number[]>>({}); //
const activityNodes = ref<BpmProcessInstanceApi.ApprovalNodeInfo[]>([]); // const activityNodes = ref<BpmProcessInstanceApi.ApprovalNodeInfo[]>([]); //
const processDefinitionId = ref(''); const processDefinitionId = ref('');
@ -65,23 +69,21 @@ async function onSubmit() {
// 1.2 // 1.2
if (startUserSelectTasks.value?.length > 0) { if (startUserSelectTasks.value?.length > 0) {
for (const userTask of startUserSelectTasks.value) { for (const userTask of startUserSelectTasks.value) {
if ( const assignees = startUserSelectAssignees.value[userTask.id];
Array.isArray(startUserSelectAssignees.value[userTask.id]) && if (Array.isArray(assignees) && assignees.length === 0) {
startUserSelectAssignees.value[userTask.id].length === 0
) {
return message.warning(`请选择${userTask.name}的审批人`); return message.warning(`请选择${userTask.name}的审批人`);
} }
} }
} }
// //
const data = (await formApi.getValues()) as BpmOALeaveApi.Leave; const data = (await formApi.getValues()) as LeaveCreateData;
// //
if (startUserSelectTasks.value?.length > 0) { if (startUserSelectTasks.value?.length > 0) {
data.startUserSelectAssignees = startUserSelectAssignees.value; data.startUserSelectAssignees = startUserSelectAssignees.value;
} }
// //
const submitData: BpmOALeaveApi.Leave = { const submitData: LeaveCreateData = {
...data, ...data,
startTime: Number(data.startTime), startTime: Number(data.startTime),
endTime: Number(data.endTime), endTime: Number(data.endTime),
@ -144,11 +146,10 @@ async function getApprovalDetail() {
// //
if (startUserSelectTasks.value?.length > 0) { if (startUserSelectTasks.value?.length > 0) {
for (const node of startUserSelectTasks.value) { for (const node of startUserSelectTasks.value) {
startUserSelectAssignees.value[node.id] = const tempAssignees = tempStartUserSelectAssignees.value[node.id];
tempStartUserSelectAssignees.value[node.id] && startUserSelectAssignees.value[node.id] = tempAssignees?.length
tempStartUserSelectAssignees.value[node.id].length > 0 ? tempAssignees
? tempStartUserSelectAssignees.value[node.id] : [];
: [];
} }
} }
} finally { } finally {
@ -157,8 +158,8 @@ async function getApprovalDetail() {
} }
/** 审批相关:选择发起人 */ /** 审批相关:选择发起人 */
function selectUserConfirm(id: string, userList: any[]) { function selectUserConfirm(id: string, userList: Array<{ id: number }>) {
startUserSelectAssignees.value[id] = userList?.map((item: any) => item.id); startUserSelectAssignees.value[id] = userList.map((item) => item.id);
} }
/** 获取请假数据,用于重新发起时自动填充 */ /** 获取请假数据,用于重新发起时自动填充 */

View File

@ -19,6 +19,10 @@ const expanded = ref(false); // 是否展开
function handleToggleFab() { function handleToggleFab() {
expanded.value = !expanded.value; expanded.value = !expanded.value;
} }
function handleActive() {
expanded.value = false;
}
</script> </script>
<template> <template>
<div <div
@ -35,9 +39,10 @@ function handleToggleFab() {
v-for="(item, index) in property.list" v-for="(item, index) in property.list"
:key="index" :key="index"
class="flex flex-col items-center" class="flex flex-col items-center"
@click="handleActive"
> >
<Image :src="item.imgUrl" :width="28" :height="28" :preview="false"> <Image :src="item.imgUrl" :width="28" :height="28" :preview="false">
<template #error> <template #fallback>
<div class="flex h-full w-full items-center justify-center"> <div class="flex h-full w-full items-center justify-center">
<IconifyIcon <IconifyIcon
icon="lucide:image" icon="lucide:image"

View File

@ -21,7 +21,9 @@ const spuList = ref<MallSpuApi.Spu[]>([]);
watch( watch(
() => props.property.spuIds, () => props.property.spuIds,
async () => { async () => {
spuList.value = await getSpuDetailList(props.property.spuIds); spuList.value = props.property.spuIds.length > 0
? await getSpuDetailList(props.property.spuIds)
: [];
}, },
{ {
immediate: true, immediate: true,

View File

@ -12,7 +12,6 @@ export namespace BpmOALeaveApi {
startTime: number; startTime: number;
endTime: number; endTime: number;
createTime: Date; createTime: Date;
startUserSelectAssignees?: Record<string, string[]>;
} }
} }

View File

@ -35,10 +35,14 @@ const { query } = useRoute();
const formLoading = ref(false); // 12 const formLoading = ref(false); // 12
const processTimeLineLoading = ref(false); // const processTimeLineLoading = ref(false); //
type LeaveCreateData = BpmOALeaveApi.Leave & {
startUserSelectAssignees?: Record<string, number[]>;
};
const processDefineKey = 'oa_leave'; // Key const processDefineKey = 'oa_leave'; // Key
const startUserSelectTasks = ref<any>([]); // const startUserSelectTasks = ref<BpmProcessInstanceApi.ApprovalNodeInfo[]>([]); //
const startUserSelectAssignees = ref<any>({}); // const startUserSelectAssignees = ref<Record<string, number[]>>({}); //
const tempStartUserSelectAssignees = ref<any>({}); // const tempStartUserSelectAssignees = ref<Record<string, number[]>>({}); //
const activityNodes = ref<BpmProcessInstanceApi.ApprovalNodeInfo[]>([]); // const activityNodes = ref<BpmProcessInstanceApi.ApprovalNodeInfo[]>([]); //
const processDefinitionId = ref(''); const processDefinitionId = ref('');
@ -72,23 +76,21 @@ async function onSubmit() {
// 1.2 // 1.2
if (startUserSelectTasks.value?.length > 0) { if (startUserSelectTasks.value?.length > 0) {
for (const userTask of startUserSelectTasks.value) { for (const userTask of startUserSelectTasks.value) {
if ( const assignees = startUserSelectAssignees.value[userTask.id];
Array.isArray(startUserSelectAssignees.value[userTask.id]) && if (Array.isArray(assignees) && assignees.length === 0) {
startUserSelectAssignees.value[userTask.id].length === 0
) {
return ElMessage.warning(`请选择${userTask.name}的审批人`); return ElMessage.warning(`请选择${userTask.name}的审批人`);
} }
} }
} }
// //
const data = (await formApi.getValues()) as BpmOALeaveApi.Leave; const data = (await formApi.getValues()) as LeaveCreateData;
// //
if (startUserSelectTasks.value?.length > 0) { if (startUserSelectTasks.value?.length > 0) {
data.startUserSelectAssignees = startUserSelectAssignees.value; data.startUserSelectAssignees = startUserSelectAssignees.value;
} }
// //
const submitData: BpmOALeaveApi.Leave = { const submitData: LeaveCreateData = {
...data, ...data,
startTime: Number(data.startTime), startTime: Number(data.startTime),
endTime: Number(data.endTime), endTime: Number(data.endTime),
@ -151,11 +153,10 @@ async function getApprovalDetail() {
// //
if (startUserSelectTasks.value?.length > 0) { if (startUserSelectTasks.value?.length > 0) {
for (const node of startUserSelectTasks.value) { for (const node of startUserSelectTasks.value) {
startUserSelectAssignees.value[node.id] = const tempAssignees = tempStartUserSelectAssignees.value[node.id];
tempStartUserSelectAssignees.value[node.id] && startUserSelectAssignees.value[node.id] = tempAssignees?.length
tempStartUserSelectAssignees.value[node.id].length > 0 ? tempAssignees
? tempStartUserSelectAssignees.value[node.id] : [];
: [];
} }
} }
} finally { } finally {
@ -164,8 +165,8 @@ async function getApprovalDetail() {
} }
/** 审批相关:选择发起人 */ /** 审批相关:选择发起人 */
function selectUserConfirm(id: string, userList: any[]) { function selectUserConfirm(id: string, userList: Array<{ id: number }>) {
startUserSelectAssignees.value[id] = userList?.map((item: any) => item.id); startUserSelectAssignees.value[id] = userList.map((item) => item.id);
} }
/** 获取请假数据,用于重新发起时自动填充 */ /** 获取请假数据,用于重新发起时自动填充 */

View File

@ -19,6 +19,10 @@ const expanded = ref(false); // 是否展开
function handleToggleFab() { function handleToggleFab() {
expanded.value = !expanded.value; expanded.value = !expanded.value;
} }
function handleActive() {
expanded.value = false;
}
</script> </script>
<template> <template>
<div <div
@ -35,6 +39,7 @@ function handleToggleFab() {
v-for="(item, index) in property.list" v-for="(item, index) in property.list"
:key="index" :key="index"
class="flex flex-col items-center" class="flex flex-col items-center"
@click="handleActive"
> >
<ElImage :src="item.imgUrl" fit="contain" class="h-7 w-7"> <ElImage :src="item.imgUrl" fit="contain" class="h-7 w-7">
<template #error> <template #error>

View File

@ -21,7 +21,9 @@ const spuList = ref<MallSpuApi.Spu[]>([]);
watch( watch(
() => props.property.spuIds, () => props.property.spuIds,
async () => { async () => {
spuList.value = await getSpuDetailList(props.property.spuIds); spuList.value = props.property.spuIds.length > 0
? await getSpuDetailList(props.property.spuIds)
: [];
}, },
{ {
immediate: true, immediate: true,