index.vue 8.5 KB

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