<template>
  <div style="padding: 20px; padding-top: 0" class="reporttablecardxm">
    <div
      style="position: absolute; padding-top: 10px; line-height: 32px"
      class="header_sd-header_common"
    >
      <div :class="$style.titlepoint"></div>
      <span :class="['toptitle', $style.toptitle]">工作动态: {{ params.title }} 阅读情况</span>
    </div>
    <br />
    <br />
    <sd-data-table
      ref="dataTable"
      :columns="columns"
      :projectlist="true"
      :data-url="dataUrl"
      :actions="actions"
      :process-req="processReq"
      :process-res="processRes"
      :defultpagination-pagesize="50"
    >
      <template slot="islink" slot-scope="text, record">
        {{ record.isRead === 'true' ? '是' : '否' }}
      </template>
    </sd-data-table>
  </div>
</template>

<script>
import components from './_import-components/xm-audit-reader-list-import'

export default {
  name: 'XmAuditorReaderList',
  metaInfo: {
    title: '阅读者列表',
  },
  components,
  data() {
    return {
      params: {},
      columns: [],
      year: '',
      data: [],
      unitName: '',
      unitCode: '',
      actions: [],
    }
  },
  computed: {
    dataUrl() {
      return `api/xcoa-mobile/v1/portal/getAuditorReaderList?formId=${this.params.formId}&beanId=${this.params.beanId}`
    },
  },
  mounted() {
    const params = JSON.parse(this.$route.query.params)
    this.params = params
    this.columns.push({ title: '姓名', dataIndex: 'name' })
    this.columns.push({ title: '公司', dataIndex: 'orgName' })
    this.columns.push({
      title: '是否已阅',
      dataIndex: 'isReader',
      scopedSlots: { customRender: 'islink' },
    })
  },
  methods: {
    processRes(res) {
      return res
    },
    processReq(req) {
      const params = JSON.parse(this.$route.query.params)
      if (req.data.pageIndex === undefined) {
        req.data.pageIndex = req.data.startPosition
      }

      if (req.data.pageSize === undefined) {
        req.data.pageSize = 10
      }
      return req
    },
  },
}
</script>

<style module lang="scss">
@use '@/common/design' as *;
.titlepoint {
  position: absolute;
  top: 12px;
  left: 20px;
  width: 8px;
  height: 27px;
  background: #1890ff;
  border-radius: 8px;
}
.toptitle {
  position: absolute;
  top: 9px;
  left: 40px;
  width: 1250px;
  font-size: 22px;
  font-weight: bold;
  color: #404040;
}
</style>
