mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 04:29:20 +08:00
fix: 修复前端若干类型报错
This commit is contained in:
+12
-4
@@ -127,7 +127,7 @@ function findDepartmentPathById(
|
||||
options: DepartmentCascaderOption[],
|
||||
departmentId: number,
|
||||
currentPath: number[] = [],
|
||||
): number[] | null {
|
||||
): null | number[] {
|
||||
for (const option of options) {
|
||||
const nextPath = [...currentPath, option.value];
|
||||
if (option.value === departmentId) return nextPath;
|
||||
@@ -207,7 +207,9 @@ function handleDepartmentChange(value: number[]) {
|
||||
if (
|
||||
previousDepartmentId !== selectedDepartmentId &&
|
||||
formData.value.positionId &&
|
||||
!positionOptions.value.some((item) => item.value === formData.value.positionId)
|
||||
!positionOptions.value.some(
|
||||
(item) => item.value === formData.value.positionId,
|
||||
)
|
||||
) {
|
||||
formData.value.positionId = undefined;
|
||||
}
|
||||
@@ -279,7 +281,9 @@ watch(
|
||||
() => {
|
||||
if (
|
||||
formData.value.positionId &&
|
||||
!positionOptions.value.some((item) => item.value === formData.value.positionId)
|
||||
!positionOptions.value.some(
|
||||
(item) => item.value === formData.value.positionId,
|
||||
)
|
||||
) {
|
||||
formData.value.positionId = undefined;
|
||||
}
|
||||
@@ -345,7 +349,11 @@ defineExpose({
|
||||
:options="departmentTreeOptions"
|
||||
:loading="departmentOptionsLoading"
|
||||
placeholder="请选择所属部门"
|
||||
:field-names="{ label: 'label', value: 'value', children: 'children' }"
|
||||
:field-names="{
|
||||
label: 'label',
|
||||
value: 'value',
|
||||
children: 'children',
|
||||
}"
|
||||
change-on-select
|
||||
class="w-full"
|
||||
@change="(value) => handleDepartmentChange((value || []) as number[])"
|
||||
|
||||
Reference in New Issue
Block a user