contactList.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. <template>
  2. <!-- <div class="ele-body"> -->
  3. <!-- <el-card shadow="never" v-loading="loading"> -->
  4. <ele-split-layout
  5. width="210px"
  6. allow-collapse
  7. :right-style="{ overflow: 'hidden' }"
  8. >
  9. <div>
  10. <div
  11. class="ele-border-lighter sys-organization-list"
  12. style="margin-left: 10px"
  13. >
  14. <AssetTree
  15. @handleNodeClick="handleNodeClick"
  16. :defaultExpandedKeys="defaultExpandedKeys"
  17. :defaultExpandAll="false"
  18. id="17"
  19. :isFirstRefreshTable="false"
  20. ref="treeList"
  21. />
  22. </div>
  23. </div>
  24. <template v-slot:content>
  25. <div
  26. class="ele-border-lighter form-content"
  27. v-loading="loading"
  28. style="margin-right: 10px"
  29. >
  30. <contact-search @search="reload"></contact-search>
  31. <!-- 数据表格 -->
  32. <ele-pro-table
  33. ref="table"
  34. :columns="columns"
  35. :datasource="datasource"
  36. height="calc(100vh - 365px)"
  37. style="margin-bottom: 15px"
  38. full-height="calc(100vh - 116px)"
  39. tool-class="ele-toolbar-form"
  40. :selection.sync="selection"
  41. :page-size="20"
  42. @columns-change="handleColumnChange"
  43. :cache-key="cacheKeyUrl"
  44. >
  45. <!-- 表头工具栏 -->
  46. <template v-slot:toolbar>
  47. <el-button
  48. size="small"
  49. type="primary"
  50. icon="el-icon-plus"
  51. class="ele-btn-icon"
  52. @click="openEdit('新建', {})"
  53. v-if="$hasPermission('eom:contact:save')"
  54. >
  55. 新建
  56. </el-button>
  57. <el-button
  58. size="small"
  59. type="primary"
  60. class="ele-btn-icon"
  61. @click="addApply"
  62. :disabled="selection?.length !== 1"
  63. v-if="$hasPermission('eom:contactlistapply:apply')"
  64. >
  65. 申请
  66. </el-button>
  67. <el-button
  68. type="primary"
  69. size="small"
  70. icon="el-icon-upload2"
  71. plain
  72. @click="uploadFile"
  73. >导入</el-button
  74. >
  75. <exportButton
  76. fileName="客户"
  77. apiUrl="/eom/contact/export"
  78. :params="params"
  79. ></exportButton>
  80. <el-button
  81. v-if="$hasPermission('eom:contact:push')"
  82. size="small"
  83. type="primary"
  84. class="ele-btn-icon"
  85. @click="allPushBtn"
  86. :disabled="selection?.length === 0"
  87. >
  88. 批量推送
  89. </el-button>
  90. </template>
  91. <template v-slot:name="{ row }">
  92. <el-link type="primary" :underline="false" @click="openDetail(row)">
  93. {{ row.name }}
  94. </el-link>
  95. </template>
  96. <!-- 操作列 -->
  97. <template v-slot:action="{ row }">
  98. <el-link
  99. type="primary"
  100. v-if="
  101. [0, 3].includes(row.approvalStatus) ||
  102. ([2].includes(row.approvalStatus) &&
  103. contact_approval_afterupdate == 1)
  104. "
  105. :underline="false"
  106. icon="el-icon-edit"
  107. @click="openEdit('编辑', row)"
  108. >
  109. 修改
  110. </el-link>
  111. <el-popconfirm
  112. class="ele-action"
  113. title="确定要删除此信息吗?"
  114. @confirm="remove(row)"
  115. >
  116. <template v-slot:reference>
  117. <el-link
  118. v-if="
  119. [0, 3].includes(row.approvalStatus) ||
  120. ([2].includes(row.approvalStatus) &&
  121. contact_approval_afterupdate == 1)
  122. "
  123. type="danger"
  124. :underline="false"
  125. icon="el-icon-delete"
  126. >
  127. 删除
  128. </el-link>
  129. </template>
  130. </el-popconfirm>
  131. </template>
  132. </ele-pro-table>
  133. </div>
  134. </template>
  135. <AddContactDialog
  136. ref="addContactDialogRef"
  137. :categoryTreeList="treeList"
  138. @done="reload"
  139. ></AddContactDialog>
  140. <ContactDetailDialog ref="contactDetailDialogRef"></ContactDetailDialog>
  141. <drawer ref="drawerRef"></drawer>
  142. <process-submit-dialog
  143. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  144. isCloseRefresh="false"
  145. v-if="processSubmitDialogFlag"
  146. ref="processSubmitDialogRef"
  147. @reload="reload"
  148. ></process-submit-dialog>
  149. <importDialog
  150. ref="importDialogRef"
  151. @success="reload"
  152. :fileUrl="'/eos/importTemplate/客户信息导入模板.xlsx'"
  153. fileName="客户信息导入模板"
  154. apiUrl="/eom/contact/importFile"
  155. />
  156. </ele-split-layout>
  157. <!-- </el-card> -->
  158. <!-- 多选删除弹窗 -->
  159. <!-- <pop-modal :visible.sync="delVisible" content="是否确定删除?" @done="commitBtn"/> -->
  160. <!-- </div> -->
  161. </template>
  162. <script>
  163. import ContactSearch from './components/contactSearch.vue';
  164. import AddContactDialog from './components/addContactDialog.vue';
  165. import ContactDetailDialog from './components/contactDetailDialog.vue';
  166. // import popModal from '@/components/pop-modal';
  167. import AssetTree from '@/components/AssetTree';
  168. import {
  169. applySave,
  170. contactDelete,
  171. contactPage,
  172. contactTypeTree,
  173. updateStatus,
  174. customerAdd
  175. } from '@/api/saleManage/contact';
  176. import dictMixins from '@/mixins/dictMixins';
  177. import drawer from './components/drawer.vue';
  178. import { reviewStatus } from '@/enum/dict';
  179. import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
  180. import { mapGetters } from 'vuex';
  181. import tabMixins from '@/mixins/tableColumnsMixin';
  182. import importDialog from '@/components/upload/import-dialog.vue';
  183. import exportButton from '@/components/upload/exportButton.vue';
  184. import { parameterGetByCode } from '@/api/main/index.js';
  185. export default {
  186. mixins: [dictMixins, tabMixins],
  187. components: {
  188. processSubmitDialog,
  189. AssetTree,
  190. ContactSearch,
  191. // popModal,
  192. AddContactDialog,
  193. ContactDetailDialog,
  194. drawer,
  195. importDialog,
  196. exportButton
  197. },
  198. data() {
  199. return {
  200. selection: [],
  201. defaultExpandedKeys: [],
  202. contact_approval_afterupdate: 0,
  203. params: {},
  204. delVisible: false,
  205. // 加载状态
  206. loading: false,
  207. processSubmitDialogFlag: false,
  208. columns: [
  209. {
  210. width: 45,
  211. type: 'selection',
  212. columnKey: 'selection',
  213. align: 'center'
  214. },
  215. {
  216. columnKey: 'index',
  217. label: '序号',
  218. type: 'index',
  219. width: 55,
  220. align: 'center',
  221. showOverflowTooltip: true,
  222. fixed: 'left',
  223. fixed: 'left'
  224. },
  225. {
  226. prop: 'code',
  227. label: '编码',
  228. align: 'center',
  229. showOverflowTooltip: true,
  230. minWidth: 140,
  231. fixed: 'left'
  232. },
  233. {
  234. prop: 'name',
  235. label: '名称',
  236. align: 'center',
  237. slot: 'name',
  238. showOverflowTooltip: true,
  239. minWidth: 200
  240. },
  241. {
  242. prop: 'serialNo',
  243. label: '代号',
  244. align: 'center',
  245. showOverflowTooltip: true,
  246. minWidth: 140
  247. },
  248. {
  249. prop: 'phone',
  250. label: '电话',
  251. align: 'center',
  252. showOverflowTooltip: true,
  253. minWidth: 120
  254. },
  255. {
  256. prop: 'addressName',
  257. label: '注册地址',
  258. align: 'center',
  259. showOverflowTooltip: true,
  260. minWidth: 120,
  261. formatter: (_row, _column, cellValue) => {
  262. return (
  263. (_row.addressName ? _row.addressName.replaceAll(',', '') : '') +
  264. (_row.address || '')
  265. );
  266. }
  267. },
  268. {
  269. prop: 'otherAddressName',
  270. label: '联系地址',
  271. align: 'center',
  272. showOverflowTooltip: true,
  273. minWidth: 120,
  274. formatter: (_row, _column, cellValue) => {
  275. return (
  276. (_row.otherAddressName
  277. ? _row.otherAddressName.replaceAll(',', '')
  278. : '') + (_row.otherAddress || '')
  279. );
  280. }
  281. },
  282. {
  283. prop: 'linkName',
  284. label: '联系人',
  285. align: 'center',
  286. showOverflowTooltip: true,
  287. minWidth: 120
  288. },
  289. {
  290. prop: 'linkPhone',
  291. label: '联系人电话',
  292. align: 'center',
  293. showOverflowTooltip: true,
  294. minWidth: 120
  295. },
  296. {
  297. prop: 'parentName',
  298. label: '上级单位',
  299. align: 'center',
  300. showOverflowTooltip: true,
  301. minWidth: 120
  302. },
  303. {
  304. prop: 'salesmanName',
  305. label: '销售员',
  306. align: 'center',
  307. showOverflowTooltip: true,
  308. minWidth: 120
  309. },
  310. {
  311. prop: 'status',
  312. label: '状态',
  313. align: 'center',
  314. showOverflowTooltip: true,
  315. minWidth: 100,
  316. formatter: (_row, _column, cellValue) => {
  317. return _row.status === 1 ? '启用' : '禁用';
  318. }
  319. },
  320. {
  321. prop: 'approvalStatus',
  322. label: '审批状态',
  323. align: 'center',
  324. showOverflowTooltip: true,
  325. minWidth: 100,
  326. formatter: (_row, _column, cellValue) => {
  327. return reviewStatus[_row.approvalStatus];
  328. }
  329. },
  330. {
  331. prop: 'createUsername',
  332. label: '创建人',
  333. align: 'center',
  334. showOverflowTooltip: true,
  335. minWidth: 100
  336. },
  337. {
  338. prop: 'createTime',
  339. label: '创建时间',
  340. align: 'center',
  341. showOverflowTooltip: true,
  342. minWidth: 160,
  343. formatter: (_row, _column, cellValue) => {
  344. return this.$util.toDateString(cellValue);
  345. }
  346. },
  347. {
  348. columnKey: 'action',
  349. label: '操作',
  350. width: 200,
  351. align: 'center',
  352. resizable: false,
  353. slot: 'action',
  354. showOverflowTooltip: true,
  355. fixed: 'right'
  356. }
  357. ],
  358. current: {},
  359. curNodeData: {},
  360. treeList: [],
  361. treeLoading: false,
  362. formData: {},
  363. rootTreeId: null,
  364. defaultProps: {
  365. children: 'children',
  366. label: 'name'
  367. },
  368. showEdit: true,
  369. cacheKeyUrl: 'eos-77c81132-saleManage-contact-staff'
  370. };
  371. },
  372. computed: {
  373. ...mapGetters(['user'])
  374. },
  375. created() {
  376. this.requestDict('状态');
  377. this.getTreeData();
  378. parameterGetByCode({
  379. code: 'contact_approval_afterupdate'
  380. }).then((res) => {
  381. this.contact_approval_afterupdate = res.value;
  382. });
  383. },
  384. methods: {
  385. /* 表格数据源 */
  386. datasource({ page, limit, where, order }) {
  387. this.params = {
  388. pageNum: page,
  389. size: limit,
  390. assignStatus: 0,
  391. type: 1,
  392. ...where,
  393. categoryId: this.curNodeData.id
  394. };
  395. return contactPage(this.params);
  396. },
  397. allPushBtn() {
  398. const dataId = this.selection.map((v) => v.id);
  399. customerAdd(dataId).then((res) => {
  400. this.$message.success('推送成功!');
  401. this.reload();
  402. });
  403. },
  404. async getTreeData() {
  405. try {
  406. this.treeLoading = true;
  407. const res = await contactTypeTree({ id: '17' });
  408. this.treeLoading = false;
  409. if (res?.code === '0') {
  410. this.treeList = res.data;
  411. this.$nextTick(() => {
  412. this.defaultExpandedKeys = this.treeList?.map(
  413. (item) => item.id
  414. ) || [17];
  415. // 默认高亮第一级树节点
  416. // if (this.treeList[0]) {
  417. // this.rootTreeId = this.treeList[0].id;
  418. // this.getDetail(this.treeList[0].id);
  419. // }
  420. });
  421. return this.treeList;
  422. }
  423. } catch (error) {}
  424. this.treeLoading = false;
  425. },
  426. handleNodeClick(data, node) {
  427. this.curNodeData = data;
  428. this.reload({ categoryId: data.id });
  429. },
  430. /* 刷新表格 */
  431. reload(where) {
  432. this.$refs.table.reload({ page: 1, where });
  433. },
  434. sub(res) {
  435. this.processSubmitDialogFlag = true;
  436. this.$nextTick(() => {
  437. let params = {
  438. businessId: res.id,
  439. businessKey: 'contact_approve',
  440. formCreateUserId: res.createUserId,
  441. variables: {
  442. certificationType: 1,
  443. businessCode: res.code,
  444. businessName: res.name,
  445. businessType: '客户审核'
  446. }
  447. // callBackMethodType : '1',
  448. // callBackMethod : 'proTargetPlanApproveApiImpl.updatePlanApprovalStatus',
  449. // pcHandle : '/bpm/handleTask/components/project-manage/plan-manage/submit.vue',
  450. // pcView : '/bpm/handleTask/components/project-manage/plan-manage/detailDialog.vue',
  451. // miniHandle : '',
  452. // miniView : '',
  453. };
  454. this.$refs.processSubmitDialogRef.init(params);
  455. });
  456. // submit({
  457. // businessId: res.id
  458. // }).then((res) => {
  459. // this.$message.success('提交成功!');
  460. // this.reload();
  461. // });
  462. },
  463. openEdit(row, type) {
  464. this.current = row;
  465. this.showEdit = true;
  466. this.$refs.addContactDialogRef.open(row, type, this.curNodeData.id);
  467. this.$refs.addContactDialogRef.$refs.form &&
  468. this.$refs.addContactDialogRef.$refs.form.clearValidate();
  469. },
  470. //批量删除
  471. allDelBtn() {
  472. if (this.selection.length === 0) return;
  473. this.delVisible = true;
  474. },
  475. commitBtn() {
  476. console.log(this.selection);
  477. const dataId = this.selection.map((v) => v.id);
  478. contactDelete(dataId).then((res) => {
  479. this.$message.success('删除成功!');
  480. this.reload();
  481. });
  482. },
  483. remove(row) {
  484. contactDelete([row.id]).then((res) => {
  485. this.$message.success('删除成功!');
  486. this.reload();
  487. });
  488. },
  489. /** 启用 */
  490. enableOption(row) {
  491. updateStatus(row.id, 1)
  492. .then((msg) => {
  493. this.$message.success('启用成功');
  494. this.reload();
  495. })
  496. .catch((e) => {
  497. this.$message.error(e.message);
  498. });
  499. },
  500. /** 禁用 */
  501. disableOption(row) {
  502. updateStatus(row.id, 2)
  503. .then((msg) => {
  504. this.$message.success('禁用成功');
  505. this.reload();
  506. })
  507. .catch((e) => {
  508. this.$message.error(e.message);
  509. });
  510. },
  511. //申请
  512. addApply(row) {
  513. applySave({
  514. applyId: this.user.info.userId,
  515. applyName: this.user.info.name,
  516. contactIds: this.selection[0].id,
  517. contactNames: this.selection[0].name
  518. }).then((res) => {
  519. this.processSubmitDialogFlag = true;
  520. this.$nextTick(() => {
  521. let params = {
  522. businessId: res,
  523. businessKey: 'contact_list_apply',
  524. formCreateUserId: this.user.info.userId,
  525. variables: {
  526. businessCode: this.selection[0].code,
  527. businessName: this.selection[0].name,
  528. businessType: '客户名单申请'
  529. }
  530. };
  531. this.$refs.processSubmitDialogRef.init(params);
  532. });
  533. });
  534. },
  535. uploadFile() {
  536. this.$refs.importDialogRef.open();
  537. },
  538. openDetail(row) {
  539. this.$refs.drawerRef.open(row);
  540. }
  541. }
  542. };
  543. </script>
  544. <style lang="scss" scoped>
  545. :deep(.el-link--inner) {
  546. margin-left: 0px !important;
  547. }
  548. .sys-organization-list {
  549. height: calc(100vh - 264px);
  550. box-sizing: border-box;
  551. border-width: 1px;
  552. border-style: solid;
  553. overflow: auto;
  554. }
  555. .sys-organization-list :deep(.el-tree-node__content) {
  556. height: 40px;
  557. & > .el-tree-node__expand-icon {
  558. margin-left: 10px;
  559. }
  560. }
  561. </style>