materialModal.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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"></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="index"
  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) =>
  62. item.categoryCode === row.categoryCode &&
  63. item.produceTaskInstanceId === row.produceTaskInstanceId
  64. );
  65. }
  66. },
  67. {
  68. width: 45,
  69. type: 'index',
  70. columnKey: 'index',
  71. align: 'center'
  72. },
  73. {
  74. label: '类型',
  75. prop: 'categoryLevelNamePath',
  76. minWidth: 120
  77. },
  78. {
  79. label: '编码',
  80. prop: 'categoryCode',
  81. minWidth: 120
  82. },
  83. {
  84. label: '名称',
  85. prop: 'categoryName',
  86. minWidth: 120
  87. },
  88. {
  89. label: '工序名称',
  90. prop: 'produceTaskName',
  91. minWidth: 120
  92. },
  93. {
  94. label: '领料数量',
  95. prop: 'pickQuantity',
  96. minWidth: 120,
  97. formatter: (row) => {
  98. return (row.pickQuantity || 0) + (row.pickUnit || '');
  99. }
  100. },
  101. {
  102. label: '出库数量',
  103. prop: 'outStorageQuantity',
  104. minWidth: 120,
  105. formatter: (row) => {
  106. return (row.outStorageQuantity || 0) + (row.outStorageUnit || '');
  107. }
  108. },
  109. {
  110. label: '投料数量',
  111. prop: 'feedQuantity',
  112. minWidth: 120,
  113. formatter: (row) => {
  114. return (row.feedQuantity || 0) + (row.feedUnit || '');
  115. }
  116. },
  117. {
  118. label: '已报工数量',
  119. prop: 'reportQuantity',
  120. minWidth: 120,
  121. formatter(row) {
  122. return (row.reportQuantity || 0) + row.feedUnit;
  123. }
  124. },
  125. {
  126. label: '未报工数量',
  127. prop: 'noReportQuantity',
  128. minWidth: 120,
  129. formatter(row) {
  130. if (row.reportQuantity != null) {
  131. return row.feedQuantity - row.reportQuantity + row.feedUnit;
  132. }
  133. return `${row.feedQuantity}${row.feedUnit || ''}`;
  134. }
  135. },
  136. {
  137. label: '合格总数',
  138. prop: 'qualifiedQuantity',
  139. minWidth: 120,
  140. formatter(row) {
  141. return (row.qualifiedQuantity || 0) + (row.feedUnit || '');
  142. }
  143. },
  144. {
  145. label: '不合格总数',
  146. prop: 'noQualifiedQuantity',
  147. minWidth: 120,
  148. formatter(row) {
  149. return (row.noQualifiedQuantity || 0) + (row.feedUnit || '');
  150. }
  151. }
  152. ],
  153. // 表格选中数据
  154. selection: [],
  155. taskPlanList: [],
  156. params: {},
  157. // 已选物料
  158. pickDetails: []
  159. };
  160. },
  161. computed: {
  162. seekList() {
  163. return [
  164. {
  165. label: '关键词:',
  166. value: 'keyword',
  167. type: 'input',
  168. placeholder: '物料编码、物料名称、批次号'
  169. }
  170. ];
  171. }
  172. },
  173. created() {},
  174. methods: {
  175. /* 表格数据源 */
  176. async datasource({ page, limit, where }) {
  177. const res = await queryPickAndFeedByWorkOrderId({
  178. ...where,
  179. ...this.params
  180. // pageNum: page,
  181. // size: limit
  182. });
  183. return res;
  184. },
  185. /* 刷新表格 */
  186. reload(where) {
  187. this.$refs.table.reload({ page: 1, where: where });
  188. },
  189. handleClose() {
  190. this.$refs.table.setSelectedRows([]);
  191. this.selection = [];
  192. this.visible = false;
  193. },
  194. open(params = {}, pickDetails = []) {
  195. this.params = params;
  196. this.visible = true;
  197. },
  198. selected() {
  199. if (this.selection.length === 0) {
  200. this.$message.warning('请至少选择一条数据');
  201. return;
  202. }
  203. this.$emit('confirm', this.selection);
  204. this.handleClose();
  205. }
  206. }
  207. };
  208. </script>
  209. <style lang="scss" scoped>
  210. .rx-sc {
  211. flex: 0 0 50px;
  212. display: flex;
  213. align-items: center;
  214. justify-content: center;
  215. }
  216. .ml60 {
  217. margin-left: 60px;
  218. }
  219. </style>