index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  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="领料详情" name="pick">
  49. <pickDetails
  50. :isDetails="true"
  51. :routeObj="routeObj"
  52. :curTaskObj="curTaskObj"
  53. ></pickDetails>
  54. </el-tab-pane>
  55. <el-tab-pane label="投料详情" name="feed">
  56. <feedDetails
  57. :routeObj="routeObj"
  58. :curTaskObj="curTaskObj"
  59. ></feedDetails
  60. ></el-tab-pane>
  61. <el-tab-pane label="报工详情" name="job">
  62. <jobDetails
  63. :routeObj="routeObj"
  64. :curTaskObj="curTaskObj"
  65. :newId="newId"
  66. ></jobDetails>
  67. </el-tab-pane>
  68. <el-tab-pane label="生产明细" name="production">
  69. <productionDetails
  70. :workOrderInfo="workOrderInfo"
  71. ></productionDetails>
  72. </el-tab-pane>
  73. <!-- <el-tab-pane label="退料详情">
  74. </el-tab-pane> -->
  75. <el-tab-pane
  76. label="记录详情"
  77. name="record"
  78. v-if="
  79. sourceTaskId &&
  80. workOrderInfo &&
  81. sourceTaskId != '-1' &&
  82. sourceTaskId != '-2'
  83. "
  84. >
  85. <recordRules
  86. :produceTaskId="sourceTaskId"
  87. :workOrderInfo="workOrderInfo"
  88. ></recordRules>
  89. </el-tab-pane>
  90. <el-tab-pane label="放行单" name="check">
  91. <checkList
  92. :isDetails="true"
  93. :workOrderInfo="workOrderInfo"
  94. ></checkList>
  95. </el-tab-pane>
  96. <!-- <el-tab-pane label="布点详情" name="dot">
  97. <dotLineDetail :workOrderInfo="workOrderInfo"></dotLineDetail>
  98. </el-tab-pane> -->
  99. </el-tabs>
  100. </div>
  101. </el-drawer>
  102. </div>
  103. </template>
  104. <script>
  105. import Info from './newInfo.vue';
  106. import feedDetails from '@/views/produce/components/feeding/details.vue';
  107. import jobDetails from '@/views/produce/components/jobBooking/details.vue';
  108. import { getTaskInstanceList } from '@/api/produce/job';
  109. import productionDetails from '@/views//workOrderList/components/productionDetails.vue';
  110. import pickDetails from '../../details.vue';
  111. import recordRules from '../recordRules/recordRules.vue';
  112. import checkList from '@/views/checklistManagement/checklist.vue';
  113. import dotLineDetail from './dotLineDetail.vue';
  114. export default {
  115. components: {
  116. Info,
  117. feedDetails,
  118. jobDetails,
  119. productionDetails,
  120. pickDetails,
  121. recordRules,
  122. checkList,
  123. dotLineDetail
  124. },
  125. data() {
  126. return {
  127. drawer: false,
  128. isFullscreen: true,
  129. workOrderInfo: {},
  130. routeList: [],
  131. activeIndex: 0,
  132. desIndex: 0,
  133. curTaskObj: null,
  134. newId: '',
  135. routeObj: {
  136. id: null
  137. },
  138. sourceTaskId: ''
  139. };
  140. },
  141. methods: {
  142. handleClose() {
  143. this.activeIndex = 0;
  144. this.drawer = false;
  145. },
  146. handleFull() {
  147. this.isFullscreen = !this.isFullscreen;
  148. this.$forceUpdate();
  149. },
  150. open(row) {
  151. this.workOrderInfo = this.deepCopy(row);
  152. this.routeObj.id = this.workOrderInfo.id;
  153. console.log(this.workOrderInfo.id, 'workOrderInfo.id');
  154. console.log('workOrderInfo', this.workOrderInfo);
  155. this.getTaskFn();
  156. this.drawer = true;
  157. },
  158. getTaskFn() {
  159. getTaskInstanceList(this.workOrderInfo.id).then((res) => {
  160. this.routeList = res;
  161. console.log(this.routeList, '9999999');
  162. // 使用findIndex方法查找
  163. const index = this.routeList.findIndex(
  164. (item) => item.taskId == this.workOrderInfo.taskId
  165. );
  166. console.log('index', index);
  167. this.desIndex = index;
  168. console.log(this.routeList, '888888');
  169. this.newId = this.routeList[this.desIndex]?.taskId || '';
  170. this.sourceTaskId = this.routeList[this.desIndex]?.sourceTaskId || '';
  171. if (this.workOrderInfo.taskId != -2) {
  172. // this.curTaskObj = JSON.parse(JSON.stringify(this.routeObj));
  173. this.curTaskObj = {
  174. taskId: this.workOrderInfo.taskId,
  175. id: this.routeObj.id
  176. };
  177. } else {
  178. this.curTaskObj = JSON.parse(JSON.stringify(this.routeList[0]));
  179. // this.desIndex = 0;
  180. }
  181. this.activeIndex = index;
  182. console.log('this.curTaskObj', this.curTaskObj);
  183. console.log('this.newId', this.newId);
  184. });
  185. },
  186. deepCopy(obj, hash = new WeakMap()) {
  187. if (obj === null) return null;
  188. if (obj instanceof Date) return new Date(obj);
  189. if (obj instanceof RegExp) return new RegExp(obj);
  190. if (typeof obj !== 'object' && typeof obj !== 'function') return obj;
  191. if (hash.has(obj)) return hash.get(obj);
  192. const result = Array.isArray(obj) ? [] : {};
  193. hash.set(obj, result);
  194. return Object.keys(obj).reduce((acc, key) => {
  195. acc[key] = this.deepCopy(obj[key], hash);
  196. return acc;
  197. }, result);
  198. },
  199. handIdx(index, item) {
  200. this.curTaskObj = JSON.parse(JSON.stringify(item));
  201. console.log(item, '返回的数据');
  202. if (item.taskId == -2) {
  203. this.$message.info('完结状态不能点击');
  204. } else {
  205. this.desIndex = index;
  206. this.newId = this.routeList[this.desIndex].taskId || '';
  207. this.sourceTaskId = this.routeList[this.desIndex]?.sourceTaskId || '';
  208. }
  209. }
  210. }
  211. };
  212. </script>
  213. <style lang="scss" scoped>
  214. /* 自定义全屏样式 */
  215. ::v-deep .is-fullscreen {
  216. width: 100vw !important;
  217. height: 100vh !important;
  218. overflow: hidden !important; /* 隐藏滚动条 */
  219. }
  220. ::v-deep .not-fullscreen {
  221. width: calc(100vw - 260px) !important;
  222. height: 100vh !important;
  223. overflow: hidden !important; /* 隐藏滚动条 */
  224. }
  225. .custom-drawer-header {
  226. display: flex;
  227. justify-content: space-between;
  228. align-items: center;
  229. padding: 4px 15px;
  230. background-color: #f5f7fa; /* 自定义背景色 */
  231. border-bottom: 1px solid #ebeef5; /* 自定义边框,与抽屉内容分隔 */
  232. }
  233. .drawer_content {
  234. margin: 10px 20px;
  235. box-sizing: border-box;
  236. }
  237. .drawer_content {
  238. margin: 10px 20px;
  239. box-sizing: border-box;
  240. }
  241. ::v-deep .active .is-text {
  242. background: #ffa929; /* 背景色 */
  243. border-color: #ffa929;
  244. color: #ffffff; /* 图标文字颜色 */
  245. }
  246. </style>