selectCylinder.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. <!-- 选择气瓶 -->
  2. <template>
  3. <view id="gasCylinderSelectCylinder">
  4. <view class="top-input-max-box">
  5. <view class="input-box">
  6. <uni-icons type="search" class="icon-box" color="#7C7C7C" size="25"></uni-icons>
  7. <input class="uni-input input-min" confirm-type="search" @confirm="getList()"
  8. v-model="inputData" maxlength="20" placeholder="搜索关键字" />
  9. <view class="button-p" @click="resetButton()">重置</view>
  10. </view>
  11. <view class="picker-box">
  12. <picker @change="bindPickerChangeA" :value="indexA" :range="arrayA">
  13. <view class="picker-min-box">
  14. <view>{{indexA==null?'气体':arrayA[indexA]}}</view>
  15. <uni-icons type="down" class="icon-box" size="15"></uni-icons>
  16. </view>
  17. </picker>
  18. <picker @change="bindPickerChangeB" :value="indexB" :range="arrayB">
  19. <view class="picker-min-box">
  20. <view>{{indexB==null?'气体类别':arrayB[indexB]}}</view>
  21. <uni-icons type="down" class="icon-box" size="15"></uni-icons>
  22. </view>
  23. </picker>
  24. </view>
  25. </view>
  26. <scroll-view scroll-y @scrolltolower="scrollGet" class="content-box">
  27. <view class="null-p" v-if="!dataList[0]">暂无数据</view>
  28. <view class="for-max-big-box" @click="checkButton(item)"
  29. v-for="(item,index) in dataList" :key="index">
  30. <view class="for-title-box" v-if="item.specialGases == 0">
  31. <view>气瓶编码:</view>
  32. <view>{{item.bottleCode}}</view>
  33. </view>
  34. <view class="for-text-box">
  35. <view>气体:</view>
  36. <view>{{item.gasName}}</view>
  37. </view>
  38. <view class="for-text-box">
  39. <view>气瓶规格:</view>
  40. <view>{{item.specification}}</view>
  41. </view>
  42. <view class="for-text-box">
  43. <view>气体类别:</view>
  44. <view>{{item.gasCategory}}</view>
  45. </view>
  46. <view class="for-text-box" v-if="item.specialGases == 0">
  47. <view>压力:</view>
  48. <view>{{item.pressure}}</view>
  49. </view>
  50. <view class="for-text-box">
  51. <view>纯度:</view>
  52. <view>{{item.purity}}</view>
  53. </view>
  54. </view>
  55. </scroll-view>
  56. <uni-icons class="sao-code-box" type="scan" color="#fff" size="25"></uni-icons>
  57. </view>
  58. </template>
  59. <script>
  60. import {
  61. airbottleNewQpAppletBottlePage,airBottleNewQpDictList,
  62. } from '@/pages_supplierCylinderManagement/api/index.js'
  63. export default {
  64. data() {
  65. return {
  66. fromPage:'',
  67. inputData:'',
  68. arrayA:[],
  69. indexA:null,
  70. arrayB:[],
  71. indexB:null,
  72. dataList:[],
  73. // 查询参数
  74. getDataType: false,
  75. queryParams: {
  76. page: 1,
  77. pageSize: 10,
  78. },
  79. total:0,
  80. }
  81. },
  82. onLoad(options) {
  83. this.fromPage = options.from;
  84. },
  85. onShow() {
  86. this.airBottleNewQpDictList1();
  87. this.airBottleNewQpDictList2();
  88. this.getList();
  89. },
  90. methods: {
  91. bindPickerChangeA(e) {
  92. this.indexA = e.detail.value
  93. this.$set(this.queryParams,'page',1);
  94. this.getList();
  95. },
  96. bindPickerChangeB(e) {
  97. this.indexB = e.detail.value
  98. this.$set(this.queryParams,'page',1);
  99. this.getList();
  100. },
  101. //滚动加载事件
  102. scrollGet() {
  103. let self = this;
  104. if (self.total / self.queryParams.pageSize <= self.queryParams.page) {
  105. this.$set(this, 'getDataType', true);
  106. } else {
  107. this.queryParams.page += 1;
  108. this.$nextTick(() => {
  109. this.getList();
  110. })
  111. }
  112. },
  113. //搜索用户
  114. async getList() {
  115. let self = this;
  116. let obj = {
  117. page:this.queryParams.page,
  118. pageSize:this.queryParams.pageSize,
  119. searchValue:this.inputData,
  120. gasName:this.indexA==null?'':this.arrayA[this.indexA],
  121. gasCategory:this.indexB==null?'':this.arrayB[this.indexB],
  122. };
  123. const {
  124. data
  125. } = await airbottleNewQpAppletBottlePage(obj);
  126. if (data.code == 200) {
  127. if(self.queryParams.page == 1){
  128. this.dataList = data.data.records;
  129. this.total = data.data.total;
  130. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  131. this.$set(this, 'getDataType', true);
  132. }
  133. }else{
  134. this.dataList = [...this.dataList, ...data.data.records]
  135. this.total = data.data.total;
  136. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  137. this.$set(this, 'getDataType', true);
  138. }
  139. }
  140. }
  141. },
  142. async airBottleNewQpDictList1() {
  143. const {
  144. data
  145. } = await airBottleNewQpDictList({"typeCode":'gas'});
  146. if (data.code == 200) {
  147. let list = [];
  148. for(let i=0;i<data.data.length;i++){
  149. list.push(data.data[i].name);
  150. }
  151. this.$set(this,'arrayA',list);
  152. }
  153. },
  154. async airBottleNewQpDictList2() {
  155. const {
  156. data
  157. } = await airBottleNewQpDictList({"typeCode":'gas_category'});
  158. if (data.code == 200) {
  159. let list = [];
  160. for(let i=0;i<data.data.length;i++){
  161. list.push(data.data[i].name);
  162. }
  163. this.$set(this,'arrayB',list);
  164. }
  165. },
  166. //重置
  167. resetButton(){
  168. this.$set(this,'inputData','');
  169. this.$set(this,'indexA',null);
  170. this.$set(this,'indexB',null);
  171. this.$set(this,'dataList',[]);
  172. this.$set(this,'getDataType',false);
  173. this.$set(this,'queryParams',{
  174. page: 1,
  175. pageSize: 10,
  176. });
  177. this.$set(this,'total',0);
  178. this.getList();
  179. },
  180. checkButton(item){
  181. let obj = {
  182. id:item.id,
  183. bottleCode:item.bottleCode,
  184. gasName:item.gasName,
  185. specification:item.specification,
  186. gasCategory:item.gasCategory,
  187. pressure:item.pressure,
  188. purity:item.purity,
  189. }
  190. if(this.fromPage == 1){
  191. uni.redirectTo({
  192. url: '/pages_supplierCylinderManagement/views/gasCylinderManagement/inbound?form='+encodeURIComponent(JSON.stringify(obj))+'&pageType=1'
  193. });
  194. }else if(this.fromPage == 2){
  195. uni.redirectTo({
  196. url: '/pages_supplierCylinderManagement/views/gasCylinderManagement/outbound?form='+encodeURIComponent(JSON.stringify(obj))+'&pageType=1'
  197. });
  198. }
  199. },
  200. }
  201. }
  202. </script>
  203. <style lang="stylus" scoped>
  204. #gasCylinderSelectCylinder {
  205. height: 100%;
  206. width: 100%;
  207. display flex ;
  208. flex-direction column;
  209. overflow: hidden;
  210. position: relative;
  211. .top-input-max-box{
  212. background-color: #fff;
  213. .input-box{
  214. display: flex;
  215. border-radius:40rpx;
  216. background-color: #eeeeee;
  217. margin:20rpx 20rpx 0 20rpx;
  218. color:#7C7C7C;
  219. .icon-box{
  220. margin:15rpx;
  221. }
  222. .input-min{
  223. height:80rpx;
  224. line-height:80rpx;
  225. flex:1;
  226. }
  227. .button-p{
  228. line-height:80rpx;
  229. width:120rpx;
  230. text-align: center;
  231. color:#333;
  232. font-size:28rpx;
  233. background-color: #D4D4D4;
  234. border-top-right-radius:40rpx;
  235. border-bottom-right-radius:40rpx;
  236. }
  237. }
  238. .picker-box{
  239. display: flex;
  240. .picker-min-box{
  241. height:80rpx;
  242. line-height:80rpx;
  243. display: flex;
  244. padding:0 30rpx;
  245. .icon-box{
  246. margin-left:10rpx;
  247. }
  248. }
  249. }
  250. }
  251. .content-box{
  252. flex:1;
  253. display flex ;
  254. flex-direction column;
  255. overflow: scroll;
  256. padding-bottom:40rpx;
  257. .null-p{
  258. text-align: center;
  259. line-height:300rpx;
  260. color:#999;
  261. }
  262. .for-max-big-box{
  263. padding:20rpx 30rpx;
  264. background-color: #fff;
  265. border-radius:10rpx;
  266. margin:25rpx 25rpx 0;
  267. .for-title-box{
  268. display: flex;
  269. margin-bottom:20rpx;
  270. view{
  271. padding-bottom:20rpx;
  272. line-height: 60rpx
  273. border-bottom:1rpx solid #dedede;
  274. font-weight:700;
  275. }
  276. view:nth-child(1){
  277. color:#666666;
  278. }
  279. view:nth-child(2){
  280. flex:1;
  281. text-align: right;
  282. }
  283. }
  284. .for-text-box{
  285. display: flex;
  286. view{
  287. line-height: 60rpx
  288. font-weight:700;
  289. }
  290. view:nth-child(1){
  291. color:#666666;
  292. }
  293. view:nth-child(2){
  294. flex:1;
  295. text-align: right;
  296. }
  297. }
  298. }
  299. }
  300. .sao-code-box{
  301. width:100rpx;
  302. height:100rpx;
  303. line-height:100rpx;
  304. text-align: center;
  305. background-color: #266FFF;
  306. border-radius:50%;
  307. position: absolute;
  308. bottom:60rpx;
  309. left:50%;
  310. margin-left:-50rpx;
  311. }
  312. }
  313. </style>