index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  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. function handleScanCode() {
  121. // 引入原生插件
  122. const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
  123. if (mpaasScanModule) {
  124. // 调用插件的 mpaasScan 方法
  125. mpaasScanModule.mpaasScan({
  126. // 扫码识别类型,参数可多选,qrCode、barCode,
  127. // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
  128. scanType: ["qrCode", "barCode"],
  129. // 是否隐藏相册,默认false不隐藏
  130. hideAlbum: false,
  131. },
  132. (ret) => {
  133. let vehicleObj = JSON.parse(ret.resp_result);
  134. if (!vehicleObj.carrierId || vehicleObj.carrierId == "") {
  135. uni.showToast({
  136. icon: "none",
  137. title: "请扫载具码",
  138. duration: 1000
  139. })
  140. return;
  141. }
  142. // 测试时用
  143. getDayworkByCarrierCode({
  144. carrierId: vehicleObj.carrierId,
  145. status: 7,
  146. deptId: store.curDeptDetails.deptId
  147. }).then(res => {
  148. if (res.code == 200) {
  149. if (res.data.length === 0) {
  150. uni.showToast({
  151. title: '该批次未周转到当前工段',
  152. icon: 'none'
  153. })
  154. } else {
  155. allData.value.push(...res.data.filter(v =>
  156. allData.value.findIndex(e => e.id === v.id) <
  157. 0))
  158. handleSearch()
  159. debounce(handleScanCode, 700)
  160. }
  161. } else {
  162. uni.showToast({
  163. icon: 'none',
  164. title: res.msg,
  165. duration: 2000
  166. })
  167. }
  168. }).catch(err => {
  169. console.log(err)
  170. })
  171. }
  172. );
  173. } else {
  174. // 测试时用
  175. getDayworkByCarrierCode({
  176. carrierId: '1780467398971187210',
  177. status: 7,
  178. deptId: store.curDeptDetails.deptId
  179. }).then(res => {
  180. if (res.code == 200) {
  181. if (res.data.length === 0) {
  182. uni.showToast({
  183. title: '该批次未周转到当前工段',
  184. icon: 'none'
  185. })
  186. } else {
  187. // console.log(res.data)
  188. // console.log(res.data.filter(v => allData.value.findIndex(e => e.id === v.id) < 0))
  189. allData.value.push(...res.data.filter(v => allData.value.findIndex(e => e.id === v.id) <
  190. 0))
  191. // const filtered = res.data.filter(v => listData.value.findIndex(e => e.id === v.id) < 0 && (
  192. // v.lotCode.includes(keywords.value == null ? '' : keywords.value) ||
  193. // v.productDescription.includes(keywords.value == null ? '' : keywords.value)))
  194. // console.log(filtered)
  195. // listData.value.push(...filtered)
  196. // console.log(listData.value)
  197. // console.log(allData.value)
  198. handleSearch()
  199. }
  200. } else {
  201. // console.log(res)
  202. uni.showToast({
  203. icon: 'none',
  204. title: res.msg,
  205. duration: 2000
  206. })
  207. }
  208. }).catch(err => {
  209. console.log(err)
  210. })
  211. }
  212. }
  213. function handleSearch() {
  214. listData.value = allData.value.filter(v =>
  215. v.lotCode.includes(keywords.value == null ? '' : keywords.value) ||
  216. v.productDescription.includes(keywords.value == null ? '' : keywords.value))
  217. }
  218. function showDoTurnover() {
  219. turnoverApplicationDialog.value.open(allData.value)
  220. isMaskShow.value = true
  221. }
  222. function handleDoTurnoverAfter() {
  223. isMaskShow.value = false
  224. allData.value = []
  225. handleSearch()
  226. }
  227. function turnoverApplicationClose() {
  228. // console.log('close')
  229. isMaskShow.value = false
  230. }
  231. function delItem(item) {
  232. allData.value = allData.value.filter(e => e.id != item.id)
  233. handleSearch()
  234. }
  235. function handleClickProcessList(item) {
  236. let curProcessAfterList = [];
  237. let nextIndex = 0;
  238. console.log(item)
  239. for (let i = 0; i < item.processSequence.length; i++) {
  240. if (item.technologicalProcessDetail.id == item.processSequence[i].technologicalProcessDetailId) {
  241. nextIndex = i;
  242. }
  243. }
  244. for (let i = 0; i < item.processSequence.length; i++) {
  245. if (i > nextIndex) {
  246. curProcessAfterList.push(item.processSequence[i]);
  247. }
  248. }
  249. if (item.status == 3) {
  250. curProcessAfterList.splice(0, 1)
  251. }
  252. curProcessAfte.value = curProcessAfterList;
  253. showRight.value.open();
  254. }
  255. </script>
  256. <style lang="scss">
  257. $nav-height: 60rpx;
  258. $gray: #ebebeb;
  259. $green: #62e200;
  260. /* 遮罩层样式 */
  261. .mask {
  262. position: fixed;
  263. /* 固定定位,覆盖整个屏幕 */
  264. top: 0;
  265. left: 0;
  266. right: 0;
  267. bottom: 0;
  268. background-color: rgba(0, 0, 0, 0.3);
  269. /* 黑色背景,透明度30% */
  270. display: flex;
  271. justify-content: center;
  272. /* 水平居中 */
  273. align-items: center;
  274. /* 垂直居中 */
  275. z-index: 1000;
  276. /* 确保遮罩层在其他元素之上 */
  277. }
  278. .box-bg {
  279. width: 94%;
  280. background-color: #F5F5F5;
  281. padding: 5rpx 16rpx;
  282. justify-content: space-around;
  283. align-items: center;
  284. margin: 24rpx auto 0;
  285. .input-view {
  286. width: 100%;
  287. flex: 4;
  288. background-color: #f8f8f8;
  289. height: $nav-height;
  290. border: 1rpx solid #999;
  291. border-radius: 15rpx;
  292. padding: 0 15rpx;
  293. flex-wrap: nowrap;
  294. margin: 0 10rpx 0;
  295. line-height: $nav-height;
  296. .input-uni-icon {
  297. line-height: $nav-height;
  298. }
  299. .nav-bar-input {
  300. width: 80%;
  301. height: $nav-height;
  302. line-height: $nav-height;
  303. padding: 0 5rpx;
  304. background-color: #f8f8f8;
  305. }
  306. }
  307. .search {
  308. width: 20%;
  309. text-align: center;
  310. color: #808080;
  311. }
  312. }
  313. .list-title {
  314. width: 100%;
  315. margin-top: 16rpx;
  316. height: 64rpx;
  317. line-height: 64rpx;
  318. align-items: center;
  319. margin-left: 32rpx;
  320. .label {
  321. font-size: 32rpx;
  322. margin-right: 24rpx;
  323. }
  324. .icon-gear {
  325. font-size: 56rpx;
  326. }
  327. }
  328. .switch {
  329. margin-top: -8rpx;
  330. transform: scale(0.7);
  331. }
  332. .scroll-container {
  333. width: 92%;
  334. margin: 24rpx auto 0 auto;
  335. height: calc(90% - 100rpx);
  336. overflow: auto;
  337. }
  338. .list-item {
  339. background-color: #fff;
  340. position: relative;
  341. padding: 16rpx;
  342. padding-bottom: 24rpx;
  343. margin-bottom: 24rpx;
  344. border-radius: 24rpx;
  345. .title-container {
  346. margin-top: 8rpx;
  347. margin-bottom: 16rpx;
  348. .title {
  349. height: 48rpx;
  350. align-items: center;
  351. .label {
  352. font-size: 32rpx;
  353. font-weight: bold;
  354. &.code {
  355. margin-left: 8rpx;
  356. }
  357. }
  358. }
  359. .tag {
  360. border: 1px solid #1CE5B0;
  361. background-color: #F6FFFD;
  362. padding: 8rpx;
  363. border-radius: 8rpx;
  364. .label {
  365. color: #1CE5B0;
  366. font-size: 24rpx;
  367. }
  368. &.finished {
  369. border: 1px solid #BBBBBB;
  370. background-color: #F5F5F5;
  371. .label {
  372. color: #BBBBBB;
  373. }
  374. }
  375. &.turnover {
  376. border: 1px solid #FF7901;
  377. background-color: #F6FFFD;
  378. .label {
  379. color: #FF7901;
  380. }
  381. }
  382. }
  383. }
  384. .item-info {
  385. margin-bottom: 8rpx;
  386. .label {
  387. font-size: 28rpx;
  388. width: 220rpx;
  389. color: #808080;
  390. &.right {
  391. flex: 1;
  392. color: #000000;
  393. }
  394. }
  395. }
  396. .status-btn {
  397. justify-content: flex-end;
  398. align-items: center;
  399. .turnover-tag {
  400. padding-right: 12rpx;
  401. padding-left: 12rpx;
  402. border-radius: 8rpx;
  403. border: 1rpx solid #FF7901;
  404. background-color: #FF7901;
  405. font-size: 28rpx;
  406. color: #FFFFFF;
  407. }
  408. .reporting-tag {
  409. padding-right: 12rpx;
  410. padding-left: 12rpx;
  411. border-radius: 8rpx;
  412. margin-left: 16rpx;
  413. border: 1rpx solid #1684fc;
  414. background-color: #1684fc;
  415. font-size: 28rpx;
  416. color: #FFFFFF;
  417. }
  418. }
  419. }
  420. .bottom {
  421. height: 10%;
  422. position: fixed;
  423. right: 0;
  424. bottom: 0;
  425. left: 0;
  426. height: 100rpx;
  427. border-top: 1px solid #999999;
  428. padding: 16rpx 32rpx;
  429. align-items: center;
  430. background-color: #fff;
  431. justify-content: space-evenly;
  432. .start-batch-btn {
  433. flex: 1;
  434. height: 80rpx;
  435. line-height: 80rpx;
  436. border-radius: 8rpx;
  437. color: #FFFFFF;
  438. font-size: 28rpx;
  439. }
  440. }
  441. </style>