selectplain.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <view class=" m-w u-flex f-d-c ">
  3. <view class="scr-hei">
  4. <!-- <scroll-view v-if="taskList != null && taskList.length > 0" @scrolltolower="getlist" :scroll-y="true" class="scr-hei "> -->
  5. <view v-if="taskList.length > 0 " v-for="(index,key) in taskList" :key="key">
  6. <slectdicsk :parobj="index"
  7. :prourl="`/scan_pages/scanning/scanning?roomId=${roomId}&taskId=${index.id}`" />
  8. </view>
  9. <!-- </scroll-view> -->
  10. <view v-if="taskList.length == 0">
  11. <u-empty margin-top="400" text="暂无数据" mode="list"></u-empty>
  12. </view>
  13. </view>
  14. <u-tabbar :height="tabheight" :before-switch="beforeSwitch" :list="tabbar" :mid-button="true"></u-tabbar>
  15. </view>
  16. </template>
  17. <script>
  18. import {
  19. mapState,
  20. } from 'vuex'
  21. import slectdicsk from '@/components/slectdicsk/index.vue'
  22. export default {
  23. components: {
  24. slectdicsk
  25. },
  26. data() {
  27. return {
  28. tabheight: 0,
  29. taskList: []
  30. }
  31. },
  32. computed: {
  33. ...mapState({
  34. tabbar: state => state.tabbar.tabbar,
  35. roomId: state => state.user.roomId
  36. })
  37. },
  38. watch: {
  39. taskList: {
  40. deep: true,
  41. immediate: true,
  42. handler(n, o) {
  43. // console.log('taskList', n)
  44. }
  45. }
  46. },
  47. onLoad() {
  48. this.taskList = this.$store.state.user.taskList
  49. this.tabheight = getApp().globalData.tabhei
  50. this.getlist()
  51. },
  52. methods: {
  53. //底部导航栏
  54. beforeSwitch(id) {
  55. if (id == 1) {
  56. // this.taskList = this.$store.state.user.taskList
  57. this.$store.dispatch("user/gettasklist");
  58. return false;
  59. } else {
  60. return true;
  61. }
  62. },
  63. //判定房间计划是否为一条 一条则直接跳转去巡检
  64. async getlist() {
  65. if (this.taskList.length == 1) {
  66. const index = this.taskList[0]
  67. uni.redirectTo({
  68. url: `/scan_pages/scanning/scanning?roomId=${this.roomId}&taskId=${index.id}`,
  69. })
  70. }
  71. // this.taskList.length == 0 && (this.taskList = null)
  72. },
  73. }
  74. }
  75. </script>
  76. <style>
  77. .scr-hei {
  78. /* height: calc( 100vh - 74rpx ); */
  79. background: #FFFFFF;
  80. /* box-shadow: 0px 0px 6rpx 0px rgba(6, 0, 1,.3); */
  81. border-radius: 10rpx 10rpx 0px 0px;
  82. width: 750rpx;
  83. }
  84. </style>