queue.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <view v-show="show">
  3. <view v-if="isfeedback && total" class="clear" @click="clearList">
  4. <view class="total">共 {{ total }} 条</view>
  5. <view class="clear-but" hover-class="navigator-hover">
  6. 清空队列
  7. </view>
  8. </view>
  9. <operate-list :list="list" />
  10. </view>
  11. </template>
  12. <script>
  13. let paging = {}
  14. import operateList from "./operateList";
  15. export default {
  16. components: { operateList },
  17. name: "queue",
  18. props: {
  19. w_deviceid: String,
  20. isfeedback: {
  21. type: [String, Number]
  22. }
  23. },
  24. data() {
  25. return {
  26. total: 0,
  27. show: false,
  28. uninitialized: true,
  29. list: [],
  30. "where": {
  31. "begindate": "",
  32. "enddate": ""
  33. }
  34. }
  35. },
  36. methods: {
  37. getList(init = false) {
  38. if (init) paging = {
  39. pageNumber: 1,
  40. pageTotal: 1,
  41. };
  42. return new Promise((resolve) => {
  43. if (paging.pageNumber > paging.pageTotal) return resolve()
  44. this.$Http.basic({
  45. "id": 20230701132202,
  46. "content": {
  47. "type": 2,
  48. "w_deviceid": this.w_deviceid,
  49. ...paging,
  50. "where": this.where
  51. }
  52. }).then(res => {
  53. console.log('操作队列', res)
  54. resolve(!this.cutoff(res.msg));
  55. if (this.cutoff(res.msg)) return;
  56. paging.pageNumber = res.pageNumber + 1;
  57. paging.pageTotal = res.pageTotal;
  58. this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data)
  59. this.total = res.total;
  60. })
  61. })
  62. },
  63. clearList() {
  64. let that = this;
  65. uni.showModal({
  66. title: '提示',
  67. content: '是否确定清空操作队列',
  68. success: function (res) {
  69. if (res.confirm) that.$Http.basic({
  70. "id": 20231128145402,
  71. "content": {
  72. w_deviceid: that.w_deviceid
  73. }
  74. }).then(res => {
  75. if (that.cutoff(res.msg, '已清空队列')) return;
  76. that.getList(true)
  77. })
  78. }
  79. });
  80. }
  81. },
  82. }
  83. </script>
  84. <style lang="scss" scoped>
  85. .clear {
  86. display: flex;
  87. justify-content: space-between;
  88. color: #fff;
  89. width: 100vw;
  90. padding: 0 18px 10px;
  91. box-sizing: border-box;
  92. font-size: 12px;
  93. }
  94. </style>