index.vue 11 KB

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