index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <div class="mainContentBox">
  3. <el-row :gutter="20">
  4. <el-col :span="4" class="boxStyle">
  5. <!-- 侧边栏盒子 -->
  6. <Jiluxiang />
  7. </el-col>
  8. <el-col :span="8">
  9. <div class="grid-content ep-bg-purple">
  10. <Info />
  11. </div>
  12. </el-col>
  13. <el-col :span="12">
  14. <div class="grid-content ep-bg-purple">
  15. <Replacement />
  16. </div>
  17. </el-col>
  18. </el-row>
  19. </div>
  20. </template>
  21. <script setup>
  22. import Jiluxiang from "@/views/repair/operation/components/Jiluxiang.vue";
  23. import Replacement from "@/views/repair/operation/components/replacement.vue";
  24. import { useRepairStore } from "@/store";
  25. import Info from "@/views/repair/components/info.vue";
  26. import { getOpCompent } from "@/api/prosteps";
  27. defineOptions({ name: "ProSteps" });
  28. const store = useRepairStore();
  29. const route = useRoute();
  30. const router = useRouter();
  31. const loading = ref(false);
  32. //配置标签信息Data
  33. const stepComponents = ref([]);
  34. const defaultComponents = [
  35. {
  36. compentName: "物料采集",
  37. iconName: "wuliaocaiji",
  38. path: "wuliaocaiji",
  39. name: "Wuliaocaiji",
  40. },
  41. {
  42. compentName: "记录项",
  43. iconName: "jiluxiang",
  44. path: "jiluxiang",
  45. name: "Jiluxiang",
  46. },
  47. {
  48. compentName: "多媒体采集",
  49. iconName: "duomeiticaiji",
  50. path: "duomeiticaiji",
  51. name: "Duomeiticaiji",
  52. },
  53. {
  54. compentName: "ESOP",
  55. iconName: "ESOP",
  56. path: "esop",
  57. name: "Esop",
  58. },
  59. {
  60. compentName: "点检",
  61. iconName: "dianjian",
  62. path: "dianjian",
  63. name: "Dianjian",
  64. },
  65. {
  66. compentName: "设备记录",
  67. iconName: "shebeijilu",
  68. path: "shebeijilu",
  69. name: "Shebeijilu",
  70. },
  71. {
  72. compentName: "紧固",
  73. iconName: "jingu",
  74. path: "jingu",
  75. name: "Jingu",
  76. },
  77. {
  78. compentName: "调试配对",
  79. iconName: "tiaoshipipei",
  80. path: "tiaoshipipei",
  81. name: "Tiaoshipipei",
  82. },
  83. {
  84. compentName: "铭牌绑定",
  85. iconName: "mingpai",
  86. path: "mingpaibangding",
  87. name: "Mingpaibangding",
  88. },
  89. ];
  90. //当前路由在setpComponents中的index
  91. const selectIndex = ref(0);
  92. //配置data固定路由参数等
  93. const setStepComponents = (data) => {
  94. let resData = [];
  95. data.forEach((item) => {
  96. defaultComponents.forEach((obj) => {
  97. if (item.compentName === obj.compentName) {
  98. resData.push({ ...item, ...obj });
  99. }
  100. });
  101. });
  102. return resData;
  103. };
  104. const getNameClass = (index) => {
  105. return index === selectIndex.value ? "typeBoxSelected" : "typeBoxNormal";
  106. };
  107. //获取当前tags列表
  108. const getOpCompentArray = async () => {
  109. const { data } = await getOpCompent("/129/12");
  110. stepComponents.value = setStepComponents(data);
  111. router.replace({ name: stepComponents.value[0].name });
  112. };
  113. //设置标签是否被选中
  114. const setSelectIndex = (index) => {
  115. selectIndex.value = index;
  116. };
  117. const setSelectTag = () => {
  118. const nowRouteName = route.name;
  119. stepComponents.value.forEach((item, index) => {
  120. if (item.name == nowRouteName) {
  121. setSelectIndex(index);
  122. }
  123. });
  124. };
  125. onMounted(async () => {
  126. await getOpCompentArray();
  127. setSelectTag();
  128. });
  129. </script>
  130. <style lang="scss" scoped>
  131. .boxStyle {
  132. height: calc(100vh - 80px);
  133. }
  134. .scrollbar-demo-item {
  135. flex-shrink: 0;
  136. display: flex;
  137. align-items: center;
  138. justify-content: center;
  139. height: 80px;
  140. width: 135px;
  141. border-radius: 16px;
  142. text-align: center;
  143. }
  144. .typeContainer {
  145. width: 100%;
  146. height: 80px;
  147. overflow-x: auto;
  148. .svgIcon {
  149. @include flex;
  150. }
  151. }
  152. .routerView {
  153. display: flex;
  154. flex: 1;
  155. overflow-y: auto;
  156. width: 100%;
  157. height: calc(100vh - 184px);
  158. }
  159. .typeBox {
  160. height: 80px;
  161. width: 135px;
  162. border-radius: 16px;
  163. display: flex;
  164. flex-direction: column;
  165. justify-content: center;
  166. align-items: center;
  167. .name {
  168. height: 16px;
  169. font-weight: 500;
  170. font-size: $f20;
  171. line-height: 20px;
  172. text-align: center;
  173. font-style: normal;
  174. text-transform: none;
  175. margin-top: $p10;
  176. }
  177. }
  178. .typeBoxNormal {
  179. background: transparent;
  180. color: rgba(0, 0, 0, 0.9);
  181. }
  182. .typeBoxSelected {
  183. background: $select-hover;
  184. color: white;
  185. }
  186. </style>