whRecord.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. <template>
  2. <view class="box u-skeleton">
  3. <u-skeleton :loading="loading" :animation="true"></u-skeleton>
  4. <view v-if="list.length>0" style="display: flex;flex-direction: column;width: 100%;">
  5. <view class="list" @click="detail(item.id)" v-for="(item,index) in list" :key="index">
  6. <view class="list-top">
  7. <text class="txt1">{{item.room.name}}</text>
  8. <image src="/static/image/record/right.png" mode="" style="width: 24px;height: 24px;"></image>
  9. </view>
  10. <view class="list-center">
  11. <image src="/static/image/record/user_jilu.png" mode="" style="width: 12px;height: 14px;"></image>
  12. <text>{{item.maintain_admin.name}}</text>
  13. </view>
  14. <view class="list-bottom">
  15. <image src="/static/image/record/time.png" mode="" style="width: 12px;height: 12px;"></image>
  16. <text>{{item.day}} · 第{{item.week}}周 · {{item.week_index}} · {{item.time.name}}</text>
  17. </view>
  18. <view class="btm_btn" v-if="item.status == 1 && item.complete_status == 0">
  19. <view @click.stop="complete(item,1)" style="margin-right: 10px;"><text>取消维护</text></view>
  20. <view @click.stop="complete(item,2)"><text>维护完成</text></view>
  21. </view>
  22. </view>
  23. <u-loadmore :status="statuss" :load-text="loadText" icon="true" />
  24. </view>
  25. <view class="empty" v-else style="padding-top: 110px;">
  26. <u-empty text="暂无维护记录~" mode="favor"></u-empty>
  27. </view>
  28. <u-popup v-model="show" mode="center" width="327px" height="370px" border-radius="24">
  29. <view class="pop">
  30. <text class="title">维护详情</text>
  31. <view class="msg" style="width: 100%;">
  32. <text class="txt1">实验室名称:<text class="txt2">{{message.room.name}}</text></text>
  33. <text class="txt1">维护人:<text class="txt2">{{message.maintain_admin.name}}</text></text>
  34. <text class="txt1">维护时间:<text
  35. class="txt2">{{message.day}}·第{{message.week}}周·{{message.week_index}}·{{message.time.name}}</text></text>
  36. <text class="txt1">维护内容:<text class="txt2">{{message.body}}</text></text>
  37. </view>
  38. <view @click="show=false" class="btn">
  39. <text>确定</text>
  40. </view>
  41. </view>
  42. </u-popup>
  43. <u-popup v-model="completeShow" mode="center" width="327px" height="370px" border-radius="24">
  44. <view class="pop">
  45. <text class="title">维护完成</text>
  46. <view class="msg" style="width: 100%;">
  47. <view class="txt1"><text style="color: red;">*</text>可用座位数:<u-input v-model="value" type="number" border="true" placeholder="请输入可用座位数" />
  48. </view>
  49. <view class="textar">
  50. <text style="padding: 5px 0px;">备注</text>
  51. <textarea v-model="body" rows="2"></textarea>
  52. <!-- <u-input v-model="body" type="textarea" border height="150" auto-height /> -->
  53. </view>
  54. </view>
  55. <view @click="comTrue" class="btn">
  56. <text>确定</text>
  57. </view>
  58. </view>
  59. </u-popup>
  60. <u-modal v-model="qxShow" content="你确定要取消当前实验室维护吗?" show-cancel-button="true" @confirm="confirm" @cancel="cancel"></u-modal>
  61. </view>
  62. </template>
  63. <script>
  64. export default {
  65. data() {
  66. return {
  67. show: false,
  68. list: '',
  69. message: '',
  70. loading: true,
  71. id: '',
  72. page: 1,
  73. statuss: 'loadmore',
  74. loadText: {
  75. loadmore: '轻轻上拉',
  76. loading: '努力加载中',
  77. nomore: '实在没有了'
  78. },
  79. meta: '',
  80. completeShow:false,
  81. value:'',
  82. body:'',
  83. details:'',
  84. qxShow:false
  85. }
  86. },
  87. methods: {
  88. detail(id) {
  89. this.$u.get('lab/maintain/info/' + id).then(res => {
  90. console.log(res)
  91. this.show = true;
  92. switch (res.data.week_index) {
  93. case 0:
  94. res.data.week_index = '星期一'
  95. break
  96. case 1:
  97. res.data.week_index = '星期二'
  98. break
  99. case 2:
  100. res.data.week_index = '星期三'
  101. break
  102. case 3:
  103. res.data.week_index = '星期四'
  104. break
  105. case 4:
  106. res.data.week_index = '星期五'
  107. break
  108. case 5:
  109. res.data.week_index = '星期六'
  110. break
  111. case 6:
  112. res.data.week_index = '星期日'
  113. break
  114. }
  115. this.message = res.data;
  116. })
  117. },
  118. complete(item,type){
  119. this.details = item;
  120. if(type==2){
  121. this.completeShow = true
  122. }
  123. if(type==1){
  124. this.qxShow = true
  125. }
  126. },
  127. confirm(){
  128. //取消维护确定事件
  129. this.$u.get('/lab/maintain/pause?id='+this.details.id).then(res=>{
  130. console.log(res)
  131. this.$u.toast('操作成功')
  132. this.qxShow = false;
  133. this.lists()
  134. })
  135. },
  136. cancel(){
  137. this.qxShow = false;
  138. },
  139. //点击维护完成
  140. comTrue(){
  141. var data = {
  142. complete_status:this.details.complete_status,
  143. id:this.details.id,
  144. remark:this.body,
  145. use_student_nums:this.value
  146. }
  147. if(this.value==''){
  148. this.$u.toast('请输入可用座位数')
  149. return;
  150. }
  151. this.$u.post('/lab/maintain/complete',data).then(res=>{
  152. console.log(res)
  153. this.$u.toast('操作成功')
  154. this.completeShow = false;
  155. this.lists()
  156. })
  157. },
  158. lists() {
  159. this.$u.get('lab/maintain?room_id=' + this.id).then(res => {
  160. console.log(res)
  161. var list = res.data.list;
  162. this.list = this.foreach(list);
  163. this.loading = false;
  164. this.meta = res.data.meta.pagination;
  165. if (res.data.list.length < 10) {
  166. this.statuss = 'nomore'
  167. }
  168. })
  169. },
  170. foreach(list) {
  171. list.map((item) => {
  172. switch (item.week_index) {
  173. case 0:
  174. item.week_index = '星期一'
  175. break
  176. case 1:
  177. item.week_index = '星期二'
  178. break
  179. case 2:
  180. item.week_index = '星期三'
  181. break
  182. case 3:
  183. item.week_index = '星期四'
  184. break
  185. case 4:
  186. item.week_index = '星期五'
  187. break
  188. case 5:
  189. item.week_index = '星期六'
  190. break
  191. case 6:
  192. item.week_index = '星期日'
  193. break
  194. }
  195. return item
  196. })
  197. return list
  198. }
  199. },
  200. onLoad(options) {
  201. this.id = options.id;
  202. this.lists()
  203. },
  204. onPullDownRefresh() {
  205. this.lists()
  206. this.page = 1;
  207. uni.stopPullDownRefresh()
  208. },
  209. onReachBottom() {
  210. this.statuss = 'loading';
  211. var page = this.page;
  212. if (page >= this.meta.total_pages) {
  213. this.statuss = 'nomore';
  214. } else {
  215. this.$u.get('/lab/maintain?page=' + Number(page + 1) + '&room_id=' + this.id).then(res => {
  216. console.log(res)
  217. var list = res.data.list;
  218. this.list = this.list.concat(this.foreach(list));
  219. this.page = ++page;
  220. })
  221. this.statuss = 'loading';
  222. }
  223. }
  224. }
  225. </script>
  226. <style lang="scss" scoped>
  227. .box {
  228. width: 100vw;
  229. min-height: 100vh;
  230. background: #F5F5F5;
  231. display: flex;
  232. flex-direction: column;
  233. align-items: center;
  234. padding-bottom: 30px;
  235. padding-left: 15px;
  236. padding-right: 15px;
  237. box-sizing: border-box;
  238. .list {
  239. display: flex;
  240. flex-direction: column;
  241. align-items: center;
  242. width: 100%;
  243. background: #FFFFFF;
  244. border-radius: 8px 8px 8px 8px;
  245. opacity: 1;
  246. display: flex;
  247. margin-top: 12px;
  248. padding: 15px 12px 8px 12px;
  249. box-sizing: border-box;
  250. .list-top {
  251. display: flex;
  252. align-items: center;
  253. justify-content: space-between;
  254. width: 100%;
  255. }
  256. .list-center {
  257. display: flex;
  258. align-items: center;
  259. font-size: 14px;
  260. font-weight: 400;
  261. color: #666666;
  262. padding-top: 8px;
  263. padding-bottom: 4px;
  264. width: 100%;
  265. text {
  266. padding-left: 10px;
  267. }
  268. }
  269. .list-bottom {
  270. display: flex;
  271. align-items: center;
  272. font-size: 14px;
  273. font-weight: 400;
  274. color: #666666;
  275. width: 100%;
  276. padding-bottom: 5px;
  277. text {
  278. padding-left: 10px;
  279. }
  280. }
  281. }
  282. .pop {
  283. display: flex;
  284. flex-direction: column;
  285. width: 100%;
  286. padding: 16px 20px 40px 20px;
  287. box-sizing: border-box;
  288. justify-content: space-between;
  289. height: 100%;
  290. align-items: center;
  291. .title {
  292. font-size: 18px;
  293. font-family: PingFang SC-Bold, PingFang SC;
  294. font-weight: bold;
  295. color: #333333;
  296. }
  297. .msg {
  298. display: flex;
  299. flex-direction: column;
  300. .txt1 {
  301. font-size: 13px;
  302. font-weight: 500;
  303. color: #333333;
  304. display: flex;
  305. align-items: center;
  306. }
  307. .txt2 {
  308. font-size: 15px;
  309. font-family: PingFang SC-Bold, PingFang SC;
  310. font-weight: 400;
  311. color: #333333;
  312. padding-top: 5px;
  313. }
  314. }
  315. .btn {
  316. width: 280px;
  317. height: 44px;
  318. background: #3665FF;
  319. border-radius: 22px 22px 22px 22px;
  320. opacity: 1;
  321. font-size: 16px;
  322. font-family: PingFang SC-Regular, PingFang SC;
  323. font-weight: 400;
  324. color: #FFFFFF;
  325. display: flex;
  326. align-items: center;
  327. justify-content: center;
  328. }
  329. }
  330. .btm_btn{
  331. width: 100%;
  332. display: flex;
  333. justify-content: flex-end;
  334. padding-top: 5px;
  335. font-size: 14px;
  336. font-weight: 400;
  337. color: white;
  338. view{
  339. display: flex;
  340. align-items: center;
  341. justify-content: center;
  342. border-radius: 10px;
  343. padding: 4px 6px;
  344. }
  345. view:nth-of-type(1){
  346. background: #ff6e27;
  347. }
  348. view:nth-of-type(2){
  349. background: #3665FF;
  350. }
  351. }
  352. textarea {
  353. border: solid 1px #dcdfe6;
  354. width: auto;
  355. border-radius: 8px;
  356. padding: 8px;
  357. height: 100px;
  358. }
  359. .textar{
  360. font-size: 13px;
  361. font-weight: 500;
  362. display: flex;
  363. flex-direction: column;
  364. }
  365. u-input{
  366. width: 70% !important;
  367. }
  368. }
  369. </style>