routings.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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-tab-pane
  57. label="记录详情"
  58. v-if="sourceTaskId && routeObj && sourceTaskId != '-1'"
  59. >
  60. <recordRules
  61. :produceTaskId="sourceTaskId"
  62. :workOrderInfo="routeObj"
  63. ></recordRules>
  64. </el-tab-pane>
  65. </el-tabs>
  66. </div>
  67. </ele-modal>
  68. </div>
  69. </template>
  70. <script>
  71. import { getTaskInstanceList } from '@/api/produce/job';
  72. import feedDetails from '../components/feeding/details.vue';
  73. import jobDetails from '../components/jobBooking/details.vue';
  74. import pickDetails from '../components/picking/details.vue';
  75. import productionDetails from '@/views//workOrderList/components/productionDetails.vue';
  76. import recordRules from '@/views/produceOrder/components/recordRules/recordRules.vue';
  77. export default {
  78. components: {
  79. feedDetails,
  80. jobDetails,
  81. pickDetails,
  82. productionDetails,
  83. recordRules
  84. },
  85. props: {
  86. routeObj: {
  87. type: Object,
  88. default() {
  89. return {};
  90. }
  91. }
  92. },
  93. data() {
  94. return {
  95. visible: true,
  96. routeList: [],
  97. activeIndex: 0,
  98. desIndex: 0,
  99. newId: '',
  100. curTaskObj: null,
  101. sourceTaskId: ''
  102. };
  103. },
  104. methods: {
  105. getTaskFn() {
  106. getTaskInstanceList(this.routeObj.id).then((res) => {
  107. this.routeList = res;
  108. // 使用findIndex方法查找
  109. const index = this.routeList.findIndex(
  110. (item) => item.taskId == this.routeObj.taskId
  111. );
  112. this.desIndex = index;
  113. console.log('res', res, index);
  114. this.newId = res[index].taskId;
  115. this.sourceTaskId = this.routeList[this.desIndex]?.sourceTaskId || '';
  116. console.log(this.routeObj, 666666);
  117. if (this.routeObj.taskId != -2) {
  118. this.curTaskObj = JSON.parse(JSON.stringify(this.routeObj));
  119. } else {
  120. this.curTaskObj = JSON.parse(JSON.stringify(this.routeList[0]));
  121. this.desIndex = 0;
  122. }
  123. this.activeIndex = index;
  124. this.$refs.pickListRef.getList([this.routeObj.id]);
  125. });
  126. },
  127. handleClose() {
  128. this.activeIndex = 0;
  129. this.$emit('closeRoute');
  130. },
  131. handIdx(index, item) {
  132. this.curTaskObj = JSON.parse(JSON.stringify(item));
  133. if (item.taskId == -2) {
  134. this.$message.info('完结状态不能点击');
  135. } else {
  136. this.desIndex = index;
  137. this.newId = this.curTaskObj.taskId;
  138. this.$refs.pickListRef.getList([this.routeObj.id]);
  139. }
  140. }
  141. },
  142. created() {
  143. this.getTaskFn();
  144. }
  145. };
  146. </script>
  147. <style lang="scss" scoped>
  148. ::v-deep .el-step__icon {
  149. cursor: pointer;
  150. }
  151. .routing_box {
  152. margin-bottom: 20px;
  153. margin-left: 20px;
  154. text-align: center;
  155. span {
  156. color: #157a2c;
  157. font-weight: bold;
  158. }
  159. }
  160. </style>