<template>
  <div >
    <div class="content">
      <dataBreadcrumb :breads="breads"></dataBreadcrumb>
	  <el-button type="primary" @click="add">创建新的角色</el-button>
      <dataTable :table-data="tableData" :columns="columns" :is-pageobj="false" :tableTop="30">
        <el-table-column slot="operate" label="操作" align="center" fixed="right" >
          <template slot-scope="scope">
            <el-button type="text" size="small" @click="see(scope.row)">查看</el-button>
          </template>
        </el-table-column>
      </dataTable>
    </div>
  </div>
</template>

<script>
import {roleList} from '@api/purchaser/organization'
import dataTable from '@components/nopageTable.vue'
import dataBreadcrumb from '@components/dataBreadcrumb.vue'
export default {
  components: {
    dataTable,
    dataBreadcrumb
  },
  data() {
    return {		
      breads: ['系统管理', '角色权限'],
      tableData: [],
      columns: [{
        label: '角色名称',
        prop: 'roleName',
        width: 400
      },
      {
        label: '备注',
        prop: 'remark',
		width: 400
      },
      {
        slot: 'operate'
      }
      ], // 操作列
     
      pageObj: {
        size: 10,
        total: 1,
        currentPage: 1,
        sizes: [100, 200, 300],
        func: (currentPage) => {
          this.pageTurning(currentPage)
        }
      }
    }
  },
  methods: {
    see() {
      this.$router.push('/purchaser/organization/jurisdictionSee')
    },
	add(){
		this.$router.push("/purchaser/organization/jurisdictionSee")
	},
	 async getroleList() {
		 let type=JSON.parse(localStorage.getItem("userInfo")).type
	        const {
	          data,
	          code
	        } = await roleList(type)
			for(let item of data){
				if(!item.remark){
					item.remark="空"
				}
			}
			this.tableData=data
	    }
  },
  created() {
  	this.getroleList()
  }
}
</script>

<style scoped>
	
</style>
