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

                <vxe-column min-width="300px" align="center" title="合同名称" field="contractName"></vxe-column>
                <vxe-column min-width="120px" align="center" title="借用人" field="borrowName" ></vxe-column>
                <vxe-column min-width="120px" align="center" title="借用状态" field="borrowType" >
                  <template #default="scope">
                    {{ $dictUtils.getDictLabel("borrow_type", scope.row.borrowType, '-') }}
                  </template>
                </vxe-column>
                <vxe-column min-width="120px" align="center" title="借用时间" field="borrowData" ></vxe-column>
                <vxe-column min-width="120px" align="center" title="大概归还时间" field="borrowRetData" ></vxe-column>
                <vxe-column min-width="120px" align="center" 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'
  import CwWorkContractBorrowService from '@/api/cw/workContract/CwWorkContractBorrowService'
  export default {
    data () {
      return {
        title: '',
        visible: false,
        loading: false,
        dataList: []
      }
    },
    cwWorkContractBorrowService: null,
    // workContractBorrowService: null,
    created () {
      this.cwWorkContractBorrowService = new CwWorkContractBorrowService()
      // this.workContractBorrowService = new WorkContractBorrowService()
    },
    methods: {
      // 获取数据列表
      findList (id) {
        this.loading = true
        this.visible = true
        this.title = '合同借用详情'
        this.cwWorkContractBorrowService.findMessageList(id).then((data) => {
          this.dataList = data
          this.loading = false
        })
        // 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>
