index.vue 6.2 KB

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