authorizationRecord.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. <template>
  2. <view id="authorizationRecord">
  3. <view class="top-max-big-box">
  4. <view class="search-box">
  5. <img class="img-view" :src="imagesUrl('commonality/icon_aqjc_ss.png')">
  6. <input type="text" v-model="searchValue" placeholder="姓名/学工号" maxlength="20">
  7. <view class="button-view" @click="searchButton()">搜索</view>
  8. </view>
  9. <view class="check-button-max-box">
  10. <view class="check-button-box" style="width:260rpx;">
  11. <view class="picker-min-box" @click="checkSubButton()">
  12. <view class="picker-name">{{subId?subName:'实验室'}}</view>
  13. <img class="picker-img" :src="imagesUrl('commonality/icon_06.png')">
  14. </view>
  15. </view>
  16. <view class="check-button-box" style="width:200rpx;">
  17. <picker @change="buttonChange" :range-key="'typeName'" :value="typeId" :range="typeList">
  18. <view class="picker-min-box">
  19. <view class="picker-name">{{typeListIndex?typeList[typeListIndex].typeName:'开门状态'}}</view>
  20. <img class="picker-img" :src="imagesUrl('commonality/icon_06.png')">
  21. </view>
  22. </picker>
  23. </view>
  24. <view class="check-button-box" style="width:230rpx;">
  25. <picker mode="date" v-model="validBeginTime" :start="currentDate" fields="day" @change="beginDateChange">
  26. <view class="picker-min-box">
  27. <view class="picker-name">{{validBeginTime?validBeginTime:'开始时间'}}</view>
  28. <img class="picker-img" :src="imagesUrl('commonality/icon_06.png')">
  29. </view>
  30. </picker>
  31. </view>
  32. </view>
  33. </view>
  34. <scroll-view scroll-y @scrolltolower="scrollGet" class="list">
  35. <view class="for-max-big-box" v-for="(item,index) in dataList" :key="index">
  36. <view class="for-top-box">
  37. <view class="for-title-box">
  38. <view class="for-title">{{item.subjectName}}</view>
  39. <view class="for-button-box">
  40. <view class="for-button-null-p"></view>
  41. <view class="for-button-p" v-if="item.openStatus == 0" @click="delButton(item,index)">删除</view>
  42. <view class="for-button-null-p"></view>
  43. </view>
  44. </view>
  45. <view class="for-border-box"></view>
  46. <view class="position-left"></view>
  47. <view class="position-right"></view>
  48. <img v-if="item.openStatus == 1" class="position-top-right" :src="imagesUrl('commonality/img_sqjl_yk@1x.png')">
  49. <img v-if="item.openStatus == 0" class="position-top-right" :src="imagesUrl('commonality/img_sqjl_wk@1x.png')">
  50. </view>
  51. <view class="for-bottom-box">
  52. <view class="for-user-box">
  53. <view class="for-user-left-box">
  54. <img :src="imagesUrl('commonality/icon_sqjl_bsqr@1x.png')">
  55. <view>被授权人:</view>
  56. <view>{{item.userName}}</view>
  57. </view>
  58. <view class="for-user-right-box">
  59. <img :src="imagesUrl('commonality/icon_sqjl_sqr@1x.png')">
  60. <view>授权人:</view>
  61. <view>{{item.createByName}}</view>
  62. </view>
  63. </view>
  64. <view class="for-time-box">
  65. <img :src="imagesUrl('commonality/icon_aqbj_sj.png')">
  66. <view>开门时间:</view>
  67. <view></view>
  68. </view>
  69. <view class="for-time-box" style="margin-top:20rpx;">
  70. <img>
  71. <view></view>
  72. <view><span style="margin-right:30rpx;">{{item.validBeginTime}}</span>至 <span style="margin-left:30rpx;">{{item.validEndTime}}</span></view>
  73. </view>
  74. </view>
  75. </view>
  76. <view class="get-data-null-p" v-if="getDataType">- 没有更多数据 -</view>
  77. <view class="get-data-null-p" v-else="getDataType">- 滑动加载更多 -</view>
  78. </scroll-view>
  79. </view>
  80. </template>
  81. <script>
  82. import {
  83. laboratoryAppletLabLockApplyList,
  84. laboratoryAppletLabLockApplyDelete
  85. } from '@/pages_manage/api/index.js'
  86. import {
  87. parseTime
  88. } from '@/component/public.js'
  89. export default {
  90. data() {
  91. return {
  92. searchValue: '',
  93. subId: '',
  94. subName: '',
  95. typeList: [{
  96. typeId: '1',
  97. typeName: '已开'
  98. },
  99. {
  100. typeId: '0',
  101. typeName: '未开'
  102. },
  103. ],
  104. typeListIndex: "",
  105. typeId: '',
  106. validBeginTime: '', //申请期限开始
  107. currentDate: '', //当前日期
  108. getDataType: false,
  109. getData: {
  110. page: 1,
  111. pageSize: 10,
  112. },
  113. dataList: [],
  114. total: 0,
  115. }
  116. },
  117. onShow() {
  118. if (uni.getStorageSync('searchSubData')) {
  119. let subData = JSON.parse(uni.getStorageSync('searchSubData'));
  120. uni.removeStorageSync('searchSubData');
  121. this.$set(this, 'subId', subData.subId);
  122. this.$set(this, 'subName', subData.subName);
  123. }else{
  124. this.searchButton();
  125. }
  126. },
  127. methods: {
  128. //删除按钮
  129. delButton(item,index){
  130. let self = this;
  131. uni.showModal({
  132. content: '是否确认删除?',
  133. cancelColor: "#999",
  134. confirmColor: "#0183FA",
  135. success: function(res) {
  136. if (res.confirm) {
  137. self.laboratoryAppletLabLockApplyDelete(item.id,index);
  138. } else if (res.cancel) {}
  139. }
  140. });
  141. },
  142. //删除 授权记录
  143. async laboratoryAppletLabLockApplyDelete(id,index) {
  144. let self = this;
  145. const {
  146. data
  147. } = await laboratoryAppletLabLockApplyDelete({id:id});
  148. if (data.code == 200) {
  149. uni.showToast({
  150. title: '操作成功',
  151. icon: "none",
  152. mask: true,
  153. duration: 2000
  154. });
  155. this.dataList.splice(index,1);
  156. }
  157. },
  158. //滚动加载事件
  159. scrollGet() {
  160. let self = this;
  161. if (self.total / self.getData.pageSize <= self.getData.page) {
  162. this.$set(this, 'getDataType', true);
  163. } else {
  164. this.getData.page += 1;
  165. this.$nextTick(() => {
  166. this.getList();
  167. })
  168. }
  169. },
  170. //授权记录列表
  171. async getList() {
  172. let self = this;
  173. let obj = JSON.parse(JSON.stringify(this.getData))
  174. obj.searchValue = this.searchValue;
  175. obj.subjectId = this.subId;
  176. obj.openStatus = this.typeId;
  177. obj.validBeginTime = this.validBeginTime?this.validBeginTime+'T00:00:00':'';
  178. const {
  179. data
  180. } = await laboratoryAppletLabLockApplyList(obj);
  181. if (data.code == 200) {
  182. for(let i=0;i<data.data.records.length;i++){
  183. data.data.records[i].validBeginTime = parseTime(data.data.records[i].validBeginTime, "{y}-{m}-{d} {h}:{i}")
  184. data.data.records[i].validEndTime = parseTime(data.data.records[i].validEndTime, "{y}-{m}-{d} {h}:{i}")
  185. }
  186. if (self.getData.page == 1) {
  187. this.dataList = data.data.records;
  188. this.total = data.data.total;
  189. if (data.data.total / self.getData.pageSize <= self.getData.page) {
  190. this.$set(this, 'getDataType', true);
  191. }
  192. } else {
  193. this.dataList = [...this.dataList, ...data.data.records]
  194. this.total = data.data.total;
  195. if (data.data.total / self.getData.pageSize <= self.getData.page) {
  196. this.$set(this, 'getDataType', true);
  197. }
  198. }
  199. }
  200. },
  201. // 打开实验室查询
  202. checkSubButton() {
  203. uni.navigateTo({
  204. url: '/pages_manage/views/accessControl/searchSub'
  205. });
  206. },
  207. // 搜索按钮
  208. searchButton() {
  209. this.$set(this.getData,'page',1);
  210. this.getList();
  211. },
  212. //状态选择
  213. buttonChange(e) {
  214. this.typeListIndex = e.mp.detail.value;
  215. this.typeId = this.typeList[this.typeListIndex].typeId;
  216. },
  217. //时间选择触发-开始
  218. beginDateChange(data) {
  219. this.validBeginTime = data.detail.value;
  220. },
  221. }
  222. }
  223. </script>
  224. <style lang="stylus" scoped>
  225. #authorizationRecord {
  226. height: 100%;
  227. display flex;
  228. flex-direction column;
  229. .top-max-big-box {
  230. width: 750rpx;
  231. height: 180rpx;
  232. background: #FFFFFF;
  233. padding: 20rpx 30rpx;
  234. box-sizing: border-box;
  235. .search-box {
  236. width: 690rpx;
  237. height: 78rpx;
  238. border: 1rpx solid #E0E0E0;
  239. border-radius: 50rpx;
  240. display: flex;
  241. .img-view {
  242. display: inline-block;
  243. margin: 27rpx 17rpx 0 37rpx;
  244. width: 26rpx;
  245. height: 26rpx;
  246. }
  247. input {
  248. height: 78rpx;
  249. line-height: 78rpx;
  250. flex: 1;
  251. font-size: 24rpx;
  252. }
  253. .button-view {
  254. width: 100rpx;
  255. line-height: 78rpx;
  256. text-align: center;
  257. font-size: 24rpx;
  258. color: #0183FA;
  259. }
  260. }
  261. }
  262. .check-button-max-box {
  263. display: flex;
  264. .check-button-box {
  265. .picker-min-box {
  266. display: flex;
  267. .picker-name {
  268. line-height: 80rpx;
  269. flex: 1;
  270. text-align: right;
  271. display: block;
  272. overflow: hidden;
  273. text-overflow: ellipsis;
  274. white-space: nowrap;
  275. font-size:28rpx;
  276. }
  277. .picker-img {
  278. margin: 34rpx 0 0 20rpx;
  279. width: 24rpx;
  280. height: 12rpx;
  281. }
  282. }
  283. }
  284. }
  285. .list {
  286. flex: 1;
  287. overflow-y scroll;
  288. padding: 0 30rpx;
  289. box-sizing: border-box;
  290. .for-max-big-box {
  291. background-color: #fff;
  292. border-radius: 20rpx;
  293. overflow: hidden;
  294. margin-top: 20rpx;
  295. .for-top-box {
  296. position: relative;
  297. .for-title-box {
  298. display: flex;
  299. .for-title {
  300. flex: 1;
  301. line-height: 42rpx;
  302. padding: 20rpx 37rpx;
  303. font-size: 30rpx;
  304. }
  305. .for-button-box {
  306. width: 100rpx;
  307. display: flex;
  308. flex-direction: column;
  309. margin-right: 75rpx;
  310. .for-button-null-p {
  311. flex: 1;
  312. }
  313. .for-button-p {
  314. width: 100rpx;
  315. height: 50rpx;
  316. line-height: 50rpx;
  317. text-align: center;
  318. font-size: 28rpx;
  319. color: #fff;
  320. background-color: #0183FA;
  321. border-radius: 10rpx;
  322. }
  323. }
  324. }
  325. .for-border-box {
  326. height: 37rpx;
  327. margin: 0 40rpx;
  328. border-top: 1rpx dashed #E0E0E0;
  329. }
  330. .position-left {
  331. width: 50rpx;
  332. height: 50rpx;
  333. border-radius: 50%;
  334. background-color: #E0E0E0;
  335. position: absolute;
  336. left: -25rpx;
  337. bottom: 13rpx;
  338. }
  339. .position-right {
  340. width: 50rpx;
  341. height: 50rpx;
  342. border-radius: 50%;
  343. background-color: #E0E0E0;
  344. position: absolute;
  345. right: -25rpx;
  346. bottom: 13rpx;
  347. }
  348. .position-top-right {
  349. position: absolute;
  350. top: 0;
  351. right: 0;
  352. width: 64rpx;
  353. height: 57rpx;
  354. }
  355. }
  356. .for-bottom-box {
  357. font-size: 28rpx;
  358. padding: 0 0 22rpx 40rpx;
  359. .for-user-box {
  360. display: flex;
  361. margin-bottom: 35rpx;
  362. .for-user-left-box {
  363. display: flex;
  364. flex: 1;
  365. img {
  366. width: 30rpx;
  367. height: 30rpx;
  368. margin-right:18rpx;
  369. }
  370. view {
  371. height: 30rpx;
  372. line-height: 30rpx;
  373. font-size: 28rpx;
  374. }
  375. }
  376. .for-user-right-box {
  377. display: flex;
  378. width:320rpx;
  379. img {
  380. width: 30rpx;
  381. height: 30rpx;
  382. margin-right:18rpx;
  383. }
  384. view {
  385. height: 30rpx;
  386. line-height: 30rpx;
  387. font-size: 28rpx;
  388. }
  389. }
  390. }
  391. .for-time-box {
  392. display: flex;
  393. img {
  394. width: 30rpx;
  395. height: 30rpx;
  396. margin-right:18rpx;
  397. }
  398. view {
  399. height: 30rpx;
  400. line-height: 30rpx;
  401. font-size: 28rpx;
  402. }
  403. }
  404. }
  405. }
  406. .get-data-null-p {
  407. text-align: center;
  408. line-height: 100rpx;
  409. padding-bottom: 80px;
  410. color: #999;
  411. }
  412. }
  413. }
  414. </style>