boxNumberOutStacking.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. <template>
  2. <gui-page :custom-header="true" :header-class="['gui-theme-background-color']">
  3. <template #gHeader>
  4. <view style="height:44px;" class="gui-flex gui-nowrap gui-rows gui-align-items-center">
  5. <!-- 使用组件实现返回按钮及返回首页按钮 -->
  6. <text
  7. style="font-size:44rpx;"
  8. class="gui-header-leader-btns gui-color-white font-icons"
  9. @tap="goBack"
  10. >&#xe6c5;</text>
  11. <!-- 导航文本此处也可以是其他自定义内容 -->
  12. <text
  13. class="gui-h4 gui-blod gui-flex1 gui-text-center gui-ellipsis gui-color-white gui-primary-text"
  14. >栈板列表</text>
  15. <!-- 此处加一个右侧展位元素与左侧同宽,实现标题居中 -->
  16. <!-- 实际宽度请根据自己情况设置 -->
  17. <view style="width:40px;" />
  18. <!-- 如果右侧有其他内容可以利用条件编译和定位来实现 -->
  19. </view>
  20. </template>
  21. <template #gBody>
  22. <view class="list-content">
  23. <view class="select-item">
  24. <text class="store-text">出栈栈板</text>
  25. <view class="custom-select">
  26. <uni-data-select
  27. v-model="submitParams.wmsPalletId"
  28. :localdata="locationList"
  29. @change="handleSelect"
  30. />
  31. </view>
  32. </view>
  33. <view v-if="boxNumberList.length > 0">
  34. <view
  35. v-for="(item, key) in boxNumberList"
  36. :key="key"
  37. class="card-list-flexbox"
  38. @click="handleCheckedItem(item)"
  39. >
  40. <view v-if="computedChecked(item.id)" class="checkbox-cubes">
  41. <view class="checkbox-box" />
  42. <view class="checkbox-icon">✔</view>
  43. </view>
  44. <view class="card-list-item">
  45. <text class="text-1 gui-color-gray">{{ item.materialLots }}</text>
  46. </view>
  47. <view class="card-list-item">
  48. <text class="text-1 gui-color-gray">物料名称</text>
  49. <text class="text-2 gui-color-gray">{{ item.materialName }}</text>
  50. </view>
  51. <view class="card-list-item">
  52. <text class="text-1 gui-color-gray">批次数量</text>
  53. <text class="text-2 gui-color-gray">{{ computedMaterialQty(item.qty) }}</text>
  54. </view>
  55. </view>
  56. </view>
  57. <view v-else>
  58. <view class="bg-image">
  59. <image src="@/static/empty.png" mode="heightFix" />
  60. <text>这里什么都没有...</text>
  61. </view>
  62. </view>
  63. </view>
  64. <gui-right-menus>
  65. <!-- 扩展按钮 -->
  66. <template #menus-more>
  67. <view
  68. hover-class="gui-tap"
  69. class="menu-items gui-bg-primary gui-flex gui-columns gui-justify-content-center"
  70. @click="handleComplute"
  71. >
  72. <text class="menu-text gui-block gui-text-center gui-color-white">确认出栈</text>
  73. </view>
  74. </template>
  75. <!-- 核心按钮 -->
  76. <template #menus-primary>
  77. <view class="menu-items gui-bg-primary gui-flex gui-columns gui-justify-content-center">
  78. <text class="menu-icon gui-color-white gui-block gui-text-center gui-icons">&#xe614;</text>
  79. <text class="menu-text gui-color-white gui-block gui-text-center">功能</text>
  80. </view>
  81. </template>
  82. </gui-right-menus>
  83. </template>
  84. </gui-page>
  85. </template>
  86. <script>
  87. import {
  88. onReachBottom
  89. } from '@dcloudio/uni-app'
  90. import {
  91. ref,
  92. defineComponent,
  93. computed
  94. } from 'vue'
  95. export default defineComponent({
  96. setup() {
  97. const checkboxParams = ref({
  98. checkboxIds: [],
  99. checkedIds: []
  100. })
  101. const computedMaterialQty = computed(() => {
  102. return item => {
  103. return item / 10000 > 1 ? (item / 10000) + 'w' : item
  104. }
  105. })
  106. const computedChecked = computed(() => {
  107. return item => checkboxParams.value.checkedIds.includes(item)
  108. })
  109. const submitParams = ref({
  110. wmsPalletId: '', // 栈板ID
  111. materialLots: [] // 选中的字段
  112. })
  113. const queryParams = ref({
  114. pageSize: 20,
  115. pageNo: 1
  116. })
  117. const locationList = ref([])
  118. const boxNumberList = ref([])
  119. uni.$reqGet('getWmsTrestleDropDownList')
  120. .then(({
  121. data,
  122. msg
  123. }) => {
  124. if (data?.length > 0) {
  125. for (let x = 0; x < data.length; x++) {
  126. locationList.value.push({
  127. text: data[x].name,
  128. value: data[x].id
  129. })
  130. }
  131. }
  132. })
  133. // 多选框选中事件
  134. const handleCheckedItem = function(item) {
  135. const ifExist = checkboxParams.value.checkedIds.includes(item?.id)
  136. if (ifExist) {
  137. const fdIndex = checkboxParams.value.checkedIds.findIndex(option => option === item?.id)
  138. checkboxParams.value.checkedIds.splice(fdIndex, 1)
  139. } else {
  140. checkboxParams.value.checkedIds.push(item?.id)
  141. }
  142. }
  143. const handleSelect = function(wmsPalletId) {
  144. uni.$reqGet('pdaMaterialsPage', {
  145. ...queryParams.value,
  146. wmsPalletId
  147. })
  148. .then(({
  149. data
  150. }) => {
  151. submitParams.value.materialLots.length = 0
  152. boxNumberList.value.length = 0
  153. checkboxParams.value.checkedIds.length = 0
  154. boxNumberList.value = data?.list ?? []
  155. checkboxParams.value.checkboxIds = Array.from(boxNumberList.value, item => item
  156. ?.id)
  157. })
  158. }
  159. const handleComplute = function() {
  160. if (submitParams.value.wmsPalletId) {
  161. if (checkboxParams.value.checkedIds.length === 0) {
  162. uni.$grace.msg('请选择箱号')
  163. return
  164. }
  165. const ids = checkboxParams.value.checkedIds.toString(',')
  166. uni.$reqDelete('pdaDeleteBatch', {
  167. ids
  168. })
  169. .then(({
  170. code,
  171. data,
  172. msg
  173. }) => {
  174. if (code === 0) {
  175. uni.$grace.msg('出栈成功')
  176. setTimeout(() => {
  177. uni.redirectTo({
  178. url: '/pages/workbranch/warehouse/trestle/boxNumberOutStacking'
  179. })
  180. }, 500)
  181. } else {
  182. uni.$grace.msg(msg)
  183. }
  184. })
  185. } else {
  186. uni.$grace.msg('请先选择栈板')
  187. }
  188. }
  189. const goBack = function() {
  190. uni.$goBack('/pages/workbranch/warehouse/trestle/trestleList')
  191. }
  192. // uniapp移动端触底事件
  193. onReachBottom(() => {
  194. queryParams.value.pageNo += 1
  195. uni.$reqGet('pdaMaterialsPage', queryParams.value)
  196. .then(({
  197. data
  198. }) => {
  199. Array.prototype.push.call(boxNumberList.value, ...data?.list ?? [])
  200. Array.prototype.push.call(checkboxParams.value.checkboxIds, ...Array.from(data
  201. ?.list, item => item
  202. ?.id))
  203. })
  204. })
  205. return {
  206. submitParams,
  207. locationList,
  208. boxNumberList,
  209. handleComplute,
  210. goBack,
  211. computedMaterialQty,
  212. computedChecked,
  213. handleCheckedItem,
  214. handleSelect
  215. }
  216. }
  217. })
  218. </script>
  219. <style lang="scss" scoped>
  220. .gui-sbody {
  221. font-size: 14px;
  222. background-color: rgba(234, 239, 242, 1);
  223. }
  224. .gui-header-leader-btns {
  225. color: black;
  226. font-size: 28px !important;
  227. margin-left: 24rpx;
  228. margin-right: 24rpx;
  229. }
  230. .list-content {
  231. margin-top: 80px;
  232. background-color: #edeeee;
  233. }
  234. .gui-button-mini {
  235. line-height: 32px !important;
  236. height: 32px !important;
  237. width: 160rpx !important;
  238. margin-right: 34rpx;
  239. .gui-button-text-mini {
  240. line-height: 32px;
  241. }
  242. }
  243. .select-item {
  244. display: flex;
  245. flex-direction: row;
  246. justify-content: space-between;
  247. align-items: center;
  248. margin-bottom: 10px;
  249. padding: 12px;
  250. background-color: white;
  251. .store-text {
  252. width: 80px;
  253. text-align: center;
  254. margin-right: 14px;
  255. }
  256. .custom-select {
  257. display: flex;
  258. flex-direction: row;
  259. justify-content: center;
  260. align-items: center;
  261. line-height: 40px;
  262. width: 100%;
  263. min-width: 275px;
  264. }
  265. }
  266. ::v-deep .uni-checkbox-input {
  267. border-radius: 50% !important;
  268. }
  269. .card-list-flexbox {
  270. display: flex;
  271. flex-direction: row;
  272. align-items: center;
  273. flex-wrap: wrap;
  274. margin: 0 2px 4px 2px;
  275. .card-list-item,
  276. .card-list-item-operation {
  277. width: 750rpx;
  278. height: 40px;
  279. margin-bottom: 3rpx;
  280. display: flex;
  281. flex-direction: row;
  282. align-items: center;
  283. justify-content: space-between;
  284. background-color: #fff;
  285. uni-text {
  286. font-size: 14px;
  287. height: 50rpx;
  288. text-align: left;
  289. padding: 0 12px;
  290. display: flex;
  291. flex-direction: row;
  292. align-items: center;
  293. }
  294. .text-1 {
  295. flex: 1;
  296. height: 40px;
  297. justify-content: flex-start;
  298. }
  299. .text-2 {
  300. flex: 3;
  301. height: 40px;
  302. justify-content: flex-end;
  303. margin-right: 4px;
  304. padding: 2px 6px;
  305. }
  306. }
  307. .card-list-item-operation {
  308. justify-content: flex-end;
  309. }
  310. .card-list-item:nth-of-type(1) {
  311. .text-1 {
  312. font-weight: bold;
  313. color: black !important;
  314. }
  315. .text-1::before {
  316. content: "";
  317. width: 4px;
  318. height: 20px;
  319. border-radius: 4px;
  320. margin-right: 4px;
  321. background-color: skyblue;
  322. }
  323. }
  324. }
  325. .checkbox-cubes {
  326. width: 30px;
  327. height: 124px;
  328. position: absolute;
  329. .checkbox-box {
  330. /*宽高为0*/
  331. width: 0;
  332. height: 0;
  333. position: relative;
  334. /*在三角形底边设置一个边界颜色*/
  335. border-left: 28px solid skyblue;
  336. /*其它3边设置相同颜色,*/
  337. border-bottom: 25px solid transparent;
  338. }
  339. .checkbox-icon {
  340. height: 20px;
  341. position: absolute;
  342. top: 0;
  343. left: 3px;
  344. display: flex;
  345. align-items: center;
  346. font-size: 10px;
  347. font-weight: bold;
  348. color: white;
  349. }
  350. }
  351. </style>