draw-template-choose.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <!-- 图库管理 -->
  2. <template>
  3. <el-dialog title="选择图纸"
  4. width="70%"
  5. :close-on-click-modal="false"
  6. :visible.sync="visible">
  7. <div class="draw-management">
  8. <el-form :inline="true" :model="dataForm" @keyup.enter.native="search()">
  9. <el-form-item label="名称">
  10. <el-input v-model="dataForm.keyword" placeholder="名称" clearable/>
  11. </el-form-item>
  12. <el-form-item>
  13. <el-button @click="search()">查询</el-button>
  14. <el-button type="primary" @click="addSubmit">确认添加</el-button>
  15. <el-button type="text" @click="gotoPage">没有找到?去上传</el-button>
  16. </el-form-item>
  17. </el-form>
  18. <el-table
  19. :data="dataList"
  20. border
  21. v-loading="dataListLoading"
  22. @selection-change="selectionChangeHandle"
  23. style="width: 100%;">
  24. <el-table-column type="selection"></el-table-column>
  25. <el-table-column
  26. label="序号"
  27. type="index"
  28. width="50"
  29. align="center">
  30. </el-table-column>
  31. <el-table-column
  32. prop="drawingCode"
  33. header-align="center"
  34. align="center"
  35. min-width="100"
  36. :show-tooltip-when-overflow="true"
  37. label="图纸编码">
  38. </el-table-column>
  39. <el-table-column
  40. prop="drawingName"
  41. header-align="center"
  42. align="center"
  43. min-width="120"
  44. :show-tooltip-when-overflow="true"
  45. label="图纸名称">
  46. </el-table-column>
  47. <el-table-column
  48. prop="drawingNo"
  49. header-align="center"
  50. align="center"
  51. min-width="120"
  52. :show-tooltip-when-overflow="true"
  53. label="图号">
  54. </el-table-column>
  55. <el-table-column
  56. prop="source"
  57. header-align="center"
  58. align="center"
  59. min-width="200"
  60. :show-overflow-tooltip="true"
  61. label="来源">
  62. </el-table-column>
  63. <el-table-column
  64. prop="creatorName"
  65. header-align="center"
  66. align="center"
  67. min-width="100"
  68. label="上传者">
  69. </el-table-column>
  70. <el-table-column
  71. prop="notes"
  72. header-align="center"
  73. align="center"
  74. min-width="180"
  75. :show-overflow-tooltip="true"
  76. label="备注">
  77. </el-table-column>
  78. </el-table>
  79. <el-pagination
  80. @size-change="sizeChangeHandle"
  81. @current-change="currentChangeHandle"
  82. :current-page="pageIndex"
  83. :page-sizes="[10, 20, 50, 100]"
  84. :page-size="pageSize"
  85. :total="totalPage"
  86. layout="total, sizes, prev, pager, next, jumper">
  87. </el-pagination>
  88. </div>
  89. </el-dialog>
  90. </template>
  91. <script>
  92. import { getDrawList } from '@/api/product'
  93. import ProductComponent from '@/views/modules/common/product-component'
  94. export default {
  95. name: 'draw-template-choose',
  96. components: {
  97. ProductComponent
  98. },
  99. data () {
  100. return {
  101. visible: false,
  102. detailVisible: false,
  103. dataForm: {
  104. keyword: ''
  105. },
  106. optionsProducts: [],
  107. dataList: [],
  108. pageIndex: 1,
  109. pageSize: 10,
  110. totalPage: 0,
  111. dataListLoading: false,
  112. dataListSelections: []
  113. }
  114. },
  115. created () {
  116. this.getDataList()
  117. },
  118. methods: {
  119. init () {
  120. this.visible = true
  121. },
  122. onChose () {
  123. this.addOrUpdateVisible = false
  124. this.detailVisible = false
  125. },
  126. // 查询
  127. search () {
  128. this.pageIndex = 1
  129. this.getDataList()
  130. },
  131. // 获取数据列表
  132. getDataList () {
  133. this.addOrUpdateVisible = false
  134. this.dataListLoading = true
  135. let params = {
  136. 'current': this.pageIndex,
  137. 'size': this.pageSize,
  138. 'keyword': this.dataForm.keyword,
  139. 'createTime': this.dataForm.createTime ? this.dataForm.createTime : null,
  140. 'productId': this.dataForm.productId ? this.dataForm.productId : null
  141. }
  142. getDrawList(params).then(({data}) => {
  143. if (data && data.code === '200') {
  144. this.dataList = data.data.records
  145. this.totalPage = Number(data.data.total)
  146. } else {
  147. this.dataList = []
  148. this.totalPage = 0
  149. }
  150. this.dataListLoading = false
  151. })
  152. },
  153. // 每页数
  154. sizeChangeHandle (val) {
  155. this.pageSize = val
  156. this.pageIndex = 1
  157. this.getDataList()
  158. },
  159. // 当前页
  160. currentChangeHandle (val) {
  161. this.pageIndex = val
  162. this.getDataList()
  163. },
  164. // 多选
  165. selectionChangeHandle (val) {
  166. this.dataListSelections = val
  167. },
  168. addSubmit () {
  169. if (this.dataListSelections.length === 0) {
  170. this.$message.warning('请选择')
  171. return
  172. }
  173. this.visible = false
  174. this.$emit('addItems', this.dataListSelections)
  175. },
  176. // 跳转上传图纸页面
  177. gotoPage () {
  178. this.visible = false
  179. this.$router.push('/tech-draw-management')
  180. }
  181. }
  182. }
  183. </script>
  184. <style scoped>
  185. </style>