doum
2026-06-17 ea689dd91eaa72425dc01759042c3b4eb2186512
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
<template>
  <GlobalWindow title="关联设备" :visible.sync="visible" width="920px" :show-confirm="false">
    <div v-if="readonly" class="readonly-tip">设备由租赁合同自动关联,仅支持查看</div>
    <div class="merchant-info">
      <div class="merchant-info__item">
        <span class="merchant-info__label">客户类型</span>
        <span class="merchant-info__value">{{ customerTypeText }}</span>
      </div>
      <div class="merchant-info__item">
        <span class="merchant-info__label">客户名称</span>
        <span class="merchant-info__value">{{ customer.name || '-' }}</span>
      </div>
      <div class="merchant-info__item">
        <span class="merchant-info__label">联系人</span>
        <span class="merchant-info__value">{{ customer.memberName || '-' }}</span>
      </div>
      <div class="merchant-info__item">
        <span class="merchant-info__label">联系方式</span>
        <span class="merchant-info__value">{{ customer.memberPhone || '-' }}</span>
      </div>
    </div>
    <el-tabs v-model="activeTab" class="device-tabs">
      <el-tab-pane label="关联电表" name="electrical">
        <YwCustomerElectricalTab :customer-id="customer.id" :active="activeTab === 'electrical'" :readonly="readonly"/>
      </el-tab-pane>
      <el-tab-pane label="关联空调" name="conditioner">
        <YwCustomerConditionerTab :customer-id="customer.id" :active="activeTab === 'conditioner'" :readonly="readonly"/>
      </el-tab-pane>
    </el-tabs>
  </GlobalWindow>
</template>
 
<script>
import GlobalWindow from '@/components/common/GlobalWindow'
import YwCustomerElectricalTab from './YwCustomerElectricalTab'
import YwCustomerConditionerTab from './YwCustomerConditionerTab'
 
export default {
  name: 'YwCustomerDeviceWindow',
  components: { GlobalWindow, YwCustomerElectricalTab, YwCustomerConditionerTab },
  props: {
    /** 只读查看(合同自动关联,不可手动增删) */
    readonly: {
      type: Boolean,
      default: true
    }
  },
  data () {
    return {
      visible: false,
      activeTab: 'electrical',
      customer: {}
    }
  },
  computed: {
    customerTypeText () {
      const t = this.customer.type
      return t === 0 || t === '0' ? '个人' : '企业'
    }
  },
  methods: {
    open (row, tab) {
      this.customer = {
        id: row.id,
        type: row.type,
        name: row.name,
        memberName: row.memberName,
        memberPhone: row.memberPhone
      }
      this.activeTab = tab || 'electrical'
      this.visible = true
    }
  }
}
</script>
 
<style scoped>
.merchant-info {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px; 
  margin-bottom: 16px;
  padding: 30px 16px 30px 16px;
  background: #f5f7fa; 
  border-radius: 4px;
}
.merchant-info__item {
  min-width: 180px;
  line-height: 22px;
}
.merchant-info__label {
  color: #909399;
  margin-right: 8px;
}
.merchant-info__label::after {
  content: ':';
}
.merchant-info__value {
  color: #303133;
  font-weight: 500;
}
.device-tabs {
  margin-top: 4px;
}
.readonly-tip {
  margin-bottom: 12px;
  padding: 8px 12px;
  font-size: 13px;
  color: #909399;
  background: #fdf6ec;
  border-radius: 4px;
}
</style>