<template>
  <a-modal
    :title='modalTitle'
    :width='850'
    :visible='visible'
    :confirmLoading='confirmLoading'
    class='ant-modal2'
    @cancel='handleCancel'
  >
    <detail-list title='' :col='2'>
      <detail-list-item term='自定义报表名称'>{{ model.name }}</detail-list-item>
      <detail-list-item term='图形类别'>{{ BaseTool.Object.getField(echartTypeMap,model.echartType) }}</detail-list-item>
      <detail-list-item term='报表检索条件'>{{ model.parameter }}</detail-list-item>
      <detail-list-item term='报表接口类型'>{{ BaseTool.Object.getField(interTypeMap,model.interType) }}</detail-list-item>
      <detail-list-item term='数据来源'>{{ model.sqlVal }}</detail-list-item>
      <detail-list-item term='表格展示字段'>{{ model.columns }}</detail-list-item>
      <detail-list-item term='添加人'>{{ model.createdUserName }}</detail-list-item>
      <detail-list-item term='添加时间'>{{ model.createdTime }}</detail-list-item>
      <detail-list-item term='修改人'>{{ model.updateUserName }}</detail-list-item>
      <detail-list-item term='修改时间'>{{ model.updateTime }}</detail-list-item>
    </detail-list>

    <template slot='footer'>
      <a-button :loading='confirmLoading' type='primary' @click='handleCancel()'>返回</a-button>
    </template>
  </a-modal>
</template>

<script>
import DetailList from '@/components/tools/DetailList'

const DetailListItem = DetailList.Item

export default {
  name: 'CustomizeReportDetail',
  components: {
    DetailList,
    DetailListItem
  },
  data () {
    return {
      confirmLoading: false,
      mdl: {},
      modalTitle: null,
      visible: false,
      echartTypeMap: [],
      interTypeMap: [],
      // 下拉框map
      model: {
        'name': null,
        'echartType': null,
        'parameter': null,
        'interType': null,
        'sqlVal': null,
        'columns': null,
        'status': null,
        'remark': null,
        'createdUserId': null,
        'updateUserId': null,
        'updateUserName': null,
        'updateTime': null
      }
    }
  },
  created () {
    // 下拉框map
    this.echartTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CUSTOMIZE_REPORT_ECHART_TYPE)
    this.interTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CUSTOMIZE_REPORT_INTER_TYPE)
  },
  methods: {
    base(record) {
      this.visible = true
      this.modalTitle = '详情'
      this.model = record
    },
    handleCancel() {
      this.visible = false
      this.confirmLoading = false
    }

  }
}
</script>
