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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<template>
  <div>
    <el-dialog :visible.sync="ownerVisible" :modal-append-to-body='false' :close-on-click-modal='false' @close="closeDialog" center>
      <el-table stripe highlight-current-row :data="owners" :header-cell-style="{background:'#f5f5f5',color:'#222222'}" @selection-change="handleSelectionChange">
        <el-table-column
          type="selection"
          width="55">
        </el-table-column>
        <el-table-column prop="customerName" label="客户姓名"></el-table-column>
        <el-table-column prop="certTypeName" label="证件类型"></el-table-column>
        <el-table-column prop="certId" label="身份证号"></el-table-column>
        <el-table-column prop="relationShipName" label="与借款人关系"></el-table-column>
      </el-table>
      <span slot="footer" class="dialog-footer">
        <el-button plain @click="closeDialog">返回</el-button>
        <el-button type="primary" @click="submit">确定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import {
  selectPropertyInfo,
  qryPropertyList,
  saveProperty
} from "@/api/product";
export default {
  props:['visible','propertyData','index'],
  data () {
    return {
      owners:[],
      owner:'',
      ownerVisible:true,
      selectOwners:[]
    }
  },
  async created () {
    this.getPropertyInfo()    
  },
  methods: {
    // 获取当前选中行
    handleSelectionChange(array) {
      if(this.propertyData.propertyList){
        const arr = this.propertyData.propertyList
        for (let i = 0; i < arr.length; i++) {
          for (let j = 0; j < array.length; j++) {
            if(array[j].certId==arr[i].certid&&array[j].certType==arr[i].certtype&&array[j].customerName==arr[i].propertyowner){
              this.$message.warning('产权人已存在,请重新选择')
              return;
            }
          }
        }
      }else{
        this.propertyData.propertyList = []
      }
      this.selectOwners = array
    },
    // 查询产权人信息
    async getPropertyList(){
      const res = await qryPropertyList({
        applyserialno: this.$store.state.product.applyInfo.serialNo,
        relativeserialno:this.propertyData.serialno
      })
      const arr = []
      if(res.result.length){
        res.result.forEach(val => {
          const obj = {}
          for (const key in val) {
            obj[key] = val[key].value
            obj.certtypeDesc = val['certtype'].valueDesc
          }
          arr.push(obj)
        });
      }
      this.propertyData.index = this.index
      this.propertyData.propertyList = arr
      this.$emit('sendPropertyForm',this.propertyData)
      this.$emit('closeDialog',false)
    },
    submit(){
      if(!this.selectOwners.length){
        this.$message.warning('请选择产权人')
        return;
      }
      let arr = []
      if(this.propertyData.propertyList){
        arr = this.propertyData.propertyList
      }  
      this.eachArray(this.selectOwners).forEach(val => {
        arr.push(val)
      });
      this.propertyData.index = this.index
      this.propertyData.propertyList = arr
      this.$emit('sendPropertyForm',this.propertyData)
      this.$emit('closeDialog',this.index)
    },
    eachArray(array){
      const arr = []
      array.forEach(val => {
        const obj = {
          applyserialno:this.$store.state.product.applyInfo.serialNo,
          propertyowner:val.customerName,
          certtype:val.certType,
          certtypeDesc:val.certTypeName,
          certid:val.certId,
        }
        if(this.propertyData.serialno){
          obj.relativeserialno = this.propertyData.serialno
        }
        arr.push(obj)
      });
      return arr
    },
    closeDialog(){
      this.$emit('closeDialog',this.index)
    },
    // 查询产权人列表
    getPropertyInfo(){
      selectPropertyInfo({applySerialNo:this.$store.state.product.applyInfo.serialNo}).then(res=>{
        this.owners = res.result
      })
    }
  }
}
</script>
<style lang="stylus" scoped>
div
  &>>>.el-dialog
    width auto
    max-width calc(100% - 180px)
    min-width 850px
    max-height 100%
    overflow hidden
    margin 0 !important
    position absolute
    left 50%
    top 50%
    transform translate(-50%,-50%)
    .el-dialog__body
      padding 0
      margin 56px 20px 20px
      max-height 576px
      overflow auto
    .el-dialog__header
      padding 0
    .el-dialog__footer
      padding 0 0 20px
      .el-button
        width: 120px
        font-size: 14px
        line-height: 20px
        padding: 5px 0
</style>