zjf
2023-03-08 51468f93275c2bcfcc7ad25bf05f3d6a079ff764
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
<template>
  <div class="main" v-if="visible">
    <div class="bgColor" @click.self="hiddenView"></div>
    <div class="content">
       <component
        v-if="id&&visible"
        :is="tabName"
        :crm-type="crmType"
        :id="id"
        :isFollow="isFollow"
        :listener-ids="listenerIDs"
        :no-listener-ids="noListenerIDs"
        class="d-view"
        @handle="detailHandle"
        @hide-view="hiddenView"/>
    </div>
  </div>
</template>
 
<script type="text/javascript">
import { getMaxIndex } from '@/utils/index'
import ClueDetail from '../clue/ClueDetail'
import CustomerDetail from '../customer/CustomerDetail'
import ContactsDetail from '../contacts/ContactsDetail'
import BusinessDetail from '../business/BusinessDetail'
import BusinessCustomerDetail from '../businessCustomer/BusinessCustomerDetail'
import BusinessChancesDetail from '../businessChances/BusinessChancesDetail'
// import ContractDetail from '../contract/ContractDetail'
// import ProductDetail from '../product/ProductDetail'
// import MoneyDetail from '../money/MoneyDetail'
 
export default {
  name: 'CRMAllDetail', // 详情
  components: {
    ClueDetail,
    CustomerDetail,
    ContactsDetail,
    BusinessDetail,
    BusinessCustomerDetail,
    BusinessChancesDetail
    // ContractDetail,
    // ProductDetail,
    // MoneyDetail
  },
  props: {
    /** 模块ID */
    id: [String, Number],
    /** 没有值就是全部类型 有值就是当个类型 */
    crmType: {
      type: String,
      default: ''
    },
    visible: {
      type: Boolean,
      default: false
    },
    // 监听的dom 进行隐藏详情
    listenerIDs: {
      type: Array,
      default: () => {
        return ['crm-main-container']
      }
    },
    isFollow: {
      type: Boolean,
      default: false
    },
    // 不监听
    noListenerIDs: {
      type: Array,
      default: () => {
        return []
      }
    },
    noListenerClass: {
      type: Array,
      default: () => {
        return ['el-table__body']
      }
    }
  },
  data () {
    return {
      // tabName: '' // 组件名
    }
  },
  computed: {
    tabName: function () {
      let name = ''
      if (this.crmType === 'leads') {
        name = 'clue-detail'
      } else if (this.crmType === 'customer') {
        name = 'customer-detail'
      } else if (this.crmType === 'contacts') {
        name = 'contacts-detail'
      } else if (this.crmType === 'business') {
        name = 'business-detail'
      } else if (this.crmType === 'contract') {
        name = 'contract-detail'
      } else if (this.crmType === 'product') {
        name = 'product-detail'
      } else if (this.crmType === 'receivables') {
        name = 'money-detail'
      } else if (this.crmType === 'businessCustomer') {
        name = 'business-customer-detail'
      } else if (this.crmType === 'businessChances') {
        name = 'business-chances-detail'
      }
      return name
    }
  },
  watch: {
  },
  mounted () {
    console.log(this.crmType, this.visible, this.id)
    if (this.visible) {
      document.body.appendChild(this.$el)
      this.$el.style.zIndex = getMaxIndex()
    }
  },
  destroyed () {
    // remove DOM node after destroy
    if (this.$el && this.$el.parentNode) {
      this.$el.parentNode.removeChild(this.$el)
    }
  },
  methods: {
    hiddenView () {
      this.$emit('update:visible', false)
    },
 
    /**
     * 详情操作
     */
    detailHandle (data) {
      this.$emit('handle', data)
    }
  }
}
</script>
<style lang="scss" scoped>
.full-container {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  overflow: auto;
  margin: 0;
  background-color: rgba(0, 0, 0, 0.3);
}
 
.d-view {
  position: fixed;
  width: 1200px;
  top: 0px;
  // width: 100%;
  // top: 500px;
  bottom: 0px;
  right: 0px;
  // background: #FFFFFF;
  box-shadow: 0px -4px 12px 0px rgba(61, 121, 204, 0.2);
  border-radius: 24px 0px 0px 0px;
}
.bgColor {
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  overflow: hidden;
  outline: 0;
  filter: alpha(opacity=60);
  background-color: rgba(51, 51, 51, 0.2);
  z-index: 100;
}
</style>