inbound.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  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">
  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">
  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 @click="checkUserButton(item)"
  110. v-for="(item,index) in userList" :key="index">
  111. {{item.userName}}({{item.account}})
  112. </view>
  113. </view>
  114. </view>
  115. </view>
  116. </view>
  117. </template>
  118. <script>
  119. import {
  120. config
  121. } from '@/api/request/config.js'
  122. import {
  123. systemUserSelectUser
  124. } from '@/pages_supplierCylinderManagement/api/index.js'
  125. export default {
  126. data() {
  127. return {
  128. baseUrl: config.base_url,
  129. newData: {
  130. newData1: '',
  131. newData2: '',
  132. newData3: '',
  133. newData4: '',
  134. newData5: '',
  135. newData6: '',
  136. newData7: '',
  137. newData8: '',
  138. newData9: '',
  139. newData91: '',
  140. newData92: '',
  141. newData10: '',
  142. newData11: '',
  143. newData12: '',
  144. newData13: '',
  145. newData133: '',
  146. newData14: '',
  147. newData15: [],
  148. newData16: '',
  149. },
  150. inputData: '',
  151. userList:[],
  152. shadeType:false,
  153. }
  154. },
  155. onLoad(options) {
  156. if (options.pageType) {
  157. let obj = JSON.parse(decodeURIComponent(options.form));
  158. if (options.pageType == 1) {
  159. this.$set(this.newData, 'newData1', obj.id);
  160. this.$set(this.newData, 'newData2', obj.bottleCode);
  161. this.$set(this.newData, 'newData3', obj.gasName);
  162. this.$set(this.newData, 'newData4', obj.specification);
  163. this.$set(this.newData, 'newData5', obj.gasCategory);
  164. this.$set(this.newData, 'newData6', obj.pressure);
  165. this.$set(this.newData, 'newData7', obj.purity);
  166. } else if (options.pageType == 2) {
  167. this.$set(this.newData, 'newData8', obj.subId);
  168. this.$set(this.newData, 'newData9', obj.subName);
  169. this.$set(this.newData, 'newData92', obj.deptId);
  170. this.$set(this.newData, 'newData10', obj.buildName);
  171. this.$set(this.newData, 'newData11', obj.floorName);
  172. this.$set(this.newData, 'newData12', obj.roomNum);
  173. }
  174. }
  175. },
  176. onShow() {
  177. },
  178. methods: {
  179. checkButton(type) {
  180. if (type == 1) {
  181. uni.navigateTo({
  182. url: "/pages_supplierCylinderManagement/views/gasCylinderManagement/selectCylinder?from=1",
  183. });
  184. } else if (type == 2) {
  185. uni.navigateTo({
  186. url: "/pages_supplierCylinderManagement/views/gasCylinderManagement/selectLab?from=1",
  187. });
  188. }
  189. },
  190. //提交方法
  191. submitButton() {
  192. uni.showModal({
  193. title: '确认入库',
  194. content: '确认后,该气体气瓶的当前状态将变更为已入库。',
  195. showCancel: true,
  196. cancelText: '关闭',
  197. confirmText: '确认入库',
  198. confirmColor: '#2684D8',
  199. success: (res) => {
  200. if (res.confirm) {
  201. uni.showToast({
  202. title: '入库完成',
  203. icon: "success",
  204. mask: true,
  205. duration: 2000
  206. });
  207. setTimeout(function() {
  208. uni.navigateBack();
  209. }, 2000);
  210. }
  211. }
  212. });
  213. },
  214. /******图片上传******/
  215. selectImage() {
  216. let self = this;
  217. if (self.newData.newData15[8]) {
  218. uni.showToast({
  219. title: '最多上传9张图片',
  220. icon: "none",
  221. mask: true,
  222. duration: 2000
  223. });
  224. return
  225. }
  226. uni.chooseImage({
  227. count: 1,
  228. sizeType: ["original", "compressed"],
  229. sourceType: ["album", "camera"],
  230. success: function(res) {
  231. if (res.tempFilePaths[0]) {
  232. res.tempFilePaths.forEach(function(item, index) {
  233. self.uploadImg(item);
  234. })
  235. }
  236. }
  237. });
  238. },
  239. async uploadImg(tempFilePaths) {
  240. var self = this;
  241. uni.showLoading({
  242. title: '上传中',
  243. mask: true
  244. });
  245. uni.uploadFile({
  246. url: config.base_url + '/system/file/upload', //仅为示例,非真实的接口地址
  247. header: {
  248. 'Authorization': uni.getStorageSync('token')
  249. },
  250. filePath: tempFilePaths,
  251. name: 'file',
  252. formData: {
  253. 'user': 'test'
  254. },
  255. success: (uploadFileRes) => {
  256. let res = JSON.parse(uploadFileRes.data);
  257. if (res.code == 200) {
  258. this.newData.newData15.push(res.data.url)
  259. // this.$set(this.newData, 'newData15', res.data.url);
  260. } else {
  261. uni.showToast({
  262. title: res.msg,
  263. icon: "none",
  264. mask: true,
  265. duration: 2000
  266. });
  267. }
  268. },
  269. fail: err => {},
  270. complete: () => {
  271. uni.hideLoading()
  272. }
  273. });
  274. },
  275. //删除图片
  276. delImg(index) {
  277. this.newData.newData15.splice(index, 1)
  278. },
  279. //预览图片
  280. previewSingleImage(imageUrl) {
  281. uni.previewImage({
  282. urls: [imageUrl] // 必须包裹成数组
  283. });
  284. },
  285. searchButton(){
  286. if(this.inputData !== '' && this.inputData.length>1){
  287. this.systemUserSelectUser();
  288. }else{
  289. uni.showToast({
  290. title: '请输入至少2个字符',
  291. icon: "none",
  292. mask: true,
  293. duration: 2000
  294. });
  295. }
  296. },
  297. //搜索用户
  298. async systemUserSelectUser() {
  299. const {
  300. data
  301. } = await systemUserSelectUser({
  302. "userName": this.inputData,
  303. 'userType': '1'
  304. });
  305. if (data.code == 200) {
  306. this.$set(this,'userList',data.data);
  307. }
  308. },
  309. //选择用户
  310. checkUserButton(item){
  311. this.$set(this.newData,'newData13',item.userName);
  312. this.$set(this.newData,'newData133',item.userId);
  313. this.$set(this,'shadeType',false);
  314. },
  315. //遮罩层开关
  316. shadeButton(type){
  317. if(type == 1){
  318. if(this.newData.newData13){
  319. this.$set(this,'inputData',this.newData.newData13);
  320. this.systemUserSelectUser();
  321. }
  322. this.$set(this,'shadeType',true);
  323. }else if(type == 2){
  324. this.$set(this,'shadeType',false);
  325. }
  326. }
  327. }
  328. }
  329. </script>
  330. <style lang="stylus" scoped>
  331. #gasCylinderInbound {
  332. height: 100%;
  333. width: 100%;
  334. display flex;
  335. flex-direction column;
  336. overflow: hidden;
  337. .gasCylinderInbound-page {
  338. flex: 1;
  339. display flex;
  340. flex-direction column;
  341. overflow: hidden;
  342. .content-max-box {
  343. flex: 1;
  344. display flex;
  345. flex-direction column;
  346. overflow-y: scroll;
  347. .content-big-box {
  348. margin: 0 30rpx 0;
  349. .content-title-p {
  350. line-height: 80rpx;
  351. padding: 0 20rpx;
  352. color: #666;
  353. }
  354. .content-min-box {
  355. background-color: #fff;
  356. border-radius: 12rpx;
  357. .content-check-box {
  358. display: flex;
  359. padding: 40rpx 30rpx;
  360. view {
  361. font-size: 30rpx;
  362. line-height: 40rpx;
  363. }
  364. view:nth-child(1) {
  365. flex: 1;
  366. font-weight: 600;
  367. }
  368. view:nth-child(2) {
  369. font-size: 28rpx;
  370. font-weight: 600;
  371. margin-right: 10rpx;
  372. color: #666;
  373. }
  374. .right-icon {
  375. font-size: 30rpx;
  376. }
  377. }
  378. .content-bottom-text-box {
  379. border-top: 1rpx solid #dedede;
  380. margin: 0 30rpx;
  381. padding: 20rpx 0;
  382. .content-text-box {
  383. display: flex;
  384. view {
  385. font-size: 28rpx;
  386. line-height: 60rpx;
  387. }
  388. view:nth-child(1) {}
  389. view:nth-child(2) {
  390. flex: 1;
  391. text-align: right;
  392. }
  393. }
  394. }
  395. }
  396. }
  397. }
  398. .content-max-input-box {
  399. background-color: #fff;
  400. border-radius: 12rpx;
  401. display: flex;
  402. margin: 30rpx 30rpx 0;
  403. padding: 0 30rpx;
  404. .name-box {
  405. font-size: 30rpx;
  406. font-weight: 600;
  407. line-height: 100rpx;
  408. }
  409. .input-box {
  410. flex: 1;
  411. height: 100rpx;
  412. line-height: 100rpx;
  413. text-align: right;
  414. }
  415. }
  416. .content-max-up-box {
  417. background-color: #fff;
  418. border-radius: 12rpx;
  419. margin: 30rpx 30rpx 0;
  420. padding: 0 30rpx;
  421. .name-box {
  422. font-size: 30rpx;
  423. font-weight: 600;
  424. line-height: 100rpx;
  425. }
  426. .up-big-box {
  427. padding: 0 0 30rpx 0;
  428. .img-data:nth-child(3n) {
  429. margin-right: 0 !important;
  430. }
  431. .img-data {
  432. display: inline-block;
  433. width: 190rpx;
  434. height: 190rpx;
  435. margin-right: 30rpx;
  436. margin-bottom: 25rpx;
  437. position: relative;
  438. .min-img {
  439. display: block;
  440. width: 190rpx;
  441. height: 190rpx;
  442. overflow: hidden;
  443. border-radius: 12rpx;
  444. }
  445. .del-postion-p {
  446. position: absolute;
  447. top: -15rpx;
  448. right: -15rpx;
  449. width: 40rpx;
  450. height: 40rpx;
  451. color: red;
  452. }
  453. }
  454. .add-button {
  455. display: inline-block;
  456. overflow: hidden;
  457. border: 1rpx solid #dedede;
  458. border-radius: 12rpx;
  459. width: 190rpx !important;
  460. height: 145rpx;
  461. text-align: center;
  462. color: #666;
  463. font-size: 28rpx;
  464. padding-top: 45rpx;
  465. }
  466. }
  467. .textarea-box {
  468. width: 570rpx;
  469. padding: 30rpx;
  470. border: 1px solid #dedede;
  471. border-radius: 12rpx;
  472. margin-bottom: 30rpx;
  473. }
  474. }
  475. .bottom-button-p {
  476. width: 700rpx;
  477. height: 100rpx;
  478. line-height: 100rpx;
  479. text-align: center;
  480. margin: 30rpx auto 60rpx;
  481. color: #fff;
  482. background-color: #0183FA;
  483. border-radius: 16rpx;
  484. }
  485. }
  486. .shade-max-big-box {
  487. position: absolute;
  488. top: 0;
  489. left: 0;
  490. height: 100%;
  491. width: 100%;
  492. display: flex;
  493. flex-direction: column;
  494. overflow: hidden;
  495. z-index: 10;
  496. background-color: rgba(0, 0, 0, 0.2);
  497. .shade-big-top-box {
  498. flex: 1;
  499. }
  500. .shade-big-bottom-box {
  501. height:800rpx;
  502. background-color: #fff;
  503. border-top-left-radius: 30rpx;
  504. border-top-right-radius: 30rpx;
  505. .shade-input-max-box {
  506. display: flex;
  507. margin: 40rpx 60rpx;
  508. .icons-box {
  509. border-top-left-radius: 30rpx;
  510. border-bottom-left-radius: 30rpx;
  511. width: 80rpx;
  512. text-align: center;
  513. height: 60rpx;
  514. line-height: 60rpx;
  515. background-color: #eeeeee;
  516. }
  517. .input-box {
  518. flex: 1;
  519. padding: 0 20rpx 0 0;
  520. height: 60rpx;
  521. line-height: 60rpx;
  522. background-color: #eeeeee;
  523. font-size: 28rpx;
  524. }
  525. .button-box {
  526. background-color: #0183FA;
  527. color: #fff;
  528. width: 120rpx;
  529. text-align: center;
  530. line-height: 60rpx;
  531. font-size: 28rpx;
  532. border-top-right-radius: 30rpx;
  533. border-bottom-right-radius: 30rpx;
  534. }
  535. }
  536. .list-max-box {
  537. height:660rpx;
  538. overflow-y: scroll;
  539. border-top: 1rpx solid #dedede;
  540. view:nth-child(1){
  541. border:none;
  542. }
  543. view{
  544. font-size:28rpx;
  545. padding:20rpx 40rpx;
  546. line-height:60rpx;
  547. border-top:1rpx solid #dedede;
  548. display block;
  549. overflow hidden;
  550. text-overflow ellipsis;
  551. white-space nowrap;
  552. }
  553. }
  554. }
  555. }
  556. }
  557. </style>