index.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. <template>
  2. <view class="content-box">
  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_box rx-sc">
  21. <view
  22. class="nav_item"
  23. :class="{ active: pickStatus == 0 }"
  24. @click="handNav(0)"
  25. >
  26. 工单({{ navObj.unclaimedQuantity || 0 }})</view
  27. >
  28. <view
  29. class="nav_item"
  30. :class="{ active: pickStatus == 1 }"
  31. @click="handNav(1)"
  32. >
  33. 领料中({{ navObj.claimedQuantity || 0 }})</view
  34. >
  35. <view
  36. class="nav_item"
  37. :class="{ active: pickStatus == 2 }"
  38. @click="handNav(2)"
  39. >
  40. 已出库({{ navObj.outInQuantity || 0 }})</view
  41. >
  42. <view class="menu_box" @click="handleSearch">
  43. <image class="menu_icon" src="~@/static/pda/menu.svg"></image>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="list_box">
  48. <u-list @scrolltolower="scrolltolower">
  49. <pickCard v-if="dataList.length && pickStatus == 0" :list="dataList">
  50. </pickCard>
  51. <pickWorkCard
  52. v-if="dataList.length && pickStatus != 0"
  53. :list="dataList"
  54. >
  55. </pickWorkCard>
  56. <view v-else style="margin-top: 20vh">
  57. <u-empty iconSize="150" textSize="32" text="暂无工单"> </u-empty>
  58. </view>
  59. </u-list>
  60. </view>
  61. <view class="bottom-wrapper rx-bc" v-if="pickStatus == 0">
  62. <view>
  63. <checkbox
  64. v-if="!seletedAll"
  65. color="#fff"
  66. :checked="seletedAll"
  67. @tap="_seletedAll"
  68. >全选</checkbox
  69. >
  70. <checkbox
  71. class="select-all"
  72. color="#fff"
  73. v-else
  74. :checked="seletedAll"
  75. @tap="_seletedAll"
  76. >取消全选
  77. </checkbox>
  78. </view>
  79. <view>
  80. <u-button
  81. type="success"
  82. size="small"
  83. class="u-reset-button"
  84. :disabled="!checkListLen"
  85. @click="jumpAdd"
  86. >
  87. <view> 选择( {{ checkListLen }} ) </view>
  88. </u-button>
  89. </view>
  90. </view>
  91. <SearchPopup mode="top" v-if="searchShow">
  92. <template v-slot:list>
  93. <view class="search_list">
  94. <u-form
  95. labelPosition="left"
  96. :model="formData"
  97. labelWidth="180"
  98. labelAlign="left"
  99. class="baseForm"
  100. >
  101. <u-form-item
  102. label="工艺路线:"
  103. class="required-form"
  104. borderBottom
  105. prop="assetType"
  106. >
  107. <zxz-uni-data-select
  108. :localdata="produceList"
  109. v-model="formData.produceRoutingId"
  110. dataValue="id"
  111. format="{name}"
  112. dataKey="name"
  113. filterable
  114. ></zxz-uni-data-select>
  115. </u-form-item>
  116. </u-form>
  117. </view>
  118. </template>
  119. <template v-slot:operate>
  120. <view class="operate_box rx-bc">
  121. <u-button size="small" class="u-reset-button" @click="searchCancel">
  122. 重置
  123. </u-button>
  124. <u-button
  125. type="success"
  126. size="small"
  127. class="u-reset-button"
  128. @click="search"
  129. >
  130. 确定
  131. </u-button>
  132. </view>
  133. </template>
  134. </SearchPopup>
  135. </view>
  136. </template>
  137. <script>
  138. import pickCard from "../components/pickCard.vue";
  139. import pickWorkCard from "../components/pickWorkCard.vue";
  140. import { workorderPage, producerouting } from "@/api/pda/workOrder.js";
  141. import { pickStatistics, getAllPickList } from "@/api/pda/picking.js";
  142. import SearchPopup from "../../components/searchPopup.vue";
  143. let [isEnd] = [false];
  144. export default {
  145. components: {
  146. pickCard,
  147. SearchPopup,
  148. pickWorkCard,
  149. },
  150. data() {
  151. return {
  152. tabType: 1,
  153. pickStatus: 0,
  154. formData: {
  155. produceRoutingId: "",
  156. },
  157. navObj: {
  158. unclaimedQuantity: 0,
  159. claimedQuantity: 0,
  160. },
  161. page: 1,
  162. size: 10,
  163. dataList: [],
  164. produceList: [],
  165. seletedAll: false, //全选状态
  166. searchShow: false,
  167. };
  168. },
  169. //选择的列表长度
  170. computed: {
  171. checkListLen() {
  172. let _fitArr = this.dataList.filter((f) => f.checked);
  173. return _fitArr.length;
  174. },
  175. },
  176. onLoad(option) {
  177. this.pickStatus = option.pickStatus || 0;
  178. this.produceFn();
  179. },
  180. onShow() {
  181. this.page = 1;
  182. // this.dataList = []
  183. this.getList();
  184. this.getpickTics();
  185. },
  186. methods: {
  187. search() {
  188. this.page = 1;
  189. this.getList();
  190. this.searchShow = false;
  191. },
  192. async getList() {
  193. let params = null;
  194. if (this.pickStatus == 0) {
  195. params = {
  196. pageNum: this.page,
  197. size: this.size,
  198. pickStatus: this.pickStatus,
  199. customerClient: 2,
  200. workOrderType: 1,
  201. produceRoutingId: this.formData.produceRoutingId,
  202. };
  203. } else {
  204. params = {
  205. pageNum: this.page,
  206. size: this.size,
  207. status: this.pickStatus,
  208. };
  209. }
  210. isEnd = false;
  211. const URL = this.pickStatus == 0 ? workorderPage : getAllPickList;
  212. // const res = await workorderPage(params);
  213. const res = await URL(params);
  214. if (params.pageNum === 1) {
  215. this.dataList = [];
  216. }
  217. let _list = res.list.map((m) => {
  218. return {
  219. checked: false,
  220. ...m,
  221. };
  222. });
  223. this.dataList.push(..._list);
  224. isEnd = this.dataList.length >= res.count;
  225. },
  226. getpickTics() {
  227. pickStatistics().then((res) => {
  228. this.navObj = res;
  229. });
  230. },
  231. handTab(type) {
  232. if (type != this.tabType) {
  233. this.tabType = type;
  234. }
  235. },
  236. handNav(type) {
  237. if (type != this.pickStatus) {
  238. this.pickStatus = type;
  239. this.page = 1;
  240. this.dataList = [];
  241. this.getList();
  242. }
  243. },
  244. scrolltolower() {
  245. if (isEnd) return;
  246. this.page++;
  247. this.getList();
  248. },
  249. _seletedAll() {
  250. if (!this.seletedAll) {
  251. this.seletedAll = true;
  252. this.dataList.forEach((e) => {
  253. e.checked = true;
  254. });
  255. } else {
  256. this.seletedAll = false;
  257. this.dataList.forEach((e) => {
  258. e.checked = false;
  259. });
  260. }
  261. },
  262. jumpAdd() {
  263. let url;
  264. url = "/pages/pda/picking/details";
  265. let arr = [];
  266. this.dataList.forEach((e) => {
  267. if (e.checked) {
  268. arr.push(e.id);
  269. }
  270. });
  271. let _arr = JSON.stringify(arr);
  272. url += `?arr=${encodeURIComponent(_arr)}`;
  273. uni.navigateTo({
  274. url,
  275. });
  276. },
  277. // 相机扫码
  278. HandlScanCode() {
  279. uni.scanCode({
  280. success: (res) => {
  281. console.log(res);
  282. },
  283. });
  284. //_this.Scancodedate('res')
  285. },
  286. handleSearch() {
  287. this.searchShow = true;
  288. },
  289. searchCancel() {
  290. this.formData.produceRoutingId = "";
  291. this.page = 1;
  292. this.getList();
  293. this.searchShow = false;
  294. },
  295. produceFn() {
  296. let param = {
  297. pageNum: 1,
  298. size: -1,
  299. };
  300. producerouting(param).then((res) => {
  301. this.produceList = res.list;
  302. });
  303. },
  304. },
  305. };
  306. </script>
  307. <style lang="scss" scoped>
  308. .content-box {
  309. height: 100vh;
  310. overflow: hidden;
  311. display: flex;
  312. flex-direction: column;
  313. background-color: $page-bg;
  314. }
  315. .tab_box {
  316. width: 100%;
  317. height: 68rpx;
  318. background: #fff;
  319. .tab_item {
  320. height: 68rpx;
  321. line-height: 68rpx;
  322. padding: 0 20rpx;
  323. font-size: 32rpx;
  324. color: #979c9e;
  325. }
  326. .active {
  327. box-sizing: border-box;
  328. border-bottom: 6rpx solid $theme-color;
  329. color: $theme-color;
  330. }
  331. }
  332. .nav_box {
  333. padding: 6rpx 32rpx;
  334. position: relative;
  335. .nav_item {
  336. font-size: 28rpx;
  337. font-weight: 400;
  338. color: $theme-color;
  339. background: #f0f8f2;
  340. margin-right: 16rpx;
  341. padding: 4rpx 16rpx;
  342. border-radius: 8rpx;
  343. border: 2rpx solid #acd4b5;
  344. }
  345. .menu_box {
  346. position: absolute;
  347. right: 20rpx;
  348. top: 10rpx;
  349. .menu_icon {
  350. width: 44rpx;
  351. height: 44rpx;
  352. }
  353. }
  354. .active {
  355. background: $theme-color;
  356. border: 2rpx solid $theme-color;
  357. color: #fff;
  358. }
  359. }
  360. .list_box {
  361. flex: 1;
  362. overflow: hidden;
  363. padding: 4rpx 0;
  364. .u-list {
  365. height: 100% !important;
  366. }
  367. }
  368. .bottom-wrapper {
  369. height: 80rpx;
  370. background: #fff;
  371. padding: 0 32rpx;
  372. /deep/ .uni-checkbox-input-checked {
  373. background-color: $theme-color !important;
  374. border-color: $theme-color !important;
  375. }
  376. }
  377. .search_list {
  378. min-height: 100rpx;
  379. /deep/ .baseForm {
  380. padding: 0 20rpx;
  381. }
  382. }
  383. .operate_box {
  384. padding: 10rpx 32rpx;
  385. /deep/ .u-button {
  386. width: 40%;
  387. }
  388. }
  389. </style>