requisitionList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  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. console.log(this.type, 'tttttttttttttttttttttttttttttttttttttttttttttt')
  174. if (this.type == 2) {
  175. // 出库
  176. let data = await getHierarchyFifo({
  177. type: 1,
  178. builders: res.map(item => {
  179. return {
  180. categoryId: item.categoryId,
  181. num: item.measureQuantity
  182. }
  183. })
  184. })
  185. if (data?.length > 0) {
  186. uni.$emit('requisitionSelectC', data, {
  187. sourceBizNo: this.curItem.code,
  188. bizType: this.curItem.sourceType,
  189. assetType: res.map(item => item.rootCategoryLevelId).join(',')
  190. })
  191. uni.navigateBack()
  192. } else {
  193. uni.showToast({
  194. icon: 'none',
  195. title: '该出库申请单无库存'
  196. })
  197. }
  198. } else {
  199. // 入库
  200. const batchNo = await getCode('lot_number_code')
  201. let data = res.map((item, index) => {
  202. return {
  203. ...item,
  204. index,
  205. packingQuantity: 1,
  206. minPackingQuantity: item.measureQuantity,
  207. measureUnit: item.measuringUnit,
  208. batchNo,
  209. id: '',
  210. warehouseIds: [item.warehouseId],
  211. warehouseNames: [item.warehouseName]
  212. }
  213. })
  214. uni.$emit('requisitionSelect', data, {
  215. sourceBizNo: this.curItem.code,
  216. bizType: this.curItem.sourceType,
  217. assetType: res.map(item => item.rootCategoryLevelId).join(',')
  218. })
  219. uni.navigateBack()
  220. }
  221. })
  222. // let selectionList = this.listData.filter(item => item.checked)
  223. // if (this.dimension == 1) {
  224. // let boolen = selectionList.every(item => item.outboundNum > 0)
  225. // if (!boolen) {
  226. // uni.showToast({
  227. // icon: 'none',
  228. // title: '请输入出库数量',
  229. // duration: 2000
  230. // })
  231. // return
  232. // }
  233. // }
  234. // let data = null
  235. // if (this.dimension != 1) {
  236. // data = await getHierarchyList({
  237. // ids: selectionList.map(item => item.id).join(','),
  238. // type: this.dimension
  239. // })
  240. // } else {
  241. // data = await getHierarchyFifo({
  242. // type: this.dimension,
  243. // builders: selectionList.map(item => {
  244. // return {
  245. // categoryId: item.categoryId,
  246. // num: item.outboundNum
  247. // }
  248. // })
  249. // })
  250. // }
  251. // console.log('data-------------------', data)
  252. // uni.$emit('setSelectList', data)
  253. // uni.navigateBack()
  254. },
  255. //返回添加页
  256. backAdd() {
  257. uni.navigateBack()
  258. }
  259. }
  260. }
  261. </script>
  262. <style lang="scss" scoped>
  263. .mainBox {
  264. height: 100vh;
  265. .main {
  266. height: 100%;
  267. display: flex;
  268. flex-direction: column;
  269. }
  270. .wrapper {
  271. flex: 1;
  272. overflow: hidden;
  273. }
  274. .top-wrapper {
  275. display: flex;
  276. height: 88rpx;
  277. align-items: center;
  278. justify-content: space-between;
  279. padding: 20rpx;
  280. /deep/.uni-section {
  281. margin-top: 0px;
  282. }
  283. /deep/.uni-section-header {
  284. padding: 0px;
  285. }
  286. .search_btn {
  287. width: 120rpx;
  288. height: 70rpx;
  289. line-height: 70rpx;
  290. background: $theme-color;
  291. font-size: 28rpx;
  292. color: #fff;
  293. }
  294. .menu_icon {
  295. width: 44rpx;
  296. height: 44rpx;
  297. margin-left: 14rpx;
  298. }
  299. .more_search {
  300. display: flex;
  301. align-items: center;
  302. height: 70rpx;
  303. line-height: 70rpx;
  304. }
  305. /deep/.u-input {
  306. border: 1rpx solid #ccc;
  307. .u-input__content__field-wrapper__field {
  308. height: 40rpx !important;
  309. }
  310. }
  311. }
  312. // .searchBox {
  313. // padding: 10rpx 0;
  314. // box-sizing: border-box;
  315. // background-color: #dedede;
  316. // height: 90rpx;
  317. // width: 100%;
  318. // line-height: 90rpx;
  319. // display: flex;
  320. // justify-content: space-around;
  321. // align-items: center;
  322. // input {
  323. // height: 78rpx;
  324. // width: 65%;
  325. // background: #f9f9f9 !important;
  326. // margin: 0 10rpx;
  327. // padding: 0 10rpx;
  328. // box-sizing: border-box;
  329. // border-radius: 5rpx;
  330. // }
  331. // .searchBtn {
  332. // height: 80rpx;
  333. // background: #f9f9f9 !important;
  334. // color: #676767;
  335. // font-size: 28rpx;
  336. // padding: 0 42rpx;
  337. // box-sizing: border-box;
  338. // outline: none;
  339. // border: none;
  340. // width: 260rpx;
  341. // .icon-sousuo {
  342. // font-size: 22px;
  343. // }
  344. // .text {
  345. // font-size: 16px;
  346. // margin-left: 10px;
  347. // }
  348. // }
  349. // .search-icon {
  350. // display: flex;
  351. // align-items: center;
  352. // justify-content: space-around;
  353. // font-size: 28rpx;
  354. // white-space: nowrap;
  355. // margin-left: 10rpx;
  356. // image {
  357. // width: 30rpx;
  358. // height: 30rpx;
  359. // }
  360. // }
  361. // }
  362. .tab-title {
  363. position: fixed;
  364. top: 190rpx;
  365. z-index: 99;
  366. width: 100%;
  367. display: flex;
  368. justify-content: space-between;
  369. align-items: center;
  370. height: $tab-height;
  371. line-height: $tab-height;
  372. background-color: #ffffff;
  373. border-bottom: 2rpx solid #f2f2f2;
  374. box-sizing: border-box;
  375. .tab-item {
  376. width: 25%;
  377. text-align: center;
  378. font-size: 32rpx;
  379. color: $uni-text-color-grey;
  380. }
  381. .tab-item.active {
  382. color: $j-primary-border-green;
  383. border-bottom: 1px solid $j-primary-border-green;
  384. font-weight: bold;
  385. }
  386. .tab-item.filter {
  387. flex: 1;
  388. padding: 0px 30rpx;
  389. .uni-icons {
  390. display: flex;
  391. padding-top: 5px;
  392. }
  393. }
  394. .screenIcon {
  395. display: flex;
  396. width: 80px;
  397. justify-content: center;
  398. .screenText {
  399. font-size: 32rpx;
  400. color: $uni-text-color-grey;
  401. }
  402. }
  403. }
  404. .listContent {
  405. height: 100% !important;
  406. .listBox {
  407. display: flex;
  408. // height: 180rpx;
  409. padding: 20rpx 0;
  410. border-top: 2rpx solid #e5e5e5;
  411. .listBox-sel {
  412. height: 90rpx;
  413. width: 80rpx;
  414. // line-height: 90rpx;
  415. text-align: center;
  416. checkbox {
  417. transform: scale(1.2);
  418. }
  419. }
  420. .listBox-con {
  421. width: 100%;
  422. // display: flex;
  423. // flex-wrap: wrap;
  424. // justify-content: space-between;
  425. align-items: center;
  426. padding: 0 18rpx 0 0;
  427. .round {
  428. width: 40rpx;
  429. height: 40rpx;
  430. line-height: 40rpx;
  431. border-radius: 50%;
  432. background: $theme-color;
  433. color: #fff;
  434. text-align: center;
  435. font-size: 20rpx;
  436. }
  437. .listBox-top {
  438. width: 100%;
  439. display: flex;
  440. justify-content: space-between;
  441. padding-bottom: 10rpx;
  442. .listBox-name,
  443. .listBox-code {
  444. display: inline-block;
  445. font-size: $uni-font-size-sm;
  446. font-weight: bold;
  447. }
  448. }
  449. .listBox-bottom {
  450. width: 100%;
  451. display: flex;
  452. justify-content: space-between;
  453. font-size: $uni-font-size-sm;
  454. flex-wrap: wrap;
  455. >view {
  456. width: 50%;
  457. overflow: hidden;
  458. white-space: nowrap;
  459. text-overflow: ellipsis;
  460. }
  461. .input_view {
  462. display: flex;
  463. align-items: center;
  464. justify-content: center;
  465. .u-input {
  466. height: 36rpx;
  467. padding: 0 !important;
  468. margin-right: 10rpx;
  469. border: 1px solid #ddd;
  470. }
  471. }
  472. .w100 {
  473. width: 100%;
  474. }
  475. }
  476. }
  477. }
  478. .noDate {
  479. height: 100%;
  480. }
  481. }
  482. //底部按钮
  483. .footer {
  484. height: 90rpx;
  485. position: relative;
  486. display: flex;
  487. justify-content: space-between;
  488. align-items: center;
  489. bottom: 0;
  490. width: 100%;
  491. height: 100rpx;
  492. border-top: 1rpx solid #eeecec;
  493. background-color: #ffffff;
  494. z-index: 999;
  495. .bottom {
  496. margin-left: 10rpx;
  497. }
  498. .u-reset-button {
  499. position: absolute;
  500. right: 10rpx;
  501. top: 20rpx;
  502. width: 150rpx;
  503. }
  504. }
  505. .search-container {
  506. width: 70vw;
  507. padding: 30rpx 36rpx;
  508. .footer {
  509. position: absolute;
  510. bottom: 0;
  511. left: 0;
  512. width: 100%;
  513. display: flex;
  514. box-shadow: 0 10rpx 30rpx 0 #000;
  515. .btn {
  516. width: 50%;
  517. height: 80rpx;
  518. border-radius: 0 !important;
  519. flex: 1;
  520. display: flex;
  521. justify-content: center;
  522. align-items: center;
  523. &.reset {
  524. color: $j-primary-border-green;
  525. }
  526. &.search {
  527. color: #fff;
  528. background-color: $j-primary-border-green;
  529. }
  530. }
  531. }
  532. .title {
  533. font-weight: bold;
  534. font-size: 30rpx;
  535. }
  536. .status-wrapper {
  537. display: flex;
  538. align-items: center;
  539. justify-content: space-between;
  540. view {
  541. background-color: rgba(242, 242, 242, 1);
  542. height: 60rpx;
  543. border-radius: 30rpx;
  544. line-height: 60rpx;
  545. text-align: center;
  546. width: 160rpx;
  547. border: 1rpx solid rgba(242, 242, 242, 1);
  548. &.active {
  549. color: #157a2c;
  550. border-color: rgba(21, 122, 44, 1);
  551. }
  552. }
  553. }
  554. /deep/.uni-date {
  555. .uni-icons {
  556. display: none;
  557. }
  558. .uni-date-x {
  559. padding: 0;
  560. view {
  561. margin: 0 20rpx;
  562. }
  563. }
  564. }
  565. /deep/.uni-date__x-input,
  566. /deep/.uni-easyinput__content-input {
  567. height: 60rpx;
  568. border-radius: 30rpx;
  569. overflow: hidden;
  570. background-color: rgba(242, 242, 242, 1);
  571. }
  572. }
  573. }
  574. </style>