detail.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar
  4. fixed="true"
  5. statusBar="true"
  6. left-icon="back"
  7. :title="title"
  8. @clickLeft="back"
  9. >
  10. </uni-nav-bar>
  11. <view class="view-container">
  12. <DetailView :baseInfo="baseInfo" />
  13. </view>
  14. <view class="footer">
  15. <ProcessOperate
  16. @handlePreparation="handlePreparation"
  17. :type="0"
  18. @handleReport="handleReport"
  19. />
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import baTreePicker from "@/components/ba-tree-picker/ba-tree-picker.vue";
  25. import DetailView from "./components/DetailView.vue";
  26. import ProcessOperate from "../components/ProcessOperate.vue";
  27. import { getInfoById } from "@/api/production/extrusion.js";
  28. import { getTaskListById } from "@/api/production/execute";
  29. export default {
  30. components: { DetailView, baTreePicker, ProcessOperate },
  31. data() {
  32. return {
  33. baseInfo: {
  34. conventionalStockTransferReq: {},
  35. },
  36. loading: false,
  37. title: "挤压成型",
  38. showTab: false,
  39. code: "",
  40. id: "",
  41. taskCode: "",
  42. taskId: "",
  43. };
  44. },
  45. onLoad({ id, code }) {
  46. if (id) {
  47. this._getDetail(id);
  48. this.id = id;
  49. }
  50. if (code) {
  51. this.code = code;
  52. }
  53. },
  54. methods: {
  55. handleReport() {
  56. uni.navigateTo({
  57. url: `/pages/production/execute/extrusion/report?&taskCode=${this.taskCode}&id=${this.id}`,
  58. });
  59. },
  60. handlePreparation() {
  61. uni.navigateTo({
  62. url: `/pages/production/execute/extrusion/preparation?&code=${this.code}&id=${this.id}&taskInstanceId=${this.taskId}&versionId=${this.baseInfo.produceVersionId}`,
  63. });
  64. },
  65. toNav(url) {
  66. if (url) {
  67. uni.navigateTo({
  68. url: url,
  69. });
  70. }
  71. },
  72. async _getDetail(id) {
  73. const data = await getInfoById(id);
  74. if (data) {
  75. this.baseInfo = data;
  76. this.taskCode = data.taskTypeProcessDiagrams[0].taskCode;
  77. this._getTaskListById();
  78. }
  79. },
  80. async _getTaskListById() {
  81. // 获取工序
  82. const list = await getTaskListById(this.baseInfo.produceVersionId);
  83. if (list?.length) {
  84. this.taskId = list[0].id;
  85. }
  86. },
  87. },
  88. };
  89. </script>
  90. <style lang="scss" scoped>
  91. .tabs {
  92. position: fixed;
  93. width: 100vw;
  94. background-color: rgba(242, 242, 242, 0.792156862745098);
  95. padding-top: 20rpx;
  96. display: flex;
  97. justify-content: flex-start;
  98. align-items: center;
  99. margin-bottom: 20rpx;
  100. .tab-item {
  101. width: 200rpx;
  102. display: flex;
  103. justify-content: center;
  104. align-items: center;
  105. &.active {
  106. background: linear-gradient(
  107. 180deg,
  108. rgba(75, 121, 2, 1) 0%,
  109. rgba(255, 255, 255, 1) 12%
  110. );
  111. }
  112. }
  113. }
  114. .footer {
  115. padding: 20rpx 0;
  116. z-index: 1000;
  117. }
  118. </style>