<template>
  <div>
    <Card>
      <Table ref="systemTables" searchable search-place="top" :data="tableData" stripe  :columns="columns" size="small" highlight-row></Table>
    </Card>
    <Divider />
  </div>
</template>

<script>
import {getList} from '../../../api/rbac/res-manage'
export default {
  name: "data-source",
  components: {
  },
  data () {
    return {
      dataCount:0,
      columns: [
        { title: '系统名称', key: 'name', sortable: true },
        { title: '系统地址', key: 'href'},
        { title: '系统代码', key: 'code' },
        { title: '备注', key: 'remark' },
        {
          title: '操作',
          key: 'action',
          width: 320,
          align: 'center',
          render: (h, params) => {
            return h('div', [
              h('Button', {
                props: {
                  type: 'primary',
                  size: 'small'
                },
                style: {
                  marginRight: '5px'
                },
                on: {
                  click: () => {
                    this.toMonitor(params);
                  }
                }
              }, '进入监控')
            ]);
          }
        }
      ],
      tableData: []
    }
  },
  methods: {
    toMonitor (params) {
      const url = this.$config.server_url+params.row.code+'/druid/';
      window.open(url);
    }
  },
  mounted () {
    //初始化数据
    let params = {type:'0'}
    getList(params).then(res => {
      this.tableData = res.data.result;
    })
  }
}
</script>

<style scoped>

</style>
