GroupDialog.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <el-dialog
  3. title="选择物料组"
  4. :visible.sync="groupVisible"
  5. :before-close="handleClose"
  6. :close-on-click-modal="false"
  7. :close-on-press-escape="false"
  8. append-to-body
  9. width="60%"
  10. >
  11. <div>
  12. <el-row>
  13. <el-col :span="24" class="table_col">
  14. <el-table
  15. :data="tableData"
  16. height="450"
  17. highlight-current-row
  18. @row-click="single"
  19. >
  20. <el-table-column label="物料组名称" prop="name" width="200"></el-table-column>
  21. <el-table-column label="物料组编码" prop="code"></el-table-column>
  22. <el-table-column label="分类树" prop="categoryLevelRootName">
  23. <template slot-scope="scope">
  24. {{scope.row.categoryLevelRootName+'分类'}}
  25. </template>
  26. </el-table-column>
  27. <el-table-column label="选择" align="center">
  28. <template slot-scope="scope">
  29. <el-radio class="radio" v-model="radio" :label="scope.row.id"><i></i></el-radio>
  30. </template>
  31. </el-table-column>
  32. </el-table>
  33. <div class="pagination">
  34. <el-pagination
  35. background
  36. layout="total, sizes, prev, pager, next, jumper"
  37. :total="total"
  38. :page-sizes="[10, 20, 50, 100]"
  39. :page-size="pagination.size"
  40. :current-page.sync="pagination.pageNum"
  41. @current-change="handleCurrent"
  42. @size-change="handleSize"
  43. >
  44. </el-pagination>
  45. </div>
  46. </el-col>
  47. </el-row>
  48. </div>
  49. <div class="btns">
  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 { getGroupPage } from '@/api/material/list';
  57. export default {
  58. data () {
  59. return {
  60. groupVisible: false,
  61. tableData: [],
  62. search:{},
  63. pagination: {
  64. pageNum: 1,
  65. size: 10,
  66. },
  67. total: 0,
  68. radio: '',
  69. current:null
  70. }
  71. },
  72. watch: {
  73. },
  74. methods: {
  75. open(item){
  76. if(item){
  77. this.current = item
  78. this.radio = item.id
  79. }
  80. this.groupVisible = true
  81. this.getList()
  82. },
  83. // 单击获取id
  84. single (row) {
  85. this.current = row
  86. this.radio = row.id
  87. },
  88. handleClose () {
  89. this.groupVisible = false
  90. this.current = null
  91. this.radio = ''
  92. },
  93. handleCurrent (page) {
  94. this.pagination.pageNum = page
  95. this.getList()
  96. },
  97. handleSize (size) {
  98. this.pagination.pageNum = 1
  99. this.pagination.size = size
  100. this.getList()
  101. },
  102. getList(){
  103. let params = {...this.pagination}
  104. getGroupPage(params).then(res=>{
  105. this.tableData = res.list
  106. this.total = res.count
  107. })
  108. },
  109. selected(){
  110. if(!this.current){
  111. return this.$message.warning('请选择物料组')
  112. }
  113. this.$emit('changeMaterial',this.current)
  114. this.handleClose()
  115. },
  116. }
  117. }
  118. </script>
  119. <style lang="scss" scoped>
  120. .tree_col {
  121. border: 1px solid #eee;
  122. padding: 10px 0;
  123. box-sizing: border-box;
  124. height: 500px;
  125. overflow: auto;
  126. }
  127. .table_col {
  128. padding-left: 10px;
  129. ::v-deep .el-table th.el-table__cell {
  130. background: #f2f2f2;
  131. }
  132. }
  133. .pagination {
  134. text-align: right;
  135. padding: 10px 0;
  136. }
  137. .btns {
  138. text-align: center;
  139. padding: 10px 0;
  140. }
  141. .topsearch{
  142. margin-bottom:15px;
  143. }
  144. </style>