<template>
  <div class="cooperation-box">
    <el-form
      :model="ruleForm"
      label-position="top"
      label-width="150px"
      class="rule-form-orange"
    >
      <el-form-item label="历史合作时间" prop="historicalCooperationDuration" class="one-form-item">
        <el-input v-model="ruleForm.historicalCooperationDuration" placeholder="请输入历史合作时间" />
      </el-form-item>
      <el-form-item label="评估得分" prop="historicalCooperationDurationScore" class="one-form-item">
        <el-input v-model="ruleForm.historicalCooperationDurationScore" placeholder="请输入评估得分" />
      </el-form-item>

      <el-form-item label="历史合作规模" prop="historicalCooperationScale" class="one-form-item">
        <el-input v-model="ruleForm.historicalCooperationScale" placeholder="请输入历史合作规模" />
      </el-form-item>
      <el-form-item label="评估得分" prop="historicalCooperationScaleScore" class="one-form-item">
        <el-input v-model="ruleForm.historicalCooperationScaleScore" placeholder="请输入评估得分" />
      </el-form-item>

      <el-form-item label="累计历史开票金额" prop="historicalCooperationInvoicingAmount" class="one-form-item">
        <el-input v-model="ruleForm.historicalCooperationInvoicingAmount" placeholder="请输入累计历史开票金额" />
      </el-form-item>
      <el-form-item label="评估得分" prop="historicalCooperationInvoicingAmountScore" class="one-form-item">
        <el-input v-model="ruleForm.historicalCooperationInvoicingAmountScore" placeholder="请输入评估得分" />
      </el-form-item>

      <el-form-item label="历史回款最长账期" prop="historicalCooperationMaximumAccountingPeriod" class="one-form-item">
        <el-input v-model="ruleForm.historicalCooperationMaximumAccountingPeriod" placeholder="请输入历史回款最长账期" />
      </el-form-item>
      <el-form-item label="评估得分" prop="historicalCooperationMaximumAccountingPeriodScore" class="one-form-item">
        <el-input v-model="ruleForm.historicalCooperationMaximumAccountingPeriodScore" placeholder="请输入评估得分" />
      </el-form-item>

      <el-form-item label="历史合作项目数量" prop="historicalCooperationTimes" class="one-form-item">
        <el-input v-model="ruleForm.historicalCooperationTimes" placeholder="请输入历史合作项目数量" />
      </el-form-item>
      <el-form-item label="评估得分" prop="historicalCooperationTimesScore" class="one-form-item">
        <el-input v-model="ruleForm.historicalCooperationTimesScore" placeholder="请输入评估得分" />
      </el-form-item>

    </el-form>
  </div>
</template>

<script>
export default {
  props: {
    details: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      ruleForm: {
        historicalCooperationDuration: '',
        historicalCooperationScale: '',
        historicalCooperationInvoicingAmount: '',
        historicalCooperationMaximumAccountingPeriod: '',
        historicalCooperationTimes: '',
        historicalCooperationDurationScore: '',
        historicalCooperationScaleScore: '',
        historicalCooperationInvoicingAmountScore: '',
        historicalCooperationMaximumAccountingPeriodScore: '',
        historicalCooperationTimesScore: ''
      }
    }
  },
  watch: {
    details: {
      handler(newV) {
        if (newV && Object.keys(newV)) {
          const details = JSON.parse(JSON.stringify(newV))
          console.log(details)
          for (const k in this.ruleForm) {
            if (details[k] !== '' && details[k] !== null && details[k] !== undefined) {
              this.ruleForm[k] = details[k]
            }
          }
          console.log(this.ruleForm)
        }
      },
      immediate: true,
      deep: true
    }
  }
}
</script>

<style lang="scss" scoped>
.cooperation-box {
padding: 10px 15px;
}
</style>
