routings.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <div>
  3. <ele-modal
  4. 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. :maxable="true"
  12. >
  13. <div class="routing_box">
  14. 工艺路线: <span>{{ routeObj.produceRoutingName }}</span></div
  15. >
  16. <div>
  17. <el-steps :active="activeIndex" space="20px" align-center>
  18. <el-step
  19. v-for="(item, index) in routeList"
  20. :key="index"
  21. :title="item.taskTypeName"
  22. @click.native="handIdx(index, item)"
  23. >
  24. <template v-slot:description>
  25. <!-- <div>投:{{ item.feedExistNum || 0 }} 报:{{item.reportExistNum || 0}}</div> -->
  26. <div>{{ desIndex == index ? '此处' : '' }}</div>
  27. </template>
  28. </el-step>
  29. </el-steps>
  30. <el-tabs type="border-card">
  31. <el-tab-pane label="领料记录">
  32. <!-- <feedDetails
  33. v-if="newId!=='-1'"
  34. :routeObj="routeObj"
  35. :curTaskObj="curTaskObj"
  36. ></feedDetails> -->
  37. <pickDetails ref="pickListRef" :isDetails="true"></pickDetails>
  38. </el-tab-pane>
  39. <el-tab-pane label="投料详情">
  40. <feedDetails
  41. v-if="newId !== '-1'"
  42. :routeObj="routeObj"
  43. :curTaskObj="curTaskObj"
  44. ></feedDetails>
  45. </el-tab-pane>
  46. <el-tab-pane label="报工详情">
  47. <jobDetails
  48. :newId="newId"
  49. :routeObj="routeObj"
  50. :curTaskObj="curTaskObj"
  51. ></jobDetails>
  52. </el-tab-pane>
  53. <el-tab-pane label="生产明细">
  54. <productionDetails :workOrderInfo="routeObj"></productionDetails>
  55. </el-tab-pane>
  56. </el-tabs>
  57. </div>
  58. </ele-modal>
  59. </div>
  60. </template>
  61. <script>
  62. import { getTaskInstanceList } from '@/api/produce/job';
  63. import feedDetails from '../components/feeding/details.vue';
  64. import jobDetails from '../components/jobBooking/details.vue';
  65. import pickDetails from '../components/picking/details.vue';
  66. import productionDetails from '@/views//workOrderList/components/productionDetails.vue';
  67. export default {
  68. components: {
  69. feedDetails,
  70. jobDetails,
  71. pickDetails,
  72. productionDetails
  73. },
  74. props: {
  75. routeObj: {
  76. type: Object,
  77. default() {
  78. return {};
  79. }
  80. }
  81. },
  82. data() {
  83. return {
  84. visible: true,
  85. routeList: [],
  86. activeIndex: 0,
  87. desIndex: 0,
  88. newId: '',
  89. curTaskObj: null
  90. };
  91. },
  92. methods: {
  93. getTaskFn() {
  94. getTaskInstanceList(this.routeObj.id).then((res) => {
  95. this.routeList = res;
  96. // 使用findIndex方法查找
  97. const index = this.routeList.findIndex(
  98. (item) => Number(item.taskId) == Number(this.routeObj.taskId)
  99. );
  100. this.desIndex = index;
  101. console.log('res', res, index);
  102. this.newId = res[index].taskId;
  103. console.log(this.routeObj, 666666);
  104. if (this.routeObj.taskId != -2) {
  105. this.curTaskObj = JSON.parse(JSON.stringify(this.routeObj));
  106. } else {
  107. this.curTaskObj = JSON.parse(JSON.stringify(this.routeList[0]));
  108. this.desIndex = 0;
  109. }
  110. this.activeIndex = index;
  111. this.$refs.pickListRef.getList([this.routeObj.id]);
  112. });
  113. },
  114. handleClose() {
  115. this.activeIndex = 0;
  116. this.$emit('closeRoute');
  117. },
  118. handIdx(index, item) {
  119. this.curTaskObj = JSON.parse(JSON.stringify(item));
  120. if (item.taskId == -2) {
  121. this.$message.info('完结状态不能点击');
  122. } else {
  123. this.desIndex = index;
  124. this.newId = this.curTaskObj.taskId;
  125. this.$refs.pickListRef.getList([this.routeObj.id]);
  126. }
  127. }
  128. },
  129. created() {
  130. this.getTaskFn();
  131. }
  132. };
  133. </script>
  134. <style lang="scss" scoped>
  135. ::v-deep .el-step__icon {
  136. cursor: pointer;
  137. }
  138. .routing_box {
  139. margin-bottom: 20px;
  140. margin-left: 20px;
  141. text-align: center;
  142. span {
  143. color: #157a2c;
  144. font-weight: bold;
  145. }
  146. }
  147. </style>