workorderList.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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" :style="[statusStyle(item.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. computed: {
  37. statusStyle() {
  38. return function (status) {
  39. let obj = {};
  40. switch (status) {
  41. case '待接单':
  42. obj = { color: '#EB4B5C', background: 'rgba(235, 75, 92, .2)' }
  43. break;
  44. case '待开始':
  45. obj = { color: '#3874F6', background: 'rgba(56, 116, 246, .2)' }
  46. break;
  47. case '进行中':
  48. obj = { color: '#5AB73F', background: 'rgba(90, 183, 63, .2)' };
  49. break;
  50. case '已完成':
  51. obj = { color: '#F27F37', background: 'rgba(242, 127, 55, .2)' };
  52. break;
  53. default:
  54. obj = { color: '#999999', background: 'rgba(153, 153, 153, .2)' }
  55. break;
  56. }
  57. return obj
  58. }
  59. }
  60. },
  61. name: "workorderList",
  62. data() {
  63. return {
  64. "content": {
  65. "pageNumber": 1,
  66. "pageSize": 20,
  67. "pageTotal": 1,
  68. "where": {
  69. "condition": "",
  70. "begindate": "",
  71. "enddate": ""
  72. }
  73. },
  74. list: []
  75. }
  76. },
  77. methods: {
  78. getlist(init = false) {
  79. let content = this.content;
  80. if (init) content.pageNumber = 1;
  81. if (content.pageNumber > content.pageTotal) return;
  82. this.$Http.basic({
  83. "id": "20231007095502",
  84. content
  85. }).then(res => {
  86. console.log("获取工单列表", res)
  87. if (this.cutoff(res.msg)) return;
  88. content.pageNumber = res.pageNumber + 1;
  89. content.pageTotal = res.pageTotal;
  90. let list = res.data.map(v => {
  91. switch (v.sourcetable) {
  92. case "sa_patrolplan":
  93. v.source = "巡检," + (v.planno || ' --')
  94. break;
  95. case "w_event_log":
  96. v.source = "告警," + (v.eventname || ' --')
  97. break;
  98. default:
  99. v.source = "现场"
  100. break;
  101. }
  102. v.users = v.teamRows.map(u => u.name).join(",")
  103. return v
  104. })
  105. this.list = res.pageNumber == 1 ? list : this.list.concat(list)
  106. this.content = content;
  107. })
  108. }
  109. }
  110. }
  111. </script>
  112. <style lang="scss" scoped>
  113. .item {
  114. position: relative;
  115. width: 355px;
  116. background: #fff;
  117. padding: 10px;
  118. border-radius: 4px;
  119. margin: 0 auto 10px;
  120. overflow: hidden;
  121. box-sizing: border-box;
  122. .billno {
  123. color: #004684;
  124. font-weight: bold;
  125. font-size: 14px;
  126. }
  127. .row {
  128. margin-top: 4px;
  129. font-size: 14px;
  130. }
  131. .status {
  132. position: absolute;
  133. top: 0;
  134. right: 0;
  135. padding: 4px 8px;
  136. font-size: 12px;
  137. border-radius: 0 0 0 4px;
  138. }
  139. }
  140. </style>