import Mock from 'mockjs'
const Random = Mock.Random
import { doCustomTimes } from '@/libs/util'
export const refQuery = (req) => {
    console.log(req.body);
    console.log(req.url);
    let opts = []
    doCustomTimes(5, () => {
        opts.push(Mock.mock({
        label: Random.cword(10, 15),
        value: Random.cword(3, 5),
      }))
    })
    return opts
}

export const getUIConfig = (req) => {
  console.log(req.body)
  console.log(req.url)
  let  forminfo=[
    {
       "title":"基本信息",
       "styles":{'padding-bottom':'300px'},
       ctls:[
           {"type":"input","label":"账号","prop":"userName","placeHolder":"登录账号","style":"",rules:[ { "required": true, "message": ' 登录账号 ', "trigger": 'blur' },]},
           {"type":"input","label":"昵称","prop":"nickName","placeHolder":"昵称","style":"",rules:[ { "required": true, "message": ' 昵称 ', "trigger": 'blur' },]},
           {"type":"input","label":"电话","prop":"mobile","placeHolder":"请输入电话","style":"",rules:[ { "required": true, "message": '  请输入电话', "trigger": 'blur' },]},
           {"type":"input","label":"年龄","prop":"age","placeHolder":"请输入年龄","style":"",rules:[ { "required": true, "message": '  请输入年龄', "trigger": 'blur' },]},
           {"type":"select","label":"城市","prop":"city","isMultiple":false,"placeHolder":"城市","style":"",rules:[ { "required": true, "message": '  ', "trigger": 'blur' },]},
           {"type":"switch","label":"状态","prop":"isEnabled","isDisabled":false,"placeHolder":"状态","style":"",rules:[ ]},
           {"type":"input","label":"xxdf","prop":"ookok","placeHolder":"xxdfsdf","style":"",rules:[ { "required": true, "message": '  ', "trigger": 'blur' },]},
           {"type":"input","label":"xxdf","prop":"ookok2","placeHolder":"xxdfsdf","style":"",rules:[ { "required": true, "message": '  ', "trigger": 'blur' },]},
           {"type":"input","label":"xxdf","prop":"ookok3","placeHolder":"xxdfsdf","style":"",rules:[ { "required": true, "message": '  ', "trigger": 'blur' },]},
           {"type":"checkgroup","label":"城市","prop":"fruits","placeHolder":"城市","style":"",rules:[ ],initValue:[ {label:'苹果',value:'apple'},{label:'香蕉',value:'banana'}]},
           {"type":"radiogroup","label":"蒴果","prop":"rdofruits","placeHolder":"城市","style":"",rules:[ ],initValue:[ {label:'苹果',value:'apple'},{label:'香蕉',value:'banana'}]},
        
       ]
    },
 
]
let tableinfo=[
  { title: '账号', key: 'userName', sortable: true,slot:'userName',isTmpl:true},
  { title: '昵称', key: 'nickName', sortable: true,slot:'nickName',isTmpl:true},
  { title: '电话', key: 'mobile', editable: true },
  { title: '年龄', key: 'age', editable: true },
  { title: '城市', key: 'city', editable: true },
  { title: '操作', key: 'action' ,slot:'action',options:['delete','edit']}
]
let authbuttons=
  {
    inform:[
      {key:'cancel',icon:'ios-backspace-outline',title:'取消'},
      {key:'save',icon:'ios-archive',title:'保存',isfocus:true},
    ],
    inrow:[
      {key:'edit',icon:'ios-create-outline',title:'编辑'}
    ],
    onlist:[
      {key:'create',icon:'ios-create-outline',title:'新建'},
      {key:'delete',icon:'ios-trash-outline',title:'删除'},
      {key:'export',icon:'ios-cloud-download-outline',title:'导出'},
      {key:'search',icon:'ios-search-outline',title:'搜索',isfocus:true},
    ],
    insearch:[
      {key:'searchok',icon:'ios-search-outline',title:'搜索',isfocus:true},
    ]
  }
  let searchFormInfo=[
  {
      "title":"基本信息",
       "cols":2,
      ctls:[
          {"type":"input","label":"账号","prop":"userName","placeHolder":"登录账号","style":"",rules:[ ]},
          {"type":"input","label":"昵称","prop":"nickName","placeHolder":"昵称","style":"",rules:[]},
          {"type":"input","label":"电话","prop":"mobile","placeHolder":"请输入电话","style":"",rules:[ ]},
      ]
   },

  ]
  return {forminfo,searchFormInfo,tableinfo,authbuttons}
}
