useRecordList.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  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.usageAmount==null?'-':item.usageAmount}}Mpa</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.operator==null?'':item.operator}}</text>
  47. <img class="for-back-img" src="@/pages_manage/images/Version2.2/icon_wtzg_sj.png">
  48. <text>使用时间: {{item.startTime==null?'-':item.startTime}} - {{item.endTime==null?'-':item.endTime}}</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,airbottleUsageRecordList } 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. userType:uni.getStorageSync('userType'),
  74. gasBottleLevel:uni.getStorageSync('gasBottleLevel'),// 气瓶级别
  75. gasBottleSpecification:uni.getStorageSync('gasBottleSpecification'), // 气瓶规格
  76. dataList:[],
  77. noData:false,
  78. total:0,
  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_manage/gasList/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.getList()
  119. }
  120. },
  121. //开始时间选中事件
  122. startChange(e){
  123. if(new Date(e.target.value).getTime()>=new Date(this.getData.endTime).getTime()){
  124. uni.showToast({
  125. title: '结束时间不能小于开始时间',
  126. icon:"none",
  127. mask:true,
  128. duration: 2000
  129. });
  130. }else{
  131. this.$set(this.getData,'startTime',e.target.value);
  132. }
  133. },
  134. //结束时间选中事件
  135. endChange(e){
  136. if(new Date(this.getData.startTime).getTime()>=new Date(e.target.value).getTime()){
  137. uni.showToast({
  138. title: '结束时间不能小于开始时间',
  139. icon:"none",
  140. mask:true,
  141. duration: 2000
  142. });
  143. }else{
  144. this.$set(this.getData,'endTime',e.target.value);
  145. this.getList()
  146. }
  147. },
  148. //实验室房间号搜索
  149. searchBtn(){
  150. },
  151. //新增入库
  152. subBtn(){
  153. uni.redirectTo({
  154. url:'/pages_student/useGasApply/useGasApplyAdd?status=0'
  155. });
  156. },
  157. //滚动加载事件
  158. scrollGet(){
  159. let self=this;
  160. if(self.total/self.getData.pageSize<=self.getData.pageNum){
  161. console.log('没有更多数据!')
  162. }else{
  163. setTimeout(function(){
  164. self.getData.pageNum += 1;
  165. self.getList();
  166. },1000)
  167. }
  168. },
  169. //获取列表数据
  170. async getList(){
  171. let _this = this;
  172. const {data} = await airbottleUsageRecordList(_this.getData);
  173. if(data.code==200){
  174. for(let i=0;i<data.data.records.length;i++){
  175. for(let b=0;b<this.gasBottleSpecification.length;b++){
  176. if(this.gasBottleSpecification[b].dictValue==data.data.records[i].size){
  177. data.data.records[i].sizeName=this.gasBottleSpecification[b].dictLabel
  178. }
  179. }
  180. for(let t=0;t<this.gasBottleLevel.length;t++){
  181. if(this.gasBottleLevel[t].dictValue==data.data.records[i].level){
  182. data.data.records[i].levelName=this.gasBottleLevel[t].dictLabel
  183. }
  184. }
  185. }
  186. let res = data.data.records;
  187. this.total=data.data.total;
  188. if(res && res.length>0){
  189. if(_this.getData.pageNum==1){
  190. _this.dataList=res;
  191. }else{
  192. _this.dataList=_this.dataList.concat(res);
  193. }
  194. }else{
  195. _this.noData=true;
  196. }
  197. }
  198. },
  199. }
  200. }
  201. </script>
  202. <style lang="stylus" scoped>
  203. #gasRecycle {
  204. height: 100%;
  205. width: 100%;
  206. flex :1;
  207. display flex;
  208. flex-direction column
  209. overflow hidden;
  210. .top-picker-max-box{
  211. display:flex;
  212. padding:0 20rpx;
  213. background #fff
  214. border-bottom:1rpx solid #E0E0E0;
  215. .top-picker-box{
  216. line-height:80rpx;
  217. height:80rpx;
  218. .picker-view{
  219. display flex
  220. view{
  221. display:block;
  222. overflow:hidden;
  223. text-overflow:ellipsis;
  224. white-space:nowrap;
  225. font-size:28rpx;
  226. }
  227. .picker-img{
  228. width:24rpx;
  229. height:13rpx;
  230. margin-top:36rpx;
  231. margin-left:13rpx;
  232. }
  233. }
  234. }
  235. .top-picker-box:nth-child(1){
  236. text-align left
  237. width:320rpx;
  238. .picker-view{
  239. view{
  240. max-width:260rpx;
  241. }
  242. }
  243. }
  244. .top-picker-box:nth-child(2){
  245. text-align left
  246. width:215rpx;
  247. .picker-view{
  248. view{
  249. max-width:156rpx;
  250. }
  251. }
  252. }
  253. .top-picker-box:nth-child(3){
  254. text-align right
  255. width:195rpx;
  256. .picker-view{
  257. view{
  258. flex:1;
  259. }
  260. }
  261. }
  262. }
  263. /* 搜索 */
  264. .search{
  265. .search_t{
  266. background: #FFFFFF;
  267. padding: 20rpx;
  268. box-sizing: border-box;
  269. .search_n{
  270. width: 710rpx;
  271. height: 80rpx;
  272. border: 1px solid #E0E0E0;
  273. border-radius: 40rpx;
  274. display: flex;
  275. justify-content: space-between;
  276. align-items: center;
  277. padding:0 40rpx;
  278. box-sizing: border-box;
  279. >input{
  280. width: 640rpx;
  281. font-size: 24rpx;
  282. font-family: PingFang SC;
  283. font-weight: 500;
  284. color: #CCCCCC;
  285. line-height: 30rpx;
  286. }
  287. >img{
  288. width: 30rpx;
  289. height: 30rpx;
  290. }
  291. }
  292. }
  293. .search_b{
  294. display: flex;
  295. justify-content: center;
  296. align-items: center;
  297. margin: 20rpx 0;
  298. >text{
  299. display: inline-block;
  300. width: 200rpx;
  301. height: 60rpx;
  302. background: #FFFFFF;
  303. border-radius: 30rpx;
  304. font-size: 26rpx;
  305. font-family: PingFang SC;
  306. font-weight: 500;
  307. color: #333333;
  308. line-height: 60rpx;
  309. text-align: center;
  310. margin-right: 20rpx;
  311. }
  312. }
  313. }
  314. .scroll-box{
  315. // flex:1;
  316. overflow-y scroll;
  317. margin-top: 20rpx;
  318. .for-big-box:last-child{
  319. margin-bottom:180rpx;
  320. }
  321. .for-big-box{
  322. margin:0 20rpx 20rpx;
  323. overflow hidden
  324. border-bottom-left-radius :20rpx;
  325. border-bottom-right-radius :20rpx;
  326. .for-time-p{
  327. background #fff
  328. line-height:87rpx;
  329. font-size:30rpx;
  330. padding:0 22rpx;
  331. border-top-left-radius:20rpx;
  332. border-top-right-radius:20rpx;
  333. }
  334. .for-back-img{
  335. height:30rpx;
  336. width:710rpx;
  337. }
  338. .for-box{
  339. overflow hidden;
  340. background: #fff;
  341. padding: 0 20rpx;
  342. box-sizing: border-box;
  343. .for-box_t{
  344. font-size: 28rpx;
  345. font-family: PingFang SC;
  346. font-weight: 500;
  347. color: #333333;
  348. line-height: 28rpx;
  349. margin: 28rpx 0 40rpx 0;
  350. }
  351. .for-box_b{
  352. display: flex;
  353. >img{
  354. width: 28rpx;
  355. height: 28rpx;
  356. margin-right: 10rpx;
  357. }
  358. >text{
  359. font-size: 24rpx;
  360. font-family: PingFang SC;
  361. font-weight: 500;
  362. color: #666666;
  363. line-height: 26rpx;
  364. margin-bottom: 20rpx;
  365. }
  366. >text:nth-of-type(1){
  367. width: 190rpx;
  368. }
  369. }
  370. }
  371. }
  372. /*暂无数据*/
  373. .get-null-box{
  374. height:100rpx;
  375. line-height:100rpx;
  376. color:#999;
  377. text-align center
  378. }
  379. }
  380. /* 按钮 */
  381. .sub_btn{
  382. width: 650rpx;
  383. height: 100rpx;
  384. background: #0183FA;
  385. border-radius: 20rpx;
  386. font-size: 28rpx;
  387. font-family: PingFang SC;
  388. font-weight: 500;
  389. color: #FFFFFF;
  390. line-height: 100rpx;
  391. text-align: center;
  392. margin-left: 50rpx;
  393. position: fixed;
  394. bottom:30rpx;
  395. z-index: 1000;
  396. }
  397. }
  398. </style>