index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. <template>
  2. <view class="page-container">
  3. <uni-nav-bar
  4. fixed="true"
  5. statusBar="true"
  6. left-icon="back"
  7. title="领料"
  8. background-color="#157A2C"
  9. color="#fff"
  10. @clickLeft="back"
  11. right-icon="scan"
  12. @clickRight="HandlScanCode"
  13. >
  14. </uni-nav-bar>
  15. <view class="top-wrapper">
  16. <!-- <view class="tab_box rx-sc">
  17. <view class="tab_item" :class="{active: tabType == 1}" @click="handTab(1)">生产工单列表</view>
  18. <view class="tab_item" :class="{active: tabType == 2}" @click="handTab(2)">领料工单列表</view>
  19. </view> -->
  20. <view class="nav-tabs">
  21. <view class="nav-tabs__inner">
  22. <view
  23. class="nav-tabs__item"
  24. :class="{ 'nav-tabs__item--active': pickStatus == 0 }"
  25. @click="handNav(0)"
  26. >
  27. <text class="nav-tabs__text">工单</text>
  28. <view class="nav-tabs__badge">{{ navObj.unclaimedQuantity || 0 }}</view>
  29. </view>
  30. <view
  31. class="nav-tabs__item"
  32. :class="{ 'nav-tabs__item--active': pickStatus == 1 }"
  33. @click="handNav(1)"
  34. >
  35. <text class="nav-tabs__text">领料中</text>
  36. <view class="nav-tabs__badge">{{ navObj.claimedQuantity || 0 }}</view>
  37. </view>
  38. <view
  39. class="nav-tabs__item"
  40. :class="{ 'nav-tabs__item--active': pickStatus == 2 }"
  41. @click="handNav(2)"
  42. >
  43. <text class="nav-tabs__text">已出库</text>
  44. <view class="nav-tabs__badge">{{ navObj.outInQuantity || 0 }}</view>
  45. </view>
  46. </view>
  47. <view class="nav-tabs__filter" @click="handleSearch">
  48. <image class="nav-tabs__filter-icon" src="~@/static/pda/menu.svg"></image>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="list-container">
  53. <u-list @scrolltolower="scrolltolower">
  54. <pickCard v-if="dataList.length && pickStatus == 0" :list="dataList">
  55. </pickCard>
  56. <pickWorkCard
  57. v-if="dataList.length && pickStatus != 0"
  58. :list="dataList"
  59. >
  60. </pickWorkCard>
  61. <view v-else class="empty-wrapper">
  62. <u-empty iconSize="150" textSize="32" text="暂无工单"> </u-empty>
  63. </view>
  64. </u-list>
  65. </view>
  66. <view class="footer-bar" v-if="pickStatus == 0">
  67. <view class="footer-bar__left">
  68. <checkbox
  69. v-if="!seletedAll"
  70. color="#fff"
  71. :checked="seletedAll"
  72. @tap="_seletedAll"
  73. >全选</checkbox
  74. >
  75. <checkbox
  76. class="footer-bar__checkbox--active"
  77. color="#fff"
  78. v-else
  79. :checked="seletedAll"
  80. @tap="_seletedAll"
  81. >取消全选
  82. </checkbox>
  83. </view>
  84. <view class="footer-bar__right">
  85. <u-button
  86. type="success"
  87. size="small"
  88. class="footer-bar__btn"
  89. :disabled="!checkListLen"
  90. @click="jumpAdd"
  91. >
  92. <text class="footer-bar__btn-text">选择( {{ checkListLen }} )</text>
  93. </u-button>
  94. </view>
  95. </view>
  96. <SearchPopup mode="top" v-if="searchShow">
  97. <template v-slot:list>
  98. <view class="search-panel">
  99. <u-form
  100. labelPosition="left"
  101. :model="formData"
  102. labelWidth="180"
  103. labelAlign="left"
  104. class="search-panel__form"
  105. >
  106. <u-form-item
  107. label="工艺路线:"
  108. class="required-form"
  109. borderBottom
  110. prop="assetType"
  111. >
  112. <zxz-uni-data-select
  113. :localdata="produceList"
  114. v-model="formData.produceRoutingId"
  115. dataValue="id"
  116. format="{name}"
  117. dataKey="name"
  118. filterable
  119. ></zxz-uni-data-select>
  120. </u-form-item>
  121. </u-form>
  122. </view>
  123. </template>
  124. <template v-slot:operate>
  125. <view class="search-panel__actions">
  126. <u-button size="small" class="search-panel__btn search-panel__btn--reset" @click="searchCancel">
  127. 重置
  128. </u-button>
  129. <u-button
  130. type="success"
  131. size="small"
  132. class="search-panel__btn search-panel__btn--confirm"
  133. @click="search"
  134. >
  135. 确定
  136. </u-button>
  137. </view>
  138. </template>
  139. </SearchPopup>
  140. </view>
  141. </template>
  142. <script>
  143. import pickCard from "../components/pickCard.vue";
  144. import pickWorkCard from "../components/pickWorkCard.vue";
  145. import { workorderPage, producerouting } from "@/api/pda/workOrder.js";
  146. import { pickStatistics, getAllPickList } from "@/api/pda/picking.js";
  147. import SearchPopup from "../../components/searchPopup.vue";
  148. let [isEnd] = [false];
  149. export default {
  150. components: {
  151. pickCard,
  152. SearchPopup,
  153. pickWorkCard,
  154. },
  155. data() {
  156. return {
  157. tabType: 1,
  158. pickStatus: 0,
  159. formData: {
  160. produceRoutingId: "",
  161. },
  162. navObj: {
  163. unclaimedQuantity: 0,
  164. claimedQuantity: 0,
  165. },
  166. page: 1,
  167. size: 10,
  168. dataList: [],
  169. produceList: [],
  170. seletedAll: false, //全选状态
  171. searchShow: false,
  172. };
  173. },
  174. //选择的列表长度
  175. computed: {
  176. checkListLen() {
  177. let _fitArr = this.dataList.filter((f) => f.checked);
  178. return _fitArr.length;
  179. },
  180. },
  181. onLoad(option) {
  182. this.pickStatus = option.pickStatus || 0;
  183. this.produceFn();
  184. },
  185. onShow() {
  186. this.page = 1;
  187. // this.dataList = []
  188. this.getList();
  189. this.getpickTics();
  190. },
  191. methods: {
  192. search() {
  193. this.page = 1;
  194. this.getList();
  195. this.searchShow = false;
  196. },
  197. async getList() {
  198. let params = null;
  199. if (this.pickStatus == 0) {
  200. params = {
  201. pageNum: this.page,
  202. size: this.size,
  203. pickStatus: this.pickStatus,
  204. customerClient: 2,
  205. workOrderType: 1,
  206. produceRoutingId: this.formData.produceRoutingId,
  207. };
  208. } else {
  209. params = {
  210. pageNum: this.page,
  211. size: this.size,
  212. status: this.pickStatus,
  213. };
  214. }
  215. isEnd = false;
  216. const URL = this.pickStatus == 0 ? workorderPage : getAllPickList;
  217. // const res = await workorderPage(params);
  218. const res = await URL(params);
  219. if (params.pageNum === 1) {
  220. this.dataList = [];
  221. }
  222. let _list = res.list.map((m) => {
  223. return {
  224. checked: false,
  225. ...m,
  226. };
  227. });
  228. this.dataList.push(..._list);
  229. isEnd = this.dataList.length >= res.count;
  230. },
  231. getpickTics() {
  232. pickStatistics().then((res) => {
  233. this.navObj = res;
  234. });
  235. },
  236. handTab(type) {
  237. if (type != this.tabType) {
  238. this.tabType = type;
  239. }
  240. },
  241. handNav(type) {
  242. if (type != this.pickStatus) {
  243. this.pickStatus = type;
  244. this.page = 1;
  245. this.dataList = [];
  246. this.getList();
  247. }
  248. },
  249. scrolltolower() {
  250. if (isEnd) return;
  251. this.page++;
  252. this.getList();
  253. },
  254. _seletedAll() {
  255. if (!this.seletedAll) {
  256. this.seletedAll = true;
  257. this.dataList.forEach((e) => {
  258. e.checked = true;
  259. });
  260. } else {
  261. this.seletedAll = false;
  262. this.dataList.forEach((e) => {
  263. e.checked = false;
  264. });
  265. }
  266. },
  267. jumpAdd() {
  268. let url;
  269. url = "/pages/pda/picking/details";
  270. let arr = [];
  271. this.dataList.forEach((e) => {
  272. if (e.checked) {
  273. arr.push(e.id);
  274. }
  275. });
  276. let _arr = JSON.stringify(arr);
  277. url += `?arr=${encodeURIComponent(_arr)}`;
  278. uni.navigateTo({
  279. url,
  280. });
  281. },
  282. // 相机扫码
  283. HandlScanCode() {
  284. uni.scanCode({
  285. success: (res) => {
  286. console.log(res);
  287. },
  288. });
  289. //_this.Scancodedate('res')
  290. },
  291. handleSearch() {
  292. this.searchShow = true;
  293. },
  294. searchCancel() {
  295. this.formData.produceRoutingId = "";
  296. this.page = 1;
  297. this.getList();
  298. this.searchShow = false;
  299. },
  300. produceFn() {
  301. let param = {
  302. pageNum: 1,
  303. size: -1,
  304. };
  305. producerouting(param).then((res) => {
  306. this.produceList = res.list;
  307. });
  308. },
  309. },
  310. };
  311. </script>
  312. <style lang="scss" scoped>
  313. /* 页面容器 */
  314. .page-container {
  315. height: 100vh;
  316. overflow: hidden;
  317. display: flex;
  318. flex-direction: column;
  319. background-color: $uni-bg-color-grey;
  320. }
  321. /* 顶部区域 */
  322. .top-wrapper {
  323. background-color: $uni-bg-color;
  324. }
  325. /* Tab 导航栏 */
  326. .tab_box {
  327. width: 100%;
  328. height: $tab-height;
  329. background: $uni-bg-color;
  330. .tab_item {
  331. height: $tab-height;
  332. line-height: $tab-height;
  333. padding: 0 24rpx;
  334. font-size: $uni-font-size-base;
  335. color: $uni-text-color-grey;
  336. }
  337. .active {
  338. box-sizing: border-box;
  339. border-bottom: 6rpx solid $theme-color;
  340. color: $theme-color;
  341. }
  342. }
  343. /* 状态导航标签 */
  344. .nav-tabs {
  345. display: flex;
  346. align-items: center;
  347. justify-content: space-between;
  348. padding: 20rpx 24rpx;
  349. background-color: $uni-bg-color;
  350. border-bottom: 1rpx solid $border-color;
  351. &__inner {
  352. display: flex;
  353. align-items: center;
  354. flex: 1;
  355. gap: 16rpx;
  356. }
  357. &__item {
  358. display: flex;
  359. align-items: center;
  360. padding: 12rpx 24rpx;
  361. border-radius: 40rpx;
  362. font-size: $uni-font-size-sm;
  363. color: $uni-text-regular-color;
  364. background-color: $uni-bg-color-grey;
  365. transition: all 0.2s;
  366. &--active {
  367. background-color: $theme-color;
  368. color: $uni-text-color-inverse;
  369. box-shadow: 0 4rpx 12rpx rgba(21, 122, 44, 0.3);
  370. .nav-tabs__badge {
  371. background-color: rgba(255, 255, 255, 0.3);
  372. color: $uni-text-color-inverse;
  373. }
  374. }
  375. }
  376. &__text {
  377. font-size: $uni-font-size-sm;
  378. line-height: 1;
  379. }
  380. &__badge {
  381. min-width: 36rpx;
  382. height: 36rpx;
  383. line-height: 36rpx;
  384. text-align: center;
  385. font-size: $uni-font-size-ssm;
  386. border-radius: 20rpx;
  387. padding: 0 8rpx;
  388. margin-left: 8rpx;
  389. background-color: #e8e8e8;
  390. color: $uni-text-regular-color;
  391. }
  392. &__filter {
  393. display: flex;
  394. align-items: center;
  395. justify-content: center;
  396. width: 64rpx;
  397. height: 64rpx;
  398. border-radius: 50%;
  399. background-color: $uni-bg-color-grey;
  400. flex-shrink: 0;
  401. margin-left: 16rpx;
  402. &:active {
  403. background-color: $uni-bg-color-hover;
  404. }
  405. }
  406. &__filter-icon {
  407. width: 40rpx;
  408. height: 40rpx;
  409. }
  410. }
  411. /* 列表区域 */
  412. .list-container {
  413. flex: 1;
  414. overflow: hidden;
  415. padding: 12rpx 0;
  416. .u-list {
  417. height: 100% !important;
  418. }
  419. }
  420. /* 空数据占位 */
  421. .empty-wrapper {
  422. display: flex;
  423. align-items: center;
  424. justify-content: center;
  425. padding-top: 30vh;
  426. }
  427. /* 底部操作栏 */
  428. .footer-bar {
  429. display: flex;
  430. align-items: center;
  431. justify-content: space-between;
  432. height: 100rpx;
  433. background-color: $uni-bg-color;
  434. padding: 0 32rpx;
  435. box-shadow: 0 -2rpx 12rpx rgba(0, 0, 0, 0.06);
  436. /* 适配底部安全区域 */
  437. padding-bottom: constant(safe-area-inset-bottom);
  438. padding-bottom: env(safe-area-inset-bottom);
  439. &__left {
  440. display: flex;
  441. align-items: center;
  442. font-size: $uni-font-size-sm;
  443. color: $uni-text-color;
  444. }
  445. &__right {
  446. display: flex;
  447. align-items: center;
  448. }
  449. &__btn {
  450. min-width: 180rpx;
  451. height: 68rpx;
  452. border-radius: 34rpx;
  453. font-size: $uni-font-size-sm;
  454. }
  455. &__btn-text {
  456. font-size: $uni-font-size-sm;
  457. color: $uni-text-color-inverse;
  458. }
  459. &__checkbox--active {
  460. /* 选中状态样式 */
  461. }
  462. /deep/ .uni-checkbox-input-checked {
  463. background-color: $theme-color !important;
  464. border-color: $theme-color !important;
  465. }
  466. }
  467. /* 搜索面板 */
  468. .search-panel {
  469. min-height: 120rpx;
  470. padding: 20rpx 0;
  471. &__form {
  472. padding: 0 32rpx;
  473. }
  474. &__actions {
  475. display: flex;
  476. align-items: center;
  477. justify-content: space-between;
  478. padding: 20rpx 32rpx 32rpx;
  479. gap: 24rpx;
  480. }
  481. &__btn {
  482. flex: 1;
  483. height: 76rpx;
  484. border-radius: 38rpx;
  485. font-size: $uni-font-size-sm;
  486. &--reset {
  487. background-color: $uni-bg-color-grey;
  488. color: $uni-text-regular-color;
  489. border: none;
  490. }
  491. &--confirm {
  492. background-color: $theme-color;
  493. color: $uni-text-color-inverse;
  494. border: none;
  495. }
  496. }
  497. }
  498. </style>