deliveryFrom.vue 15 KB

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