workOrderPop.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <el-dialog :title="title" v-if="visible" :visible.sync="visible" :before-close="handleClose"
  3. :close-on-click-modal="true" :close-on-press-escape="false" append-to-body width="70%">
  4. <el-card shadow="never">
  5. <workOrderSearch @search="reload" />
  6. <!-- 数据表格 -->
  7. <ele-pro-table ref="table" :columns="columns" :datasource="datasource" :selection.sync="selection" row-key="id">
  8. </ele-pro-table>
  9. </el-card>
  10. <div class="btns">
  11. <el-button type="primary" size="small" @click="selected">选择</el-button>
  12. <el-button size="small" @click="handleClose">关闭</el-button>
  13. </div>
  14. </el-dialog>
  15. </template>
  16. <script>
  17. import workOrderSearch from './workOrder-search'
  18. import { dosingPage } from '@/api/materialPlan/index.js';
  19. import dictMixins from '@/mixins/dictMixins';
  20. export default {
  21. components: { workOrderSearch },
  22. mixins: [dictMixins],
  23. data() {
  24. return {
  25. visible: false,
  26. title: '生产工单',
  27. // 表格列配置
  28. columns: [
  29. {
  30. columnKey: 'selection',
  31. type: 'selection',
  32. width: 45,
  33. align: 'center',
  34. selectable: (row, index) => {
  35. return !this.tableData.some((it) => it.id == row.id || it.salesOrderId == row.id);
  36. },
  37. reserveSelection: true,
  38. fixed: 'left'
  39. },
  40. {
  41. prop: 'code',
  42. label: '生产订单号',
  43. align: 'center',
  44. minWidth: 120
  45. },
  46. {
  47. prop: 'salesOrderCode',
  48. label: '销售订单号',
  49. align: 'center',
  50. minWidth: 110
  51. },
  52. {
  53. prop: 'productionPlanCode',
  54. label: '计划编号',
  55. align: 'center'
  56. },
  57. {
  58. prop: 'produceRoutingName',
  59. label: '工艺路线',
  60. align: 'center'
  61. },
  62. {
  63. prop: 'productName',
  64. label: '产品名称',
  65. align: 'center'
  66. },
  67. {
  68. prop: 'formingNum',
  69. label: '要求生产数量',
  70. align: 'center',
  71. showOverflowTooltip: true,
  72. minWidth: 110
  73. },
  74. {
  75. prop: 'formingWeight',
  76. label: '要求生产重量',
  77. align: 'center',
  78. showOverflowTooltip: true,
  79. minWidth: 110
  80. },
  81. {
  82. prop: 'planStartTime',
  83. label: '计划开始时间',
  84. align: 'center',
  85. showOverflowTooltip: true,
  86. minWidth: 110
  87. },
  88. {
  89. prop: 'createTime',
  90. label: '创建时间',
  91. align: 'center',
  92. showOverflowTooltip: true,
  93. minWidth: 110
  94. },
  95. {
  96. slot: 'status',
  97. label: '状态',
  98. align: 'center',
  99. formatter: (row) => {
  100. const obj = this.statusOpt.find((i) => i.value == row.status);
  101. return obj && obj.label;
  102. }
  103. },
  104. ],
  105. statusOpt: [
  106. { label: '待生产', value: 4 },
  107. { label: '生产中', value: 5 },
  108. { label: '待下达', value: 8 }
  109. ],
  110. // 表格选中数据
  111. selection: [],
  112. tableData: [],
  113. current: null,
  114. }
  115. },
  116. watch: {
  117. },
  118. created() {
  119. },
  120. methods: {
  121. open(item) {
  122. if (item) {
  123. this.tableData = item
  124. }
  125. this.visible = true
  126. },
  127. /* 表格数据源 */
  128. async datasource({ page, limit, where }) {
  129. const data = await dosingPage({
  130. ...where,
  131. pageNum: page,
  132. size: limit,
  133. statusList: [4]
  134. });
  135. return data;
  136. },
  137. /* 刷新表格 */
  138. reload(where) {
  139. this.$refs.table.reload({ page: 1, where: where });
  140. },
  141. handleClose() {
  142. this.visible = false
  143. this.$refs.table.setSelectedRows([]);
  144. this.selection = []
  145. },
  146. selected() {
  147. if (!this.selection.length) {
  148. this.$message.error('请至少选择一条数据');
  149. return;
  150. }
  151. this.$emit('chooseOrder', this.selection)
  152. this.handleClose()
  153. },
  154. }
  155. }
  156. </script>
  157. <style lang="scss" scoped>
  158. .btns {
  159. text-align: center;
  160. padding: 10px 0;
  161. }
  162. </style>