import type { ItemRenderParams } from '#/components/mj/mj-table-select'

import {
  parsePrepareParams,
  useItemRender,
} from '#/components/mj/mj-table-select'

import SpMgr from '../sp-mgr/home.vue'

export function useSearchSp(params?: ItemRenderParams) {
  parsePrepareParams(params)
  return useItemRender({
    ...params,
    cmp: SpMgr,
    setData: (item: any, _: any, value: any, label: any) => {
      item.providerId = value
      item.providerName = label
    },
    props: {
      modal: { title: '请选择服务商' },
      ...params?.props,
    },
  })
}
