| | |
| | | import { deepClone } from '/@/utils/other'; |
| | | import { travelTree } from '/@/utils/util'; |
| | | const props = defineProps(['item', 'departmentTreeList']); |
| | | const { departmentTreeList } = toRefs(props); |
| | | const { departmentTreeList, item } = toRefs(props); |
| | | const emit = defineEmits(['update', 'insert']); |
| | | const parentSelectOptions = computed(() => { |
| | | const cloneTreeData = deepClone(tableTreeData.value); |
| | | travelTree(cloneTreeData, (value, index, array, parent) => { |
| | | if ((value as any).id === parentForm.value.id) { |
| | | if ((value as any).id === dialogFormValue.value.id) { |
| | | if (parent === array) { |
| | | parent?.splice(index, 1); |
| | | } else { |
| | |
| | | const dialogHeaderIcon = computed(() => { |
| | | return isEditDialog.value ? 'ele-Edit' : 'ele-Plus'; |
| | | }); |
| | | const dialogFormValue = ref(null); |
| | | const dialogIsShow = defineModel({ |
| | | type: Boolean, |
| | | }); |
| | |
| | | }; |
| | | |
| | | //#endregion |
| | | const parentForm = ref(null); |
| | | const dialogFormValue = ref(null); |
| | | watch( |
| | | () => dialogIsShow.value, |
| | | (val) => { |
| | | if (!val) return; |
| | | const { id, parent_id, name, create_user, create_time } = props.item; |
| | | parentForm.value = { id, parent_id, name, create_user, create_time }; |
| | | openOperateDialog(props.item); |
| | | openOperateDialog(item.value); |
| | | } |
| | | ); |
| | | const tableTreeData = ref([]); |
| | |
| | | tableTreeData.value = val; |
| | | } |
| | | ); |
| | | watch( |
| | | () => item.value, |
| | | (val) => { |
| | | if (!val) return; |
| | | const { id, parent_id, name, create_user, create_time } = item.value; |
| | | dialogFormValue.value = { id, parent_id, name, create_user, create_time }; |
| | | } |
| | | ); |
| | | </script> |
| | | <style scoped lang="scss"></style> |