storageAdd.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  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="6" @input="onKeyVinInput($event)" 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 {getSubjectDict,airbottleStockEnter,subjectList,laboratorySubjectListSubJoinbeacon} 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. onKeyVinInput(e) {
  183. const o = e.detail.value
  184. const inputRule = /[^\-?\d.]/g
  185. this.$nextTick(() => {
  186. this.form.gasPressure = o.replace(inputRule, '');
  187. if (this.form.gasPressure == '') {
  188. return
  189. } else {
  190. //执行对应代码
  191. }
  192. })
  193. },
  194. //开始时间选中事件
  195. startChange(e){
  196. this.$set(this.form,'validPeriod',e.target.value);
  197. },
  198. //实验室选择器
  199. bindPickerChange(e){
  200. let self=this;
  201. self.laboratoryIndex = e.target.value;
  202. let subjectName = self.laboratory[self.laboratoryIndex];
  203. self.$set(self.form,'subjectName',subjectName);
  204. self.laboratoryList.forEach(function(item){
  205. if(item.name==subjectName){
  206. self.$set(self.form,'subjectId',item.id);
  207. }
  208. })
  209. },
  210. //单选按钮
  211. radioClick(p,d){
  212. d.checked=!d.checked
  213. if(d.checked){
  214. //如果有选中的,循环把其他选中的取消
  215. p.radioList.forEach(function(item){
  216. if(item.id==d.id){
  217. }else{
  218. item.checked=false;
  219. }
  220. })
  221. }else{
  222. }
  223. },
  224. //调用摄像头
  225. saoCode(){
  226. let _this = this;
  227. uni.scanCode({
  228. onlyFromCamera: true,
  229. success: function (res) {
  230. console.log(res.result)
  231. _this.$set(_this.form,'beaconTag',res.result);
  232. }
  233. });
  234. },
  235. //实验室列表
  236. async getSubjectDict(){
  237. let self = this;
  238. let {data} = await laboratorySubjectListSubJoinbeacon()
  239. if(data.code == 200){
  240. if(data.data[0]){
  241. let list = [];
  242. for(let i=0;i<data.data.length;i++){
  243. list.push(data.data[i].name);
  244. }
  245. this.laboratory = list;
  246. this.laboratoryList = data.data;
  247. }
  248. }
  249. },
  250. //选择气瓶
  251. seleteGasFun(){
  252. uni.redirectTo({
  253. url:'/pages/gasBottle/stockList/seleteGas?form='+encodeURIComponent(JSON.stringify(this.form))
  254. });
  255. },
  256. //提交
  257. async submitForm(){
  258. let _this = this;
  259. if(!this.form.gasName){
  260. uni.showToast({
  261. title: '请选择气体名称',
  262. icon:"none",
  263. mask:true,
  264. duration: 2000
  265. });
  266. return
  267. }
  268. // if(!this.form.gasPressure){
  269. // uni.showToast({
  270. // title: '请输入气表压力',
  271. // icon:"none",
  272. // mask:true,
  273. // duration: 2000
  274. // });
  275. // return
  276. // }
  277. // if(!this.form.validPeriod){
  278. // uni.showToast({
  279. // title: '请选择检验有效期',
  280. // icon:"none",
  281. // mask:true,
  282. // duration: 2000
  283. // });
  284. // return
  285. // }
  286. if(!this.form.beaconTag){
  287. uni.showToast({
  288. title: '请输入信标标签',
  289. icon:"none",
  290. mask:true,
  291. duration: 2000
  292. });
  293. return
  294. }
  295. if(!this.form.subjectId){
  296. uni.showToast({
  297. title: '请选择实验室',
  298. icon:"none",
  299. mask:true,
  300. duration: 2000
  301. });
  302. return
  303. }
  304. _this.list.forEach(function(item){
  305. item.radioList.forEach(function(item2){
  306. if(item.lab=='color' && item2.checked){
  307. _this.form.bottleColour=item2.id;
  308. }else if(item.lab=='isHandwheel' && item2.checked){
  309. _this.form.handwheel=item2.id;
  310. }else if(item.lab=='isFixed' && item2.checked){
  311. _this.form.fixed=item2.id;
  312. }else if(item.lab=='isElectronicTag' && item2.checked){
  313. _this.form.electronicTag=item2.id;
  314. }else if(item.lab=='isStatusSign' && item2.checked){
  315. _this.form.statusLabel=item2.id;
  316. }
  317. })
  318. })
  319. const {data} = await airbottleStockEnter(_this.form);
  320. if(data.code == 200){
  321. uni.showToast({
  322. title: '提交成功',
  323. icon:"none",
  324. mask:true,
  325. duration: 2000
  326. });
  327. setTimeout(function(){
  328. uni.redirectTo({
  329. url: '/pages/gasBottle/stockList/stockList'
  330. });
  331. },2000);
  332. }
  333. },
  334. }
  335. }
  336. </script>
  337. <style lang="stylus" scoped>
  338. #register{
  339. height:auto;
  340. width:100%;
  341. display flex
  342. flex-direction column;
  343. padding-bottom: 220rpx;
  344. .register_li{
  345. background #fff;
  346. border-radius:20rpx;
  347. margin:20rpx 20rpx 0;
  348. padding:20rpx 0;
  349. box-sizing: border-box;
  350. .register_li_min{
  351. margin:0 26rpx;
  352. display flex;
  353. align-items center;
  354. border-bottom: 1px solid #F5F5F5;
  355. view{
  356. line-height:100rpx;
  357. font-size:28rpx;
  358. }
  359. view:nth-child(1){
  360. color:red;
  361. line-height:28rpx;
  362. margin-right: 12rpx;
  363. }
  364. view:nth-child(2){
  365. //width:140rpx;
  366. flex: 1;
  367. font-size: 28rpx;
  368. font-family: PingFang SC;
  369. font-weight: 500;
  370. color: #333333;
  371. }
  372. .picker-text{
  373. text-align: right;
  374. font-size: 28rpx;
  375. }
  376. >input{
  377. width 400rpx;
  378. text-align: right;
  379. font-size: 24rpx;
  380. font-family: PingFang SC;
  381. font-weight: 500;
  382. color: #333333;
  383. }
  384. .code_img{
  385. width: 30rpx;
  386. height: 28rpx;
  387. margin-left: 26rpx;
  388. }
  389. /* 单选按钮 */
  390. .radio_group{
  391. display: flex;
  392. .radio{
  393. display: flex;
  394. margin-left: 74rpx;
  395. margin-right: 0;
  396. >img{
  397. width: 30rpx;
  398. height: 30rpx;
  399. }
  400. >text{
  401. margin-left: 34rpx;
  402. font-size: 28rpx;
  403. font-family: PingFang SC;
  404. font-weight: 500;
  405. color: #333333;
  406. line-height: 28rpx;
  407. }
  408. }
  409. }
  410. }
  411. /* 时间 */
  412. .register_li_min2{
  413. margin:0 26rpx;
  414. border-bottom: 1px solid #f5f5f5;
  415. height: 100rpx;
  416. display: flex;
  417. justify-content: flex-start;
  418. align-items: center;
  419. >view:nth-child(1){
  420. font-size: 28rpx;
  421. font-family: PingFang SC;
  422. font-weight: 500;
  423. color: #333333;
  424. line-height: 100rpx;
  425. margin-right: 96rpx;
  426. }
  427. .picker-text{
  428. font-size: 24rpx;
  429. font-family: PingFang SC;
  430. font-weight: 500;
  431. color: #999999;
  432. line-height: 100rpx;
  433. width: 390rpx;
  434. text-align: right;
  435. }
  436. >view:nth-child(2){
  437. font-size: 24rpx;
  438. font-family: PingFang SC;
  439. font-weight: 500;
  440. color: #999999;
  441. line-height: 100rpx;
  442. }
  443. .picker-text2{
  444. font-size: 24rpx;
  445. font-family: PingFang SC;
  446. font-weight: 500;
  447. color: #999999;
  448. line-height: 100rpx;
  449. width: 188rpx;
  450. text-align: right;
  451. }
  452. }
  453. }
  454. /* 按钮 */
  455. /* 按钮 */
  456. .sub_btn{
  457. width: 650rpx;
  458. height: 100rpx;
  459. background: #0183FA;
  460. border-radius: 50rpx;
  461. font-size: 28rpx;
  462. font-family: PingFang SC;
  463. font-weight: 500;
  464. color: #FFFFFF;
  465. line-height: 100rpx;
  466. text-align: center;
  467. margin-left: 50rpx;
  468. position: fixed;
  469. bottom:30rpx;
  470. z-index: 1000;
  471. }
  472. }
  473. /deep/.input-value-border{
  474. display :none !important;
  475. }
  476. </style>