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 => {
  var rtn={}
  let tableData = []
  console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
console.log(req.body)
 let reqdata= JSON.parse(req.body)
 let psize=reqdata.pageinfo.pageSize
  doCustomTimes(psize, () => {
    tableData.push(Mock.mock({
      userName: '@name',
      nickName: '@email',
      mobile:'13500110024',
      city:Random.csentence(3, 5),
      age:  Random.increment(10),
      isEnabled:true
    }))
  })
  rtn. results={rows:tableData,count:100}
  return rtn;
}

export const create = req => {
  var rtn={}
  return rtn;
}
export const update = req => {
  var rtn={}
  return rtn;
}
export const deleteByIds = req => {
  var rtn={}
  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
}
