index.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. <template>
  2. <view class="uni-column" style="padding: 24rpx;position: fixed;left: 0;right: 0;">
  3. <view class="box-bg uni-row">
  4. <view class="input-view uni-row">
  5. <uni-icons class="input-uni-icon" type="search" size="18" color="#999" />
  6. <input class="nav-bar-input" type="text" v-model="keywords" placeholder="输入搜索关键词" />
  7. </view>
  8. <view class="search" @click="handleSearch">搜索</view>
  9. </view>
  10. <view v-if="listData.length == 0" style="color: #999;margin: 50% auto;">
  11. <text>暂无生产计划</text>
  12. </view>
  13. <view v-else style="height: calc(100% - 100rpx); overflow: auto;padding-bottom: 100rpx;">
  14. <view v-for="(item, index) in listData" :key="index" @click="handleToBatchReporting(item)"
  15. class="list-item">
  16. <view class="title-container uni-row">
  17. <view class="title uni-row">
  18. <text class="label">生产计划单号</text>
  19. <text class="label code">{{ item['productionPlanNo'] }}</text>
  20. <text class="label" style="margin-left: 20px;">序号</text>
  21. <text class="label code">{{ item['lineNumber'] }}</text>
  22. </view>
  23. <view v-if="item['dayWorkList'].length > 0" class="tag"><text class="label">进行中</text></view>
  24. <view v-else type="default" class="tag not-start"><text class="label">未开始</text></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['totalLotNumber'] }}</text>
  33. </view>
  34. <!-- <view class="item-info uni-row">
  35. <text class="label">完成批数</text>
  36. <text class="label right">{{ item['equiment'] }}</text>
  37. </view> -->
  38. <view class="item-info uni-row">
  39. <text class="label">投产数</text>
  40. <text class="label right">{{ item['productionQuantity'] }}</text>
  41. </view>
  42. <view class="item-info uni-row">
  43. <text class="label">单批量</text>
  44. <text class="label right">{{ item['oneLotQuantity'] }}</text>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="bottom uni-row">
  49. <button class="start-batch-btn" style="margin-right: 10rpx;background-color: #67c337;"
  50. @click="handleScanCode">扫码报工</button>
  51. </view>
  52. <dialog-selectDaywork ref='selectDaywork' @handleSelectDaywork='handleSelectDaywork'></dialog-selectDaywork>
  53. <QrScanner v-if="showQrCodeReader" @decode="onDecodeHandler" @close="qrReaderClose" />
  54. </view>
  55. </template>
  56. <script setup>
  57. import {
  58. getInnerPlanDetailsList,
  59. selectByCarrierCode,
  60. selectInfoByLotCode
  61. } from '@/api/business/planDetails.js'
  62. import QrScanner from '../vueQrCode/index.vue'
  63. import {
  64. ref
  65. } from 'vue'
  66. import {
  67. onReady,
  68. onLoad,
  69. onUnload,
  70. onPullDownRefresh,
  71. onShow
  72. } from '@dcloudio/uni-app'
  73. import {
  74. getToken
  75. } from '@/utils/auth'
  76. import {
  77. store
  78. } from '@/store/index.js'
  79. import {
  80. getUserProcess
  81. } from '@/api/process/process.js'
  82. const listData = ref([])
  83. const keywords = ref('')
  84. const selectDaywork = ref(null)
  85. const carrierCode = ref(null)
  86. const showQrCodeReader = ref(false);
  87. onLoad(() => {
  88. // dayworkItem数据更改后刷新数据
  89. // uni.$on('dayworkItemUpdate', reflush);
  90. })
  91. onShow(() => {
  92. reflush();
  93. })
  94. onUnload(() => {
  95. console.log(store.curDeptDetails)
  96. // uni.$off('dayworkItemUpdate', reflush)
  97. })
  98. /**
  99. * 监听下拉刷新
  100. */
  101. onPullDownRefresh(() => {
  102. uni.stopPullDownRefresh();
  103. reflush();
  104. })
  105. function reflush() {
  106. keywords.value = ''
  107. init();
  108. }
  109. function init(data) {
  110. uni.showLoading({
  111. title: '加载中'
  112. });
  113. getInnerPlanDetailsList({
  114. deptId: Number(store.curDeptDetails.deptId),
  115. keywords: keywords.value
  116. }).then(res => {
  117. if (res.code == 200) {
  118. listData.value = res.data;
  119. uni.hideLoading();
  120. }
  121. uni.hideLoading();
  122. })
  123. }
  124. function handleToBatchReporting(item) {
  125. store.planDetails = item
  126. uni.navigateTo({
  127. url: '/pages/sortBatchInnerReporting/index'
  128. })
  129. }
  130. //查箱号
  131. function handleSearchCode() {
  132. uni.navigateTo({
  133. url: '/pages/sortProductionPlan/details'
  134. })
  135. }
  136. //带回
  137. function handleSelectDaywork(data) {
  138. console.log(data)
  139. //查询计划单信息跳转
  140. selectInfoByLotCode({
  141. lotCode: data
  142. }).then(res => {
  143. store.planDetails = res.data
  144. var code = encodeURIComponent(carrierCode.value);
  145. // 构建查询参数字符串
  146. var queryParam =
  147. `param1=${code}`;
  148. // 使用模板字符串构建完整的URL
  149. var navigateUrl = `/pages/sortBatchInnerReporting/index?${queryParam}`;
  150. uni.navigateTo({
  151. url: navigateUrl
  152. });
  153. })
  154. }
  155. function handleSearch() {
  156. let reqParam = {
  157. keywords: keywords.value
  158. }
  159. reqParam.tenantId = !store.tenantId ? store.userInfo.tenantId : store.tenantId;
  160. init(reqParam)
  161. }
  162. //H5扫码器回调
  163. function onDecodeHandler(data) {
  164. showQrCodeReader.value = false;
  165. let vehicleObj = {
  166. carrierCode: data
  167. };
  168. if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
  169. uni.showToast({
  170. icon: "none",
  171. title: "请扫载具码",
  172. duration: 1000
  173. })
  174. return;
  175. }
  176. selectByCarrierCode({
  177. carrierCode: vehicleObj.carrierCode,
  178. deptId: Number(store.curDeptDetails.deptId)
  179. }).then(response => {
  180. carrierCode.value = vehicleObj.carrierCode
  181. if (response.code == 200) {
  182. if (response.data.length > 1) {
  183. selectDaywork.value.open(response.data)
  184. } else {
  185. handleSelectDaywork(response.data[0].lotCode)
  186. }
  187. } else {
  188. uni.showToast({
  189. icon: 'none',
  190. title: response.msg,
  191. duration: 2000
  192. })
  193. }
  194. })
  195. }
  196. //H5扫码器关闭
  197. function qrReaderClose() {
  198. showQrCodeReader.value = false;
  199. }
  200. function handleScanCode() {
  201. showQrCodeReader.value = true;
  202. // 引入原生插件
  203. // const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
  204. // // const mpaasScanModule = null
  205. // if (mpaasScanModule) {
  206. // // 调用插件的 mpaasScan 方法
  207. // mpaasScanModule.mpaasScan({
  208. // // 扫码识别类型,参数可多选,qrCode、barCode,
  209. // // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
  210. // scanType: ["qrCode", "barCode"],
  211. // // 是否隐藏相册,默认false不隐藏
  212. // hideAlbum: false,
  213. // },
  214. // (ret) => {
  215. // console.log(ret);
  216. // let vehicleObj = {
  217. // carrierCode: ret.resp_result
  218. // };
  219. // if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
  220. // uni.showToast({
  221. // icon: "none",
  222. // title: "请扫载具码",
  223. // duration: 1000
  224. // })
  225. // return;
  226. // }
  227. // selectByCarrierCode({
  228. // carrierCode: vehicleObj.carrierCode,
  229. // deptId:Number(store.curDeptDetails.deptId)
  230. // }).then(response => {
  231. // carrierCode.value = vehicleObj.carrierCode
  232. // if (response.code == 200) {
  233. // if (response.data.length > 1) {
  234. // selectDaywork.value.open(response.data)
  235. // } else {
  236. // handleSelectDaywork(response.data[0].lotCode)
  237. // }
  238. // } else {
  239. // uni.showToast({
  240. // icon: 'none',
  241. // title: response.msg,
  242. // duration: 2000
  243. // })
  244. // }
  245. // })
  246. // }
  247. // );
  248. // } else {
  249. // // 测试时用
  250. // selectByCarrierCode({
  251. // carrierCode: '000745',
  252. // deptId:Number(store.curDeptDetails.deptId)
  253. // }).then(response => {
  254. // if (response.code == 200) {
  255. // carrierCode.value = '000745'
  256. // if (response.data.length > 1) {
  257. // selectDaywork.value.open(response.data)
  258. // } else {
  259. // handleSelectDaywork(response.data[0].lotCode)
  260. // }
  261. // } else {
  262. // uni.showToast({
  263. // icon: 'none',
  264. // title: response.msg,
  265. // duration: 2000
  266. // })
  267. // }
  268. // })
  269. // }
  270. }
  271. </script>
  272. <style lang="scss">
  273. $nav-height: 60rpx;
  274. .box-bg {
  275. width: 100%;
  276. background-color: #F5F5F5;
  277. padding: 5rpx 0;
  278. justify-content: space-around;
  279. align-items: center;
  280. .input-view {
  281. width: 100%;
  282. flex: 4;
  283. background-color: #f8f8f8;
  284. height: $nav-height;
  285. border: 1rpx solid #999;
  286. border-radius: 15rpx;
  287. padding: 0 15rpx;
  288. flex-wrap: nowrap;
  289. margin: 0 10rpx 20rpx;
  290. line-height: $nav-height;
  291. .input-uni-icon {
  292. line-height: $nav-height;
  293. }
  294. .nav-bar-input {
  295. width: 80%;
  296. height: $nav-height;
  297. line-height: $nav-height;
  298. padding: 0 5rpx;
  299. background-color: #f8f8f8;
  300. }
  301. }
  302. .search {
  303. width: 20%;
  304. text-align: center;
  305. color: #808080;
  306. margin-top: -20rpx;
  307. }
  308. }
  309. .uni-column {
  310. background-color: rgba(245, 245, 245, 1);
  311. height: calc(100% - 40rpx);
  312. }
  313. .list-item {
  314. background-color: #fff;
  315. position: relative;
  316. padding: 16rpx;
  317. padding-bottom: 24rpx;
  318. border-radius: 24rpx;
  319. margin-bottom: 24rpx;
  320. .title-container {
  321. justify-content: space-between;
  322. margin-top: 8rpx;
  323. margin-bottom: 16rpx;
  324. .title {
  325. height: 48rpx;
  326. align-items: center;
  327. .label {
  328. font-size: 32rpx;
  329. font-weight: bold;
  330. &.code {
  331. margin-left: 8rpx;
  332. }
  333. }
  334. }
  335. .tag {
  336. border: 1px solid #1ce5b0;
  337. background-color: #f6fffd;
  338. padding: 8rpx;
  339. border-radius: 8rpx;
  340. .label {
  341. color: #1ce5b0;
  342. font-size: 24rpx;
  343. }
  344. &.not-start {
  345. border: 1px solid #bbbbbb;
  346. background-color: #f5f5f5;
  347. .label {
  348. color: #bbbbbb;
  349. }
  350. }
  351. }
  352. }
  353. .item-info {
  354. margin-bottom: 8rpx;
  355. .label {
  356. font-size: 28rpx;
  357. width: 220rpx;
  358. color: #808080;
  359. &.right {
  360. flex: 1;
  361. color: #000000;
  362. }
  363. }
  364. }
  365. }
  366. .bottom {
  367. height: 10%;
  368. position: fixed;
  369. right: 0;
  370. bottom: 0;
  371. left: 0;
  372. height: 100rpx;
  373. border-top: 1px solid #999999;
  374. padding: 16rpx 32rpx;
  375. align-items: center;
  376. background-color: #fff;
  377. justify-content: space-evenly;
  378. .start-batch-btn {
  379. flex: 1;
  380. height: 80rpx;
  381. line-height: 80rpx;
  382. border-radius: 8rpx;
  383. color: #FFFFFF;
  384. font-size: 28rpx;
  385. }
  386. .view-end-btn {
  387. flex: 1;
  388. height: 80rpx;
  389. line-height: 80rpx;
  390. border-radius: 8rpx;
  391. color: #FFFFFF;
  392. font-size: 28rpx;
  393. }
  394. }
  395. </style>