zjf
2023-03-08 92b359a6458fb985b78431e0a2f54b548e01b1ca
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
<template>
  <slide-view
    v-empty="!canShowDetail"
    :listener-ids="listenerIDs"
    :no-listener-ids="noListenerIDs"
    :no-listener-class="noListenerClass"
    :body-style="{padding: 0, height: '100%'}"
    xs-empty-icon="nopermission"
    xs-empty-text="暂无权限"
    @side-close="hideView">
    <flexbox
      v-loading="loading"
      v-if="canShowDetail"
      direction="column"
      align="stretch"
      class="d-container">
      <c-r-m-detail-head
        :detail="detailData"
        :head-details="headDetails"
        :id="id"
        crm-type="leads"
        @handle="detailHeadHandle"
        @close="hideView"/>
      <div class="tabs">
        <el-tabs
          v-model="tabCurrentName"
          @tab-click="handleClick">
          <el-tab-pane
            v-for="(item, index) in tabnames"
            :key="index"
            :label="item.label"
            :name="item.name"/>
        </el-tabs>
      </div>
      <div
        id="follow-log-content"
        class="t-loading-content">
        <keep-alive>
          <component
            :is="tabName"
            :detail="detailData"
            :id="id"
            crm-type="leads"/>
        </keep-alive>
      </div>
    </flexbox>
    <c-r-m-create-view
      v-if="isCreate"
      :action="{type: 'update', id: id, batchId: detailData.batchId}"
      crm-type="leads"
      @save-success="editSaveSuccess"
      @hiden-view="isCreate=false"/>
  </slide-view>
</template>
 
<script>
// import { crmLeadsRead } from '@/api/customermanagement/clue'
 
import SlideView from '@/components/SlideView'
import CRMDetailHead from '../components/CRMDetailHead'
import ClueFollow from './components/ClueFollow' // 跟进记录
import CRMBaseInfo from '../components/CRMBaseInfo' // 线索基本信息
import RelativeFiles from '../components/RelativeFiles' // 相关附件
import RelativeHandle from '../components/RelativeHandle' // 相关操作
 
import CRMCreateView from '../components/CRMCreateView' // 新建页面
 
import detail from '../mixins/detail'
 
export default {
  /** 线索管理 的 线索详情 */
  name: 'ClueDetail',
  components: {
    SlideView,
    CRMDetailHead,
    ClueFollow,
    CRMBaseInfo,
    RelativeFiles,
    RelativeHandle,
    CRMCreateView
  },
  mixins: [detail],
  props: {
    // 详情信息id
    id: [String, Number],
    // 监听的dom 进行隐藏详情
    listenerIDs: {
      type: Array,
      default: () => {
        return ['crm-main-container']
      }
    },
    // 不监听
    noListenerIDs: {
      type: Array,
      default: () => {
        return []
      }
    },
    noListenerClass: {
      type: Array,
      default: () => {
        return ['el-table__body']
      }
    }
  },
  data () {
    return {
      loading: false, // 展示加载loading
      crmType: 'leads',
      detailData: {}, // read 详情
      headDetails: [
        { title: '姓名', value: '' },
        { title: '线索来源', value: '' },
        { title: '手机', value: '' },
        { title: '负责人', value: '' },
        { title: '创建时间', value: '' }
      ],
      tabnames: [
        { label: '跟进记录', name: 'followlog' },
        { label: '基本信息', name: 'basicinfo' },
        { label: '附件', name: 'file' },
        { label: '操作记录', name: 'operationlog' }
      ],
      tabCurrentName: 'basicinfo',
      isCreate: false // 编辑操作
    }
  },
  computed: {
    tabName () {
      if (this.tabCurrentName === 'followlog') {
        return 'clue-follow'
      } else if (this.tabCurrentName === 'basicinfo') {
        return 'c-r-m-base-info'
      } else if (this.tabCurrentName === 'file') {
        return 'relative-files'
      } else if (this.tabCurrentName === 'operationlog') {
        return 'relative-handle'
      }
      return ''
    }
  },
  mounted () {},
  methods: {
    getDetial () {
      this.loading = true
      // crmLeadsRead({
      //   leadsId: this.id
      // })
      //   .then(res => {
      //     this.detailData = res.data
 
      //     this.headDetails[0].value = res.data.name
      //     this.headDetails[1].value = res.data.线索来源
      //     this.headDetails[2].value = res.data.mobile
      //     // 负责人
      //     this.headDetails[3].value = res.data.ownerUserName
      //     this.headDetails[4].value = res.data.createTime
      //     this.loading = false
      //   })
      //   .catch(() => {
      //     this.loading = false
      //   })
    },
    //* * 点击关闭按钮隐藏视图 */
    hideView () {
      this.$emit('hide-view')
    },
    //* * tab标签点击 */
    handleClick (tab, event) {},
    editSaveSuccess () {
      this.$emit('handle', { type: 'save-success' })
      this.getDetial()
    }
  }
}
</script>
 
<style lang="scss" scoped>
@import '../styles/crmdetail.scss';
</style>