<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.parentName }}</detail-list-item>
      <detail-list-item term="部门">{{ model.deptName }}</detail-list-item>
      <detail-list-item term="章次">{{ model.surah }}</detail-list-item>
      <detail-list-item term="名称">{{ model.name }}</detail-list-item>
      <detail-list-item term="单位">{{ BaseTool.Object.getField(unitMap,model.unit) }}</detail-list-item>
      <detail-list-item term="位置单位">{{ BaseTool.Object.getField(unitMap,model.siteUnit) }}</detail-list-item>
      <detail-list-item term="总量">{{ BaseTool.Amount.formatter(model.aggregate) }}</detail-list-item>
      <detail-list-item term="单价">{{ BaseTool.Amount.formatter(model.price) }}</detail-list-item>
      <detail-list-item term="总价">{{ BaseTool.Amount.formatter(model.totalPrice) }}</detail-list-item>
    </detail-list>
    <detail-list :col="1">
      <detail-list-item term="备注">{{ model.remark }}</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: 'FillProjectQuantityDetail',
  components: {
    DetailList,
    DetailListItem
  },
  data () {
    return {
      confirmLoading: false,
      mdl: {},
      modalTitle: null,
      visible: false,
      // 下拉框map
      unitMap: {},
      model: {
        'deptId': null,
        'deptName': null,
        'surah': null,
        'name': null,
        'unit': null,
        'aggregate': null,
        'remark': null,
        'createdUserId': null,
        'updateUserId': null,
        'updateUserName': null,
        'updateTime': null
      }
    }
  },
  created () {
    // 下拉框map
    this.unitMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.FILL_PROJECT_QUANTITY_UNIT)
  },
  methods: {
    base (record) {
      this.visible = true
      this.modalTitle = '详情'
      this.model = record
    },
    handleCancel () {
      this.visible = false
      this.confirmLoading = false
    }

  }
}
</script>
