index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. mounted() {
  40. this.getlist();
  41. this.$Http.updateWorkorder = this.updete.bind(this)
  42. },
  43. onUnload() {
  44. delete this.$Http.updateWorkorder;
  45. },
  46. methods: {
  47. getlist(init = false) {
  48. let content = this.content;
  49. if (init) content.pageNumber = 1;
  50. if (content.pageNumber > content.pageTotal) return;
  51. this.$Http.basic({
  52. "id": "20231007095502",
  53. content
  54. }).then(res => {
  55. console.log("获取工单列表", res)
  56. if (this.cutoff(res.msg)) return;
  57. this.$refs.List.RefreshToComplete();
  58. this.$refs.List.setHeight();
  59. this.$refs.My_search.onFinish()
  60. this.empty = !res.data.length;
  61. content.pageNumber = res.pageNumber + 1;
  62. content.pageTotal = res.pageTotal;
  63. let list = res.data.map(v => {
  64. switch (v.sourcetable) {
  65. case "sa_patrolplan":
  66. v.source = "巡检:" + (v.planno || ' --')
  67. break;
  68. case "w_event_log":
  69. v.source = "告警:" + (v.eventname || ' --')
  70. break;
  71. default:
  72. v.source = "现场"
  73. break;
  74. }
  75. v.users = v.teamRows.map(u => u.name).join(",")
  76. return v
  77. })
  78. this.list = res.pageNumber == 1 ? list : this.list.concat(list)
  79. this.content = content;
  80. })
  81. },
  82. updete() {
  83. let content = JSON.parse(JSON.stringify(this.content));
  84. content.pageSize = content.pageNumber - 1 * content.pageSize;
  85. content.pageNumber = 1;
  86. this.$Http.basic({
  87. "id": "20231007095502",
  88. content
  89. }).then(res => {
  90. console.log("更新工单列表", res)
  91. if (this.cutoff(res.msg)) return;
  92. this.$refs.List.RefreshToComplete();
  93. this.$refs.List.setHeight();
  94. this.$refs.My_search.onFinish()
  95. this.empty = !res.data.length;
  96. let list = res.data.map(v => {
  97. switch (v.sourcetable) {
  98. case "sa_patrolplan":
  99. v.source = "巡检:" + (v.planno || ' --')
  100. break;
  101. case "w_event_log":
  102. v.source = "告警:" + (v.eventname || ' --')
  103. break;
  104. default:
  105. v.source = "现场"
  106. break;
  107. }
  108. v.users = v.teamRows.map(u => u.name).join(",")
  109. return v
  110. })
  111. this.list = list;
  112. })
  113. },
  114. startSearch(e) {
  115. this.content.where.condition = e;
  116. this.getlist(true)
  117. },
  118. onFilter(e) {
  119. let where = this.content.where,
  120. condition = where.condition;
  121. where = e;
  122. where.condition = condition;
  123. this.content.where = where;
  124. this.getlist(true)
  125. }
  126. }
  127. }
  128. </script>
  129. <style lang="scss" scoped></style>