index.vue 8.7 KB

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