index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <view class="container">
  3. <cu-custom id="custom"
  4. bgImage="https://yostest175549.obs.cn-east-2.myhuaweicloud.com:443/202306151686796745663B52544232.png"
  5. :isBack="true">
  6. <block slot="backText">返回</block>
  7. <block slot="content">
  8. 工单
  9. </block>
  10. </cu-custom>
  11. <My_search ref="My_search" @onFilter="onFilter" @startSearch="startSearch" dateRange />
  12. <My_listbox ref="List" @getlist="getlist" :empty='empty'>
  13. <work-order-list :list1="list" />
  14. <view style="height: 30px;" />
  15. </My_listbox>
  16. </view>
  17. </template>
  18. <script>
  19. import workOrderList from "../../pages/index/modules/workorderList.vue"
  20. export default {
  21. components: { workOrderList },
  22. name: "workOrder",
  23. data() {
  24. return {
  25. empty: true,
  26. "content": {
  27. "pageNumber": 1,
  28. "pageSize": 20,
  29. "pageTotal": 1,
  30. "where": {
  31. "condition": "",
  32. "begindate": "",
  33. "enddate": ""
  34. }
  35. },
  36. list: []
  37. }
  38. },
  39. onLoad(options) {
  40. if (options.date) {
  41. this.$refs.My_search.viewDateCycle(1)
  42. } else {
  43. this.getlist(true);
  44. }
  45. this.$Http.updateWorkorder = this.updete.bind(this)
  46. },
  47. onUnload() {
  48. delete this.$Http.updateWorkorder;
  49. },
  50. methods: {
  51. getlist(init = false) {
  52. let content = this.content;
  53. if (init) content.pageNumber = 1;
  54. if (content.pageNumber > content.pageTotal) return;
  55. this.$Http.basic({
  56. "id": "20231007095502",
  57. content
  58. }).then(res => {
  59. console.log("获取工单列表", res)
  60. if (this.cutoff(res.msg)) return;
  61. this.$refs.List.RefreshToComplete();
  62. this.$refs.List.setHeight();
  63. this.$refs.My_search.onFinish()
  64. this.empty = !res.data.length;
  65. content.pageNumber = res.pageNumber + 1;
  66. content.pageTotal = res.pageTotal;
  67. let list = res.data.map(v => {
  68. switch (v.sourcetable) {
  69. case "sa_patrolplan":
  70. v.source = "巡检:" + (v.planno || ' --')
  71. break;
  72. case "w_event_log":
  73. v.source = "告警:" + (v.eventname || ' --')
  74. break;
  75. default:
  76. v.source = "现场"
  77. break;
  78. }
  79. v.users = v.teamRows.map(u => u.name).join(",")
  80. return v
  81. })
  82. this.list = res.pageNumber == 1 ? list : this.list.concat(list)
  83. this.content = content;
  84. })
  85. },
  86. updete() {
  87. let content = JSON.parse(JSON.stringify(this.content));
  88. content.pageSize = content.pageNumber - 1 * content.pageSize;
  89. content.pageNumber = 1;
  90. this.$Http.basic({
  91. "id": "20231007095502",
  92. content
  93. }).then(res => {
  94. console.log("更新工单列表", res)
  95. if (this.cutoff(res.msg)) return;
  96. this.$refs.List.RefreshToComplete();
  97. this.$refs.List.setHeight();
  98. this.$refs.My_search.onFinish()
  99. this.empty = !res.data.length;
  100. let list = res.data.map(v => {
  101. switch (v.sourcetable) {
  102. case "sa_patrolplan":
  103. v.source = "巡检:" + (v.planno || ' --')
  104. break;
  105. case "w_event_log":
  106. v.source = "告警:" + (v.eventname || ' --')
  107. break;
  108. default:
  109. v.source = "现场"
  110. break;
  111. }
  112. v.users = v.teamRows.map(u => u.name).join(",")
  113. return v
  114. })
  115. this.list = list;
  116. })
  117. },
  118. startSearch(e) {
  119. this.content.where.condition = e;
  120. this.getlist(true)
  121. },
  122. onFilter(e) {
  123. let where = this.content.where,
  124. condition = where.condition;
  125. where = e;
  126. where.condition = condition;
  127. this.content.where = where;
  128. this.getlist(true)
  129. }
  130. }
  131. }
  132. </script>
  133. <style lang="scss" scoped></style>