outbound.vue 15 KB

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