index.vue 14 KB

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