<template>
  <a-card>
    <a-tabs v-model="activeKey">
      <a-tab-pane key="processed" tab="承接已办">
        <sd-data-table
          ref="processed"
          data-url="api/framework/v1/user-tasks/handover/processed"
          :columns="processedColumns"
          show-selection
          :actions="processedActions"
          :row-key="'id'"
          :search-fields="['title']"
          @rowClick="rowClick"
        >
          <a slot="name" slot-scope="text"> {{ text }} - 自定义render</a>
        </sd-data-table>
      </a-tab-pane>
      <a-tab-pane key="inform" tab="承接已阅">
        <sd-data-table
          ref="inform"
          data-url="api/framework/v1/user-tasks/handover/replied-inform"
          :columns="informColumns"
          show-selection
          :actions="informActions"
          :row-key="'id'"
          :search-fields="['title']"
          @rowClick="rowClick"
        >
          <a slot="name" slot-scope="text"> {{ text }} - 自定义render</a>
        </sd-data-table>
      </a-tab-pane>
    </a-tabs>
  </a-card>
</template>

<script>
import TodoListService from '@/todo/todo-list-service'
import TableColumnTypes from '../common/services/table-column-types'
import components from './_import-components/sd-work-handover-import'
export default {
  name: 'SdWorkHandover',
  metaInfo: {
    title: '工作交接',
  },
  components,
  data() {
    return {
      activeKey: 'processed',
      processedColumns: [
        {
          title: '业务类型',
          dataIndex: 'appCat',
        },
        {
          title: '标题',
          dataIndex: 'title',
          sdClickable: true,
        },
        {
          title: '经办人',
          dataIndex: 'creatorName',
        },
        {
          title: '主办部门',
          dataIndex: 'creatorDeptName',
        },
        {
          title: '办理时间',
          dataIndex: 'processDate',
          sorter: true,
          sdRender: TableColumnTypes.dateTime,
        },
        {
          title: '当前状态',
          dataIndex: 'activeStepNames',
        },
        {
          title: '当前处理人',
          dataIndex: 'activeOperatorUsers',
        },
      ],
      informColumns: [
        {
          title: '业务类型',
          dataIndex: 'appCat',
        },
        {
          title: '标题',
          dataIndex: 'title',
          sdClickable: true,
        },
        {
          title: '阅读时间',
          dataIndex: 'seenDate',
          sdRender: TableColumnTypes.dateTime,
        },
      ],
      processedActions: [],
      informActions: [],
    }
  },
  methods: {
    rowClick(record) {
      TodoListService.openTaskItem(record, this.activeKey)
    },
  },
}
</script>

<style module lang="scss">
@use '@/common/design' as *;
</style>
