dailyRecord.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <view v-show="show">
  3. <view class="head">
  4. <view class="left" hover-class="navigator-hover" @click="actionShow = true">
  5. {{ showPage }} <text class="iconfont icon-xiangxiazhankai" style="margin-left:4px;" />
  6. </view>
  7. <time-horizon @onConfirm="dateRange" />
  8. </view>
  9. <record ref="操作记录" :w_deviceid="w_deviceid" />
  10. <queue ref="操作队列" :w_deviceid="w_deviceid" />
  11. <upload-record ref="上传记录" :w_deviceid="w_deviceid" />
  12. <up-line-record ref="上线记录" :w_deviceid="w_deviceid" />
  13. <u-action-sheet :actions="actions" cancelText="取消" :show="actionShow" @select="selectClick"
  14. :closeOnClickOverlay="true" :closeOnClickAction="false" @close="actionClose" />
  15. </view>
  16. </template>
  17. <script>
  18. let page = {}
  19. import record from "./record.vue"
  20. import queue from "./queue.vue"
  21. import uploadRecord from "./uploadRecord.vue"
  22. import upLineRecord from "./upLineRecord.vue"
  23. export default {
  24. components: { record, queue, uploadRecord, upLineRecord },
  25. name: "dailyRecord",
  26. props: {
  27. w_deviceid: String
  28. },
  29. data() {
  30. return {
  31. show: false,
  32. uninitialized: true,
  33. showPage: "操作记录",
  34. actionShow: false,
  35. actions: [{
  36. name: '操作记录',
  37. loading: false,
  38. disabled: true
  39. }, {
  40. name: '操作队列',
  41. loading: false,
  42. disabled: false
  43. }, {
  44. name: '上传记录',
  45. loading: false,
  46. disabled: false
  47. }, {
  48. name: '上线记录',
  49. loading: false,
  50. disabled: false
  51. }],
  52. }
  53. },
  54. methods: {
  55. initialize(init = false) {
  56. this.loadData(init)
  57. },
  58. actionClose() {
  59. this.actionShow = false;
  60. setTimeout(() => {
  61. this.actions.forEach(option => {
  62. option.disabled = option.name == this.showPage;
  63. option.loading = false;
  64. });
  65. }, 100)
  66. },
  67. selectClick(result) {
  68. page.show = false;
  69. this.showPage = result.name;
  70. this.actions.forEach(option => {
  71. option.disabled = true;
  72. option.loading = option.name == result.name;
  73. if (option.name == result.name) this.loadData()
  74. });
  75. },
  76. loadData(init) {
  77. page = this.$refs[this.showPage];
  78. if ((page.uninitialized && !page.show) || init) {
  79. page.show = true;
  80. page.getList(true).then(res => {
  81. page.uninitialized = !res;
  82. this.uninitialized = false;
  83. this.actionClose()
  84. })
  85. } else if (page.show) {
  86. page.getList()
  87. } else {
  88. page.show = true;
  89. this.actionClose();
  90. }
  91. },
  92. dateRange(range, fun) {
  93. let where = page.where;
  94. if (where.begindate == range[0] && where.enddate == range[1]) return fun();
  95. this.actions.forEach(v => {
  96. let p = this.$refs[v.name];
  97. if (p) {
  98. p.where.begindate = range[0];
  99. p.where.enddate = range[1];
  100. p.uninitialized = true;
  101. };
  102. })
  103. page.getList(true).then(res => {
  104. page.uninitialized = !res;
  105. fun();
  106. })
  107. }
  108. },
  109. }
  110. </script>
  111. <style lang="scss" scoped>
  112. .head {
  113. height: 40px;
  114. display: flex;
  115. justify-content: space-between;
  116. align-items: center;
  117. width: 355px;
  118. margin: 0 auto;
  119. box-sizing: border-box;
  120. padding: 0 10px;
  121. .left {
  122. color: #fff;
  123. font-weight: bold;
  124. }
  125. }
  126. </style>