gasManageDetail.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <!-- 气瓶详情-->
  2. <template>
  3. <view id="register">
  4. <view class="register_li">
  5. <picker @change="bindPickerChange" disabled :value="pickerIndex" :range="pickerArray">
  6. <view class="register_li_min">
  7. <view>*</view>
  8. <view style="color: #333333;">气体名称:</view>
  9. <input v-model="form.airName" disabled type="text" placeholder="请选择气体名称">
  10. </view>
  11. </picker>
  12. <view class="register_li_min" style="border: none;">
  13. <view></view>
  14. <view style="color: #333333;">气体组分:</view>
  15. <input v-model="form.airConstituents" disabled maxlength="20" type="text" placeholder="请输入气体组分">
  16. </view>
  17. </view>
  18. <view class="small_title" v-if="specsList.length>0">气瓶规格</view>
  19. <view class="register_li2" v-if="specsList.length>0">
  20. <view v-for="(item,index) in specsList" :class="item.checked==false?'register_li2_btn':'colorB'" >{{item.configName}}</view>
  21. </view>
  22. <view v-if="status==1" class="sub_btn" @click="submitForm()">编辑</view>
  23. </view>
  24. </template>
  25. <script>
  26. import {googsList,googsInfoList,bottleAdd,bottleAmend,bottleDetail} from '@/api/apiDemo/index.js'
  27. import { config } from '@/api/request/config.js'
  28. export default {
  29. data() {
  30. return {
  31. form:{
  32. airName:'',
  33. airConstituents:'',
  34. configDtos:[],
  35. },
  36. pickerArray:[],
  37. googsArray:[],
  38. listType:0,//0回收申请 1配送申请 2货品问题
  39. specsList:[],
  40. status:null,//0添加1编辑2查看
  41. id:null,
  42. }
  43. },
  44. onLoad(option) {
  45. this.status=option.status;
  46. this.id=option.id;
  47. },
  48. onShow(){
  49. },
  50. methods: {
  51. //气瓶规格选中事件
  52. tabClickSpecs(data){
  53. this.specsList.forEach(function(item){
  54. if(data.configId==item.configId){
  55. item.checked=item.checked==true?false:true;
  56. }
  57. })
  58. },
  59. //气体选中事件
  60. bindPickerChange(e){
  61. let _this=this;
  62. let index=e.target.value
  63. _this.form.airName=this.pickerArray[index]
  64. _this.googsArray.forEach(function(item){
  65. if(_this.pickerArray[index]==item.goodsName){
  66. _this.getGoogsInfoList(item.id)
  67. }
  68. })
  69. },
  70. //获取气体列表数据
  71. async getGoogsList(){
  72. let _this = this;
  73. const {data} = await googsList()
  74. if(data.code==200){
  75. let res=data.rows;
  76. _this.googsArray=res;
  77. if(res){
  78. res.forEach(function(item){
  79. _this.pickerArray.push(item.goodsName)
  80. })
  81. }
  82. }
  83. },
  84. //获取气体列表数据
  85. async getGoogsInfoList(id){
  86. let _this = this;
  87. const {data} = await googsInfoList(id)
  88. if(data.code==200){
  89. let res=data.data;
  90. if(res){
  91. let arr=[];
  92. //重新组装
  93. res.forEach(function(item){
  94. arr.push({'configName':item.name,'configId':item.id,'checked':false,})
  95. })
  96. //循环对比
  97. arr.forEach(function(item){
  98. _this.specsList.forEach(function(item2){
  99. if(item.configId==item2.configId){
  100. item.checked=true;
  101. }
  102. })
  103. })
  104. _this.specsList=arr;
  105. }
  106. }
  107. },
  108. //获取详情
  109. async getInfo(){
  110. let _this = this;
  111. const {data} = await bottleDetail(this.id)
  112. if(data.code==200){
  113. let res=data.data
  114. this.form=res;
  115. if(res.configVos){
  116. this.specsList=res.configVos
  117. }
  118. _this.getGoogsInfoList(res.configId)
  119. }
  120. },
  121. //提交
  122. async submitForm(){
  123. uni.redirectTo({
  124. url:'/pages_supplier/gasManage/gasManageAdd?status=1&id='+this.id
  125. });
  126. },
  127. },
  128. mounted() {
  129. this.getGoogsList()
  130. if(this.status==1 || this.status==2){
  131. this.getInfo();
  132. }
  133. }
  134. }
  135. </script>
  136. <style lang="stylus" scoped>
  137. #register{
  138. height:100%;
  139. width:100%;
  140. display flex
  141. flex-direction column;
  142. padding-bottom: 220rpx;
  143. .register_li{
  144. background #fff;
  145. border-radius:20rpx;
  146. margin:20rpx 20rpx 0;
  147. padding:20rpx 0;
  148. box-sizing: border-box;
  149. .register_li_min{
  150. margin:0 26rpx;
  151. display flex;
  152. align-items center;
  153. border-bottom: 1px solid #F5F5F5;
  154. view{
  155. line-height:100rpx;
  156. font-size:28rpx;
  157. }
  158. view:nth-child(1){
  159. color:red;
  160. line-height:28rpx;
  161. margin-right: 12rpx;
  162. }
  163. view:nth-child(2){
  164. //width:140rpx;
  165. font-size: 28rpx;
  166. font-family: PingFang SC;
  167. font-weight: 500;
  168. color: #999999;
  169. }
  170. >input{
  171. flex:1;
  172. text-align: right;
  173. font-size: 24rpx;
  174. font-family: PingFang SC;
  175. font-weight: 500;
  176. color: #333333;
  177. }
  178. }
  179. }
  180. .small_title{
  181. font-size: 30rpx;
  182. font-family: PingFang SC;
  183. font-weight: 500;
  184. color: #999999;
  185. line-height: 100rpx;
  186. margin: 0 40rpx;
  187. }
  188. .register_li2{
  189. background #fff;
  190. border-radius:20rpx;
  191. margin:0 20rpx 0;
  192. padding:44rpx 0 20rpx 20rpx;
  193. box-sizing: border-box;
  194. display: flex;
  195. flex-wrap: wrap;
  196. .register_li2_btn{
  197. width: 200rpx;
  198. height: 60rpx;
  199. background: #F5F5F5;
  200. border-radius: 10rpx;
  201. font-size: 28rpx;
  202. font-family: PingFang SC;
  203. font-weight: 500;
  204. color: #999999;
  205. line-height: 60rpx;
  206. text-align: center;
  207. margin-right: 22rpx;
  208. margin-bottom: 24rpx;
  209. }
  210. .colorB{
  211. width: 200rpx;
  212. height: 60rpx;
  213. background: #0183FA;
  214. border-radius: 10rpx;
  215. font-size: 28rpx;
  216. font-family: PingFang SC;
  217. font-weight: 500;
  218. color: #FFFFFF;
  219. line-height: 60rpx;
  220. text-align: center;
  221. margin-right: 22rpx;
  222. margin-bottom: 24rpx;
  223. }
  224. }
  225. /* 按钮 */
  226. .sub_btn{
  227. width: 650rpx;
  228. height: 100rpx;
  229. background: #0183FA;
  230. border-radius: 20rpx;
  231. font-size: 28rpx;
  232. font-family: PingFang SC;
  233. font-weight: 500;
  234. color: #FFFFFF;
  235. line-height: 100rpx;
  236. text-align: center;
  237. margin-left: 50rpx;
  238. position: fixed;
  239. bottom:30rpx;
  240. z-index: 1000;
  241. }
  242. }
  243. /deep/.input-value-border{
  244. display :none !important;
  245. }
  246. </style>