deliveryFrom.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  1. <template>
  2. <view >
  3. <u-navbar title="出库申请"></u-navbar>
  4. <!-- 出库单状态 -->
  5. <view class="container">
  6. <!-- 出库单详情 -->
  7. <view class="details">
  8. <view class="item">
  9. <view class="name">
  10. 所属项目<span style="color: red;">*</span>
  11. </view>
  12. <view class="value">
  13. <u-input v-model="form.projectName" placeholder="请输入所属项目" type="text" />
  14. </view>
  15. </view>
  16. <view class="item">
  17. <view class="name">
  18. 需求时间
  19. </view>
  20. <view class="value">
  21. <u-input v-model="needTime" @click="show=true,showText='needTime'" @clear="showText='needTime',change('')" placeholder="请输入需求时间" type="select" />
  22. </view>
  23. </view>
  24. <view class="item">
  25. <view class="name">
  26. 使用周期至<span style="color: red;">*</span>
  27. </view>
  28. <view class="value">
  29. <u-calendar v-model="show" mode="date" max-date="2099-01-01" @change="change"></u-calendar>
  30. <u-input v-model="endTime" @click="show=true,showText='endTime'" @clear="showText='endTime',change('')" placeholder="请输入使用周期" type="select" />
  31. </view>
  32. </view>
  33. </view>
  34. <!-- 出库设备清单 -->
  35. <view class="list">
  36. <view class="list-head">
  37. <view class="title">
  38. 出库设备清单
  39. </view>
  40. <view class="amount add" @click="showpopup=true">
  41. <u-icon name="plus-circle"></u-icon>添加设备
  42. </view>
  43. </view>
  44. <!-- 清单信息 -->
  45. <view class="list-infos" v-for="(item,index) in list" :key="index" >
  46. <view class="infos-head">
  47. <view class="name">
  48. {{item.obj.title}}
  49. </view>
  50. <view class="state" @click="del(index)">
  51. <u-icon name="minus-circle" ></u-icon>删除
  52. </view>
  53. </view>
  54. <view class="infos">
  55. <view class="infos-1">
  56. <view class="infos-item">
  57. <view class="item-name">
  58. 厂家:
  59. </view>
  60. <view class="item-value">
  61. {{item.obj.manufactor}}
  62. </view>
  63. </view>
  64. <view class="infos-item">
  65. <view class="item-name">
  66. 单位:
  67. </view>
  68. <view class="item-value">
  69. {{item.obj.unit}}
  70. </view>
  71. </view>
  72. </view>
  73. <view class="infos-2">
  74. <view class="infos-item">
  75. <view class="item-name">
  76. 规格:
  77. </view>
  78. <view class="item-value">
  79. {{item.obj.specifications}}
  80. </view>
  81. </view>
  82. <view class="infos-item">
  83. <view class="item-name">
  84. 型号:
  85. </view>
  86. <view class="item-value">
  87. {{item.obj.model}}
  88. </view>
  89. </view>
  90. </view>
  91. </view>
  92. <view class="infos" v-if="false">
  93. <view class="infos-1">
  94. <view class="infos-item">
  95. <view class="item-name">
  96. 型号:
  97. </view>
  98. <view class="item-value">
  99. {{item.obj.model}}
  100. </view>
  101. </view>
  102. <view class="infos-item">
  103. <view class="item-name">
  104. 库存:
  105. </view>
  106. <view class="item-value">
  107. {{item.obj.count}}
  108. </view>
  109. </view>
  110. </view>
  111. <view class="infos-2" v-if="false">
  112. <view class="infos-item">
  113. <view class="item-name">
  114. 单位:
  115. </view>
  116. <view class="item-value">
  117. </view>
  118. </view>
  119. <view class="infos-item">
  120. <view class="item-name">
  121. 库存:
  122. </view>
  123. <view class="item-value">
  124. 20
  125. </view>
  126. </view>
  127. </view>
  128. </view>
  129. <view>
  130. <u-gap height="2" bg-color="#bbb"></u-gap>
  131. 出库数量
  132. <u-number-box bg-color="#FFFFFF"
  133. style="float: right;" v-model="item.count"></u-number-box>
  134. </view>
  135. </view>
  136. </view>
  137. </view>
  138. <!-- -sync -sync -->
  139. <u-popup v-model="showpopup" mode="bottom"
  140. border-radius="14"
  141. :closeable="true" >
  142. <view class="showpopup">添加设备</view>
  143. <!-- 搜索 -->
  144. <view class="search" >
  145. <view class="search-box">
  146. <u-search placeholder="搜索设备名称或型号" v-model="queryContent" :show-action="false">
  147. </u-search>
  148. <view class="search-btn" @click="ckQueryContent" >
  149. <view class="text">
  150. 搜索
  151. </view>
  152. </view>
  153. </view>
  154. </view>
  155. <scroll-view scroll-y="true" style="height: 800rpx;" @scrolltolower="refscrolltolower()">
  156. <equipmentRetrieval @ckItem="ckItem" :list="list"
  157. ref="equipmentRetrievalRef" :iscomponents="1"></equipmentRetrieval>
  158. </scroll-view>
  159. </u-popup>
  160. <!-- 确认出库 -->
  161. <view class="bottom" @click="submit()" >
  162. <button>提交出库单</button>
  163. </view>
  164. </view>
  165. </template>
  166. <script>
  167. import equipmentRetrieval from "@/pages/otherFunctions/equipmentRetrieval/equipmentRetrieval"
  168. import * as API from '@/apis/pagejs/projectDepartment.js'
  169. export default {
  170. data() {
  171. return {
  172. recordId:"",
  173. form:{
  174. recordId:"",
  175. needTime:"",
  176. endTime:"",
  177. projectName:"",
  178. },
  179. show:false,
  180. showText:"",
  181. showpopup:false,
  182. endTime:'',
  183. needTime:'',
  184. queryContent:'',
  185. list:[]
  186. }
  187. },
  188. components:{
  189. equipmentRetrieval
  190. },
  191. computed:{
  192. },
  193. methods:{
  194. refscrolltolower(){
  195. this.$refs.equipmentRetrievalRef.myLoadmoreonReachBottom()
  196. },
  197. ckQueryContent(){
  198. this.$refs.equipmentRetrievalRef.queryContent=this.queryContent
  199. this.$refs.equipmentRetrievalRef.getList()
  200. },
  201. change(e){
  202. if(e==''){
  203. this.form[this.showText]='';
  204. this[this.showText]=''
  205. }else{
  206. this.form[this.showText]=e.result;
  207. this[this.showText]=e.year+"年"+e.month+"月"+e.day+"日"
  208. }
  209. },
  210. submit(){
  211. if(!this.form.projectName){
  212. uni.showToast({
  213. title: "请填写所属项目"
  214. })
  215. return
  216. }
  217. if(!this.form.endTime){
  218. uni.showToast({
  219. title: "请输入使用周期"
  220. })
  221. return
  222. }
  223. if(this.list.length==0){
  224. uni.showToast({
  225. title: "请添加设备"
  226. })
  227. return
  228. }
  229. var list=this.list.map(item=>{
  230. var obj={
  231. ...item
  232. }
  233. delete obj.obj
  234. return obj
  235. })
  236. this.form.deviceData=list
  237. uni.showLoading({
  238. title: "加载中",
  239. mask: true,
  240. })
  241. API.saveOutRecord({
  242. content:JSON.stringify(this.form)
  243. }).then((res) => {
  244. const eventChannel = this.getOpenerEventChannel();
  245. eventChannel.emit('refreshData');
  246. uni.hideLoading()
  247. uni.showModal({
  248. title: '提示',
  249. content: '操作成功',
  250. showCancel:false,
  251. success: function (res) {
  252. if (res.confirm) {
  253. uni.navigateBack()
  254. } else if (res.cancel) {
  255. console.log('用户点击取消');
  256. }
  257. }
  258. });
  259. }).catch(error => {
  260. uni.showToast({
  261. title: error
  262. })
  263. })
  264. },
  265. del(val){
  266. this.list.splice(val,1)
  267. },
  268. deviceDetailsByNameApi(val,item){
  269. uni.showLoading({
  270. title: "加载中",
  271. mask: true,
  272. })
  273. API.deviceDetailsByName({
  274. name:val
  275. }).then((res) => {
  276. uni.hideLoading()
  277. this.list.push({
  278. deviceName:val,
  279. obj:res.data.deviceInfo,
  280. count:1
  281. })
  282. }).catch(error => {
  283. this.list.push({
  284. deviceName:item.title,
  285. obj:item,
  286. count:1
  287. })
  288. })
  289. },
  290. ckItem(item){
  291. var c=this.list.findIndex(it=>{
  292. return it.obj.title==item.title
  293. })
  294. if(c!=-1){
  295. console.log(c)
  296. this.del(c)
  297. }else{
  298. this.deviceDetailsByNameApi(item.title,item);
  299. }
  300. },
  301. }
  302. }
  303. </script>
  304. <style scoped lang="scss">
  305. // 搜索
  306. .search {
  307. padding: 12rpx 24rpx;
  308. display: flex;
  309. border-radius: 8px;
  310. overflow: hidden;
  311. .search-box {
  312. display: flex;
  313. border-radius: 8px;
  314. overflow: hidden;
  315. }
  316. /deep/.u-search {
  317. width: 630rpx;
  318. margin: auto !important;
  319. position: relative;
  320. flex: 0;
  321. margin: 0 !important;
  322. height: 64rpx !important;
  323. }
  324. /deep/.u-content {
  325. width: 430px;
  326. border-radius: 0px !important;
  327. height: 64rpx !important;
  328. }
  329. /deep/.u-icon--right {
  330. margin-right: 16rpx;
  331. }
  332. .search-btn {
  333. width: 100rpx;
  334. height: 64rpx;
  335. background-color: #f2f2f2;
  336. .text {
  337. height: 40rpx;
  338. margin: 12rpx 0;
  339. border-left: 1px solid #999999;
  340. font-family: Microsoft Yahei;
  341. text-align: center;
  342. color: rgba(16, 98, 213, 1);
  343. font-size: 28rpx;
  344. }
  345. }
  346. }
  347. .showpopup{
  348. font-size: 36rpx;
  349. text-align: center;
  350. margin: 32rpx;
  351. }
  352. page {
  353. padding-bottom: 200rpx;
  354. }
  355. // 出库单状态
  356. .head {
  357. background-color: #fff;
  358. padding: 24rpx 32rpx;
  359. display: flex;
  360. align-items: center;
  361. color: #101010;
  362. font-size: 32rpx;
  363. .photo {
  364. width: 84rpx;
  365. height: 84rpx;
  366. border-radius: 100rpx;
  367. img {
  368. width: 100%;
  369. height: 100%;
  370. overflow: hidden;
  371. }
  372. }
  373. .name {
  374. color: #101010;
  375. font-size: 32rpx;
  376. margin-right: 8rpx;
  377. margin-left: 24rpx;
  378. }
  379. .submit {
  380. text {
  381. color: #3385FF;
  382. }
  383. }
  384. .state {
  385. line-height: 48rpx;
  386. padding: 0 24rpx;
  387. border-radius: 50px;
  388. background-color: rgba(255, 255, 255, 1);
  389. color: rgba(51, 133, 255, 1);
  390. font-size: 12px;
  391. text-align: center;
  392. font-family: Arial;
  393. border: 1px solid rgba(51, 133, 255, 1);
  394. margin-left: auto;
  395. }
  396. }
  397. // 出库单详情
  398. .details {
  399. background-color: #fff;
  400. margin-top: 24rpx;
  401. padding: 0 32rpx;
  402. .item {
  403. display: flex;
  404. justify-content: space-between;
  405. padding: 22rpx 0;
  406. border-bottom: 1px solid rgba(244, 244, 244, 1);
  407. .name {
  408. color: rgba(119, 119, 119, 1);
  409. }
  410. .value {
  411. color: #101010;
  412. }
  413. }
  414. }
  415. // 出库单列表
  416. .list {
  417. background-color: #fff;
  418. margin-top: 24rpx;
  419. padding: 22rpx 32rpx;
  420. .list-head {
  421. display: flex;
  422. justify-content: space-between;
  423. align-items: center;
  424. .title {
  425. color: #333333;
  426. font-size: 32rpx
  427. }
  428. .amount.add{
  429. color:#45BA45 ;
  430. }
  431. .amount {
  432. font-size: 24rpx;
  433. text {
  434. color: #3385FF;
  435. }
  436. /deep/.u-icon--right {
  437. margin-left: 8rpx;
  438. }
  439. }
  440. }
  441. // 清单信息
  442. .list-infos {
  443. border-radius: 8px;
  444. background-color: #F5F6F9;
  445. margin-top: 24rpx;
  446. padding: 24rpx;
  447. .infos-head {
  448. display: flex;
  449. justify-content: space-between;
  450. align-items: center;
  451. margin-bottom: 24rpx;
  452. .name {
  453. color: rgba(51, 51, 51, 1);
  454. font-size: 32rpx;
  455. }
  456. .state {
  457. color: #999999;
  458. }
  459. }
  460. .infos {
  461. margin-top: 16rpx;
  462. display: flex;
  463. color: #777777;
  464. font-size: 24rpx;
  465. .infos-1 {
  466. margin-right: 68rpx;
  467. }
  468. .infos-item {
  469. display: flex;
  470. margin-bottom: 8rpx;
  471. }
  472. }
  473. }
  474. }
  475. // 流程
  476. .process {
  477. background-color: #fff;
  478. margin-top: 24rpx;
  479. padding: 24rpx 32rpx;
  480. .title {
  481. color: rgba(51, 51, 51, 1);
  482. font-size: 32rpx;
  483. }
  484. .u-time-axis-item{
  485. //margin-bottom: 76rpx;
  486. }
  487. .u-time-axis {
  488. //padding: 18rpx 40rpx;
  489. }
  490. .u-node {
  491. width: 18rpx;
  492. height: 18rpx;
  493. border-radius: 100rpx !important;
  494. display: flex;
  495. justify-content: center;
  496. align-items: center;
  497. background: #d0d0d0;
  498. }
  499. .u-order{
  500. margin-bottom: 32rpx;
  501. }
  502. .u-order-title {
  503. color: #333333;
  504. font-weight: bold;
  505. font-size: 32rpx;
  506. }
  507. .u-order-desc {
  508. margin-bottom: 16rpx;
  509. display: flex;
  510. justify-content: space-between;
  511. align-items: center;
  512. .level {
  513. color: #333333;
  514. font-size: 32rpx;
  515. font-weight: bold;
  516. }
  517. .date {
  518. color: rgba(119, 119, 119, 1);
  519. }
  520. .state {
  521. color: rgba(255, 121, 0, 1);
  522. }
  523. }
  524. .u-order-time {
  525. width: 90rpx;
  526. color: #777777;
  527. font-size: 28rpx;
  528. margin-top: 16rpx;
  529. display: flex;
  530. flex-direction: column;
  531. align-items: center;
  532. .photo {
  533. width: 56rpx;
  534. height: 56rpx;
  535. border-radius: 100px;
  536. margin-bottom: 4rpx;
  537. img {
  538. width: 100%;
  539. height: 100%;
  540. overflow: hidden;
  541. position: relative;
  542. }
  543. }
  544. .confirm {
  545. position: absolute;
  546. top: 46rpx;
  547. left: 56rpx;
  548. }
  549. .name {
  550. color: rgba(51, 51, 51, 1);
  551. font-size: 24rpx;
  552. }
  553. }
  554. }
  555. // .u-time-axis{
  556. // .u-time-axis-item:last-of-type{
  557. // margin-bottom: 0;
  558. // }
  559. // }
  560. // 确认出库
  561. .bottom{
  562. background-color: #fff;
  563. margin-top: 44rpx;
  564. padding: 16rpx 32rpx;
  565. z-index: 999;
  566. position: fixed;
  567. left: 0;
  568. right: 0;
  569. bottom: 0;
  570. uni-button{
  571. border-radius: 8px;
  572. background: linear-gradient(180deg, rgba(22,119,255,1) 0%,rgba(16,98,213,1) 100%);
  573. color: rgba(255, 255, 255, 1);
  574. font-size: 32rpx;
  575. line-height: 88rpx;
  576. }
  577. }
  578. </style>