deliveryFrom.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  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="showpopupBtn()" >
  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" >
  162. <u-button type="primary" @click="submit">提交出库单</u-button>
  163. </view>
  164. </view>
  165. </template>
  166. <script>
  167. import equipmentRetrieval from "@/components/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. showpopupBtn(){
  195. console.log(123)
  196. uni.showToast({
  197. title:"123"
  198. })
  199. this.showpopup=true
  200. },
  201. refscrolltolower(){
  202. this.$refs.equipmentRetrievalRef.myLoadmoreonReachBottom()
  203. },
  204. ckQueryContent(){
  205. this.$refs.equipmentRetrievalRef.queryContent=this.queryContent
  206. this.$refs.equipmentRetrievalRef.getList()
  207. },
  208. change(e){
  209. if(e==''){
  210. this.form[this.showText]='';
  211. this[this.showText]=''
  212. }else{
  213. this.form[this.showText]=e.result;
  214. this[this.showText]=e.year+"年"+e.month+"月"+e.day+"日"
  215. }
  216. },
  217. submit(){
  218. if(!this.form.projectName){
  219. uni.showToast({
  220. title: "请填写所属项目"
  221. })
  222. return
  223. }
  224. if(!this.form.endTime){
  225. uni.showToast({
  226. title: "请输入使用周期"
  227. })
  228. return
  229. }
  230. if(this.list.length==0){
  231. uni.showToast({
  232. title: "请添加设备"
  233. })
  234. return
  235. }
  236. var list=this.list.map(item=>{
  237. var obj={
  238. ...item
  239. }
  240. delete obj.obj
  241. return obj
  242. })
  243. this.form.deviceData=list
  244. uni.showLoading({
  245. title: "加载中",
  246. mask: true,
  247. })
  248. API.saveOutRecord({
  249. content:JSON.stringify(this.form)
  250. }).then((res) => {
  251. const eventChannel = this.getOpenerEventChannel();
  252. eventChannel.emit('refreshData');
  253. uni.hideLoading()
  254. uni.showModal({
  255. title: '提示',
  256. content: '操作成功',
  257. showCancel:false,
  258. success: function (res) {
  259. if (res.confirm) {
  260. uni.navigateBack()
  261. } else if (res.cancel) {
  262. console.log('用户点击取消');
  263. }
  264. }
  265. });
  266. }).catch(error => {
  267. uni.showToast({
  268. title: error
  269. })
  270. })
  271. },
  272. del(val){
  273. this.list.splice(val,1)
  274. },
  275. deviceDetailsByNameApi(val,item){
  276. uni.showLoading({
  277. title: "加载中",
  278. mask: true,
  279. })
  280. API.deviceDetailsByName({
  281. name:val
  282. }).then((res) => {
  283. uni.hideLoading()
  284. this.list.push({
  285. deviceName:val,
  286. obj:res.data.deviceInfo,
  287. count:1
  288. })
  289. }).catch(error => {
  290. this.list.push({
  291. deviceName:item.title,
  292. obj:item,
  293. count:1
  294. })
  295. })
  296. },
  297. ckItem(item){
  298. var c=this.list.findIndex(it=>{
  299. return it.obj.title==item.title
  300. })
  301. if(c!=-1){
  302. console.log(c)
  303. this.del(c)
  304. }else{
  305. this.deviceDetailsByNameApi(item.title,item);
  306. }
  307. },
  308. }
  309. }
  310. </script>
  311. <style scoped lang="scss">
  312. // 搜索
  313. .search {
  314. padding: 12rpx 24rpx;
  315. display: flex;
  316. border-radius: 8px;
  317. overflow: hidden;
  318. .search-box {
  319. display: flex;
  320. border-radius: 8px;
  321. overflow: hidden;
  322. }
  323. /deep/.u-search {
  324. width: 630rpx;
  325. margin: auto !important;
  326. position: relative;
  327. flex: 0;
  328. margin: 0 !important;
  329. height: 64rpx !important;
  330. }
  331. /deep/.u-content {
  332. width: 430px;
  333. border-radius: 0px !important;
  334. height: 64rpx !important;
  335. }
  336. /deep/.u-icon--right {
  337. margin-right: 16rpx;
  338. }
  339. .search-btn {
  340. width: 100rpx;
  341. height: 64rpx;
  342. background-color: #f2f2f2;
  343. .text {
  344. height: 40rpx;
  345. margin: 12rpx 0;
  346. border-left: 1px solid #999999;
  347. font-family: Microsoft Yahei;
  348. text-align: center;
  349. color: rgba(16, 98, 213, 1);
  350. font-size: 28rpx;
  351. }
  352. }
  353. }
  354. .showpopup{
  355. font-size: 36rpx;
  356. text-align: center;
  357. margin: 32rpx;
  358. }
  359. page {
  360. padding-bottom: 200rpx;
  361. }
  362. // 出库单状态
  363. .head {
  364. background-color: #fff;
  365. padding: 24rpx 32rpx;
  366. display: flex;
  367. align-items: center;
  368. color: #101010;
  369. font-size: 32rpx;
  370. .photo {
  371. width: 84rpx;
  372. height: 84rpx;
  373. border-radius: 100rpx;
  374. img {
  375. width: 100%;
  376. height: 100%;
  377. overflow: hidden;
  378. }
  379. }
  380. .name {
  381. color: #101010;
  382. font-size: 32rpx;
  383. margin-right: 8rpx;
  384. margin-left: 24rpx;
  385. }
  386. .submit {
  387. text {
  388. color: #3385FF;
  389. }
  390. }
  391. .state {
  392. line-height: 48rpx;
  393. padding: 0 24rpx;
  394. border-radius: 50px;
  395. background-color: rgba(255, 255, 255, 1);
  396. color: rgba(51, 133, 255, 1);
  397. font-size: 12px;
  398. text-align: center;
  399. font-family: Arial;
  400. border: 1px solid rgba(51, 133, 255, 1);
  401. margin-left: auto;
  402. }
  403. }
  404. // 出库单详情
  405. .details {
  406. background-color: #fff;
  407. margin-top: 24rpx;
  408. padding: 0 32rpx;
  409. .item {
  410. display: flex;
  411. justify-content: space-between;
  412. padding: 22rpx 0;
  413. border-bottom: 1px solid rgba(244, 244, 244, 1);
  414. .name {
  415. color: rgba(119, 119, 119, 1);
  416. }
  417. .value {
  418. color: #101010;
  419. }
  420. }
  421. }
  422. // 出库单列表
  423. .list {
  424. background-color: #fff;
  425. margin-top: 24rpx;
  426. padding: 22rpx 32rpx;
  427. .list-head {
  428. display: flex;
  429. justify-content: space-between;
  430. align-items: center;
  431. .title {
  432. color: #333333;
  433. font-size: 32rpx
  434. }
  435. .amount.add{
  436. color:#45BA45 ;
  437. }
  438. .amount {
  439. font-size: 24rpx;
  440. text {
  441. color: #3385FF;
  442. }
  443. /deep/.u-icon--right {
  444. margin-left: 8rpx;
  445. }
  446. }
  447. }
  448. // 清单信息
  449. .list-infos {
  450. border-radius: 8px;
  451. background-color: #F5F6F9;
  452. margin-top: 24rpx;
  453. padding: 24rpx;
  454. .infos-head {
  455. display: flex;
  456. justify-content: space-between;
  457. align-items: center;
  458. margin-bottom: 24rpx;
  459. .name {
  460. color: rgba(51, 51, 51, 1);
  461. font-size: 32rpx;
  462. }
  463. .state {
  464. color: #999999;
  465. }
  466. }
  467. .infos {
  468. margin-top: 16rpx;
  469. display: flex;
  470. color: #777777;
  471. font-size: 24rpx;
  472. .infos-1 {
  473. margin-right: 68rpx;
  474. }
  475. .infos-item {
  476. display: flex;
  477. margin-bottom: 8rpx;
  478. }
  479. }
  480. }
  481. }
  482. // 流程
  483. .process {
  484. background-color: #fff;
  485. margin-top: 24rpx;
  486. padding: 24rpx 32rpx;
  487. .title {
  488. color: rgba(51, 51, 51, 1);
  489. font-size: 32rpx;
  490. }
  491. .u-time-axis-item{
  492. //margin-bottom: 76rpx;
  493. }
  494. .u-time-axis {
  495. //padding: 18rpx 40rpx;
  496. }
  497. .u-node {
  498. width: 18rpx;
  499. height: 18rpx;
  500. border-radius: 100rpx !important;
  501. display: flex;
  502. justify-content: center;
  503. align-items: center;
  504. background: #d0d0d0;
  505. }
  506. .u-order{
  507. margin-bottom: 32rpx;
  508. }
  509. .u-order-title {
  510. color: #333333;
  511. font-weight: bold;
  512. font-size: 32rpx;
  513. }
  514. .u-order-desc {
  515. margin-bottom: 16rpx;
  516. display: flex;
  517. justify-content: space-between;
  518. align-items: center;
  519. .level {
  520. color: #333333;
  521. font-size: 32rpx;
  522. font-weight: bold;
  523. }
  524. .date {
  525. color: rgba(119, 119, 119, 1);
  526. }
  527. .state {
  528. color: rgba(255, 121, 0, 1);
  529. }
  530. }
  531. .u-order-time {
  532. width: 90rpx;
  533. color: #777777;
  534. font-size: 28rpx;
  535. margin-top: 16rpx;
  536. display: flex;
  537. flex-direction: column;
  538. align-items: center;
  539. .photo {
  540. width: 56rpx;
  541. height: 56rpx;
  542. border-radius: 100px;
  543. margin-bottom: 4rpx;
  544. img {
  545. width: 100%;
  546. height: 100%;
  547. overflow: hidden;
  548. position: relative;
  549. }
  550. }
  551. .confirm {
  552. position: absolute;
  553. top: 46rpx;
  554. left: 56rpx;
  555. }
  556. .name {
  557. color: rgba(51, 51, 51, 1);
  558. font-size: 24rpx;
  559. }
  560. }
  561. }
  562. // .u-time-axis{
  563. // .u-time-axis-item:last-of-type{
  564. // margin-bottom: 0;
  565. // }
  566. // }
  567. // 确认出库
  568. .bottom{
  569. background-color: #fff;
  570. margin-top: 44rpx;
  571. padding: 16rpx 32rpx;
  572. z-index: 999;
  573. position: fixed;
  574. left: 0;
  575. right: 0;
  576. bottom: 0;
  577. uni-button{
  578. border-radius: 8px;
  579. background: linear-gradient(180deg, rgba(22,119,255,1) 0%,rgba(16,98,213,1) 100%);
  580. color: rgba(255, 255, 255, 1);
  581. font-size: 32rpx;
  582. line-height: 88rpx;
  583. }
  584. }
  585. </style>