| | |
| | | const emit = defineEmits(['success']) |
| | | const formRef = ref(null) |
| | | const formData = ref(initForm()) |
| | | const visible = ref(false) |
| | | const visible = defineModel() |
| | | const dialogMode = ref('add') |
| | | const submitting = ref(false) |
| | | const isAddChild = ref(false) |
| | |
| | | }) |
| | | ElMessage.success(dialogMode.value === 'add' ? '新增成功' : '更新成功') |
| | | visible.value = false |
| | | emit('success') |
| | | emit('success', { parentId: formData.value.parentId || null, mode: dialogMode.value, isAddChild: isAddChild.value }) |
| | | } finally { |
| | | submitting.value = false |
| | | } |
| | |
| | | |
| | | async function open({ mode, row, parent } = {}) { |
| | | dialogMode.value = mode || 'add' |
| | | visible.value = true |
| | | isAddChild.value = mode === 'add' && !!parent?.id |
| | | await getDeptTree().then(res => { |
| | | if (deptTree) { |