list.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <template>
  2. <div>
  3. <search-table @search="reload"></search-table>
  4. <ele-pro-table
  5. ref="table"
  6. :columns="columns"
  7. :datasource="datasource"
  8. height="calc(100vh - 365px)"
  9. full-height="calc(100vh - 116px)"
  10. tool-class="ele-toolbar-form"
  11. :selection.sync="selection"
  12. :page-size="20"
  13. @columns-change="handleColumnChange"
  14. :cache-key="cacheKeyUrl + queryType"
  15. :initLoad="false"
  16. >
  17. <template v-slot:followupCount="{ row }">
  18. <el-link
  19. type="primary"
  20. :underline="false"
  21. @click="handleAddOrEdit(row, 'view')"
  22. >
  23. {{ row.followupCount }}
  24. </el-link>
  25. </template>
  26. <template v-slot:toolbar v-if="queryType === 0">
  27. <el-button
  28. size="small"
  29. type="primary"
  30. icon="el-icon-plus"
  31. class="ele-btn-icon"
  32. @click="openEdit('add', {})"
  33. >
  34. 新建
  35. </el-button>
  36. <el-button
  37. size="small"
  38. type="danger"
  39. el-icon-delete
  40. class="ele-btn-icon"
  41. @click="allDelBtn"
  42. :disabled="selection?.length === 0"
  43. >
  44. 批量删除
  45. </el-button>
  46. </template>
  47. <template v-slot:action="{ row }">
  48. <el-link
  49. type="primary"
  50. :underline="false"
  51. icon="el-icon-edit"
  52. @click="openEdit('编辑', row)"
  53. >
  54. 修改
  55. </el-link>
  56. <el-popconfirm
  57. class="ele-action"
  58. title="确定要删除此信息吗?"
  59. @confirm="remove(row)"
  60. >
  61. <template v-slot:reference>
  62. <el-link type="danger" :underline="false" icon="el-icon-delete">
  63. 删除
  64. </el-link>
  65. </template>
  66. </el-popconfirm>
  67. </template>
  68. </ele-pro-table>
  69. <viewDialog ref="viewDialogRef"></viewDialog>
  70. <AddFollowDialog ref="addFollowDialogRef" @done="done"></AddFollowDialog>
  71. </div>
  72. </template>
  73. <script>
  74. import tabMixins from '@/mixins/tableColumnsMixin';
  75. import dictMixins from '@/mixins/dictMixins';
  76. import viewDialog from './viewDialog.vue';
  77. import searchTable from './searchTable.vue';
  78. import { groupByContact } from '@/api/saleManage/contact.js';
  79. import AddFollowDialog from './addFollowDialog.vue';
  80. export default {
  81. mixins: [dictMixins, tabMixins],
  82. components: {
  83. searchTable,
  84. viewDialog,
  85. AddFollowDialog
  86. },
  87. props: {
  88. queryType: {
  89. default: 0,
  90. type: Number
  91. }
  92. },
  93. data() {
  94. return {
  95. // 加载状态
  96. loading: false,
  97. cacheKeyUrl: 'eos-be72e790-followList-myList',
  98. columnsVersion: 1,
  99. selection: []
  100. };
  101. },
  102. computed: {
  103. columns() {
  104. // 当columnsVersion变化时会重新计算,用作更新列配置
  105. const version = this.columnsVersion;
  106. let arr = [
  107. {
  108. width: 60,
  109. label: '序号',
  110. type: 'index',
  111. columnKey: 'index',
  112. align: 'center'
  113. },
  114. {
  115. minWidth: 200,
  116. prop: 'contactName',
  117. label: '客户名称',
  118. align: 'center',
  119. showOverflowTooltip: true
  120. },
  121. {
  122. minWidth: 150,
  123. prop: 'userName',
  124. label: '负责人',
  125. align: 'center',
  126. showOverflowTooltip: true
  127. },
  128. {
  129. minWidth: 150,
  130. prop: 'deptName',
  131. label: '负责人部门',
  132. align: 'center',
  133. showOverflowTooltip: true
  134. },
  135. {
  136. minWidth: 150,
  137. prop: 'followupCount',
  138. label: '跟进次数',
  139. align: 'center',
  140. slot: 'followupCount',
  141. showOverflowTooltip: true
  142. },
  143. {
  144. minWidth: 200,
  145. prop: 'beginTime',
  146. label: '开始跟进时间',
  147. align: 'center',
  148. showOverflowTooltip: true
  149. },
  150. {
  151. minWidth: 200,
  152. prop: 'lastTime',
  153. label: '最近一次跟进时间',
  154. align: 'center',
  155. showOverflowTooltip: true
  156. },
  157. {
  158. columnKey: 'action',
  159. label: '操作',
  160. width: 180,
  161. align: 'center',
  162. resizable: false,
  163. slot: 'action',
  164. showOverflowTooltip: true,
  165. fixed: 'right'
  166. }
  167. ];
  168. if (this.queryType === 1) {
  169. arr.pop();
  170. }
  171. return arr;
  172. }
  173. },
  174. created() {},
  175. methods: {
  176. //新增、修改
  177. handleAddOrEdit(row = {}) {
  178. this.$nextTick(() => {
  179. this.$refs.viewDialogRef.open({
  180. contactId: row.contactId,
  181. deptIds: row.deptIds,
  182. beginTime: row.beginTime,
  183. endTime: row.endTime,
  184. deptId: row.deptId,
  185. userId: row.userId
  186. });
  187. });
  188. },
  189. /* 表格数据源 */
  190. datasource({ page, limit, where, order }) {
  191. return groupByContact({
  192. pageNum: page,
  193. size: limit,
  194. ...where,
  195. queryType: this.queryType
  196. });
  197. },
  198. /* 刷新表格 */
  199. reload(where = {}) {
  200. this.$refs.table.reload({ page: 1, where });
  201. },
  202. openEdit(type, row, index) {
  203. this.$refs.addFollowDialogRef.open(type, row, index);
  204. this.$refs.addFollowDialogRef.$refs.form &&
  205. this.$refs.addFollowDialogRef.$refs.form.clearValidate();
  206. },
  207. allDelBtn() {},
  208. remove() {},
  209. done({ data }) {
  210. console.log(data);
  211. }
  212. }
  213. };
  214. </script>
  215. <style lang="scss" scoped>
  216. :deep(.el-link--inner) {
  217. margin-left: 0px !important;
  218. }
  219. .sys-organization-list {
  220. height: calc(100vh - 264px);
  221. box-sizing: border-box;
  222. border-width: 1px;
  223. border-style: solid;
  224. overflow: auto;
  225. }
  226. .sys-organization-list :deep(.el-tree-node__content) {
  227. height: 40px;
  228. & > .el-tree-node__expand-icon {
  229. margin-left: 10px;
  230. }
  231. }
  232. </style>