stockList.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. <!--库存列表-->
  2. <template>
  3. <view id="gasRecycle">
  4. <view class="top-picker-max-box">
  5. <view class="top-picker-box">
  6. <picker @change="facultyChange" :value="facultyIndex" :range="facultyArray">
  7. <view class="picker-view">
  8. <view>{{!facultyIndex?'学院':facultyArray[facultyIndex]}}</view>
  9. <img class="picker-img" src="@/pages_manage/images/icon_06.png" alt="">
  10. </view>
  11. </picker>
  12. </view>
  13. <view class="top-picker-box">
  14. <picker mode="date" @change="startChange($event)">
  15. <view class="picker-view">
  16. <view>{{!getData.startTime?'开始时间':getData.startTime}}</view>
  17. <img class="picker-img" src="@/pages_manage/images/icon_06.png" alt="">
  18. </view>
  19. </picker>
  20. </view>
  21. <view class="top-picker-box">
  22. <picker mode="date" @change="endChange($event)">
  23. <view class="picker-view">
  24. <view>{{!getData.endTime?'结束时间':getData.endTime}}</view>
  25. <img class="picker-img" src="@/pages_manage/images/icon_06.png" alt="">
  26. </view>
  27. </picker>
  28. </view>
  29. </view>
  30. <view class="search">
  31. <view class="search_t">
  32. <view class="search_n">
  33. <input v-model="getData.searchValue" type="text" placeholder="实验室名称/房间号">
  34. <view class="search_n_img" @click="searchBtn()">
  35. <img class="icon_img" src="@/pages_manage/images/icon_aqjc_ss.png"/>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <scroll-view scroll-y @scrolltolower="scrollGet" class="scroll-box">
  41. <view class="for-big-box" v-for="(item,index) in dataList" :key="index">
  42. <view class="for-time-p">{{item.gasName}}-{{item.levelName}}({{item.sizeName}})</view>
  43. <img class="for-back-img" src="@/pages_manage/images/Version2.2/for_min_bg.png">
  44. <view class="for-box" @click="goInfo(item)">
  45. <view class="for-box_t">{{item.subjectName}}+{{item.roomNum}}</view>
  46. <view class="for-box_b">
  47. <img class="for-back-img" src="@/pages_manage/images/Version3.0/icon_qpgl_syl.png">
  48. <text>余量: {{item.gasPressure==null?'':item.gasPressure}}Mpa</text>
  49. <img class="for-back-img" src="@/pages_manage/images/Version2.2/icon_wtzg_sj.png">
  50. <text>{{item.createTime==null?'':item.createTime}}</text>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="get-null-box" v-if="total==0">暂无更多数据</view>
  55. </scroll-view>
  56. <view class="sub_btn" @click="subBtn()">新增入库</view>
  57. </view>
  58. </template>
  59. <script>
  60. import { gasList,listDepartments,airbottleStockList} from '@/api/index.js'
  61. export default {
  62. name: "gasRecycle",
  63. data() {
  64. return {
  65. pageType:0,
  66. //列表请求参数
  67. getData:{
  68. pageNum:1,
  69. pageSize:20,
  70. collegeId:'',
  71. startTime:'',
  72. endTime:'',
  73. searchValue:'',
  74. },
  75. total:0,
  76. userType:uni.getStorageSync('userType'),
  77. gasBottleLevel:uni.getStorageSync('gasBottleLevel'),// 气瓶级别
  78. gasBottleSpecification:uni.getStorageSync('gasBottleSpecification'), // 气瓶规格
  79. dataList:[],
  80. noData:false,
  81. //院系选择器数据
  82. facultyList:[],
  83. facultyArray:[],
  84. facultyIndex:"",
  85. }
  86. },
  87. onLoad() {
  88. },
  89. onShow() {
  90. },
  91. mounted(){
  92. this.getList();
  93. this.listDepartments();
  94. },
  95. methods: {
  96. goInfo(d){
  97. uni.navigateTo({
  98. url:'/pages/gasBottle/stockList/gasListDetail?id='+d.id
  99. });
  100. },
  101. //获取院系
  102. async listDepartments(){
  103. const {data} = await listDepartments();
  104. if(data.code == 200){
  105. let list = [];
  106. for(let i=0;i<data.data.length;i++){
  107. list.push(data.data[i].deptName)
  108. }
  109. this.facultyArray = list;
  110. list.unshift('全部院系');
  111. this.facultyList = data.data;
  112. this.facultyList.unshift({deptName:"全部院系", deptId:""})
  113. }
  114. },
  115. //学院选中
  116. facultyChange: function(e) {
  117. if(this.facultyArray[0]){
  118. this.facultyIndex = parseInt(e.target.value);
  119. this.getData.collegeId=this.facultyList[e.target.value].deptId;
  120. this.getData.pageNum=1;
  121. this.dataList=[];
  122. this.getList()
  123. }
  124. },
  125. //开始时间选中事件
  126. startChange(e){
  127. if(new Date(e.target.value).getTime()>=new Date(this.getData.endTime).getTime()){
  128. uni.showToast({
  129. title: '结束时间不能小于开始时间',
  130. icon:"none",
  131. mask:true,
  132. duration: 2000
  133. });
  134. }else{
  135. this.getData.startTime=e.target.value
  136. if(this.getData.endTime){
  137. this.getData.pageNum=1;
  138. this.dataList=[];
  139. this.getList()
  140. }
  141. }
  142. },
  143. //结束时间选中事件
  144. endChange(e){
  145. if(new Date(this.getData.startTime).getTime()>=new Date(e.target.value).getTime()){
  146. uni.showToast({
  147. title: '结束时间不能小于开始时间',
  148. icon:"none",
  149. mask:true,
  150. duration: 2000
  151. });
  152. }else{
  153. this.getData.endTime=e.target.value;
  154. this.getData.pageNum=1;
  155. this.dataList=[];
  156. this.getList()
  157. }
  158. },
  159. //实验室房间号搜索
  160. searchBtn(){
  161. this.getData.pageNum=1;
  162. this.dataList=[];
  163. this.getList()
  164. },
  165. //新增入库
  166. subBtn(){
  167. uni.redirectTo({
  168. url:'/pages/gasBottle/stockList/storageAdd'
  169. });
  170. },
  171. //滚动加载事件
  172. scrollGet(){
  173. let self=this;
  174. if(self.total/self.getData.pageSize<=self.getData.pageNum){
  175. console.log('没有更多数据!')
  176. }else{
  177. setTimeout(function(){
  178. self.getData.pageNum += 1;
  179. self.getList();
  180. },1000)
  181. }
  182. },
  183. //获取列表数据
  184. async getList(){
  185. let _this = this;
  186. const {data} = await airbottleStockList(_this.getData);
  187. if(data.code==200){
  188. for(let i=0;i<data.data.records.length;i++){
  189. for(let b=0;b<this.gasBottleSpecification.length;b++){
  190. if(this.gasBottleSpecification[b].dictValue==data.data.records[i].size){
  191. data.data.records[i].sizeName=this.gasBottleSpecification[b].dictLabel
  192. }
  193. }
  194. for(let t=0;t<this.gasBottleLevel.length;t++){
  195. if(this.gasBottleLevel[t].dictValue==data.data.records[i].level){
  196. data.data.records[i].levelName=this.gasBottleLevel[t].dictLabel
  197. }
  198. }
  199. }
  200. let res = data.data.records;
  201. if(res && res.length>0){
  202. if(_this.getData.pageNum==1){
  203. _this.dataList=res;
  204. }else{
  205. _this.dataList=_this.dataList.concat(res);
  206. }
  207. this.total=data.data.total;
  208. }
  209. }
  210. },
  211. }
  212. }
  213. </script>
  214. <style lang="stylus" scoped>
  215. #gasRecycle {
  216. height: 100%;
  217. width: 100%;
  218. flex :1;
  219. display flex;
  220. flex-direction column
  221. overflow hidden;
  222. .top-picker-max-box{
  223. display:flex;
  224. padding:0 20rpx;
  225. background #fff
  226. border-bottom:1rpx solid #E0E0E0;
  227. .top-picker-box{
  228. line-height:80rpx;
  229. height:80rpx;
  230. .picker-view{
  231. display flex
  232. view{
  233. display:block;
  234. overflow:hidden;
  235. text-overflow:ellipsis;
  236. white-space:nowrap;
  237. font-size:28rpx;
  238. }
  239. .picker-img{
  240. width:24rpx;
  241. height:13rpx;
  242. margin-top:36rpx;
  243. margin-left:13rpx;
  244. }
  245. }
  246. }
  247. .top-picker-box:nth-child(1){
  248. text-align left
  249. width:320rpx;
  250. .picker-view{
  251. view{
  252. max-width:260rpx;
  253. }
  254. }
  255. }
  256. .top-picker-box:nth-child(2){
  257. text-align left
  258. width:215rpx;
  259. .picker-view{
  260. view{
  261. max-width:156rpx;
  262. }
  263. }
  264. }
  265. .top-picker-box:nth-child(3){
  266. text-align right
  267. width:195rpx;
  268. .picker-view{
  269. view{
  270. flex:1;
  271. }
  272. }
  273. }
  274. }
  275. /* 搜索 */
  276. .search{
  277. .search_t{
  278. background: #FFFFFF;
  279. padding: 20rpx;
  280. box-sizing: border-box;
  281. .search_n{
  282. width: 710rpx;
  283. height: 80rpx;
  284. border: 1px solid #E0E0E0;
  285. border-radius: 40rpx;
  286. display: flex;
  287. justify-content: space-between;
  288. align-items: center;
  289. padding:0 0rpx 0 40rpx;
  290. box-sizing: border-box;
  291. >input{
  292. width: 640rpx;
  293. font-size: 24rpx;
  294. font-family: PingFang SC;
  295. font-weight: 500;
  296. color: #CCCCCC;
  297. line-height: 30rpx;
  298. }
  299. .search_n_img{
  300. width: 70rpx;
  301. height: 80rpx;
  302. >img{
  303. width: 30rpx;
  304. height: 30rpx;
  305. margin: 26rpx 0 0 15rpx;
  306. }
  307. }
  308. }
  309. }
  310. .search_b{
  311. display: flex;
  312. justify-content: center;
  313. align-items: center;
  314. margin: 20rpx 0;
  315. >text{
  316. display: inline-block;
  317. width: 200rpx;
  318. height: 60rpx;
  319. background: #FFFFFF;
  320. border-radius: 30rpx;
  321. font-size: 26rpx;
  322. font-family: PingFang SC;
  323. font-weight: 500;
  324. color: #333333;
  325. line-height: 60rpx;
  326. text-align: center;
  327. margin-right: 20rpx;
  328. }
  329. }
  330. }
  331. .scroll-box{
  332. // flex:1;
  333. overflow-y scroll;
  334. margin-top: 20rpx;
  335. padding-bottom: 144rpx;
  336. box-sizing: border-box;
  337. .for-big-box:last-child{
  338. margin-bottom:180rpx;
  339. }
  340. .for-big-box{
  341. margin:0 20rpx 20rpx;
  342. overflow hidden
  343. border-bottom-left-radius :20rpx;
  344. border-bottom-right-radius :20rpx;
  345. .for-time-p{
  346. background #fff
  347. line-height:87rpx;
  348. font-size:30rpx;
  349. padding:0 22rpx;
  350. border-top-left-radius:20rpx;
  351. border-top-right-radius:20rpx;
  352. }
  353. .for-back-img{
  354. height:30rpx;
  355. width:710rpx;
  356. }
  357. .for-box{
  358. overflow hidden;
  359. background: #fff;
  360. padding: 0 20rpx;
  361. box-sizing: border-box;
  362. .for-box_t{
  363. font-size: 28rpx;
  364. font-family: PingFang SC;
  365. font-weight: 500;
  366. color: #333333;
  367. line-height: 28rpx;
  368. margin: 28rpx 0 40rpx 0;
  369. }
  370. .for-box_b{
  371. display: flex;
  372. >img{
  373. width: 28rpx;
  374. height: 28rpx;
  375. margin-right: 10rpx;
  376. }
  377. >text{
  378. font-size: 24rpx;
  379. font-family: PingFang SC;
  380. font-weight: 500;
  381. color: #666666;
  382. line-height: 26rpx;
  383. margin-bottom: 20rpx;
  384. }
  385. >text:nth-of-type(1){
  386. width: 190rpx;
  387. }
  388. }
  389. }
  390. }
  391. /*暂无数据*/
  392. .get-null-box{
  393. height:100rpx;
  394. line-height:100rpx;
  395. color:#999;
  396. text-align center
  397. }
  398. }
  399. /* 按钮 */
  400. .sub_btn{
  401. width: 650rpx;
  402. height: 100rpx;
  403. background: #0183FA;
  404. border-radius: 20rpx;
  405. font-size: 28rpx;
  406. font-family: PingFang SC;
  407. font-weight: 500;
  408. color: #FFFFFF;
  409. line-height: 100rpx;
  410. text-align: center;
  411. margin-left: 50rpx;
  412. position: fixed;
  413. bottom:30rpx;
  414. z-index: 1000;
  415. }
  416. }
  417. </style>