index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  1. <template>
  2. <view v-if="isMaskShow" class="mask">
  3. </view>
  4. <view class="uni-column" style="height: 100%; background-color: #f5f5f5;position: absolute;
  5. left: 0;right: 0;">
  6. <view class="box-bg uni-row">
  7. <view class="input-view uni-row">
  8. <uni-icons class="input-uni-icon" type="search" size="18" color="#999" />
  9. <input class="nav-bar-input" type="text" v-model="keywords" placeholder="请输入关键字" />
  10. </view>
  11. <view class="search" @click="handleSearch">
  12. 搜索
  13. </view>
  14. </view>
  15. <view class="scroll-container" style="padding-bottom: 150rpx">
  16. <view v-if="listData.length == 0" style="color: #999;margin: 50% auto;">
  17. <text>暂无批次</text>
  18. </view>
  19. <!-- 批次列表 -->
  20. <view v-else v-for="(item, index) in listData" :key="index" class="list-item">
  21. <view class="title-container uni-row" style="justify-content: flex-start;">
  22. <view class="title uni-row">
  23. <text class="label">批次号:</text>
  24. <text class="label code">{{ item['lotCode'] }}</text>
  25. </view>
  26. </view>
  27. <view class="item-info uni-row">
  28. <text class="label">产品描述</text>
  29. <text class="label right">{{ item['productDescription'] }}</text>
  30. </view>
  31. <view class="item-info uni-row">
  32. <text class="label">箱号</text>
  33. <text class="label right">{{ item['carrierName'] ? item['carrierName'] : '-' }}</text>
  34. </view>
  35. <view class="item-info uni-row">
  36. <text class="label">投产数量</text>
  37. <text class="label right">{{ item.prodNum }}</text>
  38. </view>
  39. <view class="item-info uni-row">
  40. <text class="label">上道工序</text>
  41. <view class="label right uni-row">
  42. {{ item.technologicalProcessDetail ? item['technologicalProcessDetail'].processAlias : '-'}}
  43. (<view style="color: #1684fc;" @click.stop="handleClickProcessList(item)">&nbsp;工艺列表&nbsp;
  44. </view>)
  45. </view>
  46. </view>
  47. <view @tap="delItem(item)" class="del-btn"
  48. style="position: absolute; top: 1rem; right: 1rem; color: red;">
  49. <text class="fa fa-trash"></text>
  50. </view>
  51. </view>
  52. </view>
  53. <!-- 抽屉 -->
  54. <uni-drawer ref="showRight" mode="right" :mask-click="true">
  55. <view style="text-align: center; font-size: 48rpx; padding: 48rpx 0 24rpx 0;">工艺列表</view>
  56. <view style="font-size: 24rpx;text-align: center;color: red; margin-bottom: 16rpx;">
  57. 仅显示当前工序后面工艺
  58. </view>
  59. <scroll-view scroll-y="true" style="height: 82%;" @touchmove.stop>
  60. <view v-for="(item,index) in curProcessAfte" :key="index"
  61. style="padding: 8rpx 5% 8rpx 14%; border-top: 1px solid #cccccc">
  62. <text>{{ index + 1 }}.{{item.processAlias}}</text>
  63. </view>
  64. </scroll-view>
  65. </uni-drawer>
  66. <view class="bottom uni-row">
  67. <button class="start-batch-btn" style="margin-right: 10rpx; background-color: #60d500;"
  68. @click="handleScanCode">扫码添加</button>
  69. <button class="start-batch-btn" :disabled="allData.length === 0" type="primary"
  70. @click="showDoTurnover">周转申请</button>
  71. </view>
  72. <dialog-turnoverApplicationAll ref="turnoverApplicationDialog" @reflushDaywork="handleDoTurnoverAfter"
  73. @close="turnoverApplicationClose" />
  74. <QrScanner v-if="showQrCodeReader" @decode="onDecodeHandler" @close="qrReaderClose" />
  75. </view>
  76. </template>
  77. <script setup>
  78. import {
  79. normalizeProps,
  80. reactive,
  81. onMounted,
  82. ref
  83. } from 'vue'
  84. import {
  85. onLoad,
  86. onReady,
  87. onUnload,
  88. onShow
  89. } from '@dcloudio/uni-app'
  90. import {
  91. getDayworkByCarrierCode
  92. } from '@/api/business/switchDept.js'
  93. import {
  94. store
  95. } from '@/store/index.js'
  96. import QrScanner from '../vueQrCode/index.vue'
  97. import {
  98. debounce
  99. } from '@/utils/common.js'
  100. const turnoverApplicationDialog = ref(null)
  101. const selectProduction = ref(null)
  102. const lotDialog = ref(null)
  103. const listData = ref([])
  104. const curPlan = ref(null)
  105. const bizDayworkObj = ref({})
  106. const bottomStatus = ref(false) // 底部按钮显示
  107. const paging = ref();
  108. const reqParam = ref(null);
  109. const normalStatus = ref(true)
  110. const isLoding = ref(false);
  111. const curDayworkItem = ref({}) // 当前报工记录,回显是否显示取消周转的状态
  112. const keywords = ref(null)
  113. const tempList = ref([])
  114. const wasteRecyclingList = ref([]) //废品回用批次
  115. // 在数据中定义一个变量来控制遮罩层的显示
  116. const isMaskShow = ref(false);
  117. const notPreProcess = ref(true)
  118. const curProcessAfte = ref([])
  119. const allData = ref([])
  120. const showRight = ref(null) // 抽屉
  121. const showQrCodeReader = ref(false);
  122. onLoad(() => {})
  123. onShow(() => {})
  124. /*
  125. function handleScanCode() {
  126. // 引入原生插件
  127. const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
  128. if (mpaasScanModule) {
  129. // 调用插件的 mpaasScan 方法
  130. mpaasScanModule.mpaasScan({
  131. // 扫码识别类型,参数可多选,qrCode、barCode,
  132. // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
  133. scanType: ["qrCode", "barCode"],
  134. // 是否隐藏相册,默认false不隐藏
  135. hideAlbum: false,
  136. },
  137. (ret) => {
  138. let vehicleObj = JSON.parse(ret.resp_result);
  139. if (!vehicleObj.carrierId || vehicleObj.carrierId == "") {
  140. uni.showToast({
  141. icon: "none",
  142. title: "请扫载具码",
  143. duration: 1000
  144. })
  145. return;
  146. }
  147. // 测试时用
  148. getDayworkByCarrierCode({
  149. carrierId: vehicleObj.carrierId,
  150. status: 7,
  151. deptId: store.curDeptDetails.deptId
  152. }).then(res => {
  153. if (res.code == 200) {
  154. if (res.data.length === 0) {
  155. uni.showToast({
  156. title: '该批次未周转到当前工段',
  157. icon: 'none'
  158. })
  159. } else {
  160. allData.value.push(...res.data.filter(v =>
  161. allData.value.findIndex(e => e.id === v.id) <
  162. 0))
  163. handleSearch()
  164. debounce(handleScanCode, 700)
  165. }
  166. } else {
  167. uni.showToast({
  168. icon: 'none',
  169. title: res.msg,
  170. duration: 2000
  171. })
  172. }
  173. }).catch(err => {
  174. console.log(err)
  175. })
  176. }
  177. );
  178. } else {
  179. // 测试时用
  180. getDayworkByCarrierCode({
  181. carrierId: '1780467398971187210',
  182. status: 7,
  183. deptId: store.curDeptDetails.deptId
  184. }).then(res => {
  185. if (res.code == 200) {
  186. if (res.data.length === 0) {
  187. uni.showToast({
  188. title: '该批次未周转到当前工段',
  189. icon: 'none'
  190. })
  191. } else {
  192. // console.log(res.data)
  193. // console.log(res.data.filter(v => allData.value.findIndex(e => e.id === v.id) < 0))
  194. allData.value.push(...res.data.filter(v => allData.value.findIndex(e => e.id === v.id) <
  195. 0))
  196. // const filtered = res.data.filter(v => listData.value.findIndex(e => e.id === v.id) < 0 && (
  197. // v.lotCode.includes(keywords.value == null ? '' : keywords.value) ||
  198. // v.productDescription.includes(keywords.value == null ? '' : keywords.value)))
  199. // console.log(filtered)
  200. // listData.value.push(...filtered)
  201. // console.log(listData.value)
  202. // console.log(allData.value)
  203. handleSearch()
  204. }
  205. } else {
  206. // console.log(res)
  207. uni.showToast({
  208. icon: 'none',
  209. title: res.msg,
  210. duration: 2000
  211. })
  212. }
  213. }).catch(err => {
  214. console.log(err)
  215. })
  216. }
  217. }
  218. */
  219. //H5扫码器回调
  220. function onDecodeHandler(data) {
  221. showQrCodeReader.value = false;
  222. let vehicleObj = {
  223. carrierCode: data
  224. };
  225. if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
  226. uni.showToast({
  227. icon: "none",
  228. title: "请扫载具码",
  229. duration: 1000
  230. })
  231. return;
  232. }
  233. // 测试时用
  234. getDayworkByCarrierCode({
  235. carrierCode: vehicleObj.carrierCode,
  236. status: 7,
  237. deptId: store.curDeptDetails.deptId
  238. }).then(res => {
  239. if (res.code == 200) {
  240. if (res.data.length === 0) {
  241. uni.showToast({
  242. title: '该批次未周转到当前工段',
  243. icon: 'none'
  244. })
  245. } else {
  246. allData.value.push(...res.data.filter(v =>
  247. allData.value.findIndex(e => e.id === v.id) <
  248. 0))
  249. handleSearch()
  250. debounce(handleScanCode, 700)
  251. }
  252. } else {
  253. uni.showToast({
  254. icon: 'none',
  255. title: res.msg,
  256. duration: 2000
  257. })
  258. }
  259. }).catch(err => {
  260. console.log(err)
  261. })
  262. }
  263. //H5扫码器关闭
  264. function qrReaderClose() {
  265. showQrCodeReader.value = false;
  266. }
  267. function handleScanCode() {
  268. showQrCodeReader.value = true;
  269. // 引入原生插件
  270. // const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
  271. // if (mpaasScanModule) {
  272. // // 调用插件的 mpaasScan 方法
  273. // mpaasScanModule.mpaasScan({
  274. // // 扫码识别类型,参数可多选,qrCode、barCode,
  275. // // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
  276. // scanType: ["qrCode", "barCode"],
  277. // // 是否隐藏相册,默认false不隐藏
  278. // hideAlbum: false,
  279. // },
  280. // (ret) => {
  281. // let vehicleObj = {carrierCode: ret.resp_result};
  282. // if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
  283. // uni.showToast({
  284. // icon: "none",
  285. // title: "请扫载具码",
  286. // duration: 1000
  287. // })
  288. // return;
  289. // }
  290. // // 测试时用
  291. // getDayworkByCarrierCode({
  292. // carrierCode: vehicleObj.carrierCode,
  293. // status: 7,
  294. // deptId: store.curDeptDetails.deptId
  295. // }).then(res => {
  296. // if (res.code == 200) {
  297. // if (res.data.length === 0) {
  298. // uni.showToast({
  299. // title: '该批次未周转到当前工段',
  300. // icon: 'none'
  301. // })
  302. // } else {
  303. // allData.value.push(...res.data.filter(v =>
  304. // allData.value.findIndex(e => e.id === v.id) <
  305. // 0))
  306. // handleSearch()
  307. // debounce(handleScanCode, 700)
  308. // }
  309. // } else {
  310. // uni.showToast({
  311. // icon: 'none',
  312. // title: res.msg,
  313. // duration: 2000
  314. // })
  315. // }
  316. // }).catch(err => {
  317. // console.log(err)
  318. // })
  319. // }
  320. // );
  321. // } else {
  322. // // 测试时用
  323. // getDayworkByCarrierCode({
  324. // carrierId: '1780467398971187210',
  325. // status: 7,
  326. // deptId: store.curDeptDetails.deptId
  327. // }).then(res => {
  328. // if (res.code == 200) {
  329. // if (res.data.length === 0) {
  330. // uni.showToast({
  331. // title: '该批次未周转到当前工段',
  332. // icon: 'none'
  333. // })
  334. // } else {
  335. // // console.log(res.data)
  336. // // console.log(res.data.filter(v => allData.value.findIndex(e => e.id === v.id) < 0))
  337. // allData.value.push(...res.data.filter(v => allData.value.findIndex(e => e.id === v.id) <
  338. // 0))
  339. // // const filtered = res.data.filter(v => listData.value.findIndex(e => e.id === v.id) < 0 && (
  340. // // v.lotCode.includes(keywords.value == null ? '' : keywords.value) ||
  341. // // v.productDescription.includes(keywords.value == null ? '' : keywords.value)))
  342. // // console.log(filtered)
  343. // // listData.value.push(...filtered)
  344. // // console.log(listData.value)
  345. // // console.log(allData.value)
  346. // handleSearch()
  347. // }
  348. // } else {
  349. // // console.log(res)
  350. // uni.showToast({
  351. // icon: 'none',
  352. // title: res.msg,
  353. // duration: 2000
  354. // })
  355. // }
  356. // }).catch(err => {
  357. // console.log(err)
  358. // })
  359. // }
  360. }
  361. function handleSearch() {
  362. listData.value = allData.value.filter(v =>
  363. v.lotCode.includes(keywords.value == null ? '' : keywords.value) ||
  364. v.productDescription.includes(keywords.value == null ? '' : keywords.value))
  365. }
  366. function showDoTurnover() {
  367. turnoverApplicationDialog.value.open(allData.value)
  368. isMaskShow.value = true
  369. }
  370. function handleDoTurnoverAfter() {
  371. isMaskShow.value = false
  372. allData.value = []
  373. handleSearch()
  374. }
  375. function turnoverApplicationClose() {
  376. // console.log('close')
  377. isMaskShow.value = false
  378. }
  379. function delItem(item) {
  380. allData.value = allData.value.filter(e => e.id != item.id)
  381. handleSearch()
  382. }
  383. function handleClickProcessList(item) {
  384. let curProcessAfterList = [];
  385. let nextIndex = 0;
  386. console.log(item)
  387. for (let i = 0; i < item.processSequence.length; i++) {
  388. if (item.technologicalProcessDetail.id == item.processSequence[i].technologicalProcessDetailId) {
  389. nextIndex = i;
  390. }
  391. }
  392. for (let i = 0; i < item.processSequence.length; i++) {
  393. if (i > nextIndex) {
  394. curProcessAfterList.push(item.processSequence[i]);
  395. }
  396. }
  397. if (item.status == 3) {
  398. curProcessAfterList.splice(0, 1)
  399. }
  400. curProcessAfte.value = curProcessAfterList;
  401. showRight.value.open();
  402. }
  403. </script>
  404. <style lang="scss">
  405. $nav-height: 60rpx;
  406. $gray: #ebebeb;
  407. $green: #62e200;
  408. /* 遮罩层样式 */
  409. .mask {
  410. position: fixed;
  411. /* 固定定位,覆盖整个屏幕 */
  412. top: 0;
  413. left: 0;
  414. right: 0;
  415. bottom: 0;
  416. background-color: rgba(0, 0, 0, 0.3);
  417. /* 黑色背景,透明度30% */
  418. display: flex;
  419. justify-content: center;
  420. /* 水平居中 */
  421. align-items: center;
  422. /* 垂直居中 */
  423. z-index: 8;
  424. /* 确保遮罩层在其他元素之上 */
  425. }
  426. .box-bg {
  427. width: 94%;
  428. background-color: #F5F5F5;
  429. padding: 5rpx 16rpx;
  430. justify-content: space-around;
  431. align-items: center;
  432. margin: 24rpx auto 0;
  433. .input-view {
  434. width: 100%;
  435. flex: 4;
  436. background-color: #f8f8f8;
  437. height: $nav-height;
  438. border: 1rpx solid #999;
  439. border-radius: 15rpx;
  440. padding: 0 15rpx;
  441. flex-wrap: nowrap;
  442. margin: 0 10rpx 0;
  443. line-height: $nav-height;
  444. .input-uni-icon {
  445. line-height: $nav-height;
  446. }
  447. .nav-bar-input {
  448. width: 80%;
  449. height: $nav-height;
  450. line-height: $nav-height;
  451. padding: 0 5rpx;
  452. background-color: #f8f8f8;
  453. }
  454. }
  455. .search {
  456. width: 20%;
  457. text-align: center;
  458. color: #808080;
  459. }
  460. }
  461. .list-title {
  462. width: 100%;
  463. margin-top: 16rpx;
  464. height: 64rpx;
  465. line-height: 64rpx;
  466. align-items: center;
  467. margin-left: 32rpx;
  468. .label {
  469. font-size: 32rpx;
  470. margin-right: 24rpx;
  471. }
  472. .icon-gear {
  473. font-size: 56rpx;
  474. }
  475. }
  476. .switch {
  477. margin-top: -8rpx;
  478. transform: scale(0.7);
  479. }
  480. .scroll-container {
  481. width: 92%;
  482. margin: 24rpx auto 0 auto;
  483. height: calc(90% - 100rpx);
  484. overflow: auto;
  485. }
  486. .list-item {
  487. background-color: #fff;
  488. position: relative;
  489. padding: 16rpx;
  490. padding-bottom: 24rpx;
  491. margin-bottom: 24rpx;
  492. border-radius: 24rpx;
  493. .title-container {
  494. margin-top: 8rpx;
  495. margin-bottom: 16rpx;
  496. .title {
  497. height: 48rpx;
  498. align-items: center;
  499. .label {
  500. font-size: 32rpx;
  501. font-weight: bold;
  502. &.code {
  503. margin-left: 8rpx;
  504. }
  505. }
  506. }
  507. .tag {
  508. border: 1px solid #1CE5B0;
  509. background-color: #F6FFFD;
  510. padding: 8rpx;
  511. border-radius: 8rpx;
  512. .label {
  513. color: #1CE5B0;
  514. font-size: 24rpx;
  515. }
  516. &.finished {
  517. border: 1px solid #BBBBBB;
  518. background-color: #F5F5F5;
  519. .label {
  520. color: #BBBBBB;
  521. }
  522. }
  523. &.turnover {
  524. border: 1px solid #FF7901;
  525. background-color: #F6FFFD;
  526. .label {
  527. color: #FF7901;
  528. }
  529. }
  530. }
  531. }
  532. .item-info {
  533. margin-bottom: 8rpx;
  534. .label {
  535. font-size: 28rpx;
  536. width: 220rpx;
  537. color: #808080;
  538. &.right {
  539. flex: 1;
  540. color: #000000;
  541. }
  542. }
  543. }
  544. .status-btn {
  545. justify-content: flex-end;
  546. align-items: center;
  547. .turnover-tag {
  548. padding-right: 12rpx;
  549. padding-left: 12rpx;
  550. border-radius: 8rpx;
  551. border: 1rpx solid #FF7901;
  552. background-color: #FF7901;
  553. font-size: 28rpx;
  554. color: #FFFFFF;
  555. }
  556. .reporting-tag {
  557. padding-right: 12rpx;
  558. padding-left: 12rpx;
  559. border-radius: 8rpx;
  560. margin-left: 16rpx;
  561. border: 1rpx solid #1684fc;
  562. background-color: #1684fc;
  563. font-size: 28rpx;
  564. color: #FFFFFF;
  565. }
  566. }
  567. }
  568. .bottom {
  569. height: 10%;
  570. position: fixed;
  571. right: 0;
  572. bottom: 0;
  573. left: 0;
  574. height: 100rpx;
  575. border-top: 1px solid #999999;
  576. padding: 16rpx 32rpx;
  577. align-items: center;
  578. background-color: #fff;
  579. justify-content: space-evenly;
  580. .start-batch-btn {
  581. flex: 1;
  582. height: 80rpx;
  583. line-height: 80rpx;
  584. border-radius: 8rpx;
  585. color: #FFFFFF;
  586. font-size: 28rpx;
  587. }
  588. }
  589. </style>