parentList.vue 6.7 KB

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