<template>
  <div class="credit-info">
    <el-form
      :model="ruleForm"
      label-position="top"
      label-width="150px"
      :rules="formRuels"
      class="rule-form-orange"
      ref="creditForm"
    >
      <el-form-item label="授信类型">
        <el-input v-model="info.creditType" disabled placeholder="请输入授信类型" />
      </el-form-item>
      <el-form-item label="合作业务板块">
        <el-input v-model="info.domesticFactoring" disabled placeholder="请输入合作业务板块" />
      </el-form-item>
      <el-form-item label="国内-实施保理产品">
        <el-input v-model="info.implementingFactoringProducts" disabled placeholder="请输入国内-实施保理产品" />
      </el-form-item>
      <el-form-item label="国内-实施保理类型">
        <el-input v-model="info.implementingFactoringType" disabled placeholder="请输入国内-实施保理类型" />
      </el-form-item>
      <el-form-item label="授信金额">
        <el-input v-model="info.proposedCreditLine" placeholder="请输入授信金额" disabled />
      </el-form-item>
      <el-form-item label="币种">
        <el-input v-model="info.currency" placeholder="请输入币种" disabled />
      </el-form-item>
      <el-form-item label="授信生效日">
        <el-input v-model="info.creditStartDate" placeholder="请输入授信生效日" disabled />
      </el-form-item>
      <el-form-item label="授信期限">
        <el-input v-model="info.proposedCreditTerm" placeholder="请输入授信期限" disabled />
      </el-form-item>
      <el-form-item label="授信到期日">
        <el-input v-model="info.creditEndDate" placeholder="请输入授信到期日" disabled />
      </el-form-item>
      <el-form-item label="融资比例（占用）" class="one-form-item" prop="financingRatioLow">
        <div class="row-three">
          <div style="width: 47%">
            <el-input v-model="ruleForm.financingRatioLow" placeholder="请输入融资比例" :disabled="isView">
              <template slot="append">%</template>
            </el-input>
          </div>
          <div style="width: 6%; margin-right: 0px;">至</div>
          <div style="width: 47%">
            <el-input v-model="ruleForm.financingRatioHigh" placeholder="请输入融资比例" :disabled="isView">
              <template slot="append">%</template>
            </el-input>
          </div>
        </div>
      </el-form-item>
      <el-form-item label="预期IRR低限" class="one-form-item" prop="planIrr">
        <el-input v-model="ruleForm.planIrr" placeholder="请输入预期IRR低限" :disabled="isView">
          <template slot="append">%</template>
        </el-input>
      </el-form-item>
      <el-form-item label="融资比例（不占用）" class="one-form-item" prop="proposedFinancingRatioTwoLow">
        <div class="row-three">
          <div style="width: 47%">
            <el-input v-model="ruleForm.proposedFinancingRatioTwoLow" placeholder="请输入融资比例" :disabled="isView">
              <template slot="append">%</template>
            </el-input>
          </div>
          <div style="width: 6%; margin-right: 0px;">至</div>
          <div style="width: 47%">
            <el-input v-model="ruleForm.proposedFinancingRatioTwoHigh" placeholder="请输入融资比例" :disabled="isView">
              <template slot="append">%</template>
            </el-input>
          </div>
        </div>
      </el-form-item>
      <el-form-item label="预期IRR低限" class="one-form-item" prop="planIrrTwo">
        <el-input v-model="ruleForm.planIrrTwo" placeholder="请输入预期IRR低限" :disabled="isView">
          <template slot="append">%</template>
        </el-input>
      </el-form-item>
      <el-form-item label="融资利率" class="one-form-item" prop="financingRateLow">
        <div class="row-three">
          <div style="width: 47%">
            <el-input v-model="ruleForm.financingRateLow" placeholder="请输入融资比例" :disabled="isView">
              <template slot="append">%</template>
            </el-input>
          </div>
          <div style="width: 6%; margin-right: 0px;">至</div>
          <div style="width: 47%">
            <el-input v-model="ruleForm.financingRateHigh" placeholder="请输入融资比例" :disabled="isView">
              <template slot="append">%</template>
            </el-input>
          </div>
        </div>
      </el-form-item>
      <el-form-item label="管理费比例" class="one-form-item" prop="managementRateLow">
        <div class="row-three">
          <div style="width: 47%">
            <el-input v-model="ruleForm.managementRateLow" placeholder="请输入融资比例" :disabled="isView">
              <template slot="append">%</template>
            </el-input>
          </div>
          <div style="width: 6%; margin-right: 0px;">至</div>
          <div style="width: 47%">
            <el-input v-model="ruleForm.managementRateHigh" placeholder="请输入融资比例" :disabled="isView">
              <template slot="append">%</template>
            </el-input>
          </div>
        </div>
      </el-form-item>
      <el-form-item label="保证金比例" class="one-form-item" prop="marginRatioLow">
        <div class="row-three">
          <div style="width: 47%">
            <el-input v-model="ruleForm.marginRatioLow" placeholder="请输入融资比例" :disabled="isView">
              <template slot="append">%</template>
            </el-input>
          </div>
          <div style="width: 6%; margin-right: 0px;">至</div>
          <div style="width: 47%">
            <el-input v-model="ruleForm.marginRatioHigh" placeholder="请输入融资比例" :disabled="isView">
              <template slot="append">%</template>
            </el-input>
          </div>
        </div>
      </el-form-item>
      <el-form-item label="对外综合报价" class="one-form-item" prop="comprehensiveQuotation">
        <el-input v-model="ruleForm.comprehensiveQuotation" placeholder="请输入对外综合报价" :disabled="isView">
          <template slot="append">%</template>
        </el-input>
      </el-form-item>
      <el-form-item label="本金支付方式" prop="principalPaymentMethod" style="width: 100%;">
        <el-select v-model="ruleForm.principalPaymentMethod" :disabled="isView" placeholder="请选择本金支付方式">
          <el-option
            v-for="item in constant.principalPaymentMethod"
            :key="item.code"
            :label="item.name"
            :value="item.code">
          </el-option>
        </el-select>
        <!-- <el-input v-model="ruleForm.principalPaymentMethod" placeholder="请输入本金支付方式" :disabled="isView" /> -->
      </el-form-item>
      <el-form-item label="利息管理费支付方式" :prop="ruleForm.paymentMethodForInterestManagementFee != 'paymentMethodForInterestManagementFee_D' ? 'paymentMethodForInterestManagementFee' : 'paymentMethodForInterestManagementFeeDetail'" class="select-input-item">
        <el-select v-model="ruleForm.paymentMethodForInterestManagementFee" placeholder="请选择利息管理费支付方式" style="width: 100%;" @change="setResultInfo" :disabled="isView">
          <el-option v-for="item in typeList" :key="item.code" :label="item.name" :value="item.code" />
        </el-select>
        <el-input v-model="ruleForm.paymentMethodForInterestManagementFeeDetail" v-show="ruleForm.paymentMethodForInterestManagementFee == 'paymentMethodForInterestManagementFee_D'" placeholder="请输入利息管理费支付方式" @change="setResultInfo" :disabled="isView" />
      </el-form-item>
      <el-form-item label="保证金支付方式" prop="marginPaymentMethod">
        <el-input v-model="ruleForm.marginPaymentMethod" placeholder="请输入保证金支付方式" :disabled="isView" />
      </el-form-item>
      <el-form-item label="其他费用支付方式" prop="otherFeePaymentMethod">
        <el-input v-model="ruleForm.otherFeePaymentMethod" placeholder="请输入其他费用支付方式" :disabled="isView" />
      </el-form-item>
      <el-form-item label="上游账期" prop="upstreamAccountingPeriod">
        <el-input v-model="ruleForm.upstreamAccountingPeriod" placeholder="请输入上游账期" @change="changeValue('upstreamAccountingPeriod', 'originUpstreamAccountingPeriod')" :disabled="isView">
          <template slot="append">天</template>
        </el-input>
      </el-form-item>
      <el-form-item label="变更原因" prop="upstreamAccountingPeriodChangReason" style="width: calc(66% - 15px);">
        <el-input type="textarea" autosize v-model="ruleForm.upstreamAccountingPeriodChangReason" placeholder="请输入变更原因" :disabled="isView" />
      </el-form-item>
      <el-form-item label="保理融资期限" prop="factoringFinancingPeriod">
        <el-input v-model="ruleForm.factoringFinancingPeriod" placeholder="请输入保理融资期限" @change="changeValue('factoringFinancingPeriod', 'originFactoringFinancingPeriod')" :disabled="isView">
          <template slot="append">天</template>
        </el-input>
      </el-form-item>
      <el-form-item label="变更原因" prop="factoringFinancingPeriodChangReason" style="width: calc(66% - 15px);">
        <el-input type="textarea" autosize v-model="ruleForm.factoringFinancingPeriodChangReason" placeholder="请输入变更原因" :disabled="isView" />
      </el-form-item>
      <el-form-item label="是否上报征信" prop="creditReport">
        <el-radio-group v-model="ruleForm.creditReport" disabled>
          <el-radio :label="1">是</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="账户上报方式" prop="reportMethod" style="min-width: 60%;">
        <el-radio-group v-model="ruleForm.reportMethod" @change="setResultInfo" :disabled="isView">
          <el-radio :label="1">A类</el-radio>
          <el-radio :label="0">B类</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="增信措施" prop="type" style="min-width: 60%;">
        <el-checkbox-group v-model="ruleForm.type" :disabled="isView">
          <el-checkbox label="creditEnhancementMeasuresOne">保证</el-checkbox>
          <el-checkbox label="creditEnhancementMeasuresTwo">抵押</el-checkbox>
          <el-checkbox label="creditEnhancementMeasuresThree">质押</el-checkbox>
          <el-checkbox label="creditEnhancementMeasuresFore">其他</el-checkbox>
        </el-checkbox-group>
      </el-form-item>
      <el-form-item label="增信措施说明1" prop="creditEnhancementMeasuresIllustrate" style="width: 100%;" v-if="ruleForm.creditEnhancementMeasuresIllustrateList.length > 0">
        {{ ruleForm.creditEnhancementMeasuresIllustrateList[0].msg }}
      </el-form-item>
      <el-form-item label="增信措施说明2" prop="creditEnhancementMeasuresIllustrateList.1.code" style="width: 100%;" v-if="ruleForm.creditEnhancementMeasuresIllustrateList.length > 1">
        {{ ruleForm.creditEnhancementMeasuresIllustrateList[1].msg }}
        <el-select v-model="ruleForm.creditEnhancementMeasuresIllustrateList[1].code" placeholder="请选择征信类型" style="width: 150px;" @change="setResultInfo" :disabled="isView">
          <el-option label="A类征信" value="A类征信" />
          <el-option label="B类征信" value="B类征信" />
        </el-select>
      </el-form-item>
      <el-form-item label="增信措施说明3" prop="creditEnhancementMeasuresIllustrateList.2.code" style="width: 100%;" v-if="ruleForm.creditEnhancementMeasuresIllustrateList.length > 2">
        {{ ruleForm.creditEnhancementMeasuresIllustrateList[2].msg }}
        <el-select v-model="ruleForm.creditEnhancementMeasuresIllustrateList[2].code" placeholder="请选择征信类型" style="width: 150px;" @change="setResultInfo" :disabled="isView">
          <el-option label="A类征信" value="A类征信" />
          <el-option label="B类征信" value="B类征信" />
        </el-select>
      </el-form-item>
      <el-form-item label="指导性单笔业务满足条件" prop="hasCondition">
        <el-radio-group v-model="ruleForm.hasCondition" @change="setConditionList" :disabled="isView">
          <el-radio :label="1">有</el-radio>
          <el-radio :label="0">无</el-radio>
        </el-radio-group>
      </el-form-item>
      <template v-if="ruleForm.hasCondition == 1">
        <div v-for="(item, index) in ruleForm.businessMeetsConditionsList" :key="'condition_' + index" style="width: 100%;">
          <el-form-item :label="`条件${index + 1}`" class="one-form-item" :prop="`businessMeetsConditionsList.${index}.content`"
            :rules="[{ required: true, message: '请输入条件', trigger: 'blur' }]" style="width: 100%;">
            <el-input type="textarea" autosize v-model="item.content" placeholder="请输入条件" style="width: 90%;" :disabled="isView" />
            <el-button type="text" style="float: right; margin-left: 10px;" @click="ruleForm.businessMeetsConditionsList.splice(index, 1)" v-if="index !== 0 && !isView">删除</el-button>
            <el-button type="text" style="float: right;" @click="ruleForm.businessMeetsConditionsList.push({ content: '' })" v-if="!isView">增加</el-button>
          </el-form-item>
        </div>
      </template>
    </el-form>
  </div>
</template>

<script>
import request from '@/utils/request'
import { mapGetters } from 'vuex';
export default {
  data() {
    const validateEmpty1 = (rule, value, callback) => {
      if(!String(this.ruleForm.financingRatioLow).trim()) {
        callback(new Error('请输入融资比例低限'))
        return
      }
      if(!String(this.ruleForm.financingRatioHigh).trim()) {
        callback(new Error('请输入融资比例高限'))
        return
      }
      if(isNaN(this.ruleForm.financingRatioHigh) || isNaN(this.ruleForm.financingRatioLow)) {
        callback(new Error('请输入数字'))
        return
      }
      if(Number(this.ruleForm.financingRatioHigh) > 100) {
        callback(new Error('融资比例高限不能高于100'))
        return
      }
      if(Number(this.ruleForm.financingRatioLow) < 0) {
        callback(new Error('融资比例高限不能低于0'))
        return
      }
      if(Number(this.ruleForm.financingRatioHigh) < Number(this.ruleForm.financingRatioLow)) {
        callback(new Error('融资比例低限不能高于高限'))
        return
      }
      callback()
    }
    const validateEmpty2 = (rule, value, callback) => {
      if(!String(this.ruleForm.proposedFinancingRatioTwoLow).trim()) {
        callback(new Error('请输入融资比例低限'))
        return
      }
      if(!String(this.ruleForm.proposedFinancingRatioTwoHigh).trim()) {
        callback(new Error('请输入融资比例高限'))
        return
      }
      if(isNaN(this.ruleForm.proposedFinancingRatioTwoHigh) || isNaN(this.ruleForm.proposedFinancingRatioTwoLow)) {
        callback(new Error('请输入数字'))
        return
      }
      if(Number(this.ruleForm.proposedFinancingRatioTwoHigh) > 100) {
        callback(new Error('融资比例高限不能高于100'))
        return
      }
      if(Number(this.ruleForm.proposedFinancingRatioTwoLow) < 0) {
        callback(new Error('融资比例高限不能低于0'))
        return
      }
      if(Number(this.ruleForm.proposedFinancingRatioTwoHigh) < Number(this.ruleForm.proposedFinancingRatioTwoLow)) {
        callback(new Error('融资比例低限不能高于高限'))
        return
      }
      callback()
    }
    const validateEmpty3 = (rule, value, callback) => {
      if(!String(this.ruleForm.financingRateLow).trim()) {
        callback(new Error('请输入融资利率低限'))
        return
      }
      if(!String(this.ruleForm.financingRateHigh).trim()) {
        callback(new Error('请输入融资利率高限'))
        return
      }
      if(isNaN(this.ruleForm.financingRateHigh) || isNaN(this.ruleForm.financingRateLow)) {
        callback(new Error('请输入数字'))
        return
      }
      if(Number(this.ruleForm.financingRateHigh) > 100) {
        callback(new Error('融资利率高限不能高于100'))
        return
      }
      if(Number(this.ruleForm.financingRateLow) < 0) {
        callback(new Error('融资利率高限不能低于0'))
        return
      }
      if(Number(this.ruleForm.financingRateHigh) < Number(this.ruleForm.financingRateLow)) {
        callback(new Error('融资利率低限不能高于高限'))
        return
      }
      callback()
    }
    const validateEmpty4 = (rule, value, callback) => {
      if(!String(this.ruleForm.managementRateLow).trim()) {
        callback(new Error('请输入管理费比例低限'))
        return
      }
      if(!String(this.ruleForm.managementRateHigh).trim()) {
        callback(new Error('请输入管理费比例高限'))
        return
      }
      if(isNaN(this.ruleForm.managementRateHigh) || isNaN(this.ruleForm.managementRateLow)) {
        callback(new Error('请输入数字'))
        return
      }
      if(Number(this.ruleForm.managementRateHigh) > 100) {
        callback(new Error('管理费比例高限不能高于100'))
        return
      }
      if(Number(this.ruleForm.managementRateLow) < 0) {
        callback(new Error('管理费比例高限不能低于0'))
        return
      }
      if(Number(this.ruleForm.managementRateHigh) < Number(this.ruleForm.managementRateLow)) {
        callback(new Error('管理费比例低限不能高于高限'))
        return
      }
      callback()
    }
    const validateEmpty5 = (rule, value, callback) => {
      if(!String(this.ruleForm.marginRatioLow).trim()) {
        callback(new Error('请输入保证金比例低限'))
        return
      }
      if(!String(this.ruleForm.marginRatioHigh).trim()) {
        callback(new Error('请输入保证金比例高限'))
        return
      }
      if(isNaN(this.ruleForm.marginRatioHigh) || isNaN(this.ruleForm.marginRatioLow)) {
        callback(new Error('请输入数字'))
        return
      }
      if(Number(this.ruleForm.marginRatioHigh) > 100) {
        callback(new Error('保证金比例高限不能高于100'))
        return
      }
      if(Number(this.ruleForm.marginRatioLow) < 0) {
        callback(new Error('保证金比例高限不能低于0'))
        return
      }
      if(Number(this.ruleForm.marginRatioHigh) < Number(this.ruleForm.marginRatioLow)) {
        callback(new Error('保证金比例低限不能高于高限'))
        return
      }
      callback()
    }
    return {
      ruleForm: {
        financingRatioLow: '',
        financingRatioHigh: '',
        planIrr: '',
        proposedFinancingRatioTwoLow: '',
        proposedFinancingRatioTwoHigh: '',
        planIrrTwo: '',
        financingRateLow: '',
        financingRateHigh: '',
        managementRateLow: '',
        managementRateHigh: '',
        marginRatioLow: '',
        marginRatioHigh: '',
        comprehensiveQuotation: '',
        principalPaymentMethod: '',
        paymentMethodForInterestManagementFee: '',
        paymentMethodForInterestManagementFeeDetail: '',
        marginPaymentMethod: '',
        otherFeePaymentMethod: '',
        upstreamAccountingPeriod: '',
        upstreamAccountingPeriodChangReason: '',
        factoringFinancingPeriod: '',
        factoringFinancingPeriodChangReason: '',
        creditReport: '',
        reportMethod: '',
        creditEnhancementMeasuresIllustrate: '',
        creditEnhancementMeasuresIllustrateList: [],
        hasCondition: '',
        businessMeetsConditionsList: [],
        type: []
      },
      formRuels: {
        financingRatioLow: [
          {required: true, trigger: 'blur', validator:  validateEmpty1}
        ],
        planIrr: [
          {required: true, trigger: 'blur', message: '请输入预期IRR低限'}
        ],
        proposedFinancingRatioTwoLow: [
          {required: true, trigger: 'blur', validator:  validateEmpty2}
        ],
        planIrrTwo: [
          {required: true, trigger: 'blur', message: '请输入预期IRR低限'}
        ],
        financingRateLow: [
          {required: true, trigger: 'blur', validator:  validateEmpty3}
        ],
        managementRateLow: [
          {required: true, trigger: 'blur', validator:  validateEmpty4}
        ],
        marginRatioLow: [
          {required: true, trigger: 'blur', validator:  validateEmpty5}
        ],
        comprehensiveQuotation: [
          {required: true, trigger: 'blur', message: '请输入对外综合报价'}
        ],
        principalPaymentMethod: [
          {required: true, trigger: 'blur', message: '请输入本金支付方式'}
        ],
        paymentMethodForInterestManagementFee: [
          {required: true, trigger: 'change', message: '请选择利息管理费支付方式'}
        ],
        paymentMethodForInterestManagementFeeDetail: [
          {required: true, trigger: 'blur', message: '请输入利息管理费支付方式'}
        ],
        marginPaymentMethod: [
          {required: true, trigger: 'blur', message: '请输入保证金支付方式'}
        ],
        otherFeePaymentMethod: [
          {required: true, trigger: 'blur', message: '请输入其他费用支付方式'}
        ],
        upstreamAccountingPeriod: [
          {required: true, trigger: 'blur', message: '请输入上游账期'}
        ],
        upstreamAccountingPeriodChangReason: [
          {required: false, trigger: 'blur', message: '请输入变更原因'}
        ],
        factoringFinancingPeriod: [
          {required: true, trigger: 'blur', message: '请输入保理融资期限'}
        ],
        factoringFinancingPeriodChangReason: [
          {required: false, trigger: 'blur', message: '请输入变更原因'}
        ],
        creditReport: [
          {required: true, trigger: 'change', message: '是否上报征信'}
        ],
        reportMethod: [
          {required: true, trigger: 'change', message: '请选择账户上报方式'}
        ],
        type: [
          {required: true, trigger: 'change', message: '请选择增信措施'}
        ],
        hasCondition: [
          {required: true, trigger: 'change', message: '请选择指导性单笔业务满足条件'}
        ],
        'creditEnhancementMeasuresIllustrateList.1.code': [
          {required: true, trigger: 'change', message: '请选择征信类型'}
        ],
        'creditEnhancementMeasuresIllustrateList.2.code': [
          {required: true, trigger: 'change', message: '请选择征信类型'}
        ]
      },
      originUpstreamAccountingPeriod: '',
      originFactoringFinancingPeriod: '',
      typeList: []
    }
  },
  props: ["info", "isView"],
  computed: {
    ...mapGetters(['constant'])
  },
  created() {
    this.$store.dispatch('getConstant', ['principalPaymentMethod'])
  },
  mounted() {
    this.getTypeList()
  },
  methods: {
    confirm(type) {
      let info = { ...this.ruleForm }
      if(info.paymentMethodForInterestManagementFee != 'paymentMethodForInterestManagementFee_D') {
        info.paymentMethodForInterestManagementFeeDetail = ''
      }
      info.creditEnhancementMeasuresOne = info.type.includes('creditEnhancementMeasuresOne') ? 1 : 0
      info.creditEnhancementMeasuresTwo = info.type.includes('creditEnhancementMeasuresTwo') ? 1 : 0
      info.creditEnhancementMeasuresThree = info.type.includes('creditEnhancementMeasuresThree') ? 1 : 0
      info.creditEnhancementMeasuresFore = info.type.includes('creditEnhancementMeasuresFore') ? 1 : 0
      info.creditEnhancementMeasuresIllustrate = info.creditEnhancementMeasuresIllustrateList.map(item => {
        return item.msg + (item.code || '')
      }).join('。')
      return new Promise((resolve, reject) => {
        if(type === 'submit') {
          this.$refs.creditForm.validate(flag => {
            if(flag) {
              resolve(info)
            } else {
              reject()
            }
          })
        }else {
          resolve(info)
        }

      })
    },
    getTypeList() {
      request({
        url: '/dictionary/do_findByParentCode',
        method: 'get',
        params: {
          parentCode: 'paymentMethodForInterestManagementFee'
        }
      }).then(({ data }) => {
        this.typeList = data || []
      })
    },
    changeValue(key, originKey) {
      this.formRuels[key + 'ChangReason'][0].required = this.ruleForm[key] != this[originKey]
      this.setResultInfo()
    },
    setConditionList(val) {
      if(val == 1) {
        this.ruleForm.businessMeetsConditionsList.push({ content: '' })
      } else {
        this.ruleForm.businessMeetsConditionsList.splice(0)
      }
    },
    setResultInfo() {
      this.$emit('setResultInfo', {
        paymentMethodForInterestManagementFee: this.ruleForm.paymentMethodForInterestManagementFee,
        paymentMethodForInterestManagementFeeDetail: this.ruleForm.paymentMethodForInterestManagementFeeDetail,
        reportMethod: this.ruleForm.reportMethod,
        upstreamAccountingPeriod: this.ruleForm.upstreamAccountingPeriod,
        factoringFinancingPeriod: this.ruleForm.factoringFinancingPeriod,
        creditEnhancementMeasuresIllustrate: this.ruleForm.creditEnhancementMeasuresIllustrateList
      })
    }
  },
  watch: {
    'info.id': {
      handler: function(val) {
        if(val) {
          Object.keys(this.ruleForm).forEach(key => {
            if(this.info[key] || this.info[key] === 0) {
              this.ruleForm[key] = this.info[key]
            }
          })
          this.ruleForm.type.splice(0)
          this.info.creditEnhancementMeasuresOne == 1 && this.ruleForm.type.push('creditEnhancementMeasuresOne')
          this.info.creditEnhancementMeasuresTwo == 1 && this.ruleForm.type.push('creditEnhancementMeasuresTwo')
          this.info.creditEnhancementMeasuresThree == 1 && this.ruleForm.type.push('creditEnhancementMeasuresThree')
          this.info.creditEnhancementMeasuresFore == 1 && this.ruleForm.type.push('creditEnhancementMeasuresFore')
          this.originUpstreamAccountingPeriod = this.info.upstreamAccountingPeriod
          this.originFactoringFinancingPeriod = this.info.factoringFinancingPeriod
          this.ruleForm.creditEnhancementMeasuresIllustrateList.splice(0)
          this.ruleForm.creditEnhancementMeasuresIllustrateList.push({ msg: `卖方法定代表人${this.info.supplierEnterprise.legalRepresentative}提供个人连带责任担保，上报A类征信` })
          if(this.info.supplierEnterprise.legalRepresentative != this.info.supplierEnterprise.majorShareholders) {
            this.ruleForm.creditEnhancementMeasuresIllustrateList.push({ msg: `${this.info.supplierEnterprise.legalRepresentative}、${this.info.supplierEnterprise.majorShareholders}提供个人连带责任担保，上报`, code: this.info.creditEnhancementMeasuresIllustrate ? this.info.creditEnhancementMeasuresIllustrate.split('。')[1].slice(-4) : '' })
          }
          if(this.info.guaranteeEnterprise && this.info.guaranteeEnterprise.corporateName) {
            this.ruleForm.creditEnhancementMeasuresIllustrateList.push({ msg: `${this.info.guaranteeEnterprise.corporateName}提供连带责任担保，上报`, code: this.info.creditEnhancementMeasuresIllustrate ? this.info.creditEnhancementMeasuresIllustrate.split('。')[this.info.creditEnhancementMeasuresIllustrate.split('。').length - 1].slice(-4) : '' })
          }
          this.setResultInfo()
        }
      },
      immediate: true
    }
  }
}
</script>

<style lang="scss" scoped>
.credit-info {
 .select-input-item {
  position: relative;
  .el-input {
    width: 90%;
    position: absolute;
    top: 0;
    left: 0;
  }
 }
}
</style>
