workorderList.vue 3.5 KB

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