scheduling-mould.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <!-- 排产模板 -->
  2. <template>
  3. <div class="production">
  4. <template v-if="!detailsVisible && !detailsVisible">
  5. <el-form :inline="true" :model="dataForm" @keyup.enter.native="queryPage()">
  6. <el-form-item label="物料名称">
  7. <el-input v-model="dataForm.productName" placeholder="物料名称" clearable/>
  8. </el-form-item>
  9. <el-form-item label="模板名称">
  10. <el-input v-model="dataForm.mouldName" placeholder="模板名称" clearable/>
  11. </el-form-item>
  12. <el-form-item>
  13. <el-button @click="queryPage()">查询</el-button>
  14. <el-button v-if="isAuth('prod:productionMould:save')" type="primary" @click="detail(0, false)">新增模板</el-button>
  15. </el-form-item>
  16. </el-form>
  17. <el-table
  18. :data="dataList"
  19. border
  20. v-loading="dataListLoading"
  21. style="width: 100%;">
  22. <el-table-column
  23. label="序号"
  24. type="index"
  25. width="50"
  26. align="center">
  27. </el-table-column>
  28. <el-table-column
  29. prop="mouldName"
  30. header-align="center"
  31. align="center"
  32. min-width="120"
  33. :show-tooltip-when-overflow="true"
  34. label="模板名称">
  35. </el-table-column>
  36. <el-table-column
  37. prop="productName"
  38. header-align="center"
  39. align="center"
  40. min-width="120"
  41. :show-tooltip-when-overflow="true"
  42. label="物料名称">
  43. </el-table-column>
  44. <el-table-column
  45. prop="creatorName"
  46. header-align="center"
  47. align="center"
  48. label="创建人">
  49. </el-table-column>
  50. <el-table-column
  51. prop="createTime"
  52. header-align="center"
  53. align="center"
  54. min-width="160"
  55. label="创建时间">
  56. </el-table-column>
  57. <el-table-column
  58. fixed="right"
  59. header-align="center"
  60. align="center"
  61. width="100"
  62. label="操作">
  63. <template slot-scope="scope">
  64. <el-button v-if="isAuth('prod:productionMould:update')" type="text" size="small" @click="detail(scope.row.mouldId, true, scope.row.productName)">编辑</el-button>
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. <el-pagination
  69. @size-change="sizeChangeHandle"
  70. @current-change="currentChangeHandle"
  71. :current-page="pageIndex"
  72. :page-sizes="[10, 20, 50, 100]"
  73. :page-size="pageSize"
  74. :total="totalPage"
  75. layout="total, sizes, prev, pager, next, jumper">
  76. </el-pagination>
  77. </template>
  78. <!-- 弹窗, 新增 / 修改 -->
  79. <detail v-if="detailsVisible" ref="details" @refreshDataList="getDataList" @onChose="onChose"/>
  80. </div>
  81. </template>
  82. <script>
  83. import Detail from './scheduling-mould-details'
  84. import { getMouldList } from '@/api/production'
  85. export default {
  86. name: 'scheduling',
  87. components: {Detail},
  88. data () {
  89. return {
  90. detailsVisible: false,
  91. dataForm: {},
  92. dataList: [],
  93. pageIndex: 1,
  94. pageSize: 10,
  95. totalPage: 0,
  96. dataListLoading: false,
  97. dataListSelections: []
  98. }
  99. },
  100. created () {
  101. this.getDataList()
  102. },
  103. methods: {
  104. onChose () {
  105. this.detailsVisible = false
  106. },
  107. // 查询
  108. queryPage () {
  109. this.pageIndex = 1
  110. this.getDataList()
  111. },
  112. // 获取数据列表
  113. getDataList () {
  114. this.dataListLoading = true
  115. let submitData = {
  116. 'current': this.pageIndex,
  117. 'size': this.pageSize,
  118. 'mouldName': this.dataForm.mouldName ? this.dataForm.mouldName : null,
  119. 'productName': this.dataForm.productName ? this.dataForm.productName : null
  120. }
  121. getMouldList(submitData).then(({data}) => {
  122. if (data && data.code === '200') {
  123. this.dataList = data.data.records
  124. this.totalPage = Number(data.data.total)
  125. } else {
  126. this.dataList = []
  127. this.totalPage = 0
  128. }
  129. this.dataListLoading = false
  130. })
  131. },
  132. // 每页数
  133. sizeChangeHandle (val) {
  134. this.pageSize = val
  135. this.pageIndex = 1
  136. this.getDataList()
  137. },
  138. // 当前页
  139. currentChangeHandle (val) {
  140. this.pageIndex = val
  141. this.getDataList()
  142. },
  143. // 多选
  144. selectionChangeHandle (val) {
  145. this.dataListSelections = val
  146. },
  147. // 新增 / 修改
  148. detail (id, disable, productName) {
  149. this.detailsVisible = true
  150. this.$nextTick(() => {
  151. this.$refs.details.init(id, disable, productName)
  152. })
  153. }
  154. }
  155. }
  156. </script>
  157. <style scoped>
  158. </style>