<template>
  <div class="demo-custome-event">
    <ui-table
      :data-source="dataSource"
      :columns="columns"
      :row-events="{
        click: handlerClick,
      }" />
  </div>
</template>

<script>
import { Table } from "amumu-ui"

const dataSource = [
  {
    id: "100001",
    title: "升级版本方案",
    status: "待处理",
    handler: "吴彦祖",
  },
  {
    id: "100002",
    title: "升级版本方案",
    status: "待处理",
    handler: "吴彦祖",
  },
  {
    id: "100003",
    title: "升级版本方案",
    status: "待处理",
    handler: "吴彦祖",
  },
]

const columns = [
  {
    title: "ID",
    key: "id",
    className: "test-class",
    align: "right",
    width: 100,
    defaultSort: "desc",
    minDragWidth: 80,
  },
  {
    title: "标题",
    key: "title",
    transform: ({ value }) => `标题: ${value}`,
  },
  {
    title: "状态",
    key: "status",
    draggable: false,
  },
  {
    title: "处理人",
    key: "handler",
  },
]

export default {
  components: {
    "ui-table": Table,
  },
  data() {
    return {
      dataSource: dataSource,
      columns: columns,
    }
  },
  methods: {
    handlerClick(e, row) {
      alert(`请确定您选择行的id是：${row.id}`)
    },
  },
}
</script>
