index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  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: res.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. // console.log(res)
  184. uni.showToast({
  185. icon: 'none',
  186. title: res.msg,
  187. duration: 2000
  188. })
  189. }
  190. }).catch(err => {
  191. console.log(err)
  192. })
  193. }
  194. }
  195. function handleCancelTurnover(data) {
  196. isMaskShow.value = true; // 显示遮罩层
  197. uni.showLoading({
  198. title: '加载中'
  199. });
  200. turnoverDelete(data).then(res => {
  201. isMaskShow.value = false
  202. if (res.code == 200) {
  203. uni.showToast({
  204. icon: "success",
  205. title: "取消成功",
  206. duration: 2000
  207. })
  208. isLoding.value = false;
  209. init(store.planDetails.id);
  210. } else {
  211. uni.showToast({
  212. icon: "none",
  213. title: "取消失败",
  214. duration: 2000
  215. })
  216. isLoding.value = false;
  217. }
  218. })
  219. }
  220. function handleSearch() {
  221. listData.value = allData.value.filter(v =>
  222. v.lotCode.includes(keywords.value == null ? '' : keywords.value) ||
  223. v.productDescription.includes(keywords.value == null ? '' : keywords.value))
  224. }
  225. function showDoTurnover() {
  226. turnoverApplicationDialog.value.open()
  227. }
  228. function handleDoTurnoverAfter() {}
  229. function delItem(item) {
  230. allData.value = allData.value.filter(e => e.id != item.id)
  231. handleSearch()
  232. }
  233. function handleClickProcessList(item) {
  234. let curProcessAfterList = [];
  235. let nextIndex = 0;
  236. for (let i = 0; i < item.processSequence.length; i++) {
  237. if (item.technologicalProcessDetail.id == item.processSequence[i].id) {
  238. nextIndex = i;
  239. }
  240. }
  241. for (let i = 0; i < item.processSequence.length; i++) {
  242. if (i >= nextIndex) {
  243. curProcessAfterList.push(item.processSequence[i]);
  244. }
  245. }
  246. if (item.status == 3) {
  247. curProcessAfterList.splice(0, 1)
  248. }
  249. curProcessAfte.value = curProcessAfterList;
  250. showRight.value.open();
  251. }
  252. </script>
  253. <style lang="scss">
  254. $nav-height: 60rpx;
  255. $gray: #ebebeb;
  256. $green: #68f000;
  257. /* 遮罩层样式 */
  258. .mask {
  259. position: fixed;
  260. /* 固定定位,覆盖整个屏幕 */
  261. top: 0;
  262. left: 0;
  263. right: 0;
  264. bottom: 0;
  265. background-color: rgba(0, 0, 0, 0.3);
  266. /* 黑色背景,透明度30% */
  267. display: flex;
  268. justify-content: center;
  269. /* 水平居中 */
  270. align-items: center;
  271. /* 垂直居中 */
  272. z-index: 1000;
  273. /* 确保遮罩层在其他元素之上 */
  274. }
  275. .box-bg {
  276. width: 94%;
  277. background-color: #F5F5F5;
  278. padding: 5rpx 16rpx;
  279. justify-content: space-around;
  280. align-items: center;
  281. margin: 24rpx auto 0;
  282. .input-view {
  283. width: 100%;
  284. flex: 4;
  285. background-color: #f8f8f8;
  286. height: $nav-height;
  287. border: 1rpx solid #999;
  288. border-radius: 15rpx;
  289. padding: 0 15rpx;
  290. flex-wrap: nowrap;
  291. margin: 0 10rpx 0;
  292. line-height: $nav-height;
  293. .input-uni-icon {
  294. line-height: $nav-height;
  295. }
  296. .nav-bar-input {
  297. width: 80%;
  298. height: $nav-height;
  299. line-height: $nav-height;
  300. padding: 0 5rpx;
  301. background-color: #f8f8f8;
  302. }
  303. }
  304. .search {
  305. width: 20%;
  306. text-align: center;
  307. color: #808080;
  308. }
  309. }
  310. .list-title {
  311. width: 100%;
  312. margin-top: 16rpx;
  313. height: 64rpx;
  314. line-height: 64rpx;
  315. align-items: center;
  316. margin-left: 32rpx;
  317. .label {
  318. font-size: 32rpx;
  319. margin-right: 24rpx;
  320. }
  321. .icon-gear {
  322. font-size: 56rpx;
  323. }
  324. }
  325. .switch {
  326. margin-top: -8rpx;
  327. transform: scale(0.7);
  328. }
  329. .scroll-container {
  330. width: 92%;
  331. margin: 24rpx auto 0 auto;
  332. height: calc(90% - 100rpx);
  333. overflow: auto;
  334. }
  335. .list-item {
  336. background-color: #fff;
  337. position: relative;
  338. padding: 16rpx;
  339. padding-bottom: 24rpx;
  340. margin-bottom: 24rpx;
  341. border-radius: 24rpx;
  342. .title-container {
  343. margin-top: 8rpx;
  344. margin-bottom: 16rpx;
  345. .title {
  346. height: 48rpx;
  347. align-items: center;
  348. .label {
  349. font-size: 32rpx;
  350. font-weight: bold;
  351. &.code {
  352. margin-left: 8rpx;
  353. }
  354. }
  355. }
  356. .tag {
  357. border: 1px solid #1CE5B0;
  358. background-color: #F6FFFD;
  359. padding: 8rpx;
  360. border-radius: 8rpx;
  361. .label {
  362. color: #1CE5B0;
  363. font-size: 24rpx;
  364. }
  365. &.finished {
  366. border: 1px solid #BBBBBB;
  367. background-color: #F5F5F5;
  368. .label {
  369. color: #BBBBBB;
  370. }
  371. }
  372. &.turnover {
  373. border: 1px solid #FF7901;
  374. background-color: #F6FFFD;
  375. .label {
  376. color: #FF7901;
  377. }
  378. }
  379. }
  380. }
  381. .item-info {
  382. margin-bottom: 8rpx;
  383. .label {
  384. font-size: 28rpx;
  385. width: 220rpx;
  386. color: #808080;
  387. &.right {
  388. flex: 1;
  389. color: #000000;
  390. }
  391. }
  392. }
  393. .status-btn {
  394. justify-content: flex-end;
  395. align-items: center;
  396. .turnover-tag {
  397. padding-right: 12rpx;
  398. padding-left: 12rpx;
  399. border-radius: 8rpx;
  400. border: 1rpx solid #FF7901;
  401. background-color: #FF7901;
  402. font-size: 28rpx;
  403. color: #FFFFFF;
  404. }
  405. .reporting-tag {
  406. padding-right: 12rpx;
  407. padding-left: 12rpx;
  408. border-radius: 8rpx;
  409. margin-left: 16rpx;
  410. border: 1rpx solid #1684fc;
  411. background-color: #1684fc;
  412. font-size: 28rpx;
  413. color: #FFFFFF;
  414. }
  415. }
  416. }
  417. .bottom {
  418. height: 10%;
  419. position: fixed;
  420. right: 0;
  421. bottom: 0;
  422. left: 0;
  423. height: 100rpx;
  424. border-top: 1px solid #999999;
  425. padding: 16rpx 32rpx;
  426. align-items: center;
  427. background-color: #fff;
  428. justify-content: space-evenly;
  429. .start-batch-btn {
  430. flex: 1;
  431. height: 80rpx;
  432. line-height: 80rpx;
  433. border-radius: 8rpx;
  434. color: #FFFFFF;
  435. font-size: 28rpx;
  436. }
  437. }
  438. </style>