parentList.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <el-dialog title="选择生产厂家" :visible.sync="visible" :before-close="handleClose" :close-on-click-modal="false"
  3. top="5vh"
  4. :close-on-press-escape="false" append-to-body width="70%">
  5. <el-card shadow="never">
  6. <contact-search @search="reload"></contact-search>
  7. <ele-split-layout width="244px" allow-collapse :right-style="{ overflow: 'hidden' }">
  8. <div class="ele-border-lighter split-layout-right-content">
  9. <AssetTree @handleNodeClick="handleNodeClick" id="19" :isFirstRefreshTable="false" ref="treeList"/>
  10. </div>
  11. <!-- 表格 -->
  12. <template v-slot:content>
  13. <ele-pro-table ref="table" :columns="columns" :datasource="datasource" row-key="id"
  14. height="calc(100vh - 350px)" class="dict-table" @cell-click="cellClick">
  15. <!-- 表头工具栏 -->
  16. <template v-slot:action="{ row }">
  17. <el-radio class="radio" v-model="radio" :label="row.id"><i></i></el-radio>
  18. </template>
  19. </ele-pro-table>
  20. </template>
  21. </ele-split-layout>
  22. </el-card>
  23. <div class="btns">
  24. <el-button type="primary" size="small" @click="selected">选择</el-button>
  25. <el-button size="small" @click="handleClose">关闭</el-button>
  26. </div>
  27. </el-dialog>
  28. </template>
  29. <script>
  30. import {contactPage} from '@/api/saleManage/contact';
  31. import ContactSearch from './contactSearch.vue';
  32. import AssetTree from '@/components/AssetTree';
  33. export default {
  34. components: {
  35. ContactSearch,
  36. AssetTree
  37. },
  38. props: {
  39. classType: {
  40. type: Number,
  41. default: 1
  42. }
  43. },
  44. data() {
  45. return {
  46. visible: false,
  47. columns: [
  48. {
  49. action: 'action',
  50. slot: 'action',
  51. align: 'center',
  52. label: '选择'
  53. },
  54. {
  55. columnKey: 'index',
  56. label: '序号',
  57. type: 'index',
  58. width: 55,
  59. align: 'center',
  60. showOverflowTooltip: true,
  61. fixed: 'left'
  62. },
  63. {
  64. prop: 'code',
  65. label: '编码',
  66. align: 'center',
  67. showOverflowTooltip: true,
  68. minWidth: 140
  69. },
  70. {
  71. prop: 'name',
  72. label: '名称',
  73. align: 'center',
  74. slot: 'name',
  75. showOverflowTooltip: true,
  76. minWidth: 200
  77. },
  78. {
  79. prop: 'version',
  80. label: '版本号',
  81. align: 'center',
  82. width: 80,
  83. formatter: (_row, _column, cellValue) => `V${cellValue || 1}.0`
  84. },
  85. {
  86. prop: 'serialNo',
  87. label: '代号',
  88. align: 'center',
  89. showOverflowTooltip: true,
  90. minWidth: 140
  91. },
  92. {
  93. prop: 'phone',
  94. label: '电话',
  95. align: 'center',
  96. showOverflowTooltip: true,
  97. minWidth: 120
  98. },
  99. {
  100. prop: 'addressName',
  101. label: '单位地址',
  102. align: 'center',
  103. showOverflowTooltip: true,
  104. minWidth: 120,
  105. formatter: (_row, _column, cellValue) => {
  106. let addr = '' + _row.addressName ? _row.addressName.replaceAll(',', '') : '';
  107. addr += _row.address ? _row.address : '';
  108. return addr;
  109. }
  110. },
  111. {
  112. prop: 'linkName',
  113. label: '联系人',
  114. align: 'center',
  115. showOverflowTooltip: true,
  116. minWidth: 120
  117. },
  118. {
  119. prop: 'linkPhone',
  120. label: '联系人电话',
  121. align: 'center',
  122. showOverflowTooltip: true,
  123. minWidth: 120
  124. },
  125. {
  126. prop: 'status',
  127. label: '状态',
  128. align: 'center',
  129. showOverflowTooltip: true,
  130. minWidth: 100,
  131. formatter: (_row, _column, cellValue) => {
  132. return _row.status === 1 ? '启用' : '禁用';
  133. }
  134. },
  135. ],
  136. radio: null,
  137. }
  138. },
  139. watch: {},
  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>