import Mock from 'mockjs'
import menu from '../menu1.json'

const Random = Mock.Random;
// import { encryptResult } from '@/commons/utils/aes'
Mock.mock(/\/dynamic-table-demo\.json/, (config) => {
  console.log('======', config, config.body);
  // const page = JSON.parse(config.body)
  let rows = Mock.mock({
    "rows|100": [ {
      'id': "@guid",
      'dataStatus|1-2': 1,
      'createTime': '@datetime(yyyy-MM-dd HH:mm:ss)',
      'version': 1,
      'enable|0-1': 1,
      'image': "@image",
      'realName': "@cname(150)",
      'remark': "@cword(300)",
      'idCard': Random.id(),
      'cardType|1-2': 1,
      // 'region': '@region',
      'county': '@county(true)',
    }, ],
  });
  return {
    ...rows,
    total: 1000000000000,
    code: 200,
    msg: "查询成功",
  }
});

Mock.mock(/\/tree-table-demo\.json/, (config) => {
  console.log('======', config, config.body);
  return {
    ...menu
  }
});
Mock.mock(/\/constants\.json/, (config) => {
  console.log('======', config, config.body);
  let rows = Mock.mock({
    "rows|1000": [ {
      'id': "@guid",
      'dataStatus|1-2': 1,
      'createTime': '@datetime(yyyy-MM-dd HH:mm:ss)',
      'version': 1,
    }, ],
  });
  return {
    ...rows,
    total: 100,
    code: 200,
    msg: "查询成功",
  }
});

Mock.mock(/\/select-remote-page\.json/, (config) => {
  console.log('======', config, config.body);
  // const page = JSON.parse(config.body)
  let rows = Mock.mock({
    "rows|10": [ {
      'id': "@guid",
      'realName': "@cname(150)",
      'county': '@county(true)',
    }, ],
  });
  return {
    ...rows,
    total: 100000,
    code: 200,
    msg: "查询成功",
  }
});

export default Mock;
