index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <div>
  3. <el-drawer
  4. title=""
  5. :visible.sync="drawer"
  6. :custom-class="isFullscreen ? 'not-fullscreen' : 'is-fullscreen'"
  7. :before-close="handleClose"
  8. :with-header="false"
  9. >
  10. <!-- 自定义头部 -->
  11. <div class="custom-drawer-header">
  12. <div> </div>
  13. <div class="rx-ec">
  14. <el-button
  15. icon="el-icon-full-screen"
  16. type="text"
  17. @click="handleFull"
  18. >{{ isFullscreen ? '全屏' : '缩小' }}</el-button
  19. >
  20. <el-button
  21. icon="el-icon-circle-close"
  22. type="text"
  23. @click="handleClose"
  24. >关闭</el-button
  25. >
  26. </div>
  27. </div>
  28. <div class="drawer_content">
  29. <!-- //详细信息 -->
  30. <Info :workOrderInfo="workOrderInfo"></Info>
  31. <el-steps
  32. :active="activeIndex"
  33. space="20px"
  34. align-center
  35. style="margin-top: 18px"
  36. >
  37. <el-step
  38. v-for="(item, index) in routeList"
  39. :key="index"
  40. :title="item.taskTypeName"
  41. @click.native="handIdx(index, item)"
  42. :description="desIndex == index ? '此处' : ''"
  43. :class="desIndex == index ? 'active' : ''"
  44. ></el-step>
  45. </el-steps>
  46. <el-tabs type="border-card">
  47. <el-tab-pane label="领料详情">
  48. <pickDetails
  49. :isDetails="true"
  50. :workOrderInfo="workOrderInfo"
  51. ></pickDetails>
  52. </el-tab-pane>
  53. <el-tab-pane label="投料详情">
  54. <feedDetails
  55. :routeObj="routeObj"
  56. :curTaskObj="curTaskObj"
  57. ></feedDetails
  58. ></el-tab-pane>
  59. <el-tab-pane label="报工详情">
  60. <jobDetails
  61. :routeObj="routeObj"
  62. :curTaskObj="curTaskObj"
  63. :newId="newId"
  64. ></jobDetails>
  65. </el-tab-pane>
  66. <el-tab-pane label="生产明细">
  67. <productionDetails
  68. :workOrderInfo="workOrderInfo"
  69. ></productionDetails>
  70. </el-tab-pane>
  71. <!-- <el-tab-pane label="退料详情">
  72. </el-tab-pane> -->
  73. <el-tab-pane
  74. label="记录详情"
  75. v-if="sourceTaskId && workOrderInfo.bomCategoryId"
  76. >
  77. <recordRules
  78. :produceTaskId="sourceTaskId"
  79. :bomCategoryId="workOrderInfo.bomCategoryId"
  80. ></recordRules>
  81. </el-tab-pane>
  82. </el-tabs>
  83. </div>
  84. </el-drawer>
  85. </div>
  86. </template>
  87. <script>
  88. import Info from './info.vue';
  89. import feedDetails from '@/views/produce/components/feeding/details.vue';
  90. import jobDetails from '@/views/produce/components/jobBooking/details.vue';
  91. import { getTaskInstanceList } from '@/api/produce/job';
  92. import productionDetails from '@/views//workOrderList/components/productionDetails.vue';
  93. import pickDetails from '../../details.vue';
  94. import recordRules from '../recordRules/recordRules.vue';
  95. export default {
  96. components: {
  97. Info,
  98. feedDetails,
  99. jobDetails,
  100. productionDetails,
  101. pickDetails,
  102. recordRules
  103. },
  104. data() {
  105. return {
  106. drawer: false,
  107. isFullscreen: true,
  108. workOrderInfo: {},
  109. routeList: [],
  110. activeIndex: 0,
  111. desIndex: 0,
  112. curTaskObj: null,
  113. newId: '',
  114. routeObj: {
  115. id: null
  116. },
  117. sourceTaskId: ''
  118. };
  119. },
  120. methods: {
  121. handleClose() {
  122. this.activeIndex = 0;
  123. this.drawer = false;
  124. },
  125. handleFull() {
  126. this.isFullscreen = !this.isFullscreen;
  127. this.$forceUpdate();
  128. },
  129. open(row) {
  130. this.workOrderInfo = row;
  131. this.routeObj.id = this.workOrderInfo.id;
  132. console.log(this.workOrderInfo.id, 'workOrderInfo.id');
  133. console.log('workOrderInfo', this.workOrderInfo);
  134. this.getTaskFn();
  135. this.drawer = true;
  136. },
  137. getTaskFn() {
  138. getTaskInstanceList(this.workOrderInfo.id).then((res) => {
  139. this.routeList = res;
  140. // 使用findIndex方法查找
  141. const index = this.routeList.findIndex(
  142. (item) => Number(item.taskId) == Number(this.workOrderInfo.taskId)
  143. );
  144. console.log('index', index);
  145. this.desIndex = index;
  146. console.log(this.routeList, '888888');
  147. this.newId = this.routeList[this.desIndex]?.taskId || '';
  148. this.sourceTaskId = this.routeList[this.desIndex]?.sourceTaskId || '';
  149. if (this.workOrderInfo.taskId != -2) {
  150. this.curTaskObj = JSON.parse(JSON.stringify(this.routeObj));
  151. } else {
  152. this.curTaskObj = JSON.parse(JSON.stringify(this.routeList[0]));
  153. this.desIndex = 0;
  154. }
  155. this.activeIndex = index;
  156. console.log('this.curTaskObj', this.curTaskObj);
  157. console.log('this.newId', this.newId);
  158. });
  159. },
  160. handIdx(index, item) {
  161. this.curTaskObj = JSON.parse(JSON.stringify(item));
  162. console.log(item, '返回的数据');
  163. if (item.taskId == -2) {
  164. this.$message.info('完结状态不能点击');
  165. } else {
  166. this.desIndex = index;
  167. this.newId = this.routeList[this.desIndex].taskId || '';
  168. this.sourceTaskId = this.routeList[this.desIndex]?.sourceTaskId || '';
  169. }
  170. }
  171. }
  172. };
  173. </script>
  174. <style lang="scss" scoped>
  175. /* 自定义全屏样式 */
  176. ::v-deep .is-fullscreen {
  177. width: 100vw !important;
  178. height: 100vh !important;
  179. overflow: hidden !important; /* 隐藏滚动条 */
  180. }
  181. ::v-deep .not-fullscreen {
  182. width: calc(100vw - 260px) !important;
  183. height: 100vh !important;
  184. overflow: hidden !important; /* 隐藏滚动条 */
  185. }
  186. .custom-drawer-header {
  187. display: flex;
  188. justify-content: space-between;
  189. align-items: center;
  190. padding: 4px 15px;
  191. background-color: #f5f7fa; /* 自定义背景色 */
  192. border-bottom: 1px solid #ebeef5; /* 自定义边框,与抽屉内容分隔 */
  193. }
  194. .drawer_content {
  195. margin: 10px 20px;
  196. box-sizing: border-box;
  197. }
  198. .drawer_content {
  199. margin: 10px 20px;
  200. box-sizing: border-box;
  201. }
  202. ::v-deep .active .is-text {
  203. background: #ffa929; /* 背景色 */
  204. border-color: #ffa929;
  205. color: #ffffff; /* 图标文字颜色 */
  206. }
  207. </style>