workorderList.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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. mounted() {
  78. if (this.isHome) {
  79. this.getlist(true);
  80. this.$Http.updateWorkorderList = this.getlist.bind(this);
  81. }
  82. },
  83. methods: {
  84. getlist(init = false) {
  85. let content = this.content;
  86. if (init) content.pageNumber = 1;
  87. if (content.pageNumber > content.pageTotal) return;
  88. this.$Http.basic({
  89. "id": "20231007095502",
  90. content
  91. }).then(res => {
  92. console.log("获取工单列表", res)
  93. if (this.cutoff(res.msg)) return;
  94. content.pageNumber = res.pageNumber + 1;
  95. content.pageTotal = res.pageTotal;
  96. let list = res.data.map(v => {
  97. switch (v.sourcetable) {
  98. case "w_eventid":
  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 = res.pageNumber == 1 ? list : this.list.concat(list)
  112. this.content = content;
  113. })
  114. }
  115. }
  116. }
  117. </script>
  118. <style lang="scss" scoped>
  119. .item {
  120. position: relative;
  121. width: 355px;
  122. background: #fff;
  123. padding: 10px;
  124. border-radius: 4px;
  125. margin: 0 auto 10px;
  126. overflow: hidden;
  127. box-sizing: border-box;
  128. .billno {
  129. color: #004684;
  130. font-weight: bold;
  131. }
  132. .row {
  133. margin-top: 4px;
  134. font-size: 14px;
  135. }
  136. .status {
  137. position: absolute;
  138. top: 0;
  139. right: 0;
  140. padding: 4px 8px;
  141. font-size: 12px;
  142. border-radius: 0 0 0 4px;
  143. }
  144. }
  145. </style>