<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="详情ID">{{ model.infoId }}</detail-list-item>
      <detail-list-item term="项目ID">{{ model.gatherId }}</detail-list-item>
      <detail-list-item term="第三方ID，目前是设备ID">{{ model.targetId }}</detail-list-item>
      <detail-list-item term="第三方类型，判断是运行记录还是巡检记录">{{ BaseTool.Object.getField(targetTypeMap,model.targetType) }}</detail-list-item>
      <detail-list-item term="使用类型">{{ BaseTool.Object.getField(useTypeMap,model.useType) }}</detail-list-item>
      <detail-list-item term="字段名称">{{ model.key }}</detail-list-item>
      <detail-list-item term="类型：1.int值，2.decimal值，3.范围值，4.结果描述">{{ BaseTool.Object.getField(typeMap,model.type) }}</detail-list-item>
      <detail-list-item term="性质：1.施工信息，2.车辆运行检查，3.运行项目，4.基本信息">{{ BaseTool.Object.getField(natureMap,model.nature) }}</detail-list-item>
      <detail-list-item term="int结果值">{{ model.resultValue }}</detail-list-item>
      <detail-list-item term="decimal结果值">{{ BaseTool.Amount.formatter(model.resultNumber) }}</detail-list-item>
      <detail-list-item term="范围值">{{ BaseTool.Amount.formatter(model.resultStart) }}</detail-list-item>
      <detail-list-item term="范围值">{{ BaseTool.Amount.formatter(model.resultEnd) }}</detail-list-item>
      <detail-list-item term="结果描述">{{ model.resultDesc }}</detail-list-item>
      <detail-list-item term="备注">{{ model.remark }}</detail-list-item>
      <detail-list-item term="排序">{{ model.sort }}</detail-list-item>
      <detail-list-item term="创建人">{{ model.createdUserId }}</detail-list-item>
      <detail-list-item term="更新人">{{ model.updateUserId }}</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: 'FillExecuteDetail',
  components: {
    DetailList,
    DetailListItem
  },
  data () {
    return {
      confirmLoading: false,
      mdl: {},
      modalTitle: null,
      visible: false,
      // 下拉框map
      targetTypeMap: {},
      useTypeMap: {},
      typeMap: {},
      natureMap: {},
      model: {
        'infoId': null,
        'gatherId': null,
        'targetId': null,
        'targetType': null,
        'useType': null,
        'key': null,
        'type': null,
        'nature': null,
        'resultValue': null,
        'resultNumber': null,
        'resultStart': null,
        'resultEnd': null,
        'resultDesc': null,
        'resultEliminate': null,
        'remark': null,
        'sort': null,
        'createdUserId': null,
        'updateUserId': null,
        'updateUserName': null,
        'updateTime': null
      }
    }
  },
  created () {
    // 下拉框map
    this.targetTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.FILL_EXECUTE_TARGET_TYPE)
    this.useTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.FILL_EXECUTE_USE_TYPE)
    this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.FILL_EXECUTE_TYPE)
    this.natureMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.FILL_EXECUTE_NATURE)
  },
  methods: {
    base (record) {
      this.visible = true
      this.modalTitle = '详情'
      this.model = record
    },
    handleCancel () {
      this.visible = false
      this.confirmLoading = false
    }

  }
}
</script>
