stockList.vue 11 KB

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