materialModal.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <el-dialog
  3. v-if="visible"
  4. :title="title"
  5. :visible.sync="visible"
  6. :before-close="handleClose"
  7. :close-on-click-modal="false"
  8. :close-on-press-escape="false"
  9. append-to-body
  10. width="70%"
  11. :fullscreen="fullscreen"
  12. class="fullscreen"
  13. >
  14. <el-card shadow="never">
  15. <seek-page :seekList="seekList" @search="reload"></seek-page>
  16. <ele-pro-table
  17. style="min-height: 400px"
  18. ref="table"
  19. :columns="columns"
  20. :datasource="datasource"
  21. :selection.sync="selection"
  22. :need-page="false"
  23. row-key="id"
  24. >
  25. </ele-pro-table>
  26. </el-card>
  27. <div class="rx-sc">
  28. <el-button type="primary" size="small" @click="selected">选择</el-button>
  29. <el-button size="small" @click="handleClose">关闭</el-button>
  30. </div>
  31. </el-dialog>
  32. </template>
  33. <script>
  34. import SeekPage from '@/components/common/seekPage.vue';
  35. import {
  36. queryPickAndFeedByWorkOrderId,
  37. queryAllProduceTaskInstanceInPickOrder
  38. } from '@/api/producetaskrulerecord/index.js';
  39. export default {
  40. components: {
  41. SeekPage
  42. },
  43. data() {
  44. return {
  45. fullscreen: false,
  46. visible: false,
  47. title: '选择物品',
  48. type: null,
  49. // 表格列配置
  50. columns: [
  51. {
  52. columnKey: 'selection',
  53. type: 'selection',
  54. width: 45,
  55. align: 'center',
  56. reserveSelection: true,
  57. fixed: 'left',
  58. selectable: (row, index) => {
  59. // 已选物料不可再选
  60. return !this.pickDetails.some(
  61. (item) => item.id === row.id
  62. );
  63. }
  64. },
  65. {
  66. width: 45,
  67. type: 'index',
  68. columnKey: 'index',
  69. align: 'center'
  70. },
  71. {
  72. label: '类型',
  73. prop: 'categoryLevelNamePath',
  74. minWidth: 120
  75. },
  76. {
  77. label: '编码',
  78. prop: 'categoryCode',
  79. minWidth: 120
  80. },
  81. {
  82. label: '名称',
  83. prop: 'categoryName',
  84. minWidth: 120
  85. },
  86. {
  87. prop: 'model',
  88. label: '型号',
  89. align: 'center',
  90. showOverflowTooltip: true
  91. },
  92. {
  93. prop: 'specifications',
  94. label: '规格',
  95. align: 'center',
  96. width: 160,
  97. showOverflowTooltip: true
  98. },
  99. {
  100. prop: 'brandNo',
  101. label: '牌号',
  102. align: 'center'
  103. },
  104. {
  105. label: '工序名称',
  106. prop: 'produceTaskName',
  107. minWidth: 120
  108. },
  109. {
  110. label: '来源',
  111. prop: 'sourceInfo',
  112. },
  113. {
  114. label: '数量',
  115. prop: 'feedQuantity',
  116. minWidth: 120,
  117. formatter: (row) => {
  118. return (row.quantity || 0) + (row.unit || '');
  119. }
  120. }
  121. ],
  122. // 表格选中数据
  123. selection: [],
  124. taskPlanList: [],
  125. params: {},
  126. // 已选物料
  127. pickDetails: []
  128. };
  129. },
  130. computed: {
  131. seekList() {
  132. return [
  133. {
  134. label: '关键词:',
  135. value: 'keyword',
  136. type: 'input',
  137. placeholder: '物料编码、物料名称'
  138. }
  139. ];
  140. }
  141. },
  142. created() {},
  143. methods: {
  144. /* 表格数据源 */
  145. async datasource({ page, limit, where }) {
  146. const res = await queryPickAndFeedByWorkOrderId({
  147. ...where,
  148. ...this.params
  149. // pageNum: page,
  150. // size: limit
  151. });
  152. return res;
  153. },
  154. /* 刷新表格 */
  155. reload(where) {
  156. this.$refs.table.reload({ page: 1, where: where });
  157. },
  158. handleClose() {
  159. this.$refs.table.setSelectedRows([]);
  160. this.selection = [];
  161. this.visible = false;
  162. },
  163. open(params = {}, pickDetails = []) {
  164. this.params = params;
  165. this.pickDetails = pickDetails;
  166. this.visible = true;
  167. },
  168. selected() {
  169. if (this.selection.length === 0) {
  170. this.$message.warning('请至少选择一条数据');
  171. return;
  172. }
  173. this.$emit('confirm', this.selection);
  174. this.handleClose();
  175. }
  176. }
  177. };
  178. </script>
  179. <style lang="scss" scoped>
  180. .rx-sc {
  181. flex: 0 0 50px;
  182. display: flex;
  183. align-items: center;
  184. justify-content: center;
  185. }
  186. .ml60 {
  187. margin-left: 60px;
  188. }
  189. </style>