ChooseMaterial.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <el-dialog
  3. title="选择物料"
  4. :visible.sync="materialdialog"
  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="topsearch">
  14. <el-form >
  15. <el-row>
  16. <el-col :span="6">
  17. <el-input
  18. v-model="searchKey"
  19. placeholder="输入设备编码或名称"
  20. size="small"
  21. ></el-input>
  22. </el-col>
  23. <el-col :span="6" style="margin-left:10px">
  24. <el-button type="primary" size="small" @click="searchByKeyWords">搜索</el-button>
  25. <el-button size="small" @click="reset">重置</el-button>
  26. </el-col>
  27. </el-row>
  28. </el-form>
  29. </el-col>
  30. <el-col :span="6" class="tree_col">
  31. <AssetTree
  32. @handleNodeClick="handleNodeClick"
  33. @setRootId="setRootId"
  34. :type="'5'"
  35. :paramsType="'type'"
  36. ref="treeList"
  37. />
  38. </el-col>
  39. <el-col :span="18" class="table_col">
  40. <el-table
  41. :data="tableData"
  42. height="450"
  43. @row-click="single"
  44. >
  45. <el-table-column label="物品编码" prop="code" width="200"></el-table-column>
  46. <el-table-column label="物品名称" prop="name"></el-table-column>
  47. <el-table-column label="牌号" prop="classificationUrl"></el-table-column>
  48. <el-table-column label="选择" align="center">
  49. <template slot-scope="scope">
  50. <el-radio class="radio" v-model="radio" :label="scope.row.id"><i></i></el-radio>
  51. </template>
  52. </el-table-column>
  53. </el-table>
  54. <div class="pagination">
  55. <el-pagination
  56. background
  57. layout="total, sizes, prev, pager, next, jumper"
  58. :total="total"
  59. :page-sizes="[5, 10, 20, 50, 100]"
  60. :page-size="pagination.size"
  61. :current-page.sync="pagination.page"
  62. @current-change="handleCurrent"
  63. @size-change="handleSize"
  64. >
  65. </el-pagination>
  66. </div>
  67. </el-col>
  68. </el-row>
  69. </div>
  70. <div class="btns">
  71. <el-button type="primary" size="small" @click="selected">选择</el-button>
  72. <el-button size="small" @click="handleClose">关闭</el-button>
  73. </div>
  74. </el-dialog>
  75. </template>
  76. <script>
  77. import AssetTree from '@/components/AssetTree';
  78. export default {
  79. components: {
  80. AssetTree
  81. },
  82. data () {
  83. return {
  84. materialdialog: false,
  85. tableData: [
  86. {id:1,name:'122',model:'型号1'},
  87. {id:2,name:'222',model:'型号2'}
  88. ],
  89. pagination: {
  90. page: 1,
  91. size: 10
  92. },
  93. total: 0,
  94. searchKey:null,
  95. current:null,
  96. rootId:null,
  97. radio: '',
  98. }
  99. },
  100. watch: {
  101. },
  102. methods: {
  103. open(){
  104. this.materialdialog = true
  105. },
  106. handleNodeClick (info) {
  107. this.current = info
  108. },
  109. // 获取根节点id
  110. setRootId(id){
  111. this.rootId = id
  112. },
  113. handleClose () {
  114. this.materialdialog = false
  115. this.radio = ''
  116. },
  117. handleCurrent (page) {
  118. this.pagination.page = page
  119. },
  120. handleSize (size) {
  121. this.pagination.page = 1
  122. this.pagination.size = size
  123. },
  124. // 弹窗 - 按关键字搜索
  125. searchByKeyWords () {
  126. },
  127. // 重置
  128. reset(){
  129. },
  130. // 单击获取id
  131. single (row) {
  132. this.radio = row.id;
  133. },
  134. selected(){
  135. }
  136. }
  137. }
  138. </script>
  139. <style lang="scss" scoped>
  140. .tree_col {
  141. border: 1px solid #eee;
  142. padding: 10px 0;
  143. box-sizing: border-box;
  144. height: 500px;
  145. overflow: auto;
  146. }
  147. .table_col {
  148. padding-left: 10px;
  149. ::v-deep .el-table th.el-table__cell {
  150. background: #f2f2f2;
  151. }
  152. }
  153. .pagination {
  154. text-align: right;
  155. padding: 10px 0;
  156. }
  157. .btns {
  158. text-align: center;
  159. padding: 10px 0;
  160. }
  161. .topsearch{
  162. margin-bottom:15px;
  163. }
  164. </style>