zhaoxiaoqiang1
2026-01-04 f1d30d03186c79ca2cbcfe60d6d2ce7d73fba97b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<template>
  <div class="apply">
    <EditForm
      :inline="true"
      :list="formList"
      title="贷款信息"
      @updateValue="updateValue"
      ref="malApply"
      :formType="isEdit ? 'info' : 'text'"
    ></EditForm>
  </div>
</template>
<script>
// 贷款信息
import { mapState, mapMutations } from 'vuex'
import { dataSupplementInfo } from '@comprehensive/serve/public'
import EditForm from '../EditForm'
import {
  creditBaseHeader,
  creditCorporateHeader
} from '@comprehensive/utils/formHeaders'
import { malLoanInfoForm } from '@comprehensive/utils/formItems'
export default {
  props: {
    // 申请编号
    info: {
      type: Object,
      default: () => ({})
    }
  },
  components: {
    EditForm
  },
  data() {
    return {
      detail: {},
      valueInfo: {},
      loading: false,
      creditBaseHeader: [],
      creditCorporateHeader: [],
      formList: []
    }
  },
  created() {
    this.init()
  },
  methods: {
    init() {
      this.creditBaseHeader = [...creditBaseHeader]
      this.creditCorporateHeader = [...creditCorporateHeader]
      this.dataSupplementInfo()
    },
    async dataSupplementInfo() {
      this.loading = true
      const { applySerialNo } = this.$route.query
      const res = await dataSupplementInfo({
        applySerialNo
      })
      this.loading = false
      const { result } = res
      this.detail = result
      this.SET_LoanInfo(result)
      this.formList = malLoanInfoForm.map(item => ({
        ...item,
        value: typeof result[item.name] !== 'undefined' ? result[item.name] : ''
      }))
    },
 
    // 设置表单结果数据
    setValueInfo(info = {}) {
      this.valueInfo = info
    },
 
    // 更新数据
    updateValue(value, item) {
      let { name } = item
      this.setOrGetFormInfo(name, { value })
    },
 
    // 更新表单数据或查找某项数据
    setOrGetFormInfo(nameKey, newInfo) {
      let { formList } = this
      let index = formList.findIndex(({ name }) => name === nameKey)
      let result = {}
      if (!isNaN(index)) {
        this.$set(this.formList, index, {
          ...formList[index],
          ...newInfo
        })
        result = this.formList[index]
      }
      if (typeof newInfo === 'undefined') {
        return result
      }
    },
    ...mapMutations(['SET_LoanInfo'])
  },
  computed: {
    ...mapState({
      isEdit: state => state.comprehensiveTransaction.isEdit
    })
  }
  // watch: {
  //   serialNo() {
  //     this.init()
  //   }
  // }
}
</script>