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