workorderList.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <view class="container">
  3. <view v-if="isHome" style="height: 20px;" />
  4. <navigator v-for="item in isHome ? list : list1" :key="item.sa_workorderid" class="item"
  5. :url="'/packageA/workOrder/detail?id=' + item.sa_workorderid">
  6. <view class="billno">
  7. {{ item.billno }}
  8. </view>
  9. <view class="row">
  10. 来源:{{ item.source || ' --' }}
  11. </view>
  12. <view class="row">
  13. 设备:{{ item.devicename || ' --' }}
  14. </view>
  15. <view class="row">
  16. 任务时间:{{ item.begdate && item.enddate ? item.begdate + ' 至 ' + item.enddate : ' --' }}
  17. </view>
  18. <view class="row">
  19. 参与人:{{ item.users.length ? item.users : ' --' }}
  20. </view>
  21. <view class="status">{{ item.status }}</view>
  22. </navigator>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. props: {
  28. isHome: {
  29. type: Boolean,
  30. default: false
  31. },
  32. list1: {
  33. type: Array,
  34. }
  35. },
  36. components: {},
  37. name: "workorderList",
  38. data() {
  39. return {
  40. "content": {
  41. "pageNumber": 1,
  42. "pageSize": 20,
  43. "pageTotal": 1,
  44. "where": {
  45. "condition": "",
  46. "begindate": "",
  47. "enddate": ""
  48. }
  49. },
  50. list: []
  51. }
  52. },
  53. mounted() {
  54. if (this.isHome) {
  55. this.getlist(true);
  56. this.$Http.updateWorkorderList = this.getlist.bind(this);
  57. }
  58. },
  59. methods: {
  60. getlist(init = false) {
  61. let content = this.content;
  62. if (init) content.pageNumber = 1;
  63. if (content.pageNumber > content.pageTotal) return;
  64. this.$Http.basic({
  65. "id": "20231007095502",
  66. content
  67. }).then(res => {
  68. console.log("获取工单列表", res)
  69. if (this.cutoff(res.msg)) return;
  70. content.pageNumber = res.pageNumber + 1;
  71. content.pageTotal = res.pageTotal;
  72. let list = res.data.map(v => {
  73. switch (v.sourcetable) {
  74. case "w_eventid":
  75. v.source = "巡检," + (v.planno || ' --')
  76. break;
  77. case "w_event_log":
  78. v.source = "告警," + (v.eventname || ' --')
  79. break;
  80. default:
  81. v.source = "现场"
  82. break;
  83. }
  84. v.users = v.teamRows.map(u => u.name).join(",")
  85. return v
  86. })
  87. this.list = res.pageNumber == 1 ? list : this.list.concat(list)
  88. this.content = content;
  89. })
  90. }
  91. }
  92. }
  93. </script>
  94. <style lang="scss" scoped>
  95. .item {
  96. position: relative;
  97. width: 355px;
  98. background: #fff;
  99. padding: 10px;
  100. border-radius: 4px;
  101. margin: 0 auto 10px;
  102. overflow: hidden;
  103. box-sizing: border-box;
  104. .billno {
  105. color: #004684;
  106. font-weight: bold;
  107. }
  108. .row {
  109. margin-top: 4px;
  110. font-size: 14px;
  111. }
  112. .status {
  113. position: absolute;
  114. top: 0;
  115. right: 0;
  116. padding: 4px 8px;
  117. background: #FFEFEF;
  118. color: #F65050;
  119. font-size: 12px;
  120. border-radius: 0 0 0 4px;
  121. }
  122. }
  123. </style>