outbound.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  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. <input class="uni-input input-box" v-model="newData.newData13" maxlength="20" placeholder="请输入" />
  85. </view>
  86. <view class="content-max-up-box">
  87. <view class="name-box">出库单</view>
  88. <view class="up-big-box">
  89. <view class="img-data" v-for="(item,index) in newData.newData15" :key="index">
  90. <img class="min-img" @click="previewSingleImage(baseUrl+item)" :src="baseUrl+item">
  91. <uni-icons class="del-postion-p" @click="delImg(index)" type="close" color="red" size="20"></uni-icons>
  92. </view>
  93. <view class="add-button" @click="selectImage()" v-if="!newData.newData15[8]">
  94. <uni-icons type="cloud-upload" size="30" color="#666"></uni-icons>
  95. <view>上传照片</view>
  96. </view>
  97. </view>
  98. </view>
  99. <view class="content-max-up-box">
  100. <view class="name-box">备注</view>
  101. <textarea class="textarea textarea-box" placeholder="请输入" maxlength="100"
  102. v-model="newData.newData16"></textarea>
  103. </view>
  104. </view>
  105. <view class="bottom-button-p" @click="submitButton()">确认出库</view>
  106. </view>
  107. </view>
  108. </template>
  109. <script>
  110. import {
  111. config
  112. } from '@/api/request/config.js'
  113. export default {
  114. data() {
  115. return {
  116. baseUrl: config.base_url,
  117. detailsType:false,
  118. newData: {
  119. newData1: '',
  120. newData2: '',
  121. newData3: '',
  122. newData4: '',
  123. newData5: '',
  124. newData6: '',
  125. newData7: '',
  126. newData8: '',
  127. newData9: '',
  128. newData10: '',
  129. newData11: '',
  130. newData12: '',
  131. newData13: '',
  132. newData14: '',
  133. newData15: [],
  134. newData16: '',
  135. newData17: '',
  136. },
  137. array: ['空瓶出库', '满瓶出库'],
  138. }
  139. },
  140. onLoad(options) {
  141. if (options.pageType) {
  142. let obj = decodeURIComponent(options.form);
  143. if (options.pageType == 1) {
  144. //选择气瓶
  145. this.$set(this.newData, 'newData1', obj.data1);
  146. this.$set(this.newData, 'newData2', obj.data2);
  147. this.$set(this.newData, 'newData3', obj.data3);
  148. this.$set(this.newData, 'newData4', obj.data4);
  149. } else if (options.pageType == 2) {
  150. //选择实验室
  151. this.$set(this.newData, 'newData5', obj.data5);
  152. this.$set(this.newData, 'newData6', obj.data6);
  153. this.$set(this.newData, 'newData7', obj.data7);
  154. this.$set(this.newData, 'newData8', obj.data8);
  155. } else if (options.pageType == 3) {
  156. //历史记录-气瓶出库
  157. this.$set(this,'detailsType',true);
  158. this.$set(this.newData, 'newData1', "1");
  159. this.$set(this.newData, 'newData8', "1");
  160. }
  161. }
  162. },
  163. onShow() {
  164. },
  165. methods: {
  166. bindPickerChange(e) {
  167. if (e.detail.value == 0) {
  168. this.$set(this.newData, 'newData17', 1)
  169. } else {
  170. this.$set(this.newData, 'newData17', 2)
  171. }
  172. },
  173. checkButton(type) {
  174. if (type == 1) {
  175. uni.navigateTo({
  176. url: "/pages_supplierCylinderManagement/views/gasCylinderManagement/selectCylinder?from=2",
  177. });
  178. } else if (type == 2) {
  179. uni.navigateTo({
  180. url: "/pages_supplierCylinderManagement/views/gasCylinderManagement/selectLab?from=2",
  181. });
  182. }
  183. },
  184. //提交方法
  185. submitButton() {
  186. uni.showModal({
  187. title: '确认出库',
  188. content: '确认后,该气体气瓶的当前状态将变更为已出库。',
  189. showCancel: true,
  190. cancelText: '关闭',
  191. confirmText: '确认出库',
  192. confirmColor:'#2684D8',
  193. success: (res) => {
  194. if (res.confirm) {
  195. uni.showToast({
  196. title:'出库完成',
  197. icon:"success",
  198. mask:true,
  199. duration: 2000
  200. });
  201. setTimeout(function(){
  202. uni.navigateBack();
  203. },2000);
  204. }
  205. }
  206. });
  207. },
  208. /******图片上传******/
  209. selectImage() {
  210. let self = this;
  211. if (self.newData.newData15[8]) {
  212. uni.showToast({
  213. title: '最多上传9张图片',
  214. icon: "none",
  215. mask: true,
  216. duration: 2000
  217. });
  218. return
  219. }
  220. uni.chooseImage({
  221. count:1,
  222. sizeType: ["original", "compressed"],
  223. sourceType: ["album", "camera"],
  224. success: function(res) {
  225. if (res.tempFilePaths[0]) {
  226. res.tempFilePaths.forEach(function(item, index) {
  227. self.uploadImg(item);
  228. })
  229. }
  230. }
  231. });
  232. },
  233. async uploadImg(tempFilePaths) {
  234. var self = this;
  235. uni.showLoading({
  236. title: '上传中',
  237. mask: true
  238. });
  239. uni.uploadFile({
  240. url: config.base_url + '/system/file/upload', //仅为示例,非真实的接口地址
  241. header: {
  242. 'Authorization': uni.getStorageSync('token')
  243. },
  244. filePath: tempFilePaths,
  245. name: 'file',
  246. formData: {
  247. 'user': 'test'
  248. },
  249. success: (uploadFileRes) => {
  250. let res = JSON.parse(uploadFileRes.data);
  251. if (res.code == 200) {
  252. this.newData.newData15.push(res.data.url)
  253. // this.$set(this.newData, 'newData15', res.data.url);
  254. } else {
  255. uni.showToast({
  256. title: res.msg,
  257. icon: "none",
  258. mask: true,
  259. duration: 2000
  260. });
  261. }
  262. },
  263. fail: err => {},
  264. complete: () => {
  265. uni.hideLoading()
  266. }
  267. });
  268. },
  269. //删除图片
  270. delImg(index) {
  271. this.newData.newData15.splice(index, 1)
  272. },
  273. //预览图片
  274. previewSingleImage(imageUrl) {
  275. uni.previewImage({
  276. urls: [imageUrl] // 必须包裹成数组
  277. });
  278. },
  279. }
  280. }
  281. </script>
  282. <style lang="stylus" scoped>
  283. #gasCylinderOutbound {
  284. height: 100%;
  285. width: 100%;
  286. display flex;
  287. flex-direction column;
  288. overflow: hidden;
  289. .gasCylinderOutbound-page {
  290. flex: 1;
  291. display flex;
  292. flex-direction column;
  293. overflow: hidden;
  294. .content-max-box {
  295. flex: 1;
  296. display flex;
  297. flex-direction column;
  298. overflow-y: scroll;
  299. .content-big-box {
  300. margin: 0 30rpx 0;
  301. .content-title-p {
  302. line-height: 80rpx;
  303. padding: 0 20rpx;
  304. color: #666;
  305. }
  306. .content-min-box {
  307. background-color: #fff;
  308. border-radius: 12rpx;
  309. .content-check-box {
  310. display: flex;
  311. padding: 40rpx 30rpx;
  312. border-bottom: 1rpx solid #dedede;
  313. view {
  314. font-size: 30rpx;
  315. line-height: 40rpx;
  316. }
  317. view:nth-child(1) {
  318. flex: 1;
  319. font-weight: 600;
  320. }
  321. view:nth-child(2) {
  322. font-size: 28rpx;
  323. font-weight: 600;
  324. margin-right: 10rpx;
  325. color: #666;
  326. }
  327. .right-icon {
  328. font-size: 30rpx;
  329. }
  330. }
  331. .content-bottom-text-box {
  332. margin: 0 30rpx;
  333. padding: 20rpx 0;
  334. .content-text-box {
  335. display: flex;
  336. view {
  337. font-size: 28rpx;
  338. line-height: 60rpx;
  339. }
  340. view:nth-child(1) {}
  341. view:nth-child(2) {
  342. flex: 1;
  343. text-align: right;
  344. }
  345. }
  346. }
  347. }
  348. }
  349. }
  350. .content-max-input-box {
  351. background-color: #fff;
  352. border-radius: 12rpx;
  353. display: flex;
  354. margin: 30rpx 30rpx 0;
  355. padding: 0 30rpx;
  356. .name-box {
  357. font-size: 30rpx;
  358. font-weight: 600;
  359. line-height: 100rpx;
  360. }
  361. .input-box {
  362. flex: 1;
  363. height: 100rpx;
  364. line-height: 100rpx;
  365. text-align: right;
  366. }
  367. }
  368. .content-max-up-box {
  369. background-color: #fff;
  370. border-radius: 12rpx;
  371. margin: 30rpx 30rpx 0;
  372. padding: 0 30rpx;
  373. .name-box {
  374. font-size: 30rpx;
  375. font-weight: 600;
  376. line-height: 100rpx;
  377. }
  378. .up-big-box {
  379. padding: 0 0 30rpx 0;
  380. .img-data:nth-child(3n) {
  381. margin-right: 0 !important;
  382. }
  383. .img-data {
  384. display: inline-block;
  385. width: 190rpx;
  386. height: 190rpx;
  387. margin-right: 30rpx;
  388. margin-bottom: 25rpx;
  389. position: relative;
  390. .min-img {
  391. display: block;
  392. width: 190rpx;
  393. height: 190rpx;
  394. overflow: hidden;
  395. border-radius: 12rpx;
  396. }
  397. .del-postion-p {
  398. position: absolute;
  399. top: -15rpx;
  400. right: -15rpx;
  401. width: 40rpx;
  402. height: 40rpx;
  403. color: red;
  404. }
  405. }
  406. .add-button {
  407. display: inline-block;
  408. overflow: hidden;
  409. border: 1rpx solid #dedede;
  410. border-radius: 12rpx;
  411. width: 190rpx !important;
  412. height: 145rpx;
  413. text-align: center;
  414. color: #666;
  415. font-size: 28rpx;
  416. padding-top: 45rpx;
  417. }
  418. }
  419. .textarea-box {
  420. width: 570rpx;
  421. padding: 30rpx;
  422. border: 1px solid #dedede;
  423. border-radius: 12rpx;
  424. margin-bottom: 30rpx;
  425. }
  426. }
  427. .bottom-button-p {
  428. width: 700rpx;
  429. height: 100rpx;
  430. line-height: 100rpx;
  431. text-align: center;
  432. margin: 30rpx auto 60rpx;
  433. color: #fff;
  434. background-color: #0183FA;
  435. border-radius: 16rpx;
  436. }
  437. }
  438. }
  439. </style>