useRecordList.vue 11 KB

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