dailyRecord.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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="操作队列" :isfeedback="isfeedback" :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. isfeedback: {
  29. type: [String, Number]
  30. }
  31. },
  32. data() {
  33. return {
  34. show: false,
  35. uninitialized: true,
  36. showPage: "操作记录",
  37. actionShow: false,
  38. actions: [{
  39. name: '操作记录',
  40. loading: false,
  41. disabled: true
  42. }, {
  43. name: '操作队列',
  44. loading: false,
  45. disabled: false
  46. }, {
  47. name: '上传记录',
  48. loading: false,
  49. disabled: false
  50. }, {
  51. name: '上线记录',
  52. loading: false,
  53. disabled: false
  54. }],
  55. }
  56. },
  57. methods: {
  58. initialize(init = false) {
  59. this.loadData(init)
  60. },
  61. actionClose() {
  62. this.actionShow = false;
  63. setTimeout(() => {
  64. this.actions.forEach(option => {
  65. option.disabled = option.name == this.showPage;
  66. option.loading = false;
  67. });
  68. }, 100)
  69. },
  70. selectClick(result) {
  71. page.show = false;
  72. this.showPage = result.name;
  73. this.actions.forEach(option => {
  74. option.disabled = true;
  75. option.loading = option.name == result.name;
  76. if (option.name == result.name) this.loadData()
  77. });
  78. },
  79. loadData(init) {
  80. page = this.$refs[this.showPage];
  81. if ((page.uninitialized && !page.show) || init) {
  82. page.show = true;
  83. page.getList(true).then(res => {
  84. page.uninitialized = !res;
  85. this.uninitialized = false;
  86. this.actionClose()
  87. })
  88. } else if (page.show) {
  89. page.getList()
  90. } else {
  91. page.show = true;
  92. this.actionClose();
  93. }
  94. },
  95. dateRange(range, fun) {
  96. let where = page.where;
  97. if (where.begindate == range[0] && where.enddate == range[1]) return fun();
  98. this.actions.forEach(v => {
  99. let p = this.$refs[v.name];
  100. if (p) {
  101. p.where.begindate = range[0];
  102. p.where.enddate = range[1];
  103. p.uninitialized = true;
  104. };
  105. })
  106. page.getList(true).then(res => {
  107. page.uninitialized = !res;
  108. fun();
  109. })
  110. }
  111. },
  112. }
  113. </script>
  114. <style lang="scss" scoped>
  115. .head {
  116. height: 40px;
  117. display: flex;
  118. justify-content: space-between;
  119. align-items: center;
  120. width: 355px;
  121. margin: 0 auto;
  122. box-sizing: border-box;
  123. padding: 0 10px;
  124. .left {
  125. color: #fff;
  126. font-weight: bold;
  127. }
  128. }
  129. </style>