<template>
  <div class="contract-content">
    <el-form class="rule-form-orange" label-width="150px" label-position="top">
      <cy-info-title>合同清单</cy-info-title>
      <div :key="'downstreamDetailList' + index + 5" style="width: 100%;">
        <el-form-item label="上传附件" class="form-required" style="width: 100%;">
          <cy-upload
            ref="contractCheckListFileList"
            :file-data="detailsInfo.contractCheckListFileList"
            :upload-params="uploadParams"
            :disabled="disabled"
            :upload-from-orange-status="true"
          >
          </cy-upload>
        </el-form-item>
      </div>
    </el-form>
  </div>
</template>

<script>
export default {
  props: {
    disabled: {
      type: Boolean,
      default: false
    },
    detailsInfo: {
      type: Object,
      default: () => {
        return {
          contractCheckListFileList: []
        }
      }
    }
  },
  data() {
    return {
      uploadParams: {
        mouldName: 'FinancialCustomer'
      }
    }
  },
  methods: {
    getSubmit() {
      return new Promise((resolve, reject) => {
        if (this.$refs.contractCheckListFileList.getFileLists.length) {
          const fileIdList = this.$refs.contractCheckListFileList.getFileLists
          resolve({ contractChecklistFileIds: fileIdList.map(item => item.id) })
        } else {
          reject(this.$message.warning('请上传合同清单附件后提交'))
        }
      })
    }
  }
}
</script>
