index.vue 6.3 KB

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