<template>
 <el-radio-group v-model="value">
    <el-radio v-for="item in options" :key="item.id"  :label="item.id" >{{item.roleName}}</el-radio>
  </el-radio-group>
  <!-- <el-select v-model="value" placeholder="全部" ref="select" v-if="show1">
    <el-option label="全部" :value="''" v-if="showAll"></el-option>
    <el-option v-for="item in options" :key="item.id"  :label="item.roleName" :value="item.id"></el-option>
  </el-select>
  <el-select v-model="value" placeholder="全部" ref="select" v-else>
    <el-option label="全部" :value="''" v-if="showAll"></el-option>
    <el-option v-for="item in options" :key="item.id"  :label="item.roleName" :value="item.id"></el-option>
  </el-select> -->
</template>

<script>
import selectComponentJs from '../select'
import { getRoleList } from '@/request/config'
import axios from 'axios'

const extObj = selectComponentJs()

extObj.watch = {
  ...extObj.watch,
  data() {
    let base = extObj.data ? extObj.data() : {}
    return {
      ...base,
      allData: []
    }
  },
  notShow() {
    if (this.allData) {
      // this.options = this.allData.filter(item => !this.notShow.includes(item.id))
    }
  }
}

export default {
  ...extObj,
  async mounted() {
    
    let res = await axios.post(getRoleList, {})
    this.allData = res.data.map(item => ({...item, id: item.id.toString()}))
    this.options = this.allData.filter(item => item.id!=1).reverse()
    console.log(this.options);

    // if (this.notShow) {
      
    //   this.options = this.allData.filter(item => !this.notShow.includes(item.id))
    // }


    this.$emit('asyncLoad')
   
    extObj.mounted.call(this)
  }
}
</script>