requisitionList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  1. <template>
  2. <view class="mainBox">
  3. <view class="main">
  4. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" :title="`选择出入库申请单`"
  5. @clickLeft="backAdd"></uni-nav-bar>
  6. <!-- <view class="searchBox">
  7. <input v-model="searchVal" placeholder="请输入编码" class="searchInput" />
  8. <u-button type="icon-shixiangxinzeng" size="30" @click="doSearch" data-icon="Search" class="searchBtn">
  9. <view class="iconfont icon-sousuo"></view>
  10. <view class="text">搜索</view>
  11. </u-button>
  12. </view> -->
  13. <view class="top-wrapper">
  14. <uni-section>
  15. <uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="searchVal" placeholder="请输入编码">
  16. </uni-easyinput>
  17. </uni-section>
  18. <view style="display: flex;">
  19. <button class="search_btn" @click="doSearch">搜索</button>
  20. </view>
  21. </view>
  22. <view class="wrapper">
  23. <u-list @scrolltolower="scrolltolower" class="listContent">
  24. <radio-group @change="e => selectVal(e)">
  25. <label v-for="(item, index) in listData">
  26. <view class="listBox">
  27. <view class="listBox-sel">
  28. <radio :value="item.id" color="#fff" :disabled="item.disabled"
  29. :checked="item.id === (curItem && curItem.id)" />
  30. </view>
  31. <view class="listBox-con">
  32. <view style="display: flex;">
  33. <view class="listBox-top" style="justify-content: left;">
  34. <view class="round">{{Number(index)+1}}</view>
  35. <view class="listBox-name">
  36. {{ item.code }}
  37. </view>
  38. </view>
  39. <view class="listBox-top">
  40. <view class="listBox-code">
  41. {{ item.categoryNames }}
  42. </view>
  43. </view>
  44. </view>
  45. <view class="listBox-bottom">
  46. <view>牌号:{{ item.brandNum }}</view>
  47. <view>型号:{{ item.modelType }}</view>
  48. <view>规格:{{ item.specification }}</view>
  49. <view>出入库类型:{{ sourceTypeLabel(item.sourceType) }}</view>
  50. <view>审核人:{{ item.approvalUserName }}</view>
  51. <view>申请人:{{ item.createUserName }}</view>
  52. <view>状态:{{ statusOpt[item.status] }}</view>
  53. <view class="w100">创建时间:{{ item.createTime }}</view>
  54. </view>
  55. </view>
  56. </view>
  57. </label>
  58. </radio-group>
  59. <u-empty class="noDate" style="margin-top: 20vh" v-if="!listData.length"></u-empty>
  60. </u-list>
  61. </view>
  62. <view class="footer">
  63. <u-button type="success" size="small" class="u-reset-button" :disabled="!curItem" @click="jumpAdd">
  64. <view class="selBtn">选择</view>
  65. </u-button>
  66. </view>
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. import {
  72. getTreeByIds,
  73. getPackingList,
  74. getWarehouseList,
  75. getProductList,
  76. getBatchList,
  77. getHierarchyList,
  78. getHierarchyFifo,
  79. getApplystoragedetail,
  80. getCode,
  81. getinboundRequestsList
  82. } from '@/api/warehouseManagement'
  83. import {
  84. sceneState,
  85. outputSceneState
  86. } from '../common'
  87. export default {
  88. data() {
  89. return {
  90. type: null,
  91. statusOpt: ['待处理', '已处理', '已撤销'],
  92. curItem: null, //当前选中项
  93. page: 1,
  94. size: 20,
  95. sceneState,
  96. outputSceneState,
  97. isEnd: true,
  98. searchVal: '',
  99. listData: [] //列表数据
  100. }
  101. },
  102. onLoad({
  103. type
  104. }) {
  105. this.type = type
  106. },
  107. onShow() {
  108. this.getList()
  109. },
  110. methods: {
  111. sourceTypeLabel(sourceType) {
  112. switch (this.type) {
  113. case '1':
  114. // 入库
  115. return this.sceneState.filter(item => item.value == sourceType)[0].text
  116. case '2':
  117. // 出库
  118. return this.outputSceneState.filter(item => item.value == sourceType)[0].text
  119. }
  120. },
  121. scrolltolower() {
  122. if (this.isEnd) {
  123. return
  124. }
  125. // 显示加载图标
  126. uni.showLoading({
  127. title: '数据加载中'
  128. })
  129. //获取更多数据
  130. this.page++
  131. this.getList()
  132. },
  133. //列表数据
  134. async getList() {
  135. this.isEnd = false
  136. this._getClassifyList()
  137. },
  138. async _getClassifyList() {
  139. uni.showLoading({
  140. title: '数据加载中'
  141. })
  142. const params = {
  143. pageNum: this.page,
  144. size: this.size,
  145. keyWord: this.searchVal,
  146. status: 0,
  147. type: this.type
  148. }
  149. let res = await getinboundRequestsList(params)
  150. uni.hideLoading()
  151. if (this.page == 1) {
  152. this.listData = []
  153. }
  154. this.listData = this.listData.concat(res.list)
  155. this.isEnd = this.listData.length >= res.count
  156. },
  157. doSearch() {
  158. this.page = 1
  159. this.getList()
  160. },
  161. // 单选
  162. selectVal({
  163. detail
  164. }) {
  165. this.curItem = this.listData.find(i => i.id === detail?.value)
  166. console.log(this.curItem)
  167. },
  168. //跳转回添加页面
  169. async jumpAdd() {
  170. getApplystoragedetail({
  171. applyId: this.curItem.id
  172. }).then(async res => {
  173. if (this.type == 2) {
  174. // 出库
  175. let data = await getHierarchyFifo({
  176. type: 1,
  177. builders: res.map(item => {
  178. return {
  179. categoryId: item.categoryId,
  180. num: item.measureQuantity
  181. }
  182. })
  183. })
  184. if (data?.length > 0) {
  185. uni.$emit('requisitionSelect', data, {
  186. sourceBizNo: this.curItem.code,
  187. bizType: this.curItem.sourceType,
  188. assetType: res.map(item => item.rootCategoryLevelId).join(',')
  189. })
  190. uni.navigateBack()
  191. } else {
  192. uni.showToast({
  193. icon: 'none',
  194. title: '该出库申请单无库存'
  195. })
  196. }
  197. } else {
  198. // 入库
  199. const batchNo = await getCode('lot_number_code')
  200. let data = res.map((item, index) => {
  201. return {
  202. ...item,
  203. index,
  204. packingQuantity: 1,
  205. minPackingQuantity: item.measureQuantity,
  206. measureUnit: item.measuringUnit,
  207. batchNo,
  208. id: '',
  209. warehouseIds: [item.warehouseId],
  210. warehouseNames: [item.warehouseName]
  211. }
  212. })
  213. uni.$emit('requisitionSelect', data, {
  214. sourceBizNo: this.curItem.code,
  215. bizType: this.curItem.sourceType,
  216. assetType: res.map(item => item.rootCategoryLevelId).join(',')
  217. })
  218. uni.navigateBack()
  219. }
  220. })
  221. // let selectionList = this.listData.filter(item => item.checked)
  222. // if (this.dimension == 1) {
  223. // let boolen = selectionList.every(item => item.outboundNum > 0)
  224. // if (!boolen) {
  225. // uni.showToast({
  226. // icon: 'none',
  227. // title: '请输入出库数量',
  228. // duration: 2000
  229. // })
  230. // return
  231. // }
  232. // }
  233. // let data = null
  234. // if (this.dimension != 1) {
  235. // data = await getHierarchyList({
  236. // ids: selectionList.map(item => item.id).join(','),
  237. // type: this.dimension
  238. // })
  239. // } else {
  240. // data = await getHierarchyFifo({
  241. // type: this.dimension,
  242. // builders: selectionList.map(item => {
  243. // return {
  244. // categoryId: item.categoryId,
  245. // num: item.outboundNum
  246. // }
  247. // })
  248. // })
  249. // }
  250. // console.log('data-------------------', data)
  251. // uni.$emit('setSelectList', data)
  252. // uni.navigateBack()
  253. },
  254. //返回添加页
  255. backAdd() {
  256. uni.navigateBack()
  257. }
  258. }
  259. }
  260. </script>
  261. <style lang="scss" scoped>
  262. .mainBox {
  263. height: 100vh;
  264. .main {
  265. height: 100%;
  266. display: flex;
  267. flex-direction: column;
  268. }
  269. .wrapper {
  270. flex: 1;
  271. overflow: hidden;
  272. }
  273. .top-wrapper {
  274. display: flex;
  275. height: 88rpx;
  276. align-items: center;
  277. justify-content: space-between;
  278. padding: 20rpx;
  279. /deep/.uni-section {
  280. margin-top: 0px;
  281. }
  282. /deep/.uni-section-header {
  283. padding: 0px;
  284. }
  285. .search_btn {
  286. width: 120rpx;
  287. height: 70rpx;
  288. line-height: 70rpx;
  289. background: $theme-color;
  290. font-size: 28rpx;
  291. color: #fff;
  292. }
  293. .menu_icon {
  294. width: 44rpx;
  295. height: 44rpx;
  296. margin-left: 14rpx;
  297. }
  298. .more_search {
  299. display: flex;
  300. align-items: center;
  301. height: 70rpx;
  302. line-height: 70rpx;
  303. }
  304. /deep/.u-input {
  305. border: 1rpx solid #ccc;
  306. .u-input__content__field-wrapper__field {
  307. height: 40rpx !important;
  308. }
  309. }
  310. }
  311. // .searchBox {
  312. // padding: 10rpx 0;
  313. // box-sizing: border-box;
  314. // background-color: #dedede;
  315. // height: 90rpx;
  316. // width: 100%;
  317. // line-height: 90rpx;
  318. // display: flex;
  319. // justify-content: space-around;
  320. // align-items: center;
  321. // input {
  322. // height: 78rpx;
  323. // width: 65%;
  324. // background: #f9f9f9 !important;
  325. // margin: 0 10rpx;
  326. // padding: 0 10rpx;
  327. // box-sizing: border-box;
  328. // border-radius: 5rpx;
  329. // }
  330. // .searchBtn {
  331. // height: 80rpx;
  332. // background: #f9f9f9 !important;
  333. // color: #676767;
  334. // font-size: 28rpx;
  335. // padding: 0 42rpx;
  336. // box-sizing: border-box;
  337. // outline: none;
  338. // border: none;
  339. // width: 260rpx;
  340. // .icon-sousuo {
  341. // font-size: 22px;
  342. // }
  343. // .text {
  344. // font-size: 16px;
  345. // margin-left: 10px;
  346. // }
  347. // }
  348. // .search-icon {
  349. // display: flex;
  350. // align-items: center;
  351. // justify-content: space-around;
  352. // font-size: 28rpx;
  353. // white-space: nowrap;
  354. // margin-left: 10rpx;
  355. // image {
  356. // width: 30rpx;
  357. // height: 30rpx;
  358. // }
  359. // }
  360. // }
  361. .tab-title {
  362. position: fixed;
  363. top: 190rpx;
  364. z-index: 99;
  365. width: 100%;
  366. display: flex;
  367. justify-content: space-between;
  368. align-items: center;
  369. height: $tab-height;
  370. line-height: $tab-height;
  371. background-color: #ffffff;
  372. border-bottom: 2rpx solid #f2f2f2;
  373. box-sizing: border-box;
  374. .tab-item {
  375. width: 25%;
  376. text-align: center;
  377. font-size: 32rpx;
  378. color: $uni-text-color-grey;
  379. }
  380. .tab-item.active {
  381. color: $j-primary-border-green;
  382. border-bottom: 1px solid $j-primary-border-green;
  383. font-weight: bold;
  384. }
  385. .tab-item.filter {
  386. flex: 1;
  387. padding: 0px 30rpx;
  388. .uni-icons {
  389. display: flex;
  390. padding-top: 5px;
  391. }
  392. }
  393. .screenIcon {
  394. display: flex;
  395. width: 80px;
  396. justify-content: center;
  397. .screenText {
  398. font-size: 32rpx;
  399. color: $uni-text-color-grey;
  400. }
  401. }
  402. }
  403. .listContent {
  404. height: 100% !important;
  405. .listBox {
  406. display: flex;
  407. // height: 180rpx;
  408. padding: 20rpx 0;
  409. border-top: 2rpx solid #e5e5e5;
  410. .listBox-sel {
  411. height: 90rpx;
  412. width: 80rpx;
  413. // line-height: 90rpx;
  414. text-align: center;
  415. checkbox {
  416. transform: scale(1.2);
  417. }
  418. }
  419. .listBox-con {
  420. width: 100%;
  421. // display: flex;
  422. // flex-wrap: wrap;
  423. // justify-content: space-between;
  424. align-items: center;
  425. padding: 0 18rpx 0 0;
  426. .round {
  427. width: 40rpx;
  428. height: 40rpx;
  429. line-height: 40rpx;
  430. border-radius: 50%;
  431. background: $theme-color;
  432. color: #fff;
  433. text-align: center;
  434. font-size: 20rpx;
  435. }
  436. .listBox-top {
  437. width: 100%;
  438. display: flex;
  439. justify-content: space-between;
  440. padding-bottom: 10rpx;
  441. .listBox-name,
  442. .listBox-code {
  443. display: inline-block;
  444. font-size: $uni-font-size-sm;
  445. font-weight: bold;
  446. }
  447. }
  448. .listBox-bottom {
  449. width: 100%;
  450. display: flex;
  451. justify-content: space-between;
  452. font-size: $uni-font-size-sm;
  453. flex-wrap: wrap;
  454. >view {
  455. width: 50%;
  456. overflow: hidden;
  457. white-space: nowrap;
  458. text-overflow: ellipsis;
  459. }
  460. .input_view {
  461. display: flex;
  462. align-items: center;
  463. justify-content: center;
  464. .u-input {
  465. height: 36rpx;
  466. padding: 0 !important;
  467. margin-right: 10rpx;
  468. border: 1px solid #ddd;
  469. }
  470. }
  471. .w100 {
  472. width: 100%;
  473. }
  474. }
  475. }
  476. }
  477. .noDate {
  478. height: 100%;
  479. }
  480. }
  481. //底部按钮
  482. .footer {
  483. height: 90rpx;
  484. position: relative;
  485. display: flex;
  486. justify-content: space-between;
  487. align-items: center;
  488. bottom: 0;
  489. width: 100%;
  490. height: 100rpx;
  491. border-top: 1rpx solid #eeecec;
  492. background-color: #ffffff;
  493. z-index: 999;
  494. .bottom {
  495. margin-left: 10rpx;
  496. }
  497. .u-reset-button {
  498. position: absolute;
  499. right: 10rpx;
  500. top: 20rpx;
  501. width: 150rpx;
  502. }
  503. }
  504. .search-container {
  505. width: 70vw;
  506. padding: 30rpx 36rpx;
  507. .footer {
  508. position: absolute;
  509. bottom: 0;
  510. left: 0;
  511. width: 100%;
  512. display: flex;
  513. box-shadow: 0 10rpx 30rpx 0 #000;
  514. .btn {
  515. width: 50%;
  516. height: 80rpx;
  517. border-radius: 0 !important;
  518. flex: 1;
  519. display: flex;
  520. justify-content: center;
  521. align-items: center;
  522. &.reset {
  523. color: $j-primary-border-green;
  524. }
  525. &.search {
  526. color: #fff;
  527. background-color: $j-primary-border-green;
  528. }
  529. }
  530. }
  531. .title {
  532. font-weight: bold;
  533. font-size: 30rpx;
  534. }
  535. .status-wrapper {
  536. display: flex;
  537. align-items: center;
  538. justify-content: space-between;
  539. view {
  540. background-color: rgba(242, 242, 242, 1);
  541. height: 60rpx;
  542. border-radius: 30rpx;
  543. line-height: 60rpx;
  544. text-align: center;
  545. width: 160rpx;
  546. border: 1rpx solid rgba(242, 242, 242, 1);
  547. &.active {
  548. color: #157a2c;
  549. border-color: rgba(21, 122, 44, 1);
  550. }
  551. }
  552. }
  553. /deep/.uni-date {
  554. .uni-icons {
  555. display: none;
  556. }
  557. .uni-date-x {
  558. padding: 0;
  559. view {
  560. margin: 0 20rpx;
  561. }
  562. }
  563. }
  564. /deep/.uni-date__x-input,
  565. /deep/.uni-easyinput__content-input {
  566. height: 60rpx;
  567. border-radius: 30rpx;
  568. overflow: hidden;
  569. background-color: rgba(242, 242, 242, 1);
  570. }
  571. }
  572. }
  573. </style>