index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. <template>
  2. <view class="uni-column" style="padding: 24rpx">
  3. <view v-if="form.length>0" style="margin-bottom: 20rpx;">
  4. <view>
  5. <view class="item-info uni-row">
  6. <view style="flex: 2;">
  7. <button :class="[checkAll ? 'active' : 'select' ]" @click="handleAll"
  8. style="margin-left: 0rpx; ">全选</button>
  9. </view>
  10. <button @click="handleSearch" style="margin-right: 20rpx ;">搜索</button>
  11. <uni-data-select v-model=" workshopId" :localdata="workshopList" @change="handleChangeWorkshop"
  12. :clear="false" class="label right"
  13. style="width: 50rpx; outline: 2rpx solid #999999;border-radius: 10rpx;flex: 1;"></uni-data-select>
  14. </view>
  15. </view>
  16. </view>
  17. <view v-if="form.length>0" style="height: calc(100% - 200rpx); overflow: auto;">
  18. <view v-for="(item, index) in form" :key="index" :class="{'list-item':true,'selected':isSelected(item)}"
  19. @click="handleSelection(item)">
  20. <view class="title-container uni-row">
  21. <view class="title uni-row"><text class="label">{{item.lotCode}}</text></view>
  22. <view><button class="start-batch-btn uni-row" type=primary @click='handleAdd'>换箱</button></view>
  23. </view>
  24. <view class="item-info uni-row">
  25. <text class="label">产品描述</text>
  26. <text class="label right">{{item['productDescription']}}</text>
  27. </view>
  28. <view class="item-info uni-row">
  29. <text class="label">关联箱号</text>
  30. <text class="label right">{{item['carrierName']}}</text>
  31. </view>
  32. <view class="item-info uni-row">
  33. <text class="label">下序</text>
  34. <text class="label right">{{item['process']}}</text>
  35. </view>
  36. <view class="item-info uni-row">
  37. <text class="label">下序工段</text>
  38. <text class="label right">{{item['dept']}}</text>
  39. </view>
  40. </view>
  41. </view>
  42. <view v-if="form.length==0" style="color: #999;margin: 50% auto;">
  43. <text>扫码开始快速报工</text>
  44. </view>
  45. <view v-if="form.length==0" class='bottom-btn-container'>
  46. <button class="start-batch-btn uni-row" type=primary @click='handleAdd'>扫码开始报工</button>
  47. </view>
  48. <view v-if="form.length>0" class='btn uni-row'>
  49. <button class='bottom-btn left-btn' type="warn" @click="handleEnd">结束报工</button>
  50. <button class='bottom-btn right-btn' type="primary" @click="handleContinue">继续扫码</button>
  51. </view>
  52. <dialog-lotReporting ref="lotReporting"></dialog-lotReporting>
  53. </view>
  54. </template>
  55. <script setup>
  56. import {
  57. getPlanDetailsList
  58. } from '@/api/business/planDetails.js'
  59. import {
  60. ref
  61. } from 'vue'
  62. import path from '@/api/base/path.js'
  63. const lotReporting = ref(null)
  64. const workshopId = ref();
  65. const form = ref([]); //表单数据true
  66. const checkAll = ref(false); //是否全选
  67. const listData = ref([]);
  68. const selection = ref([]); //选中数据
  69. const workshopList = ref([]); //车间数据
  70. //初始化
  71. function init() {
  72. // uni.showLoading({
  73. // title: '加载中'
  74. // });
  75. workshopList.value = [{
  76. value: '1762872520725155842',
  77. text: '一号车间'
  78. },
  79. {
  80. value: '1762874510792380417',
  81. text: '二三车间'
  82. }
  83. ];
  84. workshopId.value = '1762872520725155842';
  85. form.value = [{
  86. lotCode: 'DC1885224440',
  87. productDescription: '万博_0395614149_15*110.1',
  88. carrierName: 'X12522、X55222、X15522、J5211',
  89. process: '热处理',
  90. dept: '热处理',
  91. },
  92. {
  93. lotCode: 'DC1885224423',
  94. productDescription: '万博_0395614149_15*110.1',
  95. carrierName: 'X12522、X55222、X15522、J5211',
  96. process: '热处理',
  97. dept: '热处理',
  98. },
  99. {
  100. lotCode: 'DC1885224423',
  101. productDescription: '万博_0395614149_15*110.1',
  102. carrierName: 'X12522、X55222、X15522、J5211',
  103. process: '热处理',
  104. dept: '热处理',
  105. },
  106. {
  107. lotCode: 'DC1885224423',
  108. productDescription: '万博_0395614149_15*110.1',
  109. carrierName: 'X12522、X55222、X15522、J5211',
  110. process: '热处理',
  111. dept: '热处理',
  112. },
  113. {
  114. lotCode: 'DC1885224423',
  115. productDescription: '万博_0395614149_15*110.1',
  116. carrierName: 'X12522、X55222、X15522、J5211',
  117. process: '热处理',
  118. dept: '热处理',
  119. },
  120. {
  121. lotCode: 'DC1885224423',
  122. productDescription: '万博_0395614149_15*110.1',
  123. carrierName: 'X12522、X55222、X15522、J5211',
  124. process: '热处理',
  125. dept: '热处理',
  126. }
  127. ];
  128. }
  129. function handleAdd() {
  130. let data = [{
  131. productionPlanNo: '456123',
  132. lotCode: 'D597412820',
  133. productDescription: '8669sdfrfw',
  134. carrierName: 'X12522、X55222、X15522',
  135. nextProcess: {
  136. processAlias: '热处理'
  137. }
  138. },
  139. {
  140. productionPlanNo: '456123',
  141. lotCode: 'D597412820',
  142. productDescription: '8669sdfrfw',
  143. carrierName: 'X12522、X55222、X15522',
  144. nextProcess: {
  145. processAlias: '热处理'
  146. }
  147. },
  148. {
  149. productionPlanNo: '456123',
  150. lotCode: 'D597412820',
  151. productDescription: '8669sdfrfw',
  152. carrierName: 'X12522、X55222、X15522',
  153. nextProcess: {
  154. processAlias: '热处理'
  155. }
  156. }
  157. ]
  158. lotReporting.value.open(data);
  159. }
  160. // 全选按钮操作
  161. function handleAll() {
  162. //清空选中数据
  163. selection.value.length = 0;
  164. if (checkAll.value) {
  165. //变更选中状态
  166. checkAll.value = false;
  167. } else {
  168. checkAll.value = true;
  169. form.value.findIndex(item => handleSelection(item))
  170. }
  171. }
  172. function handleChangeWorkshop() {}
  173. function isSelected(item) {
  174. return selection.value.includes(item);
  175. }
  176. //
  177. function handleSelection(item) {
  178. const buttonIndex = selection.value.findIndex(selectedItem => selectedItem === item);
  179. if (buttonIndex > -1) {
  180. selection.value.splice(buttonIndex, 1); // 取消选中
  181. } else {
  182. selection.value.push(item); // 选中
  183. }
  184. if (selection.value.length == form.value.length) {
  185. checkAll.value = true;
  186. } else {
  187. checkAll.value = false;
  188. }
  189. }
  190. init();
  191. </script>
  192. <style lang="scss">
  193. $nav-height: 60rpx;
  194. .bottom-btn-container {
  195. position: fixed;
  196. top: 80%;
  197. right: 20rpx;
  198. left: 20rpx;
  199. .start-batch-btn {
  200. margin-bottom: 24rpx;
  201. border-radius: 8rpx;
  202. background-color: #00e2a6;
  203. width: 80%;
  204. }
  205. }
  206. .active {
  207. flex: 1;
  208. height: 40rpx;
  209. font-size: 20rpx;
  210. background-color: #5e6eff;
  211. border: 1px solid #5e6eff;
  212. color: #000000;
  213. }
  214. .select {
  215. flex: 1;
  216. height: 40rpx;
  217. font-size: 20rpx;
  218. background-color: #5e6eff;
  219. border: 1px solid #5e6eff;
  220. color: #ffffff;
  221. }
  222. .btn {
  223. position: fixed;
  224. right: 0;
  225. bottom: 0;
  226. left: 0;
  227. height: 100rpx;
  228. padding: 16rpx 24rpx;
  229. align-items: center;
  230. background-color: #FFFFFF;
  231. justify-content: space-between;
  232. .bottom-btn {
  233. flex: 1;
  234. font-size: 28rpx;
  235. color: #FFFFFF;
  236. &.left-btn {
  237. // background-color: #a4adb3;
  238. }
  239. &.right-btn {
  240. background-color: #1684fc;
  241. margin-left: 24rpx;
  242. }
  243. }
  244. }
  245. .box-bg {
  246. width: 100%;
  247. background-color: #F5F5F5;
  248. padding: 5rpx 0;
  249. justify-content: space-around;
  250. align-items: center;
  251. .input-view {
  252. width: 100%;
  253. flex: 4;
  254. background-color: #f8f8f8;
  255. height: $nav-height;
  256. border: 1rpx solid #999;
  257. border-radius: 15rpx;
  258. padding: 0 15rpx;
  259. flex-wrap: nowrap;
  260. margin: 0 10rpx 20rpx;
  261. line-height: $nav-height;
  262. .input-uni-icon {
  263. line-height: $nav-height;
  264. }
  265. .nav-bar-input {
  266. width: 80%;
  267. height: $nav-height;
  268. line-height: $nav-height;
  269. padding: 0 5rpx;
  270. background-color: #f8f8f8;
  271. }
  272. }
  273. .search {
  274. width: 20%;
  275. text-align: center;
  276. color: #808080;
  277. margin-top: -20rpx;
  278. }
  279. }
  280. .uni-column {
  281. background-color: rgba(245, 245, 245, 1);
  282. height: calc(100% - 40rpx);
  283. }
  284. .list-item {
  285. background-color: #fff;
  286. position: relative;
  287. padding: 16rpx;
  288. padding-bottom: 24rpx;
  289. border-radius: 24rpx;
  290. margin-bottom: 24rpx;
  291. .title-container {
  292. justify-content: space-between;
  293. margin-top: 8rpx;
  294. margin-bottom: 16rpx;
  295. .title {
  296. height: 48rpx;
  297. align-items: center;
  298. .label {
  299. font-size: 32rpx;
  300. font-weight: bold;
  301. &.code {
  302. margin-left: 8rpx;
  303. }
  304. }
  305. }
  306. .tag {
  307. border: 1px solid #1ce5b0;
  308. background-color: #f6fffd;
  309. padding: 8rpx;
  310. border-radius: 8rpx;
  311. .label {
  312. color: #1ce5b0;
  313. font-size: 24rpx;
  314. }
  315. &.not-start {
  316. border: 1px solid #bbbbbb;
  317. background-color: #f5f5f5;
  318. .label {
  319. color: #bbbbbb;
  320. }
  321. }
  322. }
  323. }
  324. .item-info {
  325. margin-bottom: 8rpx;
  326. .label {
  327. font-size: 28rpx;
  328. width: 150rpx;
  329. color: #808080;
  330. &.right {
  331. flex: 1;
  332. color: #000000;
  333. }
  334. }
  335. }
  336. }
  337. .selected {
  338. border: 1rpx solid #c0c4fc;
  339. background-color: #c0c4fc;
  340. /* 选中之后样式 */
  341. }
  342. </style>