index.vue 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. <list :list1="list" />
  14. </My_listbox>
  15. </view>
  16. </template>
  17. <script>
  18. import { list } from "../../pages/index/modules/workorderList.vue"
  19. export default {
  20. components: { list },
  21. name: "workOrder",
  22. data() {
  23. return {
  24. empty: true,
  25. "content": {
  26. "pageNumber": 1,
  27. "pageSize": 20,
  28. "pageTotal": 1,
  29. "where": {
  30. "condition": "",
  31. "begindate": "",
  32. "enddate": ""
  33. }
  34. },
  35. list: []
  36. }
  37. },
  38. mounted() {
  39. this.getlist();
  40. },
  41. methods: {
  42. getlist(init = false) {
  43. let content = this.content;
  44. if (init) content.pageNumber = 1;
  45. if (content.pageNumber > content.pageTotal) return;
  46. this.$Http.basic({
  47. "id": "20231007095502",
  48. content
  49. }).then(res => {
  50. console.log("获取工单列表", res)
  51. if (this.cutoff(res.msg)) return;
  52. this.$refs.List.RefreshToComplete();
  53. this.$refs.List.setHeight();
  54. this.$refs.My_search.onFinish()
  55. this.empty = !res.data.length;
  56. content.pageNumber = res.pageNumber + 1;
  57. content.pageTotal = res.pageTotal;
  58. let list = res.data.map(v => {
  59. switch (v.sourcetable) {
  60. case "w_eventid":
  61. v.source = "巡检:" + (v.planno || ' --')
  62. break;
  63. case "w_event_log":
  64. v.source = "告警:" + (v.eventname || ' --')
  65. break;
  66. default:
  67. v.source = "现场"
  68. break;
  69. }
  70. v.users = v.teamRows.map(u => u.name)
  71. return v
  72. })
  73. this.list = res.pageNumber == 1 ? list : this.list.concat(list)
  74. this.content = content;
  75. })
  76. },
  77. startSearch(e) {
  78. this.content.where.condition = e;
  79. this.getlist(true)
  80. },
  81. onFilter(e) {
  82. let where = this.content.where,
  83. condition = where.condition;
  84. where = e;
  85. where.condition = condition;
  86. this.content.where = where;
  87. this.getlist(true)
  88. }
  89. }
  90. }
  91. </script>
  92. <style lang="scss" scoped>
  93. </style>