<template>
  <a-modal
    title="选择审计事项模板"
    :destroy-on-close="true"
    :visible="visible"
    width="1000px"
    @ok="handleOk"
    @cancel="handleCancel"
  >
    <sd-data-table-ex
      ref="importTable"
      form-id="iamAuditMattersTemplate"
      page-id="audit/matters/template/iamAuditMattersTemplate"
      :data-url="'api/xcoa-mobile/v1/iam-auditmatters-template/businessList'"
      :columns="columns"
      show-selection
      :filter-expressions="expressions"
      :search-fields="['templateName']"
      check-type="radio"
    >
    </sd-data-table-ex>
  </a-modal>
</template>

<script>
import TableColumnTypes from '@/common/services/table-column-types'
import components from './_import-components/iam-audit-import-matters-template-import'

export default {
  name: 'IamAuditImportMattersTemplate',
  metaInfo: {
    title: '审计事项模板',
  },
  components: {
    ...components,
  },
  props: {
    // 弹窗是否显示
    visible: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      expressions: [],
      columns: [
        {
          title: '序号',
          customRender: (text, record, index) => `${index + 1}`,
          width: '80px',
        },
        {
          title: '模板名称',
          dataIndex: 'templateName',
          width: '50%',
        },
        {
          title: '编制人员',
          dataIndex: 'creatorName',
          width: '30%',
        },

        {
          title: '编制时间',
          dataIndex: 'creationTime',
          sdRender: TableColumnTypes.date,
          width: '20%',
        },
      ],
    }
  },
  methods: {
    // 取消事件
    handleCancel() {
      this.$emit('handleCancel')
    },
    // 确认事件
    handleOk() {
      this.$emit('mbhandleOk', this.$refs.importTable.getSelectedRows())
    },
  },
}
</script>

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