index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <view class='container'>
  3. <view class='content'>
  4. <view>
  5. <text class='title'>选择批次号</text>
  6. <view>
  7. <view class="batchNo uni-row">
  8. <view :class="{'batchNo-item':true, 'uni-row': true,'check':selected === item}"
  9. v-for="(item,index) in batchNoList" :key='index' @click="handleCheckBatchNo(item)">
  10. {{item}}
  11. </view>
  12. </view>
  13. </view>
  14. </view>
  15. <view class='middle'>
  16. <view class='segment'></view>
  17. <uni-icons type="link" size="30" style="margin: 10rpx; transform: rotate(135deg);"></uni-icons>
  18. <view class='segment'></view>
  19. </view>
  20. <view>
  21. <text class='title'>绑定载具</text>
  22. <view class="vehicleList uni-row">
  23. <view class="vehicleNo uni-row" v-for="(item,index) in vehicleList">
  24. <text>{{item.carrierCode}}</text>
  25. <text @click="handleDelVehicleNo(index)">×</text>
  26. </view>
  27. </view>
  28. <view>
  29. <button style='background-color: rgba(0, 226, 166,1);
  30. color: white;margin: 20rpx auto;
  31. width: 80%;' @click='scanCodeHandle()'>扫码</button>
  32. </view>
  33. </view>
  34. <view class='middle'>
  35. <view class='segment'></view>
  36. <uni-icons type="paperclip" size="30" style="margin: 10rpx;"></uni-icons>
  37. <view class='segment'></view>
  38. </view>
  39. <view>
  40. <text class='title' style="margin-bottom: 50rpx;">基础信息</text>
  41. <view class="uni-row info">
  42. <label for="HeatNo">炉号</label>
  43. <!-- <input id="HeatNo" class="uni-input" v-model="basicInfo.heatNo" placeholder="请填写" /> -->
  44. <text id="HeatNo" class="uni-input">{{basicInfo.heatNo}}</text>
  45. </view>
  46. <view class='segment' style="width: 90%;margin: 20rpx auto;"></view>
  47. <view class="uni-row info">
  48. <label for="manufacturer">厂家</label>
  49. <!-- <input id="manufacturer" class="uni-input" v-model="basicInfo.manufacturer" placeholder="请填写" /> -->
  50. <text id="manufacturer" class="uni-input">{{basicInfo.manufacturer}}</text>
  51. </view>
  52. <view class='segment' style="width: 90%;margin: 20rpx auto;"></view>
  53. <view class="uni-row info">
  54. <label for="incomingInfo">来料信息</label>
  55. <!-- <input id="incomingInfo" class="uni-input" v-model="basicInfo.incomingInfo" placeholder="请填写" /> -->
  56. <text id="incomingInfo" class="uni-input">{{basicInfo.incomingInfo}}</text>
  57. </view>
  58. <view class='segment' style="width: 90%;margin: 20rpx auto;"></view>
  59. </view>
  60. </view>
  61. <view class='bottom uni-row'>
  62. <button class='add' type=primary @click='addHandle'>添加</button>
  63. </view>
  64. </view>
  65. </template>
  66. <script setup>
  67. import {
  68. ref
  69. } from 'vue'
  70. import {
  71. onLoad,
  72. onReady
  73. } from '@dcloudio/uni-app'
  74. import {
  75. getLotList
  76. } from "@/api/business/lot.js"
  77. import {
  78. saveDayWork
  79. } from '@/api/business/dayWork.js'
  80. onReady(() => {
  81. init();
  82. })
  83. const batchNoCheck = ref(false)
  84. const batchNoList = ref([])
  85. const vehicleList = ref([{
  86. carrierId: '1731475038666575873',
  87. carrierCode: '0001'
  88. },
  89. {
  90. carrierId: '1731467623237767169',
  91. carrierCode: '0002'
  92. }])
  93. const basicInfo = ref({
  94. heatNo: 'cs222',
  95. manufacturer: 'DMS',
  96. incomingInfo: 'L123456'
  97. })
  98. const selected = ref(null)
  99. const boxNo = ref(null)
  100. const productPlanId = ref('0')
  101. const dayWork = ref({})
  102. function init() {
  103. let obj = {}
  104. obj.productionPlanId = productPlanId.value;
  105. getLotList(obj).then(res => {
  106. for (var i = 0; i < res.rows.length; i++) {
  107. batchNoList.value.push(res.rows[i].lotCode)
  108. }
  109. console.log(batchNoList.value)
  110. })
  111. // getSubPlanDetailsList().then(res => {
  112. // console.log(res)
  113. // })
  114. }
  115. function handleCheckBatchNo(item) {
  116. selected.value = item;
  117. dayWork.value.lotId = item.id;
  118. dayWork.value.lotCode = item.lotCode;
  119. }
  120. function handleDelVehicleNo(index) {
  121. vehicleList.value.splice(index, 1);
  122. }
  123. function scanCodeHandle() {
  124. uni.scanCode({
  125. scanType: ['barCode'], // 条形码扫描
  126. onlyFromCamera: true, // 只允许相机扫码
  127. success: function(res) {
  128. vehicleList.value.push(res.result);
  129. }
  130. });
  131. }
  132. function addHandle() {
  133. dayWork.value.dayworkCarriers = vehicleList.value;
  134. saveDayWork(dayWork.value).then(res => {
  135. if(res.code === 200){
  136. uni.showToast({
  137. icon: 'success',
  138. title: '添加成功',
  139. duration: 2000
  140. });
  141. uni.navigateTo({
  142. url:'/pages/batchReporting/index'
  143. })
  144. }else{
  145. uni.showToast({
  146. icon: 'error',
  147. title: '添加失败',
  148. duration: 2000
  149. });
  150. }
  151. })
  152. }
  153. </script>
  154. <style lang="scss">
  155. .container {
  156. height: 100%;
  157. background-color: #f5f5f5;
  158. }
  159. .bottom {
  160. background-color: white;
  161. width: 100%;
  162. height: 10%;
  163. position: fixed;
  164. bottom: 0;
  165. align-items: center;
  166. .add {
  167. margin: 0 auto;
  168. width: 80%;
  169. height: 80rpx;
  170. line-height: 80rpx;
  171. padding-left: 0;
  172. }
  173. }
  174. .content {
  175. width: 90%;
  176. // height: auto;
  177. background-color: rgba(255, 255, 255, 1);
  178. margin: 50rpx auto;
  179. padding-bottom: 50rpx;
  180. padding-top: 20rpx;
  181. border-radius: 12rpx;
  182. .title {
  183. margin: 10rpx 39%;
  184. width: 30%;
  185. font-size: 36rpx;
  186. font-weight: bold;
  187. }
  188. }
  189. .batchNo {
  190. justify-content: flex-start;
  191. flex-wrap: wrap;
  192. width: 100%;
  193. height: 320rpx;
  194. overflow: auto;
  195. padding: 0 80rpx;
  196. margin-bottom: 40rpx;
  197. border-radius: 6rpx;
  198. .batchNo-item {
  199. justify-content: center;
  200. align-items: center;
  201. width: 240rpx;
  202. margin: 10rpx;
  203. height: 60rpx;
  204. border: 1px solid rgba(213, 213, 213, 1);
  205. border-radius: 6rpx;
  206. }
  207. .check {
  208. color: #FFF;
  209. border: 1 solid rgba(22, 132, 252, 1);
  210. background-color: rgba(22, 132, 252, 1);
  211. }
  212. }
  213. .vehicleList {
  214. justify-content: flex-start;
  215. flex-wrap: wrap;
  216. width: 100%;
  217. height: 120rpx;
  218. overflow: auto;
  219. padding: 0 80rpx;
  220. .vehicleNo {
  221. padding: 0 10rpx;
  222. margin: 10rpx;
  223. justify-content: space-between;
  224. align-items: center;
  225. width: 230rpx;
  226. height: 60rpx;
  227. border: 1px solid rgba(213, 213, 213, 1);
  228. border-radius: 6rpx;
  229. }
  230. }
  231. .middle {
  232. display: flex;
  233. flex-direction: row;
  234. align-items: center;
  235. justify-content: center
  236. }
  237. .segment {
  238. width: 280rpx;
  239. background-color: rgba(213, 213, 213, 1);
  240. border: 1rpx solid rgba(213, 213, 213, 1);
  241. }
  242. .info {
  243. width: 100%;
  244. justify-content: space-around;
  245. label {
  246. flex: 3;
  247. text-combine-upright: all;
  248. margin: 0 30rpx;
  249. }
  250. text {
  251. flex: 3;
  252. width: 80%;
  253. }
  254. }
  255. </style>