import {  reactive } from 'vue'
import customerService from '@/api/customer'
import customerService2 from '@/api/customer2'
import router from '@/router/index'
interface Params {
  RuleId: number
}
const curQueryId = Number(router.currentRoute.value.query.Id) ?? 0
console.log(8, curQueryId)

const msg = reactive<Params>({
  RuleId: 0
})
if (curQueryId > 0) {
  msg.RuleId = <number>curQueryId
}
const data = reactive({
  showDialog: false,
  shape: 0,
  dataTree: {}
})
const jumpBeforePage = () => {
  router.go(-1)
}

const changeDialog = () => {
  data.showDialog = true
}

const editRuleModule = () => {
  //获取线索详情
  const getDetail = () => {
    customerService.getCustomerClueRuleDetail(msg).then(res => {
      console.log(res, '数据')
    })
  }
  //获取部门数据
  const getEmployeeData = () => {
    customerService2.getEmployeeData({}).then(res => {
      console.log(res.data.Data, '数据')
      data.dataTree = res.data.Data
    })
  }
  return {
    msg,
    data,
    getDetail,
    getEmployeeData,
    jumpBeforePage,
    changeDialog
  }
}

export default editRuleModule
