<template>
  <a-modal
    :title="modalTitle"
    :width="850"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @cancel="handleCancel"
  >
    <detail-list title="" :col="2">
      <detail-list-item term="标识">{{ model.code }}</detail-list-item>
      <detail-list-item term="名称">{{ model.name }}</detail-list-item>
      <detail-list-item term="内容" v-if="model.type === 1">{{ model.content }}</detail-list-item>
      <detail-list-item term="是否对外">{{ model.openFlag ? '是' : '否' }}</detail-list-item>
      <detail-list-item term="描述">{{ model.description }}</detail-list-item>
      <detail-list-item term="创建时间">{{ model.createdTime }}</detail-list-item>
      <detail-list-item term="创建人名称">{{ model.createdUserName }}</detail-list-item>
    </detail-list>

    <detail-list title="" :col="1">
      <detail-list-item term="内容" v-if="model.type === 2"><img :src="BaseTool.Constant.FILE_URL + model.content" width="100%" /></detail-list-item>
      <detail-list-item term="内容" v-if="model.type === 3"><span v-html="model.content" style="width: 760px;margin: 0 10px;display:inline-block;overflow: scroll;"></span></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: 'SysConfigDetail',
  components: {
    DetailList,
    DetailListItem
  },
  data () {
    return {
      confirmLoading: false,
      mdl: {},
      modalTitle: null,
      visible: false,
      model: {
        'id': null,
        'code': null,
        'name': null,
        'value': null,
        'description': null,
        'type': null,
        'createdTime': null,
        'updateTime': null,
        'createdUserId': null,
        'updateUserId': null,
        'createdUserName': null,
        'updateUserName': null
      }
    }
  },
  methods: {
    base (record) {
      this.visible = true
      this.modalTitle = '详情'
      this.model = record
    },
    handleCancel () {
      this.visible = false
      this.confirmLoading = false
    }

  }
}
</script>
