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. sortable: true
  52. },
  53. {
  54. prop: 'productionPlanCode',
  55. label: '计划编号',
  56. align: 'center'
  57. },
  58. {
  59. prop: 'produceRoutingName',
  60. label: '工艺路线',
  61. align: 'center'
  62. },
  63. {
  64. prop: 'productName',
  65. label: '产品名称',
  66. align: 'center'
  67. },
  68. {
  69. prop: 'formingNum',
  70. label: '要求生产数量',
  71. align: 'center',
  72. showOverflowTooltip: true,
  73. minWidth: 110
  74. },
  75. {
  76. prop: 'formingWeight',
  77. label: '要求生产重量',
  78. align: 'center',
  79. showOverflowTooltip: true,
  80. minWidth: 110
  81. },
  82. {
  83. prop: 'planStartTime',
  84. label: '计划开始时间',
  85. align: 'center',
  86. showOverflowTooltip: true,
  87. minWidth: 110
  88. },
  89. {
  90. prop: 'createTime',
  91. label: '创建时间',
  92. align: 'center',
  93. showOverflowTooltip: true,
  94. minWidth: 110
  95. },
  96. {
  97. slot: 'status',
  98. label: '状态',
  99. align: 'center',
  100. formatter: (row) => {
  101. const obj = this.statusOpt.find((i) => i.value == row.status);
  102. return obj && obj.label;
  103. }
  104. },
  105. ],
  106. statusOpt: [
  107. { label: '待生产', value: 4 },
  108. { label: '生产中', value: 5 },
  109. { label: '待下达', value: 8 }
  110. ],
  111. // 表格选中数据
  112. selection: [],
  113. tableData: [],
  114. current: null,
  115. }
  116. },
  117. watch: {
  118. },
  119. created() {
  120. },
  121. methods: {
  122. open(item) {
  123. if (item) {
  124. this.tableData = item
  125. }
  126. this.visible = true
  127. },
  128. /* 表格数据源 */
  129. async datasource({ page, limit, where }) {
  130. const data = await dosingPage({
  131. ...where,
  132. pageNum: page,
  133. size: limit,
  134. statusList: [4]
  135. });
  136. return data;
  137. },
  138. /* 刷新表格 */
  139. reload(where) {
  140. this.$refs.table.reload({ page: 1, where: where });
  141. },
  142. handleClose() {
  143. this.visible = false
  144. this.$refs.table.setSelectedRows([]);
  145. this.selection = []
  146. },
  147. selected() {
  148. if (!this.selection.length) {
  149. this.$message.error('请至少选择一条数据');
  150. return;
  151. }
  152. this.$emit('chooseOrder', this.selection)
  153. this.handleClose()
  154. },
  155. }
  156. }
  157. </script>
  158. <style lang="scss" scoped>
  159. .btns {
  160. text-align: center;
  161. padding: 10px 0;
  162. }
  163. </style>