export const rules = () => {
  return [{
    field: 'title',
    label: '菜单名称',
    align: 'center',
  }, {
    field: 'name',
    label: '路由名称',
    align: 'center',
  }, {
    field: 'component',
    label: '组件名称',
    align: 'center',
  }, {
    field: 'sort',
    label: '排序',
    align: 'center',
  }, {
    field: 'menuType',
    label: '类型',
    align: 'center',
    options: [{
        label: '目录',
        value: "M",
      },
      {
        bgcolor: 'warning',
        label: '菜单',
        value: "C",
      },
      {
        label: '按钮',
        value: "F",
      }
    ]
  }, {
    field: 'visible',
    label: '显示状态',
    align: 'center',
    options: [{
        bgcolor: 'success',
        label: '显示',
        value: "1",
      },
      {
        bgcolor: 'info',
        label: '隐藏',
        value: "0",
      },
    ]
  }, {
    field: 'action',
    label: '操作',
    colWidth: '260px',
    align: 'center',
    labelButton: [{
      type: 'add',
      label: '新增子级',
      icon: 'el-icon-plus',
      style: 'primary',
    }, {
      type: 'edit',
      label: '修改',
      icon: 'el-icon-edit',
      style: 'primary',
    }, {
      type: 'del',
      label: '删除',
      icon: 'el-icon-delete',
      style: 'danger',
    }]
  }]
}

export const formRules = () => {
  return [{
    field: 'menuType',
    label: '菜单类型',
    type: 'radio',
    colWidth: 24,
    rules: [{
      required: true,
      message: '选择菜单类型',
      trigger: 'change'
    }],
    options: [{
        label: '目录',
        value: "M",
      },
      {
        label: '菜单',
        value: "C",
      },
      {
        label: '按钮',
        value: "F",
      }
    ]
  }, {
    field: 'title',
    label: '菜单名称',
    placeholder: '菜单名称',
    type: 'input',
    colWidth: 24,
    rules: [{
      required: true,
      message: '请输入菜单名称',
      trigger: 'blur'
    }]
  }, {
    field: 'name',
    label: '路由名称',
    placeholder: '路由名称',
    type: 'input',
    colWidth: 24,
    rules: [{
      required: true,
      message: '请输入路由名称',
      trigger: 'blur'
    }]
  }, {
    field: 'component',
    label: '组件名称',
    placeholder: '组件名称',
    type: 'input',
    colWidth: 24,
    rules: [{
      required: true,
      message: '请输入组件名称',
      trigger: 'blur'
    }]
  }, {
    field: 'icon',
    label: '图标',
    placeholder: '请输入图标',
    type: 'input',
    colWidth: 24,
  }, {
    field: 'sort',
    label: '排序',
    placeholder: '请输入',
    type: 'input',
    colWidth: 24,
  }, {
    field: 'visible',
    label: '菜单状态',
    type: 'radio',
    colWidth: 24,
    rules: [{
      required: true,
      message: '选择菜单状态',
      trigger: 'change'
    }],
    options: [{
        label: '显示',
        value: "1",
      },
      {
        label: '隐藏',
        value: "0",
      },
    ]
  }, {
    field: 'address',
    label: '重定向地址',
    placeholder: '请输入',
    type: 'input',
    colWidth: 24,
  }]
}
