perf: 使用 modalApi.unlock() 替换 modalApi.lock(false)

This commit is contained in:
xingyu4j
2025-04-29 22:29:03 +08:00
parent 84584a6fd9
commit 0dacc08c2b
52 changed files with 90 additions and 91 deletions

View File

@@ -50,7 +50,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -69,7 +69,7 @@ const [Modal, modalApi] = useVbenModal({
// 设置到 values
await formApi.setValues(formData.value);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -28,7 +28,7 @@ const [Modal, modalApi] = useVbenModal({
try {
formData.value = data;
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -28,7 +28,7 @@ const [Modal, modalApi] = useVbenModal({
try {
formData.value = data;
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -110,7 +110,7 @@ const [Modal, modalApi] = useVbenModal({
});
} finally {
hideLoading();
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -53,7 +53,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -72,7 +72,7 @@ const [Modal, modalApi] = useVbenModal({
// 设置到 values
await formApi.setValues(formData.value);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -60,7 +60,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -79,7 +79,7 @@ const [Modal, modalApi] = useVbenModal({
// 设置到 values
await formApi.setValues(formData.value);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -59,7 +59,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -78,7 +78,7 @@ const [Modal, modalApi] = useVbenModal({
try {
data = await getDemo01Contact(data.id);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
}
// 设置到 values

View File

@@ -65,7 +65,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -86,7 +86,7 @@ const [Modal, modalApi] = useVbenModal({
try {
data = await getDemo02Category(data.id);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
}
// 设置到 values

View File

@@ -61,7 +61,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -80,7 +80,7 @@ const [Modal, modalApi] = useVbenModal({
try {
data = await getDemo03Course(data.id);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
}
// 设置到 values

View File

@@ -61,7 +61,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -80,7 +80,7 @@ const [Modal, modalApi] = useVbenModal({
try {
data = await getDemo03Grade(data.id);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
}
// 设置到 values

View File

@@ -59,7 +59,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -78,7 +78,7 @@ const [Modal, modalApi] = useVbenModal({
try {
data = await getDemo03Student(data.id);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
}
// 设置到 values

View File

@@ -61,9 +61,8 @@ const [Modal, modalApi] = useVbenModal({
// 提交表单
const data = (await formApi.getValues()) as Demo03StudentApi.Demo03Student;
// 拼接子表的数据
// TODO @puhui999字段对不上
data.demo03Courses = demo03CourseFormRef.value?.getData();
data.demo03Grade = await demo03GradeFormRef.value?.getValues();
data.demo03courses = demo03CourseFormRef.value?.getData();
data.demo03grade = await demo03GradeFormRef.value?.getValues();
try {
await (formData.value?.id
? updateDemo03Student(data)
@@ -76,7 +75,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -95,7 +94,7 @@ const [Modal, modalApi] = useVbenModal({
try {
data = await getDemo03Student(data.id);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
}
// 设置到 values

View File

@@ -61,8 +61,8 @@ const [Modal, modalApi] = useVbenModal({
// 提交表单
const data = (await formApi.getValues()) as Demo03StudentApi.Demo03Student;
// 拼接子表的数据
data.demo03Courses = demo03CourseFormRef.value?.getData();
data.demo03Grade = await demo03GradeFormRef.value?.getValues();
data.demo03courses = demo03CourseFormRef.value?.getData();
data.demo03grade = await demo03GradeFormRef.value?.getValues();
try {
await (formData.value?.id
? updateDemo03Student(data)
@@ -75,7 +75,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -94,7 +94,7 @@ const [Modal, modalApi] = useVbenModal({
try {
data = await getDemo03Student(data.id);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
}
// 设置到 values

View File

@@ -82,7 +82,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -101,7 +101,7 @@ const [Modal, modalApi] = useVbenModal({
try {
data = await getDemo01Contact(data.id);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
}
formData.value = data;

View File

@@ -46,7 +46,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -59,7 +59,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -78,7 +78,7 @@ const [Modal, modalApi] = useVbenModal({
// 设置到 values
await formApi.setValues(formData.value);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -29,7 +29,7 @@ const [Modal, modalApi] = useVbenModal({
try {
formData.value = await getJobLog(data.id);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -32,7 +32,7 @@ const [Modal, modalApi] = useVbenModal({
// 获取下一次执行时间
nextTimes.value = await getJobNextTimes(data.id);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -53,7 +53,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -72,7 +72,7 @@ const [Modal, modalApi] = useVbenModal({
// 设置到 values
await formApi.setValues(formData.value);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -40,7 +40,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -53,12 +53,12 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
if (!isOpen) {
formData.value = undefined;
formApi.resetForm();
return;
}
// 加载数据
@@ -71,7 +71,7 @@ const [Modal, modalApi] = useVbenModal({
try {
data = await getDept(data.id);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
}
// 设置到 values

View File

@@ -59,7 +59,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -82,7 +82,7 @@ const [Modal, modalApi] = useVbenModal({
await formApi.setValues(formData.value);
}
} finally {
modalApi.lock(false);
modalApi.unlock();
}
} else if (data && 'dictType' in data && data.dictType) {
// 新增时如果传入了dictType则需要设置

View File

@@ -57,7 +57,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -78,7 +78,7 @@ const [Modal, modalApi] = useVbenModal({
await formApi.setValues(formData.value);
}
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -28,7 +28,7 @@ const [Modal, modalApi] = useVbenModal({
try {
formData.value = data;
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -60,7 +60,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -79,7 +79,7 @@ const [Modal, modalApi] = useVbenModal({
// 设置到 values
await formApi.setValues(formData.value);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -28,7 +28,7 @@ const [Modal, modalApi] = useVbenModal({
try {
formData.value = data;
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -60,7 +60,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -79,7 +79,7 @@ const [Modal, modalApi] = useVbenModal({
// 设置到 values
await formApi.setValues(formData.value);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -61,7 +61,7 @@ const [Modal, modalApi] = useVbenModal({
} catch (error) {
console.error('发送邮件失败', error);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {

View File

@@ -53,7 +53,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -71,7 +71,7 @@ const [Modal, modalApi] = useVbenModal({
try {
data = await getMenu(data.id as number);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
}
// 设置到 values

View File

@@ -53,7 +53,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -74,7 +74,7 @@ const [Modal, modalApi] = useVbenModal({
await formApi.setValues(formData.value);
}
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -28,7 +28,7 @@ const [Modal, modalApi] = useVbenModal({
try {
formData.value = data;
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -78,7 +78,7 @@ const [Modal, modalApi] = useVbenModal({
formData.value = data;
descApi.setState({ data });
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -60,7 +60,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -79,7 +79,7 @@ const [Modal, modalApi] = useVbenModal({
// 设置到 values
await formApi.setValues(formData.value);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -63,7 +63,7 @@ const [Modal, modalApi] = useVbenModal({
} catch (error) {
console.error('发送站内信失败', error);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {

View File

@@ -60,7 +60,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -79,7 +79,7 @@ const [Modal, modalApi] = useVbenModal({
// 设置到 values
await formApi.setValues(formData.value);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -25,7 +25,7 @@ const [Modal, modalApi] = useVbenModal({
try {
formData.value = data;
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -53,7 +53,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -72,7 +72,7 @@ const [Modal, modalApi] = useVbenModal({
// 设置到 values
await formApi.setValues(formData.value);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -64,7 +64,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -83,7 +83,7 @@ const [Modal, modalApi] = useVbenModal({
await loadDeptTree();
toggleExpandAll();
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -59,7 +59,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -80,7 +80,7 @@ const [Modal, modalApi] = useVbenModal({
// 加载菜单列表
await loadMenuTree();
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -53,7 +53,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -72,7 +72,7 @@ const [Modal, modalApi] = useVbenModal({
// 设置到 values
await formApi.setValues(formData.value);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -59,7 +59,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -78,7 +78,7 @@ const [Modal, modalApi] = useVbenModal({
// 设置到 values
await formApi.setValues(formData.value);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -28,7 +28,7 @@ const [Modal, modalApi] = useVbenModal({
try {
formData.value = data;
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -60,7 +60,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -79,7 +79,7 @@ const [Modal, modalApi] = useVbenModal({
// 设置到 values
await formApi.setValues(formData.value);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -61,7 +61,7 @@ const [Modal, modalApi] = useVbenModal({
} catch (error) {
console.error('发送短信失败', error);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {

View File

@@ -60,7 +60,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -79,7 +79,7 @@ const [Modal, modalApi] = useVbenModal({
// 设置到 values
await formApi.setValues(formData.value);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -30,7 +30,7 @@ const [Modal, modalApi] = useVbenModal({
try {
formData.value = await getSocialUser(data.id);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -53,7 +53,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -72,7 +72,7 @@ const [Modal, modalApi] = useVbenModal({
// 设置到 values
await formApi.setValues(formData.value);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -68,7 +68,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -88,7 +88,7 @@ const [Modal, modalApi] = useVbenModal({
formData.value = await getTenantPackage(data.id as number);
await formApi.setValues(data);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -47,7 +47,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -68,7 +68,7 @@ const [Modal, modalApi] = useVbenModal({
roleIds,
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -53,7 +53,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
@@ -72,7 +72,7 @@ const [Modal, modalApi] = useVbenModal({
// 设置到 values
await formApi.setValues(formData.value);
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -46,7 +46,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
});

View File

@@ -44,7 +44,7 @@ const [Modal, modalApi] = useVbenModal({
key: 'action_process_msg',
});
} finally {
modalApi.lock(false);
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {