parentList.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template>
  2. <el-dialog
  3. title="选择客户"
  4. custom-class="ele-dialog-form long-dialog-form"
  5. :visible.sync="visible"
  6. :before-close="handleClose"
  7. :close-on-click-modal="false"
  8. top="5vh"
  9. :close-on-press-escape="false"
  10. append-to-body
  11. width="80%"
  12. >
  13. <el-card shadow="never">
  14. <contact-search @search="reload"> </contact-search>
  15. <ele-split-layout
  16. width="244px"
  17. allow-collapse
  18. :right-style="{ overflow: 'hidden' }"
  19. >
  20. <div class="ele-border-lighter split-layout-right-content">
  21. <AssetTree
  22. @handleNodeClick="handleNodeClick"
  23. id="17"
  24. :isFirstRefreshTable="false"
  25. ref="treeList"
  26. />
  27. </div>
  28. <!-- 表格 -->
  29. <template v-slot:content>
  30. <ele-pro-table
  31. ref="table"
  32. :columns="columns"
  33. :datasource="datasource"
  34. row-key="id"
  35. height="calc(100vh - 350px)"
  36. class="dict-table"
  37. @cell-click="cellClick"
  38. >
  39. <!-- 表头工具栏 -->
  40. <template v-slot:action="{ row }">
  41. <el-radio class="radio" v-model="radio" :label="row.id"
  42. ><i></i
  43. ></el-radio>
  44. </template>
  45. </ele-pro-table>
  46. </template>
  47. </ele-split-layout>
  48. </el-card>
  49. <div class="btns" slot="footer">
  50. <el-button type="primary" size="small" @click="selected">选择</el-button>
  51. <el-button size="small" @click="handleClose">关闭</el-button>
  52. </div>
  53. </el-dialog>
  54. </template>
  55. <script>
  56. import { contactPage } from '@/api/bpm/components/saleManage/contact';
  57. import ContactSearch from './contactSearch.vue';
  58. import AssetTree from '@/components/AssetTree';
  59. export default {
  60. components: {
  61. ContactSearch,
  62. AssetTree
  63. },
  64. props: {
  65. classType: {
  66. type: Number | String,
  67. default: 1
  68. }
  69. },
  70. data() {
  71. return {
  72. visible: false,
  73. currentIndex:'',
  74. columns: [
  75. {
  76. action: 'action',
  77. slot: 'action',
  78. align: 'center',
  79. label: '选择'
  80. },
  81. {
  82. columnKey: 'index',
  83. label: '序号',
  84. type: 'index',
  85. width: 55,
  86. align: 'center',
  87. showOverflowTooltip: true,
  88. fixed: 'left'
  89. },
  90. {
  91. prop: 'code',
  92. label: '客户编码',
  93. align: 'center',
  94. showOverflowTooltip: true,
  95. minWidth: 140
  96. },
  97. {
  98. prop: 'name',
  99. label: '客户名称',
  100. align: 'center',
  101. slot: 'name',
  102. showOverflowTooltip: true,
  103. minWidth: 200
  104. },
  105. {
  106. prop: 'version',
  107. label: '版本号',
  108. align: 'center',
  109. width: 80,
  110. formatter: (_row, _column, cellValue) => `V${cellValue || 1}.0`
  111. },
  112. {
  113. prop: 'serialNo',
  114. label: '客户代号',
  115. align: 'center',
  116. showOverflowTooltip: true,
  117. minWidth: 140
  118. },
  119. {
  120. prop: 'phone',
  121. label: '客户电话',
  122. align: 'center',
  123. showOverflowTooltip: true,
  124. minWidth: 120
  125. },
  126. {
  127. prop: 'addressName',
  128. label: '单位地址',
  129. align: 'center',
  130. showOverflowTooltip: true,
  131. minWidth: 120,
  132. formatter: (_row, _column, cellValue) => {
  133. let addr =
  134. '' + _row.addressName
  135. ? _row.addressName.replaceAll(',', '')
  136. : '';
  137. addr += _row.address ? _row.address : '';
  138. return addr;
  139. }
  140. },
  141. {
  142. prop: 'linkName',
  143. label: '联系人',
  144. align: 'center',
  145. showOverflowTooltip: true,
  146. minWidth: 120
  147. },
  148. {
  149. prop: 'linkPhone',
  150. label: '联系人电话',
  151. align: 'center',
  152. showOverflowTooltip: true,
  153. minWidth: 120
  154. },
  155. {
  156. prop: 'status',
  157. label: '状态',
  158. align: 'center',
  159. showOverflowTooltip: true,
  160. minWidth: 100,
  161. formatter: (_row, _column, cellValue) => {
  162. return _row.status === 1 ? '启用' : '禁用';
  163. }
  164. }
  165. ],
  166. radio: null
  167. };
  168. },
  169. watch: {},
  170. methods: {
  171. open(item,index) {
  172. if (item) {
  173. this.radio = item.id;
  174. }
  175. this.currentIndex=index
  176. this.visible = true;
  177. },
  178. /* 表格数据源 */
  179. datasource({ page, limit, where, order }) {
  180. return contactPage({
  181. pageNum: page,
  182. size: limit,
  183. type: this.classType,
  184. ...where
  185. });
  186. },
  187. /* 刷新表格 */
  188. reload(where) {
  189. this.$refs.table.reload({ page: 1, where });
  190. },
  191. handleNodeClick(data, node) {
  192. this.curNodeData = data;
  193. this.reload({ categoryId: data.id });
  194. },
  195. // 单击获取id
  196. cellClick(row) {
  197. this.current = row;
  198. this.radio = row.id;
  199. },
  200. handleClose() {
  201. this.visible = false;
  202. this.current = null;
  203. this.radio = '';
  204. },
  205. selected() {
  206. if (!this.current) {
  207. return this.$message.warning('请选择');
  208. }
  209. this.$emit('changeParent', this.current, this.currentIndex);
  210. this.handleClose();
  211. }
  212. }
  213. };
  214. </script>
  215. <style lang="scss" scoped>
  216. .tree_col {
  217. border: 1px solid #eee;
  218. padding: 10px 0;
  219. box-sizing: border-box;
  220. height: 500px;
  221. overflow: auto;
  222. }
  223. .table_col {
  224. padding-left: 10px;
  225. ::v-deep .el-table th.el-table__cell {
  226. background: #f2f2f2;
  227. }
  228. }
  229. .pagination {
  230. text-align: right;
  231. padding: 10px 0;
  232. }
  233. .btns {
  234. text-align: center;
  235. padding: 10px 0;
  236. }
  237. .topsearch {
  238. margin-bottom: 15px;
  239. }
  240. </style>