Detail.vue 7.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <template>
  2. <slide-view
  3. v-empty="!canShowDetail"
  4. :listener-ids="listenerIDs"
  5. :no-listener-ids="noListenerIDs"
  6. :no-listener-class="noListenerClass"
  7. :body-style="{padding: 0, height: '100%'}"
  8. xs-empty-icon="nopermission"
  9. xs-empty-text="暂无权限"
  10. @afterEnter="viewAfterEnter"
  11. @close="hideView">
  12. <div
  13. v-loading="loading"
  14. ref="crmDetailMain"
  15. class="detail-main">
  16. <flexbox
  17. v-if="canShowDetail && detailData"
  18. direction="column"
  19. align="stretch"
  20. class="d-container">
  21. <c-r-m-detail-head
  22. :detail="detailData"
  23. :head-details="headDetails"
  24. :id="id"
  25. :crm-type="crmType"
  26. @handle="detailHeadHandle"
  27. @close="hideView">
  28. <template slot="name">
  29. <el-tooltip :content="detailData.star == 0 ? '添加关注' : '取消关注'" effect="dark" placement="top">
  30. <i
  31. :class="{active: detailData.star != 0}"
  32. class="wk wk-focus-on focus-icon"
  33. @click="toggleStar()" />
  34. </el-tooltip>
  35. </template>
  36. </c-r-m-detail-head>
  37. <flexbox class="d-container-bd" align="stretch">
  38. <el-tabs
  39. v-model="tabCurrentName"
  40. type="border-card"
  41. class="d-container-bd--left">
  42. <el-tab-pane
  43. v-for="(item, index) in tabNames"
  44. :key="index"
  45. :label="item.label"
  46. :name="item.name"
  47. lazy>
  48. <component
  49. :is="item.name"
  50. :detail="detailData"
  51. :type-list="logTyps"
  52. :id="id"
  53. :handle="activityHandle"
  54. :crm-type="crmType" />
  55. </el-tab-pane>
  56. </el-tabs>
  57. <transition name="slide-fade">
  58. <el-tabs
  59. v-show="showImportInfo"
  60. value="chiefly-contacts"
  61. type="border-card"
  62. class="d-container-bd--right">
  63. <el-tab-pane
  64. label="重要信息"
  65. name="chiefly-contacts"
  66. lazy>
  67. <contacts-import
  68. :id="id"
  69. :customer-id="customerId" />
  70. </el-tab-pane>
  71. </el-tabs>
  72. </transition>
  73. </flexbox>
  74. </flexbox>
  75. </div>
  76. <el-button
  77. class="firse-button"
  78. @click="showImportInfo= !showImportInfo">重<br>要<br>信<br>息<br><i :class="{ 'is-reverse': !showImportInfo }" class="el-icon-arrow-right el-icon--right" /></el-button>
  79. <c-r-m-all-create
  80. v-if="isCreate"
  81. :action="{type: 'update', id: id, batchId: detailData.batchId}"
  82. :crm-type="crmType"
  83. @save-success="editSaveSuccess"
  84. @close="isCreate=false"/>
  85. </slide-view>
  86. </template>
  87. <script>
  88. import { crmContactsReadAPI } from '@/api/crm/contacts'
  89. import SlideView from '@/components/SlideView'
  90. import CRMDetailHead from '../components/CRMDetailHead'
  91. import Activity from '../components/Activity' // 活动
  92. import ContactsImport from './components/ContactsImport' // 重要信息
  93. import CRMEditBaseInfo from '../components/CRMEditBaseInfo' // 联系人基本信息
  94. import RelativeBusiness from '../components/RelativeBusiness' // 相关商机
  95. import RelativeHandle from '../components/RelativeHandle' // 相关操作
  96. import RelativeFiles from '../components/RelativeFiles' // 相关附件
  97. import CRMAllCreate from '../components/CRMAllCreate' // 新建页面
  98. import DetailMixin from '../mixins/Detail'
  99. export default {
  100. /** 联系人管理 的 联系人详情 */
  101. name: 'ContactsDetail',
  102. components: {
  103. SlideView,
  104. CRMDetailHead,
  105. Activity,
  106. CRMEditBaseInfo,
  107. RelativeBusiness,
  108. RelativeHandle,
  109. RelativeFiles,
  110. CRMAllCreate,
  111. ContactsImport
  112. },
  113. mixins: [DetailMixin],
  114. props: {
  115. // 详情信息id
  116. id: [String, Number],
  117. // 监听的dom 进行隐藏详情
  118. listenerIDs: {
  119. type: Array,
  120. default: () => {
  121. return ['crm-main-container']
  122. }
  123. },
  124. // 不监听
  125. noListenerIDs: {
  126. type: Array,
  127. default: () => {
  128. return []
  129. }
  130. },
  131. noListenerClass: {
  132. type: Array,
  133. default: () => {
  134. return ['el-table__body']
  135. }
  136. }
  137. },
  138. data() {
  139. return {
  140. // 展示加载loading
  141. loading: false,
  142. crmType: 'contacts',
  143. headDetails: [
  144. { title: '客户名称', value: '' },
  145. { title: '职务', value: '' },
  146. { title: '手机', value: '' },
  147. { title: '创建时间', value: '' }
  148. ],
  149. tabCurrentName: 'Activity',
  150. // 编辑操作
  151. isCreate: false,
  152. // 展示重要信息
  153. showImportInfo: true
  154. }
  155. },
  156. computed: {
  157. /**
  158. * 活动操作
  159. */
  160. activityHandle() {
  161. let temps = [
  162. {
  163. type: 'task',
  164. label: '创建任务'
  165. }, {
  166. type: 'business',
  167. label: '创建商机'
  168. }, {
  169. type: 'contract',
  170. label: '创建合同'
  171. }, {
  172. type: 'receivables',
  173. label: '创建回款'
  174. }
  175. ]
  176. if (this.canCreateFollowRecord) {
  177. temps = [{
  178. type: 'log',
  179. label: '写跟进'
  180. }].concat(temps)
  181. }
  182. return temps
  183. },
  184. /**
  185. * tabs
  186. */
  187. tabNames() {
  188. var tempsTabs = []
  189. tempsTabs.push({ label: '活动', name: 'Activity' })
  190. if (this.crm.contacts && this.crm.contacts.read) {
  191. tempsTabs.push({ label: '详细资料', name: 'CRMEditBaseInfo' })
  192. }
  193. if (this.crm.business && this.crm.business.index) {
  194. tempsTabs.push({ label: this.getTabName('商机', this.tabsNumber.businessCount), name: 'RelativeBusiness' })
  195. }
  196. tempsTabs.push({ label: this.getTabName('附件', this.tabsNumber.fileCount), name: 'RelativeFiles' })
  197. tempsTabs.push({ label: '操作记录', name: 'RelativeHandle' })
  198. return tempsTabs
  199. },
  200. /**
  201. * 根据记录筛选
  202. */
  203. logTyps() {
  204. return [{
  205. icon: 'all',
  206. color: '#2362FB',
  207. command: '',
  208. label: '全部活动'
  209. }, {
  210. icon: 'contacts',
  211. color: '#27BA4A',
  212. command: 3,
  213. label: '联系人'
  214. }, {
  215. icon: 'o-task',
  216. color: '#D376FF',
  217. command: 11,
  218. label: '任务'
  219. }, {
  220. icon: 'log',
  221. color: '#5864FF',
  222. command: 8,
  223. label: '日志'
  224. }, {
  225. icon: 'approve',
  226. color: '#9376FF',
  227. command: 9,
  228. label: '审批'
  229. }]
  230. },
  231. /**
  232. * 客户ID
  233. */
  234. customerId() {
  235. return this.detailData ? this.detailData.customer_id || '' : ''
  236. }
  237. },
  238. mounted() {},
  239. methods: {
  240. /**
  241. * 详情
  242. */
  243. getDetial() {
  244. this.loading = true
  245. crmContactsReadAPI({
  246. id: this.id
  247. })
  248. .then(res => {
  249. this.loading = false
  250. this.detailData = res.data
  251. if (this.detailData.dataAuth === 0) return
  252. // 负责人
  253. this.headDetails[0].value = res.data.customer_name
  254. this.headDetails[1].value = res.data.post
  255. this.headDetails[2].value = res.data.mobile
  256. this.headDetails[3].value = res.data.create_time
  257. })
  258. .catch(() => {
  259. this.loading = false
  260. this.hideView()
  261. })
  262. },
  263. /**
  264. * 关闭
  265. */
  266. hideView() {
  267. this.$emit('hide-view')
  268. }
  269. // /**
  270. // * 编辑成功
  271. // */
  272. // editSaveSuccess() {
  273. // this.$emit('handle', { type: 'save-success' })
  274. // this.getDetial()
  275. // }
  276. }
  277. }
  278. </script>
  279. <style lang="scss" scoped>
  280. @import '../styles/crmdetail.scss';
  281. </style>