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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
<template>
  <div
    class="form-content"
    v-loading="loading"
    v-if="keysSub.length > 0 && Object.keys(showInfo).length > 0"
  >
    <SectionTitle v-if="title" :title="title"></SectionTitle>
    <div class="btn" v-if="$route.query.flowno =='CreditFlowCase'">
      <el-button
        type="text"
        v-if="discountAgreementFile.visible&&title=='定价信息'"
        @click="$emit('downloadDiscountAgreement',true)"
      >查看项目贴息方案</el-button>
      <el-button
        type="text"
        v-if="showInfo['buildingprojectid']&&title=='物业明细信息'&&!isCapital"
        @click="$emit('projectManageDetail',true)"
      >查看项目信息</el-button>
      <el-button
        type="text"
        v-if="showInfo['buildingprojectid']&&title=='物业明细信息'&&!isCapital"
        @click="$emit('showAgent',true)"
      >查看代理交易信息</el-button>
    </div>
    <ul class="list-fileds" :class="`form-cols-${inline ? showColumn : '0'}`">
      <li v-for="(item, index) in keysSub" :key="index" :class="[{long: item.isLong}, item.class]">
        <p class="label">{{item.label}}:</p>
        <p
          class="input"
          v-if="typeof showInfo[item.field] === 'object' && showInfo[item.field] !== null"
        >{{showInfo[item.field][item.isDesc ? 'valueDesc' : 'value'] | showValue}}</p>
        <p class="input" v-else>{{showInfo[item.field] | showValue}}</p>
 
        <!-- {{ typeof scope.row[item.prop] !== 'undefined' && scope.row[item.prop].toString().trim() === '' ? '--' : scope.row[item.prop]}}</p> -->
      </li>
    </ul>
  </div>
</template>
<script>
// 以表单的形式展示数据
import SectionTitle from './SectionTitle'
import { userBaseInfo } from '@comprehensive/utils/formHeaders'
export default {
  components: {
    SectionTitle
  },
  props: {
    /**
     * 信息列表
     * @example
     * {  "education": { "value": "10", "codeNo": "EducationExperience", "valueDesc": "研究生", "name": null, "type": null, "orders": null, "filedDescription": null, "visible": true, "required": true, "writeAble": true }}
     * or
     * { "serialno": "2019071000000001", "contractserialno": "2019070900000001"}
     */
    info: {
      type: Object,
      default: v => {
        return {}
      }
    },
 
    /**
     * 映射信息
     * @example
     * [ { "label": "客户编号", "field": "customerid" }]
     */
    keys: {
      type: Array,
      default: v => {
        return [...userBaseInfo]
      }
    },
 
    // 数据标题
    title: {
      type: String,
      default: ''
    },
 
    // 是否展示分页信息
    loading: {
      type: Boolean,
      default: false
    },
    discountAgreementFile: {
      type: Object,
      default: v => {
        return {}
      }
    },
 
    inline: {
      type: Boolean,
      default: true
    },
 
    // 显示列数(固定列数,0为不设置固定值)
    column: {
      type: [String, Number],
      default: 0
    },
 
    // form类型
    // search:搜索条件类(屏幕适应缩放3-4个)
    // edit:编辑类(屏幕适应缩放2-3个)
    // info:编辑处理类(自动判断是否为readonly,屏幕适应缩放2-3个)
    // text:文本展示类(不会有输入框,屏幕适应缩放2-3个)
    formType: {
      type: String,
      default: 'text'
    }
  },
  filters: {
    showValue(val = '') {
      return val.toString().trim() === '' ? '--' : val
    }
  },
  data() {
    return {
      clientWidth: 0
    }
  },
  mounted() {
    window.addEventListener('resize', this.updateClientWidth)
    this.updateClientWidth()
  },
  methods: {
    updateClientWidth() {
      const clientWidth = document.documentElement.clientWidth || 0
      this.clientWidth = clientWidth
    },
    // 格式化金额
    getMoney(money) {
      if (money && money != null) {
        money = String(money)
        let left = money.split('.')[0]
        let right = money.split('.')[1]
        right = right
          ? right.length >= 2
            ? '.' + right.substr(0, 2)
            : '.' + right + '0'
          : '.00'
        var temp = left
          .split('')
          .reverse()
          .join('')
          .match(/(\d{1,3})/g)
        return (
          (Number(money) < 0 ? '-' : '') +
          temp
            .join(',')
            .split('')
            .reverse()
            .join('') +
          right
        )
      } else if (Number(money) === 0) {
        // 注意===在这里的使用,如果传入的money为0,if中会将其判定为boolean类型,故而要另外做===判断
        return '0.00'
      } else {
        return ''
      }
    }
  },
  computed: {
    showColumn() {
      const { formType, column, clientWidth } = this
      if (Number(column) !== 0) {
        return Number(column)
      }
      const num = formType === 'search' ? 4 : 3
      if (clientWidth > 1460) {
        return num
      }
      return num - 1
    },
    labelWidth() {
      const { formType } = this
      return formType === 'search' ? '84px' : '160px'
    },
    showInfo() {
      const { info, keysSub } = this
      return Object.keys(info).reduce((pre, key) => {
        let item = info[key]
 
        const moneyItem = keysSub.find(({ field }) => field === key)
        let moneyInfo = {}
        if (moneyItem) {
          const { isDesc, isMoney } = moneyItem
          if (isMoney) {
            if (typeof item === 'object') {
              moneyInfo = isDesc
                ? { valueDesc: this.getMoney(item.valueDesc) }
                : { value: this.getMoney(item.value) }
              item = { ...item, ...moneyInfo }
            } else {
              item = this.getMoney(item)
            }
          }
        }
        pre[key] = item
        return pre
      }, {})
    },
    // 过滤显示字段
    keysSub() {
      let { info = {}, keys } = this
      let arr = []
      if (typeof info !== 'object' || info === null) {
        return arr
      }
 
      if (Object.keys(info).length > 0) {
        arr = keys.filter(item => {
          const field = info[item.field]
 
          // 不存在的字段过滤掉
          if (typeof field === 'undefined') {
            return false
          }
 
          // 字段值为对象,则通过visible字段判断是否需要展示该字段
          if (typeof field === 'object' && field !== null) {
            return typeof field === 'object' && field.visible
          }
          return true
        })
      }
      return arr
    },
    // 是否是资方查看
    isCapital() {
      const {  source } = this.$route.query;
      // 资方查询限制查看权限
      if(source === 'capital') {
        return true
      }
      return false
    }
  }
}
</script>
<style lang="postcss" scoped>
.next {
  padding: 30px 0 0 150px;
}
.form-content {
  position: relative;
  & >>> .el-form-item__content .no-edit {
    margin: 0;
  }
}
.btn {
  position: absolute;
  top: -8px;
  right: 20px;
}
.btn > .el-button {
  padding: 8px 12px;
  border: 1px solid #0081f0;
  border-radius: 15px;
}
.list-fileds {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  & li {
    display: flex;
    align-items: center;
    font-size: 14px;
    margin: 0;
    padding: 10px 0 10px 0;
    width: 33.33%;
    @media (max-width:1459px){
      &{
        width: 50%
      }
    }
    & .label {
      color: #888;
      width: 160px;
      text-align: right;
      margin-right: 22px;
    }
    & .input {
      width: 220px;
      word-wrap: break-word;
      color: #222222;
    }
    & p {
      margin: 0;
      padding: 0;
    }
    &.long {
      width: 100%;
      & .input {
        width: 80%;
      }
    }
  }
}
 
.form-cols-1 {
  grid-template-columns: 1fr;
  & .textarea-item {
    grid-column-start: 1;
    grid-column-end: 1;
  }
  & .form-right {
    grid-column-start: 1;
    grid-column-end: 1;
  }
}
 
.form-cols-2 {
  grid-template-columns: repeat(2, 1fr);
  & .textarea-item {
    grid-column-start: 1;
    grid-column-end: 3;
  }
  & .form-right {
    grid-column-start: 2;
    grid-column-end: 3;
  }
}
.form-cols-3 {
  grid-template-columns: repeat(3, 1fr);
  & .textarea-item {
    grid-column-start: 1;
    grid-column-end: 4;
  }
  & .form-right {
    grid-column-start: 3;
    grid-column-end: 4;
  }
}
.form-cols-4 {
  grid-template-columns: repeat(4, 1fr);
  & .textarea-item {
    grid-column-start: 1;
    grid-column-end: 5;
  }
  & .form-right {
    grid-column-start: 4;
    grid-column-end: 5;
  }
}
 
/* .list-fileds {
  display: flex;
  flex-wrap: wrap;
  & li {
    display: flex;
    align-items: center;
    font-size: 14px;
    margin: 0;
    padding: 10px 0 10px 0;
    & .label {
      color: #888;
      width: 124px;
      text-align: right;
      margin-right: 22px;
    }
    & .input {
      width: 220px;
      word-wrap:break-word;
      color: #222222;
    }
    & p {
      margin: 0;
      padding: 0;
    }
    &.long {
      width: 100%;
      & .input {
        width: 80%;
      }
    }
  }
} */
</style>