<template>
  <el-dialog
    :title="title"
    :close-on-click-modal="false"
	draggable
    width="1200px"
    @close="close()"
    v-model="visible">
  <div class="page">
      <el-form size="small" :inline="true" @submit.native.prevent>
        <div style="height: calc(100% - 80px);">
            <vxe-table
                border="inner"
                auto-resize
                resizable
                height="500px"
                :loading="loading"
                size="small"
                ref="workClientTable"
                show-header-overflow
                show-overflow
                highlight-hover-row
                :menu-config="{}"
                :print-config="{}"
                :sort-config="{remote:true}"
                :data="dataList"
                :checkbox-config="{}">

                <vxe-column width="300px" title="合同名称" field="name"></vxe-column>
                <vxe-column width="100px" title="借用人" field="borrowName" ></vxe-column>
                <vxe-column width="100px" title="借用状态" field="borrowType" >
                  <template #default="scope">
                    {{ $dictUtils.getDictLabel("borrow_type", scope.row.borrowType, '-') }}
                  </template>
                </vxe-column>
                <vxe-column width="200px" title="借用时间" field="borrowData" ></vxe-column>
                <vxe-column width="200px" title="大概归还时间" field="borrowRetData" ></vxe-column>
                <vxe-column width="200px" title="实际归还时间" field="retData">
                  <template #default="scope">
                    {{getRetData(scope.row.retData)}}
                  </template>
                </vxe-column>

            </vxe-table>
        </div>
      </el-form>
  </div>
  </el-dialog>
</template>

<script>
  import WorkContractBorrowService from '@/api/sys/WorkContractBorrowService'
  export default {
    data () {
      return {
        title: '',
        visible: false,
        loading: false,
        dataList: []
      }
    },
    workContractBorrowService: null,
    created () {
      this.workContractBorrowService = new WorkContractBorrowService()
    },
    methods: {
      // 获取数据列表
      findList (id) {
        this.loading = true
        this.visible = true
        this.title = '合同借用详情'
        this.workContractBorrowService.findMessageList(id).then((data) => {
          this.dataList = data
          this.loading = false
        })
      },
      close () {
        this.visible = false
        this.dataList = []
      },
      getRetData (value) {
        if (value) {
          return value
        }
        return '--'
      }
    }
  }
</script>
