inbound.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700
  1. <!-- 气瓶入库 -->
  2. <template>
  3. <view id="gasCylinderInbound">
  4. <view class="gasCylinderInbound-page">
  5. <view class="content-max-box">
  6. <view class="content-big-box">
  7. <view class="content-title-p">气瓶信息</view>
  8. <view class="content-min-box">
  9. <view class="content-check-box" @click="checkButton(1)">
  10. <view>选择气瓶</view>
  11. <view>{{newData.newData1?'更改':'请选择'}}</view>
  12. <uni-icons class="right-icon" type="right"></uni-icons>
  13. </view>
  14. <view class="content-bottom-text-box" v-if="newData.newData1">
  15. <view class="content-text-box" v-if="!newData.newData0">
  16. <view>气瓶编码:</view>
  17. <view>{{newData.newData2}}</view>
  18. </view>
  19. <view class="content-text-box">
  20. <view>气体:</view>
  21. <view>{{newData.newData3}}</view>
  22. </view>
  23. <view class="content-text-box">
  24. <view>气瓶规格:</view>
  25. <view>{{newData.newData4}}</view>
  26. </view>
  27. <view class="content-text-box">
  28. <view>气体类别:</view>
  29. <view>{{newData.newData5}}</view>
  30. </view>
  31. <view class="content-text-box" v-if="!newData.newData0">
  32. <view>压力:</view>
  33. <view>{{newData.newData6}}</view>
  34. </view>
  35. <view class="content-text-box">
  36. <view>纯度:</view>
  37. <view>{{newData.newData7}}</view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="content-big-box">
  43. <view class="content-title-p">实验室信息</view>
  44. <view class="content-min-box">
  45. <view class="content-check-box" @click="checkButton(2)">
  46. <view>入库实验室</view>
  47. <view>{{newData.newData8?'更改':'请选择'}}</view>
  48. <uni-icons class="right-icon" type="right"></uni-icons>
  49. </view>
  50. <view class="content-bottom-text-box" v-if="newData.newData8">
  51. <view class="content-text-box">
  52. <view>实验室名称:</view>
  53. <view>{{newData.newData9}}</view>
  54. </view>
  55. <view class="content-text-box">
  56. <view>楼栋:</view>
  57. <view>{{newData.newData10}}</view>
  58. </view>
  59. <view class="content-text-box">
  60. <view>楼层:</view>
  61. <view>{{newData.newData11}}</view>
  62. </view>
  63. <view class="content-text-box">
  64. <view>房间:</view>
  65. <view>{{newData.newData12}}</view>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. <view class="content-max-input-box">
  71. <view class="name-box">签收人</view>
  72. <view class="input-box" style="color:#808080;" @click='shadeButton(1)'>{{newData.newData13?newData.newData13:'请选择'}}</view>
  73. </view>
  74. <view class="content-max-input-box">
  75. <view class="name-box">费用</view>
  76. <input class="uni-input input-box" v-model="newData.newData14" type="number" maxlength="10"
  77. placeholder="请输入" />
  78. </view>
  79. <view class="content-max-up-box">
  80. <view class="name-box">入库单</view>
  81. <view class="up-big-box">
  82. <view class="img-data" v-for="(item,index) in newData.newData15" :key="index">
  83. <img class="min-img" @click="previewSingleImage(baseUrl+item)" :src="baseUrl+item">
  84. <uni-icons class="del-postion-p" @click="delImg(index)" type="close" color="red" size="20"></uni-icons>
  85. </view>
  86. <view class="add-button" @click="selectImage()" v-if="!newData.newData15[8]">
  87. <uni-icons type="cloud-upload" size="30" color="#666"></uni-icons>
  88. <view>上传照片</view>
  89. </view>
  90. </view>
  91. </view>
  92. <view class="content-max-up-box">
  93. <view class="name-box">备注</view>
  94. <textarea class="textarea textarea-box" placeholder="请输入" maxlength="100"
  95. v-model="newData.newData16"></textarea>
  96. </view>
  97. </view>
  98. <view class="bottom-button-p" @click="submitButton()">确认入库</view>
  99. </view>
  100. <view class="shade-max-big-box" v-if="shadeType">
  101. <view class="shade-big-top-box" @click="shadeButton(2)"></view>
  102. <view class="shade-big-bottom-box">
  103. <view class="shade-input-max-box">
  104. <uni-icons type="search" class="icons-box" size="20"></uni-icons>
  105. <input class="uni-input input-box" v-model="inputData" maxlength="20" placeholder="请输入" />
  106. <view class="button-box" @click="searchButton()">搜索</view>
  107. </view>
  108. <view class="list-max-box">
  109. <view class="for-p" @click="checkUserButton(item)"
  110. v-for="(item,index) in userList" :key="index">
  111. {{item.userName}}({{item.account}})
  112. </view>
  113. <view class="null-p" v-if="!userList[0]">搜索并查询签收人</view>
  114. </view>
  115. </view>
  116. </view>
  117. </view>
  118. </template>
  119. <script>
  120. import {
  121. config
  122. } from '@/api/request/config.js'
  123. import {
  124. systemUserSelectUser,airBottleNewQpAppletBottleStorageIn,
  125. } from '@/pages_supplierCylinderManagement/api/index.js'
  126. export default {
  127. data() {
  128. return {
  129. baseUrl: config.base_url,
  130. newData: {
  131. newData0: '',
  132. newData1: '',
  133. newData2: '',
  134. newData3: '',
  135. newData4: '',
  136. newData5: '',
  137. newData6: '',
  138. newData7: '',
  139. newData8: '',
  140. newData9: '',
  141. newData92: '',
  142. newData10: '',
  143. newData11: '',
  144. newData12: '',
  145. newData13: '',
  146. newData133: '',
  147. newData14: '',
  148. newData15: [],
  149. newData16: '',
  150. },
  151. inputData: '',
  152. userList:[],
  153. shadeType:false,
  154. }
  155. },
  156. onLoad(options) {
  157. uni.$on('refreshBPageData', (data) => {
  158. if (data.pageType == 1) {
  159. this.$set(this.newData, 'newData0', data.specialGases);
  160. this.$set(this.newData, 'newData1', data.id);
  161. this.$set(this.newData, 'newData2', data.bottleCode);
  162. this.$set(this.newData, 'newData3', data.gasName);
  163. this.$set(this.newData, 'newData4', data.specification);
  164. this.$set(this.newData, 'newData5', data.gasCategory);
  165. this.$set(this.newData, 'newData6', data.pressure);
  166. this.$set(this.newData, 'newData7', data.purity);
  167. } else if (data.pageType == 2) {
  168. this.$set(this.newData, 'newData8', data.subId);
  169. this.$set(this.newData, 'newData9', data.subName);
  170. this.$set(this.newData, 'newData92', data.deptId);
  171. this.$set(this.newData, 'newData10', data.buildName);
  172. this.$set(this.newData, 'newData11', data.floorName);
  173. this.$set(this.newData, 'newData12', data.roomNum);
  174. }
  175. });
  176. },
  177. onUnload() {
  178. uni.$off('refreshBPageData');
  179. },
  180. // onLoad(options) {
  181. // if (options.pageType) {
  182. // this.$set(this,'newData',JSON.parse(uni.getStorageSync('inboundData')));
  183. // uni.removeStorageSync('inboundData')
  184. // let obj = JSON.parse(decodeURIComponent(options.form));
  185. // if (options.pageType == 1) {
  186. // this.$set(this.newData, 'newData0', obj.specialGases);
  187. // this.$set(this.newData, 'newData1', obj.id);
  188. // this.$set(this.newData, 'newData2', obj.bottleCode);
  189. // this.$set(this.newData, 'newData3', obj.gasName);
  190. // this.$set(this.newData, 'newData4', obj.specification);
  191. // this.$set(this.newData, 'newData5', obj.gasCategory);
  192. // this.$set(this.newData, 'newData6', obj.pressure);
  193. // this.$set(this.newData, 'newData7', obj.purity);
  194. // } else if (options.pageType == 2) {
  195. // this.$set(this.newData, 'newData8', obj.subId);
  196. // this.$set(this.newData, 'newData9', obj.subName);
  197. // this.$set(this.newData, 'newData92', obj.deptId);
  198. // this.$set(this.newData, 'newData10', obj.buildName);
  199. // this.$set(this.newData, 'newData11', obj.floorName);
  200. // this.$set(this.newData, 'newData12', obj.roomNum);
  201. // }
  202. // }
  203. // },
  204. onShow() {
  205. },
  206. methods: {
  207. checkButton(type) {
  208. if (type == 1) {
  209. uni.navigateTo({
  210. url: "/pages_supplierCylinderManagement/views/gasCylinderManagement/selectCylinder?from=1",
  211. });
  212. } else if (type == 2) {
  213. uni.navigateTo({
  214. url: "/pages_supplierCylinderManagement/views/gasCylinderManagement/selectLab?from=1",
  215. });
  216. }
  217. },
  218. //提交方法
  219. submitButton() {
  220. let self = this;
  221. if(!this.newData.newData1){
  222. uni.showToast({
  223. title: '请选择气瓶',
  224. icon: "error",
  225. mask: true,
  226. duration: 2000
  227. });
  228. return
  229. }else if(!this.newData.newData8){
  230. uni.showToast({
  231. title: '请选择实验室',
  232. icon: "error",
  233. mask: true,
  234. duration: 2000
  235. });
  236. return
  237. }else if(!this.newData.newData133){
  238. uni.showToast({
  239. title: '请选择签收人',
  240. icon: "error",
  241. mask: true,
  242. duration: 2000
  243. });
  244. return
  245. }else if(!this.newData.newData14){
  246. uni.showToast({
  247. title: '请输入金额',
  248. icon: "error",
  249. mask: true,
  250. duration: 2000
  251. });
  252. return
  253. }else if(!this.newData.newData15[0]){
  254. uni.showToast({
  255. title: '请上传入库单',
  256. icon: "error",
  257. mask: true,
  258. duration: 2000
  259. });
  260. return
  261. }
  262. uni.showModal({
  263. title: '确认入库',
  264. content: '确认后,该气体气瓶的当前状态将变更为已入库。',
  265. showCancel: true,
  266. cancelText: '关闭',
  267. confirmText: '确认入库',
  268. confirmColor: '#2684D8',
  269. success: (res) => {
  270. if (res.confirm) {
  271. self.airBottleNewQpAppletBottleStorageIn();
  272. }
  273. }
  274. });
  275. },
  276. //入库
  277. async airBottleNewQpAppletBottleStorageIn() {
  278. let obj = {
  279. bottleId:this.newData.newData1,
  280. deptId:this.newData.newData92,
  281. subId:this.newData.newData8,
  282. receiver:this.newData.newData13,
  283. receiverId:this.newData.newData133,
  284. cost:this.newData.newData14,
  285. voucherUrl:this.newData.newData15+'',
  286. remark:this.newData.newData16,
  287. specialGases:this.newData.newData0,
  288. source:'2',
  289. };
  290. const {
  291. data
  292. } = await airBottleNewQpAppletBottleStorageIn(obj);
  293. if (data.code == 200) {
  294. uni.showToast({
  295. title: '入库完成',
  296. icon: "success",
  297. mask: true,
  298. duration: 2000
  299. });
  300. setTimeout(function() {
  301. uni.navigateBack({ delta: 1 });
  302. // uni.redirectTo({
  303. // url: '/pages_supplierCylinderManagement/views/gasCylinderManagement/index',
  304. // });
  305. }, 2000);
  306. }
  307. },
  308. /******图片上传******/
  309. selectImage() {
  310. let self = this;
  311. if (self.newData.newData15[8]) {
  312. uni.showToast({
  313. title: '最多上传9张图片',
  314. icon: "none",
  315. mask: true,
  316. duration: 2000
  317. });
  318. return
  319. }
  320. uni.chooseImage({
  321. count: 1,
  322. sizeType: ["original", "compressed"],
  323. sourceType: ["album", "camera"],
  324. success: function(res) {
  325. if (res.tempFilePaths[0]) {
  326. res.tempFilePaths.forEach(function(item, index) {
  327. self.uploadImg(item);
  328. })
  329. }
  330. }
  331. });
  332. },
  333. async uploadImg(tempFilePaths) {
  334. var self = this;
  335. uni.showLoading({
  336. title: '上传中',
  337. mask: true
  338. });
  339. uni.uploadFile({
  340. url: config.base_url + '/system/file/upload', //仅为示例,非真实的接口地址
  341. header: {
  342. 'Authorization': uni.getStorageSync('token')
  343. },
  344. filePath: tempFilePaths,
  345. name: 'file',
  346. formData: {
  347. 'user': 'test'
  348. },
  349. success: (uploadFileRes) => {
  350. let res = JSON.parse(uploadFileRes.data);
  351. if (res.code == 200) {
  352. this.newData.newData15.push(res.data.url)
  353. // this.$set(this.newData, 'newData15', res.data.url);
  354. } else {
  355. uni.showToast({
  356. title: res.msg,
  357. icon: "none",
  358. mask: true,
  359. duration: 2000
  360. });
  361. }
  362. },
  363. fail: err => {},
  364. complete: () => {
  365. uni.hideLoading()
  366. }
  367. });
  368. },
  369. //删除图片
  370. delImg(index) {
  371. this.newData.newData15.splice(index, 1)
  372. },
  373. //预览图片
  374. previewSingleImage(imageUrl) {
  375. uni.previewImage({
  376. urls: [imageUrl] // 必须包裹成数组
  377. });
  378. },
  379. searchButton(){
  380. if(this.inputData !== '' && this.inputData.length>1){
  381. this.systemUserSelectUser();
  382. }else{
  383. uni.showToast({
  384. title: '请输入至少2个字符',
  385. icon: "none",
  386. mask: true,
  387. duration: 2000
  388. });
  389. }
  390. },
  391. //搜索用户
  392. async systemUserSelectUser() {
  393. const {
  394. data
  395. } = await systemUserSelectUser({
  396. "userName": this.inputData,
  397. 'userType': '1'
  398. });
  399. if (data.code == 200) {
  400. this.$set(this,'userList',data.data);
  401. }
  402. },
  403. //选择用户
  404. checkUserButton(item){
  405. this.$set(this.newData,'newData13',item.userName);
  406. this.$set(this.newData,'newData133',item.userId);
  407. this.$set(this,'shadeType',false);
  408. },
  409. //遮罩层开关
  410. shadeButton(type){
  411. if(type == 1){
  412. if(this.newData.newData13){
  413. this.$set(this,'inputData',this.newData.newData13);
  414. this.systemUserSelectUser();
  415. }
  416. this.$set(this,'shadeType',true);
  417. }else if(type == 2){
  418. this.$set(this,'shadeType',false);
  419. }
  420. }
  421. }
  422. }
  423. </script>
  424. <style lang="stylus" scoped>
  425. #gasCylinderInbound {
  426. height: 100%;
  427. width: 100%;
  428. display flex;
  429. flex-direction column;
  430. overflow: hidden;
  431. .gasCylinderInbound-page {
  432. flex: 1;
  433. display flex;
  434. flex-direction column;
  435. overflow: hidden;
  436. .content-max-box {
  437. flex: 1;
  438. display flex;
  439. flex-direction column;
  440. overflow-y: scroll;
  441. .content-big-box {
  442. margin: 0 30rpx 0;
  443. .content-title-p {
  444. line-height: 80rpx;
  445. padding: 0 20rpx;
  446. color: #666;
  447. }
  448. .content-min-box {
  449. background-color: #fff;
  450. border-radius: 12rpx;
  451. .content-check-box {
  452. display: flex;
  453. padding: 40rpx 30rpx;
  454. view {
  455. font-size: 30rpx;
  456. line-height: 40rpx;
  457. }
  458. view:nth-child(1) {
  459. flex: 1;
  460. font-weight: 600;
  461. }
  462. view:nth-child(2) {
  463. font-size: 28rpx;
  464. font-weight: 600;
  465. margin-right: 10rpx;
  466. color: #666;
  467. }
  468. .right-icon {
  469. font-size: 30rpx;
  470. }
  471. }
  472. .content-bottom-text-box {
  473. border-top: 1rpx solid #dedede;
  474. margin: 0 30rpx;
  475. padding: 20rpx 0;
  476. .content-text-box {
  477. display: flex;
  478. view {
  479. font-size: 28rpx;
  480. line-height: 60rpx;
  481. }
  482. view:nth-child(1) {}
  483. view:nth-child(2) {
  484. flex: 1;
  485. text-align: right;
  486. }
  487. }
  488. }
  489. }
  490. }
  491. }
  492. .content-max-input-box {
  493. background-color: #fff;
  494. border-radius: 12rpx;
  495. display: flex;
  496. margin: 30rpx 30rpx 0;
  497. padding: 0 30rpx;
  498. .name-box {
  499. font-size: 30rpx;
  500. font-weight: 600;
  501. line-height: 100rpx;
  502. }
  503. .input-box {
  504. flex: 1;
  505. height: 100rpx;
  506. line-height: 100rpx;
  507. text-align: right;
  508. }
  509. }
  510. .content-max-up-box {
  511. background-color: #fff;
  512. border-radius: 12rpx;
  513. margin: 30rpx 30rpx 0;
  514. padding: 0 30rpx;
  515. .name-box {
  516. font-size: 30rpx;
  517. font-weight: 600;
  518. line-height: 100rpx;
  519. }
  520. .up-big-box {
  521. padding: 0 0 30rpx 0;
  522. .img-data:nth-child(3n) {
  523. margin-right: 0 !important;
  524. }
  525. .img-data {
  526. display: inline-block;
  527. width: 190rpx;
  528. height: 190rpx;
  529. margin-right: 30rpx;
  530. margin-bottom: 25rpx;
  531. position: relative;
  532. .min-img {
  533. display: block;
  534. width: 190rpx;
  535. height: 190rpx;
  536. overflow: hidden;
  537. border-radius: 12rpx;
  538. }
  539. .del-postion-p {
  540. position: absolute;
  541. top: -15rpx;
  542. right: -15rpx;
  543. width: 40rpx;
  544. height: 40rpx;
  545. color: red;
  546. }
  547. }
  548. .add-button {
  549. display: inline-block;
  550. overflow: hidden;
  551. border: 1rpx solid #dedede;
  552. border-radius: 12rpx;
  553. width: 190rpx !important;
  554. height: 145rpx;
  555. text-align: center;
  556. color: #666;
  557. font-size: 28rpx;
  558. padding-top: 45rpx;
  559. }
  560. }
  561. .textarea-box {
  562. width: 570rpx;
  563. padding: 30rpx;
  564. border: 1px solid #dedede;
  565. border-radius: 12rpx;
  566. margin-bottom: 30rpx;
  567. }
  568. }
  569. .bottom-button-p {
  570. width: 700rpx;
  571. height: 100rpx;
  572. line-height: 100rpx;
  573. text-align: center;
  574. margin: 30rpx auto 60rpx;
  575. color: #fff;
  576. background-color: #0183FA;
  577. border-radius: 16rpx;
  578. }
  579. }
  580. .shade-max-big-box {
  581. position: absolute;
  582. top: 0;
  583. left: 0;
  584. height: 100%;
  585. width: 100%;
  586. display: flex;
  587. flex-direction: column;
  588. overflow: hidden;
  589. z-index: 10;
  590. background-color: rgba(0, 0, 0, 0.2);
  591. .shade-big-top-box {
  592. flex: 1;
  593. }
  594. .shade-big-bottom-box {
  595. height:800rpx;
  596. background-color: #fff;
  597. border-top-left-radius: 30rpx;
  598. border-top-right-radius: 30rpx;
  599. .shade-input-max-box {
  600. display: flex;
  601. margin: 40rpx 60rpx;
  602. .icons-box {
  603. border-top-left-radius: 30rpx;
  604. border-bottom-left-radius: 30rpx;
  605. width: 80rpx;
  606. text-align: center;
  607. height: 60rpx;
  608. line-height: 60rpx;
  609. background-color: #eeeeee;
  610. }
  611. .input-box {
  612. flex: 1;
  613. padding: 0 20rpx 0 0;
  614. height: 60rpx;
  615. line-height: 60rpx;
  616. background-color: #eeeeee;
  617. font-size: 28rpx;
  618. }
  619. .button-box {
  620. background-color: #0183FA;
  621. color: #fff;
  622. width: 120rpx;
  623. text-align: center;
  624. line-height: 60rpx;
  625. font-size: 28rpx;
  626. border-top-right-radius: 30rpx;
  627. border-bottom-right-radius: 30rpx;
  628. }
  629. }
  630. .list-max-box {
  631. height:660rpx;
  632. overflow-y: scroll;
  633. border-top: 1rpx solid #dedede;
  634. .for-p:nth-child(1) {
  635. border: none;
  636. }
  637. .for-p {
  638. font-size: 28rpx;
  639. padding: 20rpx 40rpx;
  640. line-height: 60rpx;
  641. border-top: 1rpx solid #dedede;
  642. display:block;
  643. overflow:hidden;
  644. text-overflow:ellipsis;
  645. white-space:nowrap;
  646. }
  647. .null-p {
  648. text-align: center;
  649. font-size: 28rpx;
  650. color: #999;
  651. line-height: 300rpx;
  652. }
  653. }
  654. }
  655. }
  656. }
  657. </style>