index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. <template>
  2. <view class="uni-column" style="padding: 24rpx;position: fixed;left: 0;right: 0;height: 100%;">
  3. <view class="box-bg uni-row" style="height: 6%;">
  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: 76%; overflow: auto;">
  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. <button class="start-batch-btn" type="primary" @click="handleSearchCode">查箱号</button>
  52. </view>
  53. <dialog-selectDaywork ref='selectDaywork' @handleSelectDaywork='handleSelectDaywork'></dialog-selectDaywork>
  54. <QrScanner v-if="showQrCodeReader" @decode="onDecodeHandler" @close="qrReaderClose" />
  55. </view>
  56. </template>
  57. <script setup>
  58. import {
  59. getPlanDetailsList,
  60. selectByCarrierCode,
  61. selectInfoByLotCode
  62. } from '@/api/business/planDetails.js'
  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 QrScanner from '../vueQrCode/index.vue'
  74. import {
  75. getToken
  76. } from '@/utils/auth'
  77. import {
  78. store
  79. } from '@/store/index.js'
  80. import {
  81. getUserProcess
  82. } from '@/api/process/process.js'
  83. const listData = ref([])
  84. const keywords = ref('')
  85. const selectDaywork = ref(null)
  86. const carrierCode = ref(null)
  87. const showQrCodeReader = ref(false);
  88. onLoad(() => {
  89. // dayworkItem数据更改后刷新数据
  90. // uni.$on('dayworkItemUpdate', reflush);
  91. })
  92. onShow(() => {
  93. reflush();
  94. })
  95. onUnload(() => {
  96. console.log(store.curDeptDetails)
  97. // uni.$off('dayworkItemUpdate', reflush)
  98. })
  99. /**
  100. * 监听下拉刷新
  101. */
  102. onPullDownRefresh(() => {
  103. uni.stopPullDownRefresh();
  104. init();
  105. })
  106. function reflush() {
  107. init();
  108. }
  109. function init(data) {
  110. uni.showLoading({
  111. title: '加载中'
  112. });
  113. getPlanDetailsList({
  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. //查箱号
  125. function handleSearchCode() {
  126. uni.navigateTo({
  127. url: '/pages/productionPlan/details'
  128. })
  129. }
  130. //带回
  131. function handleSelectDaywork(data) {
  132. console.log(data)
  133. //查询计划单信息跳转
  134. selectInfoByLotCode({
  135. lotCode: data
  136. }).then(res => {
  137. store.planDetails = res.data
  138. var code = encodeURIComponent(carrierCode.value);
  139. // 构建查询参数字符串
  140. var queryParam =
  141. `param1=${code}`;
  142. // 使用模板字符串构建完整的URL
  143. var navigateUrl = `/pages/batchReporting/index?${queryParam}`;
  144. uni.navigateTo({
  145. url: navigateUrl
  146. });
  147. })
  148. }
  149. //H5扫码器回调
  150. function onDecodeHandler(data) {
  151. showQrCodeReader.value = false;
  152. let vehicleObj = {
  153. carrierCode: data
  154. };
  155. if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
  156. uni.showToast({
  157. icon: "none",
  158. title: "请扫载具码",
  159. duration: 1000
  160. })
  161. return;
  162. }
  163. selectByCarrierCode({
  164. carrierCode: vehicleObj.carrierCode,
  165. deptId: Number(store.curDeptDetails.deptId)
  166. }).then(response => {
  167. carrierCode.value = vehicleObj.carrierCode
  168. if (response.code == 200) {
  169. if (response.data.length > 1) {
  170. selectDaywork.value.open(response.data)
  171. } else {
  172. handleSelectDaywork(response.data[0].lotCode)
  173. }
  174. } else {
  175. uni.showToast({
  176. icon: 'none',
  177. title: response.msg,
  178. duration: 2000
  179. })
  180. }
  181. })
  182. }
  183. //H5扫码器关闭
  184. function qrReaderClose() {
  185. showQrCodeReader.value = false;
  186. }
  187. function handleToBatchReporting(item) {
  188. store.planDetails = item
  189. uni.navigateTo({
  190. url: '/pages/batchReporting/index'
  191. })
  192. }
  193. function handleSearch() {
  194. let reqParam = {
  195. keywords: keywords.value
  196. }
  197. reqParam.tenantId = !store.tenantId ? store.userInfo.tenantId : store.tenantId;
  198. init(reqParam)
  199. }
  200. function handleScanCode() {
  201. showQrCodeReader.value = true;
  202. }
  203. </script>
  204. <style lang="scss">
  205. $nav-height: 60rpx;
  206. .box-bg {
  207. width: 100%;
  208. background-color: #F5F5F5;
  209. padding: 5rpx 0;
  210. justify-content: space-around;
  211. align-items: center;
  212. .input-view {
  213. width: 100%;
  214. flex: 4;
  215. background-color: #f8f8f8;
  216. height: $nav-height;
  217. border: 1rpx solid #999;
  218. border-radius: 15rpx;
  219. padding: 0 15rpx;
  220. flex-wrap: nowrap;
  221. margin: 0 10rpx 20rpx;
  222. line-height: $nav-height;
  223. .input-uni-icon {
  224. line-height: $nav-height;
  225. }
  226. .nav-bar-input {
  227. width: 80%;
  228. height: $nav-height;
  229. line-height: $nav-height;
  230. padding: 0 5rpx;
  231. background-color: #f8f8f8;
  232. }
  233. }
  234. .search {
  235. width: 20%;
  236. text-align: center;
  237. color: #808080;
  238. margin-top: -20rpx;
  239. }
  240. }
  241. .uni-column {
  242. background-color: rgba(245, 245, 245, 1);
  243. // height: calc(100% - 40rpx);
  244. }
  245. .list-item {
  246. background-color: #fff;
  247. position: relative;
  248. padding: 16rpx;
  249. padding-bottom: 24rpx;
  250. border-radius: 24rpx;
  251. margin-bottom: 24rpx;
  252. .title-container {
  253. justify-content: space-between;
  254. margin-top: 8rpx;
  255. margin-bottom: 16rpx;
  256. .title {
  257. height: 48rpx;
  258. align-items: center;
  259. .label {
  260. font-size: 32rpx;
  261. font-weight: bold;
  262. &.code {
  263. margin-left: 8rpx;
  264. }
  265. }
  266. }
  267. .tag {
  268. border: 1px solid #1ce5b0;
  269. background-color: #f6fffd;
  270. padding: 8rpx;
  271. border-radius: 8rpx;
  272. .label {
  273. color: #1ce5b0;
  274. font-size: 24rpx;
  275. }
  276. &.not-start {
  277. border: 1px solid #bbbbbb;
  278. background-color: #f5f5f5;
  279. .label {
  280. color: #bbbbbb;
  281. }
  282. }
  283. }
  284. }
  285. .item-info {
  286. margin-bottom: 8rpx;
  287. .label {
  288. font-size: 28rpx;
  289. width: 220rpx;
  290. color: #808080;
  291. &.right {
  292. flex: 1;
  293. color: #000000;
  294. }
  295. }
  296. }
  297. }
  298. .bottom {
  299. height: 10%;
  300. position: fixed;
  301. right: 0;
  302. bottom: 0;
  303. left: 0;
  304. height: 100rpx;
  305. border-top: 1px solid #999999;
  306. padding: 16rpx 32rpx;
  307. align-items: center;
  308. background-color: #fff;
  309. justify-content: space-evenly;
  310. .start-batch-btn {
  311. flex: 1;
  312. height: 80rpx;
  313. line-height: 80rpx;
  314. border-radius: 8rpx;
  315. color: #FFFFFF;
  316. font-size: 28rpx;
  317. }
  318. }
  319. </style>