import Mock from 'mockjs'
import { doCustomTimes } from '@/libs/util'
import orgData from './data/org-data'
import { treeData } from './data/tree-select'
const Random = Mock.Random

export const getTableData = req => {
  let rtn={}
  console.log("========================================")
  let q=JSON.parse(req.body)
  console.log(q)
  let tableData = []
  doCustomTimes(100, () => {
    tableData.push(Mock.mock({
      name: '@name',
      email: '@email',
      createTime: '@date'
    }))
  })
  rtn.status=0;
  rtn.data={
    results:{
      count:100,
      rows:tableData.slice(0,q.pageInfo.pageSize)
    },
    aggresult:{},
    bizmsg:null

  }
  return rtn
}

export const getDragList = req => {
  let dragList = []
  doCustomTimes(5, () => {
    dragList.push(Mock.mock({
      name: Random.csentence(10, 13),
      id: Random.increment(10)
    }))
  })
  return dragList
}

export const uploadImage = req => {
  return Promise.resolve()
}

export const getOrgData = req => {
  return orgData
}

export const getTreeSelectData = req => {
  return treeData
}
