/**
 * 这是一个重置OrganizationIdTree组件的hooks,目的是用于重置分页查询的字段。
 *
 * 使用方式 const {organizationIdTreeRef,resetFn} = useResetOrganizationTree()
 *
 * organizationIdTreeRef 将ref和organizationIdTreeRef绑定即可,第二个是重置的方法
 */

import { ref } from 'vue';
import organizationIdTree from '../OrganizationIdTree.vue';
export const useResetOrganizationTree = (searchInfo: Recordable) => {
  const organizationIdTreeRef = ref<InstanceType<typeof organizationIdTree>>();
  async function resetFn() {
    organizationIdTreeRef.value.resetOrganization();
    searchInfo.organizationId = null;
  }
  return { organizationIdTreeRef, resetFn };
};
