index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. `
  2. <template>
  3. <div style="position: relative">
  4. <div class="headerInfo">
  5. <!-- <div
  6. class="titleText"
  7. style="
  8. width: 300px;
  9. white-space: nowrap;
  10. overflow: hidden;
  11. text-overflow: ellipsis;
  12. "
  13. >
  14. {{ store.processInfo.materialName }} -
  15. {{ store.processInfo.materialModel }}
  16. </div>
  17. <div class="info">
  18. <div class="item">
  19. 当前工序:
  20. {{
  21. store.scanInfo.operationName ? store.scanInfo.operationName : "-"
  22. }}
  23. </div>
  24. <div class="item">
  25. 下一工位:{{
  26. store.scanInfo.nextStation ? store.scanInfo.nextStation : "-"
  27. }}
  28. </div>
  29. <div class="item">
  30. 卡号:{{ store.scanInfo.seqNo ? store.scanInfo.seqNo : "-" }}
  31. </div>
  32. <div class="item">
  33. 编码:{{
  34. store.scanInfo.materialCode ? store.scanInfo.materialCode : "-"
  35. }}
  36. </div>
  37. </div> -->
  38. </div>
  39. <div class="mainContentBox">
  40. <el-row :gutter="20">
  41. <el-col :span="4" class="boxStyle">
  42. <div class="productInfo" @click="openPop">
  43. <template v-if="taskIndex != null">
  44. <div
  45. class="productitleText"
  46. style="
  47. font-size: 500;
  48. font-size: 24px;
  49. -webkit-line-clamp: 1;
  50. white-space: nowrap;
  51. overflow: hidden;
  52. text-overflow: ellipsis;
  53. "
  54. >
  55. {{ taskArray[taskIndex].materialName }}
  56. </div>
  57. <div
  58. class="productitleText"
  59. style="
  60. color: #ffffff60;
  61. white-space: nowrap;
  62. overflow: hidden;
  63. text-overflow: ellipsis;
  64. -webkit-line-clamp: 2; /* 限制显示的行数 */
  65. "
  66. >
  67. {{ taskArray[taskIndex].materialModel }}
  68. </div>
  69. <div style="display: flex">
  70. <div class="productitleText" style="color: #ffffff60">S/N</div>
  71. <div class="productitleText">
  72. &nbsp;{{ snVal ? snVal : "-" }}
  73. </div>
  74. </div>
  75. </template>
  76. <template v-else>
  77. <div
  78. class="productitleText"
  79. style="
  80. font-size: 500;
  81. font-size: 24px;
  82. display: flex;
  83. justify-content: center;
  84. align-items: center;
  85. height: 100%;
  86. "
  87. >
  88. 请选择产品
  89. </div>
  90. </template>
  91. </div>
  92. <!-- 侧边栏盒子 -->
  93. <div class="commonTitle">工序</div>
  94. <el-scrollbar
  95. style="height: calc(100vh - 220px); padding-bottom: 60px"
  96. >
  97. <Steps
  98. v-if="opsArray.length > 0"
  99. :opsArray="opsArray"
  100. @init="init"
  101. />
  102. <template v-else>
  103. <div
  104. class="productitleText"
  105. style="
  106. font-size: 500;
  107. font-size: 24px;
  108. display: flex;
  109. height: calc(100vh - 280px);
  110. justify-content: center;
  111. align-items: center;
  112. background-color: var(--ohos-area-bg);
  113. border-radius: 16px;
  114. color: white;
  115. "
  116. >
  117. 暂无工序
  118. </div>
  119. </template>
  120. </el-scrollbar>
  121. </el-col>
  122. <el-col :span="20">
  123. <div class="typeContainer">
  124. <el-scrollbar>
  125. <div style="display: flex">
  126. <div
  127. v-for="(item, index) in defaultComponents"
  128. :key="index"
  129. :class="
  130. componentsDisabled
  131. ? 'scrollbar-demo-item disabled'
  132. : 'scrollbar-demo-item'
  133. "
  134. >
  135. <router-link :to="{ name: item.name }" replace>
  136. <div
  137. :class="getNameClass(index)"
  138. class="typeBox"
  139. @click="setSelectIndex(index)"
  140. >
  141. <div class="svgIcon">
  142. <svg-icon :icon-class="item.iconName" size="30" />
  143. </div>
  144. <div class="name">{{ item.compentName }}</div>
  145. </div>
  146. </router-link>
  147. </div>
  148. <div
  149. v-if="snVal == null && taskIndex == null"
  150. style="
  151. font-size: 40px;
  152. font-weight: 500;
  153. color: white;
  154. width: 100%;
  155. height: 80px;
  156. text-align: center;
  157. line-height: 80px;
  158. "
  159. >
  160. 请先选择工序
  161. </div>
  162. <div
  163. v-else-if="snVal == null"
  164. style="
  165. font-size: 40px;
  166. font-weight: 500;
  167. color: white;
  168. width: 100%;
  169. height: 80px;
  170. text-align: center;
  171. line-height: 80px;
  172. "
  173. >
  174. 请选择其他工序
  175. </div>
  176. </div>
  177. </el-scrollbar>
  178. </div>
  179. <div :key="key" class="routerView" v-if="snVal != null">
  180. <el-scrollbar style="width: 100%">
  181. <router-view v-slot="{ Component, route }">
  182. <keep-alive
  183. include="Dianjian,Jiluxiang,Duomeiticaiji,Esop,Jingu,Mingpaibangding,Shebeijilu,Tiaoshipipei,Wuliaocaiji,Screwdriver"
  184. >
  185. <component :is="Component" :key="route.fullPath" />
  186. </keep-alive>
  187. </router-view>
  188. </el-scrollbar>
  189. </div>
  190. </el-col>
  191. </el-row>
  192. </div>
  193. <div class="midPopUp" v-if="popStatus" @click.stop="popStatus = false">
  194. <div class="popView">
  195. <div class="hang">
  196. 请扫码:
  197. <ScanCodeInput
  198. style="width: 400px"
  199. v-model="seqVal"
  200. @keyup.enter="console.log(111)"
  201. />
  202. </div>
  203. <el-divider class="dark" content-position="center"
  204. ><div
  205. style="
  206. background-color: var(--ohos-area-bg);
  207. width: 100%;
  208. height: 100%;
  209. display: flex;
  210. font-size: 20px;
  211. padding: 0 20px;
  212. color: white;
  213. font-weight: 500;
  214. "
  215. >
  216. 选择近期产品
  217. </div></el-divider
  218. >
  219. <el-scrollbar style="height: calc(100vh - 220px)">
  220. <div class="taskBox">
  221. <div
  222. class="productInfo"
  223. :key="item + index"
  224. style="background-color: var(--ohos-area-active-bg)"
  225. v-for="(item, index) in taskArray"
  226. @click="selectProduct(index)"
  227. >
  228. <div
  229. class="productitleText"
  230. style="font-size: 500; font-size: 24px; color: #000000"
  231. >
  232. {{ item.materialName }}
  233. </div>
  234. <div
  235. class="productitleText"
  236. style="
  237. color: #00000060;
  238. white-space: nowrap;
  239. overflow: hidden;
  240. text-overflow: ellipsis;
  241. width: 20vw;
  242. "
  243. >
  244. {{ item.materialModel }}
  245. </div>
  246. <div style="display: flex">
  247. <div class="productitleText" style="color: #00000060">Code</div>
  248. <div class="productitleText" style="color: #000000">
  249. &nbsp;{{ item.materialCode }}
  250. </div>
  251. </div>
  252. </div>
  253. </div>
  254. </el-scrollbar>
  255. </div>
  256. </div>
  257. </div>
  258. </template>
  259. <script setup>
  260. import OperationBar from "@/views/pro-steps/operationBar.vue";
  261. import ScanCodeInput from "@/components/ScanCodeInput/index.vue";
  262. import Steps from "@/views/process/components/steps.vue";
  263. import { useProcessStore } from "@/store";
  264. import { getOpCompent } from "@/api/prosteps";
  265. import { getOrders } from "@/api/process";
  266. import { getScan } from "@/api/process";
  267. defineOptions({
  268. name: "ProSteps",
  269. });
  270. const popStatus = ref(null);
  271. const openPop = async () => {
  272. await getTaskArray();
  273. popStatus.value = true;
  274. };
  275. const seqVal = ref("");
  276. const snVal = ref(null);
  277. const selectProduct = async (index) => {
  278. taskIndex.value = index;
  279. selectIndex.value = 0;
  280. //设置数据
  281. store.odersData.workOrderCode =
  282. taskArray.value[taskIndex.value].workOrderCode;
  283. store.processInfo.materialName =
  284. taskArray.value[taskIndex.value].materialName;
  285. store.processInfo.materialModel =
  286. taskArray.value[taskIndex.value].materialModel;
  287. if (taskArray.value[taskIndex.value].ops.length > 0) {
  288. opsArray.value = taskArray.value[taskIndex.value].ops;
  289. selectStepIndex.value = 0;
  290. snVal.value =
  291. taskArray.value[taskIndex.value].ops[selectStepIndex.value].seqs.length >
  292. 0
  293. ? taskArray.value[taskIndex.value].ops[selectStepIndex.value].seqs[0]
  294. .seqNo
  295. : null;
  296. } else {
  297. selectStepIndex.value = null;
  298. ElMessage.warning("暂无操作步骤");
  299. }
  300. if (snVal.value != null) {
  301. await init(0);
  302. } else {
  303. ElMessage.warning("当前工序暂不可操作");
  304. }
  305. popStatus.value = false;
  306. };
  307. const store = useProcessStore();
  308. store.odersData.productLineId = 10;
  309. const taskArray = ref([]);
  310. const taskIndex = ref(null);
  311. const getScanData = async () => {
  312. const value = snVal.value;
  313. const res = await getScan({
  314. operationId: Number(
  315. taskArray.value[taskIndex.value].ops[selectStepIndex.value].operationId
  316. ),
  317. qrCode: value,
  318. workOrderCode: taskArray.value[taskIndex.value].workOrderCode,
  319. //stationId暂时随便传一个
  320. stationId: 1,
  321. });
  322. if (res) {
  323. const { code, data, msg } = res;
  324. if (code == "200") {
  325. store.scanInfo = data;
  326. store.useSeqNo = data.seqNo;
  327. }
  328. return true;
  329. } else {
  330. snVal.value = null;
  331. stepComponents.value = [];
  332. router.replace({ name: "ProSteps" });
  333. return false;
  334. }
  335. };
  336. const getTaskArray = async () => {
  337. const { data } = await getOrders({
  338. pageNo: 1,
  339. pageSize: 999999999,
  340. queryComplete: 0,
  341. });
  342. taskArray.value = data.records;
  343. };
  344. const opsArray = ref([]);
  345. const selectStepIndex = ref(null);
  346. provide("selectStepIndex", selectStepIndex);
  347. const key = ref(false);
  348. const route = useRoute();
  349. const router = useRouter();
  350. const instance = getCurrentInstance();
  351. const loading = ref(false);
  352. const recondOPId = ref(null);
  353. const qrCode = ref(null);
  354. //配置标签信息Data
  355. const stepComponents = ref([]);
  356. const defaultComponents = [
  357. {
  358. compentName: "物料采集",
  359. iconName: "wuliaocaiji",
  360. path: "wuliaocaiji",
  361. name: "Wuliaocaiji",
  362. },
  363. {
  364. compentName: "记录项",
  365. iconName: "jiluxiang",
  366. path: "jiluxiang",
  367. name: "Jiluxiang",
  368. },
  369. {
  370. compentName: "多媒体采集",
  371. iconName: "duomeiticaiji",
  372. path: "duomeiticaiji",
  373. name: "Duomeiticaiji",
  374. },
  375. {
  376. compentName: "ESOP",
  377. iconName: "ESOP",
  378. path: "esop",
  379. name: "Esop",
  380. },
  381. {
  382. compentName: "点检",
  383. iconName: "dianjian",
  384. path: "dianjian",
  385. name: "Dianjian",
  386. },
  387. {
  388. compentName: "设备记录",
  389. iconName: "shebeijilu",
  390. path: "shebeijilu",
  391. name: "Shebeijilu",
  392. },
  393. {
  394. compentName: "紧固",
  395. iconName: "jingu",
  396. path: "jingu",
  397. name: "Jingu",
  398. },
  399. {
  400. compentName: "调试配对",
  401. iconName: "tiaoshipipei",
  402. path: "tiaoshipipei",
  403. name: "Tiaoshipipei",
  404. },
  405. {
  406. compentName: "铭牌绑定",
  407. iconName: "mingpai",
  408. path: "mingpaibangding",
  409. name: "Mingpaibangding",
  410. },
  411. {
  412. compentName: "测试记录",
  413. iconName: "mingpai",
  414. path: "ceshijilu",
  415. name: "Ceshijilu",
  416. },
  417. {
  418. compentName: "工序表单",
  419. iconName: "mingpai",
  420. path: "execl",
  421. name: "Excel",
  422. },
  423. {
  424. compentName: "数据采集",
  425. iconName: "mingpai",
  426. path: "screwdriver",
  427. name: "Screwdriver",
  428. },
  429. ];
  430. //当前路由在setpComponents中的index
  431. const selectIndex = ref(null);
  432. const componentsDisabled = ref(true);
  433. //配置data固定路由参数等
  434. const setStepComponents = (data) => {
  435. let resData = [];
  436. data.forEach((item) => {
  437. defaultComponents.forEach((obj) => {
  438. if (item.compentName === obj.compentName) {
  439. resData.push({ ...item, ...obj });
  440. }
  441. });
  442. });
  443. return resData;
  444. };
  445. const getNameClass = (index) => {
  446. return index === selectIndex.value ? "typeBoxSelected" : "typeBoxNormal";
  447. };
  448. //获取当前tags列表
  449. const getOpCompentArray = async () => {
  450. const { data } = await getOpCompent(
  451. "/" +
  452. `${Number(
  453. taskArray.value[taskIndex.value].ops[selectStepIndex.value].operationId
  454. )}` +
  455. "/" +
  456. `${store.scanInfo.id}`
  457. );
  458. stepComponents.value = setStepComponents(data);
  459. router.replace({ name: stepComponents.value[selectIndex.value].name });
  460. };
  461. //设置标签是否被选中
  462. const setSelectIndex = (index) => {
  463. if (componentsDisabled.value != true) {
  464. selectIndex.value = index;
  465. }
  466. };
  467. const init = async (index) => {
  468. if (taskIndex.value == null) {
  469. return;
  470. }
  471. selectStepIndex.value = index != null ? index : 0;
  472. //数据设置
  473. store.odersData.operationId =
  474. taskArray.value[taskIndex.value].ops[selectStepIndex.value].operationId;
  475. store.processInfo.operationCode =
  476. taskArray.value[taskIndex.value].ops[selectStepIndex.value].operationCode;
  477. store.processInfo.operationName =
  478. taskArray.value[taskIndex.value].ops[selectStepIndex.value].operationName;
  479. snVal.value =
  480. taskArray.value[taskIndex.value].ops[selectStepIndex.value].seqs.length > 0
  481. ? taskArray.value[taskIndex.value].ops[selectStepIndex.value].seqs[0]
  482. .seqNo
  483. : null;
  484. if (snVal.value != null) {
  485. const res = await getScanData();
  486. if (res == true) {
  487. await getOpCompentArray();
  488. }
  489. } else {
  490. stepComponents.value = [];
  491. ElMessage.warning("当前工序暂不可操作");
  492. }
  493. };
  494. onActivated(async () => {
  495. //缓存组件数据逻辑
  496. init(selectStepIndex.value);
  497. });
  498. watch(
  499. () => taskIndex.value,
  500. (val) => {
  501. if (val != null) {
  502. componentsDisabled.value = false;
  503. }
  504. }
  505. );
  506. </script>
  507. <style lang="scss" scoped>
  508. .disabled {
  509. opacity: 0.6 !important;
  510. }
  511. :deep(.el-input__wrapper) {
  512. background-color: #000;
  513. }
  514. .boxStyle {
  515. height: calc(100vh - 80px);
  516. .commonTitle {
  517. color: var(--ohos-text);
  518. font-size: 28px;
  519. }
  520. }
  521. .productInfo {
  522. width: 100%;
  523. height: 100px;
  524. margin-bottom: 10px;
  525. border-radius: 16px;
  526. background-color: var(--ohos-area-bg);
  527. padding: 10px 20px;
  528. cursor: pointer;
  529. .productitleText {
  530. color: white;
  531. }
  532. }
  533. .optionBox {
  534. height: calc(100vh - 150px);
  535. background-color: var(--ohos-area-bg);
  536. border-radius: 16px;
  537. }
  538. .headerInfo {
  539. height: 20px;
  540. width: calc(100vw - 40px);
  541. // padding: 10px;
  542. // margin: 0 20px;
  543. // display: flex;
  544. // justify-content: space-between;
  545. // align-items: center;
  546. // border-radius: 16px;
  547. // border-right: 0px;
  548. // border-left: 0px;
  549. // box-sizing: border-box;
  550. // margin-bottom: 10px;
  551. // background-color: white;
  552. .info {
  553. display: flex;
  554. flex-shrink: 0;
  555. .item {
  556. margin: 0 5px;
  557. font-size: 14px;
  558. font-weight: 300;
  559. }
  560. }
  561. }
  562. .scrollbar-demo-item {
  563. flex-shrink: 0;
  564. display: flex;
  565. align-items: center;
  566. justify-content: center;
  567. height: 80px;
  568. width: 135px;
  569. border-radius: 16px;
  570. text-align: center;
  571. background-color: var(--ohos-box-bg);
  572. margin-right: 10px;
  573. }
  574. .typeContainer {
  575. width: 100%;
  576. height: 80px;
  577. overflow-x: auto;
  578. .svgIcon {
  579. @include flex;
  580. }
  581. }
  582. .mainContentBox {
  583. height: calc(100vh - 110px);
  584. }
  585. .routerView {
  586. display: flex;
  587. flex: 1;
  588. overflow-y: auto;
  589. width: 100%;
  590. height: calc(100vh - 214px);
  591. margin-top: 20px;
  592. background-color: #ffffff20 !important;
  593. padding: 0 20px;
  594. border-radius: 16px;
  595. }
  596. .typeBox {
  597. height: 80px;
  598. width: 135px;
  599. border-radius: 16px;
  600. display: flex;
  601. flex-direction: column;
  602. justify-content: center;
  603. align-items: center;
  604. .name {
  605. height: 16px;
  606. font-weight: 500;
  607. font-size: $f20;
  608. line-height: 20px;
  609. text-align: center;
  610. font-style: normal;
  611. text-transform: none;
  612. margin-top: $p10;
  613. }
  614. }
  615. .typeBoxNormal {
  616. background: transparent;
  617. color: var(--ohos-text);
  618. }
  619. .typeBoxSelected {
  620. background-color: var(--ohos-area-active-bg);
  621. color: black !important;
  622. }
  623. :deep(.el-divider__text) {
  624. padding: 0px;
  625. }
  626. .popView {
  627. width: 80%;
  628. display: flex;
  629. flex-direction: column;
  630. height: 80%;
  631. background-color: var(--ohos-area-bg);
  632. border-radius: 16px;
  633. padding: 20px;
  634. .hang {
  635. display: flex;
  636. align-items: center;
  637. color: white;
  638. font-size: 20px;
  639. }
  640. .taskBox {
  641. display: grid;
  642. grid-template-columns: repeat(3, 1fr); /* 每行 3 列 */
  643. gap: 20px; /* 设置间距为 20px */
  644. }
  645. }
  646. </style>