draw-management.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <!-- 图库管理 -->
  2. <template>
  3. <div class="draw-management">
  4. <el-form :inline="true" :model="dataForm" @keyup.enter.native="search()">
  5. <el-form-item label="名称">
  6. <el-input v-model="dataForm.keyword" placeholder="名称" clearable/>
  7. </el-form-item>
  8. <el-form-item label="创建日期">
  9. <el-date-picker
  10. v-model="dataForm.date"
  11. value-format="yyyy-MM-dd"
  12. type="daterange"
  13. range-separator="至"
  14. start-placeholder="开始日期"
  15. end-placeholder="结束日期">
  16. </el-date-picker>
  17. </el-form-item>
  18. <el-form-item>
  19. <el-button @click="search()">查询</el-button>
  20. <el-button v-if="isAuth('pro:drawing:save')" type="primary" @click="addOrUpdateHandle(0, false)">上传图纸</el-button>
  21. </el-form-item>
  22. </el-form>
  23. <el-table
  24. :data="dataList"
  25. border
  26. v-loading="dataListLoading"
  27. style="width: 100%;">
  28. <el-table-column
  29. label="序号"
  30. type="index"
  31. width="50"
  32. align="center">
  33. </el-table-column>
  34. <el-table-column
  35. prop="drawingCode"
  36. header-align="center"
  37. align="center"
  38. min-width="100"
  39. label="图纸编码">
  40. </el-table-column>
  41. <el-table-column
  42. prop="drawingName"
  43. header-align="center"
  44. align="center"
  45. min-width="120"
  46. label="图纸名称">
  47. </el-table-column>
  48. <el-table-column
  49. prop="productName"
  50. header-align="center"
  51. align="center"
  52. label="对应产品">
  53. </el-table-column>
  54. <el-table-column
  55. prop="source"
  56. header-align="center"
  57. align="center"
  58. min-width="200"
  59. :show-overflow-tooltip="true"
  60. label="来源">
  61. </el-table-column>
  62. <el-table-column
  63. prop="createTime"
  64. header-align="center"
  65. align="center"
  66. min-width="160"
  67. label="创建时间">
  68. </el-table-column>
  69. <el-table-column
  70. prop="creatorName"
  71. header-align="center"
  72. align="center"
  73. min-width="100"
  74. label="上传者">
  75. </el-table-column>
  76. <el-table-column
  77. prop="notes"
  78. header-align="center"
  79. align="center"
  80. min-width="180"
  81. :show-overflow-tooltip="true"
  82. label="备注">
  83. </el-table-column>
  84. <el-table-column
  85. fixed="right"
  86. header-align="center"
  87. align="center"
  88. width="150"
  89. label="操作">
  90. <template slot-scope="scope">
  91. <el-button v-if="isAuth('pro:drawing:info')" type="text" size="small" @click="detailHandle(scope.row.drawingId)">查看</el-button>
  92. <el-button v-if="isAuth('pro:drawing:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.drawingId, false)">编辑</el-button>
  93. </template>
  94. </el-table-column>
  95. </el-table>
  96. <el-pagination
  97. @size-change="sizeChangeHandle"
  98. @current-change="currentChangeHandle"
  99. :current-page="pageIndex"
  100. :page-sizes="[10, 20, 50, 100]"
  101. :page-size="pageSize"
  102. :total="totalPage"
  103. layout="total, sizes, prev, pager, next, jumper">
  104. </el-pagination>
  105. <!-- 弹窗, 新增 / 修改 -->
  106. <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
  107. <detail v-if="detailVisible" ref="detail"/>
  108. </div>
  109. </template>
  110. <script>
  111. import AddOrUpdate from './draw-add-or-update'
  112. import Detail from './draw-detail'
  113. import { getDrawList } from '@/api/product'
  114. export default {
  115. name: 'draw-management',
  116. components: {
  117. AddOrUpdate, Detail
  118. },
  119. data () {
  120. return {
  121. addOrUpdateVisible: false,
  122. detailVisible: false,
  123. dataForm: {
  124. keyword: ''
  125. },
  126. optionsProducts: [],
  127. dataList: [],
  128. pageIndex: 1,
  129. pageSize: 10,
  130. totalPage: 0,
  131. dataListLoading: false,
  132. dataListSelections: []
  133. }
  134. },
  135. created () {
  136. this.getDataList()
  137. },
  138. methods: {
  139. // 查询
  140. search () {
  141. this.pageIndex = 1
  142. this.getDataList()
  143. },
  144. // 获取数据列表
  145. getDataList () {
  146. this.addOrUpdateVisible = false
  147. this.dataListLoading = true
  148. let params = {
  149. 'current': this.pageIndex,
  150. 'size': this.pageSize,
  151. 'keyword': this.dataForm.keyword,
  152. 'createTime': this.dataForm.createTime ? this.dataForm.createTime : null,
  153. 'productId': this.dataForm.productId ? this.dataForm.productId : null
  154. }
  155. getDrawList(params).then(({data}) => {
  156. if (data && data.code === '200') {
  157. this.dataList = data.data.records
  158. this.totalPage = Number(data.data.total)
  159. } else {
  160. this.dataList = []
  161. this.totalPage = 0
  162. }
  163. this.dataListLoading = false
  164. })
  165. },
  166. // 每页数
  167. sizeChangeHandle (val) {
  168. this.pageSize = val
  169. this.pageIndex = 1
  170. this.getDataList()
  171. },
  172. // 当前页
  173. currentChangeHandle (val) {
  174. this.pageIndex = val
  175. this.getDataList()
  176. },
  177. // 多选
  178. selectionChangeHandle (val) {
  179. this.dataListSelections = val
  180. },
  181. // 新增 / 修改
  182. addOrUpdateHandle (id, display) {
  183. this.addOrUpdateVisible = true
  184. this.$nextTick(() => {
  185. this.$refs.addOrUpdate.init(id, display)
  186. })
  187. },
  188. // 删除
  189. deleteHandle (id) {
  190. if (!id) return
  191. let ids = []
  192. ids.push(id)
  193. this.$confirm(`确定删除?`, '提示', {
  194. confirmButtonText: '确定',
  195. cancelButtonText: '取消',
  196. type: 'warning'
  197. }).then(() => {
  198. this.$http({
  199. url: this.$http.adornUrl(`/biz-service/drawing/delete`),
  200. method: 'DELETE',
  201. data: ids
  202. }).then(({data}) => {
  203. if (data && data.code === '200') {
  204. this.$message({
  205. message: '操作成功',
  206. type: 'success',
  207. duration: 1500,
  208. onClose: () => {
  209. this.getDataList()
  210. }
  211. })
  212. } else {
  213. this.$message.error(data.msg)
  214. }
  215. })
  216. }).catch(() => {})
  217. },
  218. // 详情
  219. detailHandle (id) {
  220. this.detailVisible = true
  221. this.$nextTick(() => {
  222. this.$refs.detail.init(id)
  223. })
  224. }
  225. }
  226. }
  227. </script>
  228. <style scoped>
  229. </style>