<template>
  <div>

    <el-table :data-read-url="getData" ref="pageComponentTable" :data="dataList" highlight-current-row @row-click="onRowClick" pagination-layout="total,sizes, ->, prev, next" :page-size="10" tooltip-effect="dark">
      <el-table-column label="名称">
        <template slot-scope="scope">
          <el-radio v-model="model" :label="JSON.stringify(scope.row)">
            &nbsp;
            <i class="fa fa-picture-o" v-if="scope.row.type=== 'ImagePlayer'"></i>
            <i class="fa fa-pie-chart" v-else-if="scope.row.type=== 'Vote'"></i>
            <i class="fa fa-file-archive-o" v-else-if="scope.row.type=== 'ADPosition'"></i>
            &nbsp;{{scope.row.name}}
          </el-radio>
        </template>
      </el-table-column>
      <el-table-column prop="alias" label="别名"></el-table-column>
    </el-table>

  </div>
</template>

<script>
export default {
  props: ['widgetModel'],
  data() {
    return {
      dataList: []
    }
  },
  computed: {
    model: {
      get() {
        return this.widgetModel
      },
      set(val) {
        this.$emit('update:widgetModel', val)
      }
    }
  },
  methods: {
    getData() {
      return [
        '/ui/pagewidget', {
          params: {
            pagewidget: ''
          }
        }
      ]
    },
    onRowClick(row) {
      this.model = JSON.stringify(row)
    }
  }
}
</script>
