Merge.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <!--
  2. * @Author: wanglj 471442253@qq.com
  3. * @Date: 2022-12-27 09:33:48
  4. * @LastEditors: wanglj
  5. * @LastEditTime: 2023-01-05 09:15:31
  6. * @Description: file content
  7. * @FilePath: \opms_frontend\src\views\customer\components\Merge.vue
  8. -->
  9. <template>
  10. <el-dialog title="合并客户" :visible.sync="visible" :width="width" @close="handleClose">
  11. <el-alert :closable="false" show-icon type="warning">
  12. <div slot="title">
  13. <h3>特别提示</h3>
  14. <p>1、合并后系统只保留目标客户,同时将另一个客户的联系人、商机、订单、附件、销售动态等迁移到目标客户。</p>
  15. <p>2、红色字段表示两个客户该字段值不同。</p>
  16. </div>
  17. </el-alert>
  18. <div class="merge">
  19. <ul class="title">
  20. <li :class="{ differ: flag.custName }">目标客户</li>
  21. <li :class="{ differ: flag.abbrName }">助记名</li>
  22. <li :class="{ differ: flag.custIndustry }">客户行业</li>
  23. <li :class="{ differ: flag.custLevel }">客户级别</li>
  24. <li :class="{ differ: flag.source }">客户来源</li>
  25. <li :class="{ differ: flag.followUpDate }">下次联系时间</li>
  26. <li :class="{ differ: flag.custLocation }">所在地区</li>
  27. <li :class="{ differ: flag.custAddress }">详细地址</li>
  28. <li :class="{ differ: flag.remark }">备注</li>
  29. </ul>
  30. <ul v-for="(item, index) in list" :key="index" class="each">
  31. <li>
  32. <el-radio v-model="form.custName" :label="item.custName" @change="targetChange(item)" />
  33. </li>
  34. <li>
  35. <el-radio v-model="form.abbrName" :label="item.abbrName" />
  36. </li>
  37. <li>
  38. <el-radio v-model="form.custIndustry" :label="item.custIndustry" />
  39. </li>
  40. <li>
  41. <el-radio v-model="form.custLevel" :label="item.custLevel" />
  42. </li>
  43. <li>
  44. <el-radio v-model="form.source" :label="item.source" />
  45. </li>
  46. <li>
  47. <el-radio v-model="form.followUpDate" :label="item.followUpDate" />
  48. </li>
  49. <li>
  50. <el-radio v-model="form.custLocation" :label="item.custLocation" />
  51. </li>
  52. <li>
  53. <el-radio v-model="form.custAddress" :label="item.custAddress" />
  54. </li>
  55. <li>
  56. <el-radio v-model="form.remark" :label="item.remark" />
  57. </li>
  58. </ul>
  59. </div>
  60. <span slot="footer">
  61. <el-button @click="visible = false">取消</el-button>
  62. <el-button type="primary" @click="handleConfirm">合并</el-button>
  63. </span>
  64. </el-dialog>
  65. </template>
  66. <script>
  67. import api from '@/api/customer'
  68. import to from 'await-to-js'
  69. export default {
  70. data() {
  71. return {
  72. visible: false,
  73. ids: [],
  74. form: {
  75. id: '',
  76. custName: '', // 客户名称
  77. abbrName: '', // 助记名
  78. custLocation: '', // 所在地区
  79. custAddress: '', // 详细地址
  80. custStatus: '', // 客户状态(10正常20)
  81. followUpDate: '', // 最后跟进时间
  82. custIndustry: '', // 客户行业 (没数据)
  83. custLevel: '', // 客户级别 (没数据)
  84. source: '', //客户来源
  85. },
  86. flag: {
  87. custName: false, // 客户名称
  88. abbrName: false, // 助记名
  89. custLocation: false, // 所在地区
  90. custAddress: false, // 详细地址
  91. custStatus: false, // 客户状态(10正常20)
  92. followUpDate: false, // 最后跟进时间
  93. custIndustry: false, // 客户行业 (没数据)
  94. custLevel: false, // 客户级别 (没数据)
  95. source: false, //客户来源
  96. },
  97. list: [],
  98. width: '60%',
  99. }
  100. },
  101. mounted() {},
  102. methods: {
  103. init(res, ids) {
  104. this.list = res.data.list
  105. if (this.list.length > 4) this.width = '100%'
  106. else this.width = '60%'
  107. this.ids = ids
  108. this.form = { ...res.data.list[0] }
  109. this.form.ChooseId = this.ids.filter((item) => item != this.form.id)
  110. for (const key in this.form) {
  111. const arr = this.list.filter((it) => it[key] == this.form[key])
  112. if (arr.length !== this.list.length) this.flag[key] = true
  113. }
  114. this.visible = true
  115. },
  116. targetChange(row) {
  117. this.form.id = row.id
  118. this.form.ChooseId = this.ids.filter((item) => item != row.id)
  119. },
  120. handleClose() {},
  121. async handleConfirm() {
  122. let params = { ...this.form }
  123. const [err, res] = await to(api.mergeCustomer(params))
  124. if (err) return
  125. this.$message.success(res.msg)
  126. this.visible = false
  127. this.$emit('refresh')
  128. },
  129. },
  130. }
  131. </script>
  132. <style lang="scss" scoped>
  133. .differ {
  134. color: #f56c6c;
  135. }
  136. ::v-deep .el-alert {
  137. p {
  138. margin: 0;
  139. font-weight: normal;
  140. }
  141. .el-alert__icon {
  142. font-size: 28px;
  143. width: 28px;
  144. }
  145. }
  146. .merge {
  147. height: 361px;
  148. overflow-y: auto;
  149. display: flex;
  150. ul {
  151. border: 1px solid #dcdfe6;
  152. & + ul {
  153. border-left: none;
  154. }
  155. }
  156. li {
  157. height: 40px;
  158. line-height: 40px;
  159. border-bottom: 1px solid #dcdfe6;
  160. }
  161. .title {
  162. width: 100px;
  163. text-align: center;
  164. }
  165. .each {
  166. flex: 1;
  167. li {
  168. padding-left: 10px;
  169. }
  170. }
  171. }
  172. </style>