inbound.vue 11 KB

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