inbound.vue 17 KB

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