index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. <template>
  2. <view class="uni-column" style="padding: 24rpx ;background-color: #f5f5f5;">
  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" calss="item-info uni-row" style="overflow: auto; padding-bottom: 100rpx">
  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. <dialog-Search ref="searchRef"></dialog-Search>
  54. </view>
  55. </template>
  56. <script setup>
  57. import {
  58. getPlanDetailsList
  59. } from '@/api/business/planDetails.js'
  60. import {
  61. ref
  62. } from 'vue'
  63. import path from '@/api/base/path.js'
  64. const lotReporting = ref(null);
  65. const searchRef = ref(null);
  66. const workshopId = ref();
  67. const form = ref([]); //表单数据true
  68. const checkAll = ref(false); //是否全选
  69. const listData = ref([]);
  70. const selection = ref([]); //选中数据
  71. const workshopList = ref([]); //车间数据
  72. //初始化
  73. function init() {
  74. // uni.showLoading({
  75. // title: '加载中'
  76. // });
  77. workshopList.value = [{
  78. value: '1762872520725155842',
  79. text: '一号车间'
  80. },
  81. {
  82. value: '1762874510792380417',
  83. text: '二三车间'
  84. }
  85. ];
  86. workshopId.value = '1762872520725155842';
  87. form.value = [{
  88. lotCode: 'DC1885224440',
  89. productDescription: '万博_0395614149_15*110.1',
  90. carrierName: 'X12522、X55222、X15522、J5211',
  91. process: '热处理',
  92. dept: '热处理',
  93. },
  94. {
  95. lotCode: 'DC1885224423',
  96. productDescription: '万博_0395614149_15*110.1',
  97. carrierName: 'X12522、X55222、X15522、J5211',
  98. process: '热处理',
  99. dept: '热处理',
  100. },
  101. {
  102. lotCode: 'DC1885224423',
  103. productDescription: '万博_0395614149_15*110.1',
  104. carrierName: 'X12522、X55222、X15522、J5211',
  105. process: '热处理',
  106. dept: '热处理',
  107. },
  108. {
  109. lotCode: 'DC1885224423',
  110. productDescription: '万博_0395614149_15*110.1',
  111. carrierName: 'X12522、X55222、X15522、J5211',
  112. process: '热处理',
  113. dept: '热处理',
  114. },
  115. {
  116. lotCode: 'DC1885224423',
  117. productDescription: '万博_0395614149_15*110.1',
  118. carrierName: 'X12522、X55222、X15522、J5211',
  119. process: '热处理',
  120. dept: '热处理',
  121. },
  122. {
  123. lotCode: 'DC1885224423',
  124. productDescription: '万博_0395614149_15*110.1',
  125. carrierName: 'X12522、X55222、X15522、J5211',
  126. process: '热处理',
  127. dept: '热处理',
  128. }
  129. ];
  130. }
  131. function handleAdd() {
  132. let data = [{
  133. productionPlanNo: '456123',
  134. lotCode: 'D597412820',
  135. productDescription: '8669sdfrfw',
  136. carrierName: 'X12522、X55222、X15522',
  137. nextProcess: {
  138. processAlias: '热处理'
  139. }
  140. },
  141. {
  142. productionPlanNo: '456123',
  143. lotCode: 'D597412820',
  144. productDescription: '8669sdfrfw',
  145. carrierName: 'X12522、X55222、X15522',
  146. nextProcess: {
  147. processAlias: '热处理'
  148. }
  149. },
  150. {
  151. productionPlanNo: '456123',
  152. lotCode: 'D597412820',
  153. productDescription: '8669sdfrfw',
  154. carrierName: 'X12522、X55222、X15522',
  155. nextProcess: {
  156. processAlias: '热处理'
  157. }
  158. }
  159. ]
  160. lotReporting.value.open(data);
  161. }
  162. // 搜索按钮操作
  163. function handleSearch() {
  164. searchRef.value.open();
  165. }
  166. // 全选按钮操作
  167. function handleAll() {
  168. //清空选中数据
  169. selection.value.length = 0;
  170. if (checkAll.value) {
  171. //变更选中状态
  172. checkAll.value = false;
  173. } else {
  174. checkAll.value = true;
  175. form.value.findIndex(item => handleSelection(item))
  176. }
  177. }
  178. function handleChangeWorkshop() {}
  179. function isSelected(item) {
  180. return selection.value.includes(item);
  181. }
  182. //
  183. function handleSelection(item) {
  184. const buttonIndex = selection.value.findIndex(selectedItem => selectedItem === item);
  185. if (buttonIndex > -1) {
  186. selection.value.splice(buttonIndex, 1); // 取消选中
  187. } else {
  188. selection.value.push(item); // 选中
  189. }
  190. if (selection.value.length == form.value.length) {
  191. checkAll.value = true;
  192. } else {
  193. checkAll.value = false;
  194. }
  195. }
  196. init();
  197. </script>
  198. <style lang="scss">
  199. .active {
  200. flex: 1;
  201. height: 40rpx;
  202. font-size: 20rpx;
  203. background-color: #5e6eff;
  204. border: 1px solid #5e6eff;
  205. color: #000000;
  206. }
  207. .select {
  208. flex: 1;
  209. height: 40rpx;
  210. font-size: 20rpx;
  211. background-color: #5e6eff;
  212. border: 1px solid #5e6eff;
  213. color: #ffffff;
  214. }
  215. .btn {
  216. position: fixed;
  217. right: 0;
  218. bottom: 0;
  219. left: 0;
  220. height: 100rpx;
  221. padding: 16rpx 24rpx;
  222. align-items: center;
  223. background-color: #FFFFFF;
  224. justify-content: space-between;
  225. .bottom-btn {
  226. flex: 1;
  227. font-size: 28rpx;
  228. color: #FFFFFF;
  229. &.left-btn {
  230. // background-color: #a4adb3;
  231. }
  232. &.right-btn {
  233. background-color: #1684fc;
  234. margin-left: 24rpx;
  235. }
  236. }
  237. }
  238. .search {
  239. width: 20%;
  240. text-align: center;
  241. color: #808080;
  242. margin-top: -20rpx;
  243. }
  244. .list-item {
  245. background-color: #fff;
  246. position: relative;
  247. padding: 16rpx;
  248. padding-bottom: 24rpx;
  249. border-radius: 24rpx;
  250. margin-bottom: 24rpx;
  251. .title-container {
  252. justify-content: space-between;
  253. margin-top: 8rpx;
  254. margin-bottom: 16rpx;
  255. .title {
  256. height: 48rpx;
  257. align-items: center;
  258. .label {
  259. font-size: 32rpx;
  260. font-weight: bold;
  261. &.code {
  262. margin-left: 8rpx;
  263. }
  264. }
  265. }
  266. .tag {
  267. border: 1px solid #1ce5b0;
  268. background-color: #f6fffd;
  269. padding: 8rpx;
  270. border-radius: 8rpx;
  271. .label {
  272. color: #1ce5b0;
  273. font-size: 24rpx;
  274. }
  275. &.not-start {
  276. border: 1px solid #bbbbbb;
  277. background-color: #f5f5f5;
  278. .label {
  279. color: #bbbbbb;
  280. }
  281. }
  282. }
  283. }
  284. .item-info {
  285. margin-bottom: 8rpx;
  286. .label {
  287. font-size: 28rpx;
  288. width: 150rpx;
  289. color: #808080;
  290. &.right {
  291. flex: 1;
  292. color: #000000;
  293. }
  294. }
  295. }
  296. }
  297. .selected {
  298. border: 1rpx solid #c0c4fc;
  299. background-color: #c0c4fc;
  300. /* 选中之后样式 */
  301. }
  302. </style>