parentList.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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="80%">
  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/bpm/components/supplierManage/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: 2
  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: 'serialNo',
  80. label: '供应商代号',
  81. align: 'center',
  82. showOverflowTooltip: true,
  83. minWidth: 140
  84. },
  85. {
  86. prop: 'phone',
  87. label: '供应商电话',
  88. align: 'center',
  89. showOverflowTooltip: true,
  90. minWidth: 120
  91. },
  92. {
  93. prop: 'addressName',
  94. label: '单位地址',
  95. align: 'center',
  96. showOverflowTooltip: true,
  97. minWidth: 120,
  98. formatter: (_row, _column, cellValue) => {
  99. let addr = '' + _row.addressName ? _row.addressName.replaceAll(',', '') : '';
  100. addr += _row.address ? _row.address : '';
  101. return addr;
  102. }
  103. },
  104. {
  105. prop: 'linkName',
  106. label: '联系人',
  107. align: 'center',
  108. showOverflowTooltip: true,
  109. minWidth: 120
  110. },
  111. {
  112. prop: 'linkPhone',
  113. label: '联系人电话',
  114. align: 'center',
  115. showOverflowTooltip: true,
  116. minWidth: 120
  117. },
  118. {
  119. prop: 'status',
  120. label: '状态',
  121. align: 'center',
  122. showOverflowTooltip: true,
  123. minWidth: 100,
  124. formatter: (_row, _column, cellValue) => {
  125. return _row.status === 1 ? '启用' : '禁用';
  126. }
  127. },
  128. ],
  129. radio: null,
  130. }
  131. },
  132. watch: {},
  133. methods: {
  134. open(item) {
  135. if (item) {
  136. this.radio = item.id
  137. }
  138. this.visible = true
  139. },
  140. /* 表格数据源 */
  141. datasource({page, limit, where, order}) {
  142. return contactPage({
  143. pageNum: page,
  144. size: limit,
  145. type: this.classType,
  146. ...where
  147. });
  148. },
  149. /* 刷新表格 */
  150. reload(where) {
  151. this.$refs.table.reload({page: 1, where});
  152. },
  153. handleNodeClick(data, node) {
  154. this.curNodeData = data;
  155. this.reload({categoryId: data.id});
  156. },
  157. // 单击获取id
  158. cellClick(row) {
  159. this.current = row
  160. this.radio = row.id
  161. },
  162. handleClose() {
  163. this.visible = false
  164. this.current = null
  165. this.radio = ''
  166. },
  167. selected() {
  168. if (!this.current) {
  169. return this.$message.warning('请选择一条数据')
  170. }
  171. this.$emit('changeParent', this.current)
  172. this.handleClose()
  173. },
  174. }
  175. }
  176. </script>
  177. <style lang="scss" scoped>
  178. .tree_col {
  179. border: 1px solid #eee;
  180. padding: 10px 0;
  181. box-sizing: border-box;
  182. height: 500px;
  183. overflow: auto;
  184. }
  185. .table_col {
  186. padding-left: 10px;
  187. ::v-deep .el-table th.el-table__cell {
  188. background: #f2f2f2;
  189. }
  190. }
  191. .pagination {
  192. text-align: right;
  193. padding: 10px 0;
  194. }
  195. .btns {
  196. text-align: center;
  197. padding: 10px 0;
  198. }
  199. .topsearch {
  200. margin-bottom: 15px;
  201. }
  202. </style>