storageAdd.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. <!-- 新增入库 -->
  2. <template>
  3. <view id="register">
  4. <view class="register_li">
  5. <view class="register_li_min" @click="seleteGasFun()">
  6. <view>*</view>
  7. <view style="color: #999999;">气瓶:</view>
  8. <input v-model="form.gasName" disabled placeholder="请选择气瓶" placeholder-style="color:#333;" type="text" >
  9. </view>
  10. <view class="register_li_min" style="border-bottom:0;">
  11. <view></view>
  12. <view style="color: #999999;">气体规格:</view>
  13. <input v-model="form.levelSizeName" disabled type="text" >
  14. </view>
  15. </view>
  16. <view class="register_li">
  17. <view class="register_li_min" v-for="(item,index) in list">
  18. <view></view>
  19. <view>{{item.name}}</view>
  20. <view class="radio_group">
  21. <view class="radio" v-for="(item2,index2) in item.radioList" @click="radioClick(item,item2)">
  22. <img v-if="!item2.checked" src="@/pages_manage/images/icon_5.png">
  23. <img v-if="item2.checked" src="@/pages_manage/images/icon_6.png">
  24. <text>{{item2.name}}</text>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="register_li_min">
  29. <view>*</view>
  30. <view>气表压力:</view>
  31. <input v-model="form.gasPressure" maxlength="4" type="text" placeholder-style="color:#999;" placeholder="请输入气表压力">
  32. </view>
  33. <!-- 检验有效期 -->
  34. <view class="register_li_min2">
  35. <view><text style="color: #f00;margin-right: 10rpx;">*</text>检验有效期:</view>
  36. <picker mode="date" @change="startChange($event)">
  37. <input class="picker-text" v-model="form.validPeriod" disabled type="text" placeholder-style="color:#999;" placeholder="时间">
  38. </picker>
  39. </view>
  40. <view class="register_li_min" >
  41. <view>*</view>
  42. <view>信标标签:</view>
  43. <input v-model="form.beaconTag" type="text" placeholder-style="color:#999;" placeholder="请输入信标标签ID">
  44. <img @click.stop="saoCode" class="code_img" src="@/pages_manage/images/Version2.2/icon_aqjc_sm.png">
  45. </view>
  46. <view class="register_li_min">
  47. <view>*</view>
  48. <view>实验室:</view>
  49. <picker @change="bindPickerChange" :value="laboratoryIndex" :range="laboratory">
  50. <input class="picker-text" v-model="form.subjectName" disabled type="text" placeholder-style="color:#999; text-align: right;font-size:24rpx;" placeholder="请选择入库实验室">
  51. </picker>
  52. </view>
  53. <view class="register_li_min" style="border: none;">
  54. <view>*</view>
  55. <view>备注:</view>
  56. <input v-model="form.remark" type="text" placeholder-style="color:#999;" placeholder="请输入验收备注">
  57. </view>
  58. </view>
  59. <view class="sub_btn" @click="submitForm()">确认信息并入库</view>
  60. </view>
  61. </template>
  62. <script>
  63. import {gasApplyDetailDrkDetail,gasApplyStorageAdd,getSubjectDict,airbottleStockEnter} from '@/api/index.js'
  64. import { config } from '@/api/request/config.js'
  65. export default {
  66. data() {
  67. return {
  68. form:{
  69. },
  70. laboratory:['请选择实验室'],
  71. laboratoryList:[],
  72. laboratoryIndex:0,
  73. infoForm:{},
  74. item:{},
  75. id:{},
  76. list:[
  77. {
  78. id:'0',
  79. name:'瓶身颜色:',
  80. lab:'color',
  81. radioList:[
  82. {
  83. id:1,
  84. name:'灰',
  85. checked:true,
  86. },
  87. {
  88. id:2,
  89. name:'白',
  90. checked:false,
  91. },
  92. {
  93. id:3,
  94. name:'蓝',
  95. checked:false,
  96. },
  97. ]
  98. },
  99. {
  100. id:'0',
  101. name:'有无手轮:',
  102. lab:'isHandwheel',
  103. radioList:[
  104. {
  105. id:1,
  106. name:'有',
  107. checked:true,
  108. },
  109. {
  110. id:0,
  111. name:'无',
  112. checked:false,
  113. },
  114. ]
  115. },
  116. {
  117. id:'0',
  118. name:'是否固定:',
  119. lab:'isFixed',
  120. radioList:[
  121. {
  122. id:1,
  123. name:'是',
  124. checked:true,
  125. },
  126. {
  127. id:0,
  128. name:'否',
  129. checked:false,
  130. },
  131. ]
  132. },
  133. {
  134. id:'0',
  135. name:'电子标签:',
  136. lab:'isElectronicTag',
  137. radioList:[
  138. {
  139. id:1,
  140. name:'有',
  141. checked:true,
  142. },
  143. {
  144. id:0,
  145. name:'无',
  146. checked:false,
  147. },
  148. ]
  149. },
  150. {
  151. id:'0',
  152. name:'气瓶状态标牌:',
  153. lab:'isStatusSign',
  154. radioList:[
  155. {
  156. id:1,
  157. name:'有',
  158. checked:true,
  159. },
  160. {
  161. id:0,
  162. name:'无',
  163. checked:false,
  164. },
  165. ]
  166. }
  167. ]
  168. }
  169. },
  170. onLoad(option) {
  171. if(option.form){
  172. this.form=JSON.parse(decodeURIComponent(option.form));
  173. }
  174. },
  175. onShow(){
  176. },
  177. mounted(){
  178. this.getSubjectDict();
  179. },
  180. methods: {
  181. //开始时间选中事件
  182. startChange(e){
  183. this.$set(this.form,'validPeriod',e.target.value);
  184. },
  185. //实验室选择器
  186. bindPickerChange(e){
  187. let self=this;
  188. let subjectName = self.laboratory[self.laboratoryIndex];
  189. self.$set(self.form,'subjectName',subjectName);
  190. self.laboratoryList.forEach(function(item){
  191. if(item.name==subjectName){
  192. self.$set(self.form,'subjectId',item.id);
  193. }
  194. })
  195. },
  196. //单选按钮
  197. radioClick(p,d){
  198. d.checked=!d.checked
  199. if(d.checked){
  200. //如果有选中的,循环把其他选中的取消
  201. p.radioList.forEach(function(item){
  202. if(item.id==d.id){
  203. }else{
  204. item.checked=false;
  205. }
  206. })
  207. }else{
  208. }
  209. },
  210. //调用摄像头
  211. saoCode(){
  212. let _this = this;
  213. uni.scanCode({
  214. onlyFromCamera: true,
  215. success: function (res) {
  216. console.log(res.result)
  217. _this.$set(_this.form,'beaconTag',res.result);
  218. }
  219. });
  220. },
  221. //实验室列表
  222. async getSubjectDict(){
  223. let self = this;
  224. let {data} = await getSubjectDict()
  225. if(data.code == 200){
  226. if(data.data[0]){
  227. let list = [];
  228. for(let i=0;i<data.data.length;i++){
  229. list.push(data.data[i].name);
  230. }
  231. this.laboratory = list;
  232. this.laboratoryList = data.data;
  233. }
  234. }
  235. },
  236. //选择气瓶
  237. seleteGasFun(){
  238. uni.redirectTo({
  239. url:'/pages/gasBottle/stockList/seleteGas?form='+encodeURIComponent(JSON.stringify(this.form))
  240. });
  241. },
  242. //提交
  243. async submitForm(){
  244. let _this = this;
  245. if(!this.form.gasName){
  246. uni.showToast({
  247. title: '请选择气体名称',
  248. icon:"none",
  249. mask:true,
  250. duration: 2000
  251. });
  252. return
  253. }
  254. if(!this.form.gasPressure){
  255. uni.showToast({
  256. title: '请输入气表压力',
  257. icon:"none",
  258. mask:true,
  259. duration: 2000
  260. });
  261. return
  262. }
  263. if(!this.form.validPeriod){
  264. uni.showToast({
  265. title: '请选择检验有效期',
  266. icon:"none",
  267. mask:true,
  268. duration: 2000
  269. });
  270. return
  271. }
  272. if(!this.form.beaconTag){
  273. uni.showToast({
  274. title: '请输入信标标签',
  275. icon:"none",
  276. mask:true,
  277. duration: 2000
  278. });
  279. return
  280. }
  281. if(!this.form.subjectId){
  282. uni.showToast({
  283. title: '请选择实验室',
  284. icon:"none",
  285. mask:true,
  286. duration: 2000
  287. });
  288. return
  289. }
  290. _this.list.forEach(function(item){
  291. item.radioList.forEach(function(item2){
  292. if(item.lab=='color' && item2.checked){
  293. _this.form.bottleColour=item2.id;
  294. }else if(item.lab=='isHandwheel' && item2.checked){
  295. _this.form.handwheel=item2.id;
  296. }else if(item.lab=='isFixed' && item2.checked){
  297. _this.form.fixed=item2.id;
  298. }else if(item.lab=='isElectronicTag' && item2.checked){
  299. _this.form.electronicTag=item2.id;
  300. }else if(item.lab=='isStatusSign' && item2.checked){
  301. _this.form.statusLabel=item2.id;
  302. }
  303. })
  304. })
  305. const {data} = await airbottleStockEnter(_this.form);
  306. if(data.code == 200){
  307. uni.showToast({
  308. title: '提交成功',
  309. icon:"none",
  310. mask:true,
  311. duration: 2000
  312. });
  313. setTimeout(function(){
  314. uni.redirectTo({
  315. url: '/pages/gasBottle/stockList/stockList'
  316. });
  317. },2000);
  318. }
  319. },
  320. }
  321. }
  322. </script>
  323. <style lang="stylus" scoped>
  324. #register{
  325. height:auto;
  326. width:100%;
  327. display flex
  328. flex-direction column;
  329. padding-bottom: 220rpx;
  330. .register_li{
  331. background #fff;
  332. border-radius:20rpx;
  333. margin:20rpx 20rpx 0;
  334. padding:20rpx 0;
  335. box-sizing: border-box;
  336. .register_li_min{
  337. margin:0 26rpx;
  338. display flex;
  339. align-items center;
  340. border-bottom: 1px solid #F5F5F5;
  341. view{
  342. line-height:100rpx;
  343. font-size:28rpx;
  344. }
  345. view:nth-child(1){
  346. color:red;
  347. line-height:28rpx;
  348. margin-right: 12rpx;
  349. }
  350. view:nth-child(2){
  351. //width:140rpx;
  352. flex: 1;
  353. font-size: 28rpx;
  354. font-family: PingFang SC;
  355. font-weight: 500;
  356. color: #333333;
  357. }
  358. .picker-text{
  359. text-align: right;
  360. font-size: 28rpx;
  361. }
  362. >input{
  363. width 400rpx;
  364. text-align: right;
  365. font-size: 24rpx;
  366. font-family: PingFang SC;
  367. font-weight: 500;
  368. color: #333333;
  369. }
  370. .code_img{
  371. width: 30rpx;
  372. height: 28rpx;
  373. margin-left: 26rpx;
  374. }
  375. /* 单选按钮 */
  376. .radio_group{
  377. display: flex;
  378. .radio{
  379. display: flex;
  380. margin-left: 74rpx;
  381. margin-right: 0;
  382. >img{
  383. width: 30rpx;
  384. height: 30rpx;
  385. }
  386. >text{
  387. margin-left: 34rpx;
  388. font-size: 28rpx;
  389. font-family: PingFang SC;
  390. font-weight: 500;
  391. color: #333333;
  392. line-height: 28rpx;
  393. }
  394. }
  395. }
  396. }
  397. /* 时间 */
  398. .register_li_min2{
  399. margin:0 26rpx;
  400. border-bottom: 1px solid #f5f5f5;
  401. height: 100rpx;
  402. display: flex;
  403. justify-content: flex-start;
  404. align-items: center;
  405. >view:nth-child(1){
  406. font-size: 28rpx;
  407. font-family: PingFang SC;
  408. font-weight: 500;
  409. color: #333333;
  410. line-height: 100rpx;
  411. margin-right: 96rpx;
  412. }
  413. .picker-text{
  414. font-size: 24rpx;
  415. font-family: PingFang SC;
  416. font-weight: 500;
  417. color: #999999;
  418. line-height: 100rpx;
  419. width: 390rpx;
  420. text-align: right;
  421. }
  422. >view:nth-child(2){
  423. font-size: 24rpx;
  424. font-family: PingFang SC;
  425. font-weight: 500;
  426. color: #999999;
  427. line-height: 100rpx;
  428. }
  429. .picker-text2{
  430. font-size: 24rpx;
  431. font-family: PingFang SC;
  432. font-weight: 500;
  433. color: #999999;
  434. line-height: 100rpx;
  435. width: 188rpx;
  436. text-align: right;
  437. }
  438. }
  439. }
  440. /* 按钮 */
  441. /* 按钮 */
  442. .sub_btn{
  443. width: 650rpx;
  444. height: 100rpx;
  445. background: #0183FA;
  446. border-radius: 50rpx;
  447. font-size: 28rpx;
  448. font-family: PingFang SC;
  449. font-weight: 500;
  450. color: #FFFFFF;
  451. line-height: 100rpx;
  452. text-align: center;
  453. margin-left: 50rpx;
  454. position: fixed;
  455. bottom:30rpx;
  456. z-index: 1000;
  457. }
  458. }
  459. /deep/.input-value-border{
  460. display :none !important;
  461. }
  462. </style>